-
Notifications
You must be signed in to change notification settings - Fork 0
@dsukmanova Сукманова Дарья #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dmikheeva
wants to merge
24
commits into
master
Choose a base branch
from
v0.0.1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
bdea654
Task1(part 1). Delete DetailsActivity and make fragments (main and de…
dmikheeva 429bf64
Fix plurals (add plurals resource)
dmikheeva 2e85591
Add dataLoader for loading json, remove HomeFragment for a while
dmikheeva 691becf
Add menu with info about app
dmikheeva 7c3b634
refactoring
dmikheeva 57b546a
send feedback by email (Messaging app is still appear in chooser)
dmikheeva d51b1b0
Task1(part2) Delete HomeActivity and make HimeFragment
dmikheeva 676daa7
Loader -> AsyncTaskLoader
dmikheeva 0119061
fix configuration change, take savedInstance if the one already exists
dmikheeva 757aa55
Fix troubles with names
dmikheeva e747f94
show choosing dialog with yaMusic and yaRadio on headset plugged action
dmikheeva f57d4d3
fix showing music dialog on every activity onResume action and on sta…
dmikheeva 69636fe
Мусор
dmikheeva a4fd1ae
gradle dependencies: add butterKnife
dmikheeva 20eb947
use butterKnife
dmikheeva 0629eaa
parse json in background,
dmikheeva 00ca540
functions instead of comments
dmikheeva 8dbfd3b
refactoring
dmikheeva a5db997
redundant if
dmikheeva 3b3a3dd
restartLoader
dmikheeva 082d5bb
close tag
dmikheeva 1e14308
remove homefragment
dmikheeva 59c0474
refactoring
dmikheeva 627148f
provide data to mainfragment exactly (without Home fragment)
dmikheeva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
Singers/app/src/main/java/ru/daria/singers/AboutProgramDialog.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package ru.daria.singers; | ||
|
|
||
| import android.app.DialogFragment; | ||
| import android.os.Bundle; | ||
| import android.view.LayoutInflater; | ||
| import android.view.View; | ||
| import android.view.ViewGroup; | ||
|
|
||
| import butterknife.ButterKnife; | ||
|
|
||
| /** | ||
| * Created by dsukmanova on 17.07.16. | ||
| */ | ||
| public class AboutProgramDialog extends DialogFragment { | ||
| @Override | ||
| public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance){ | ||
| View view = inflater.inflate(R.layout.about_program, null); | ||
| ButterKnife.findById(view,R.id.okButton).setOnClickListener(new View.OnClickListener() { | ||
| @Override | ||
| public void onClick(View v) { | ||
| getDialog().dismiss(); | ||
| } | ||
| }); | ||
| getDialog().setTitle(R.string.aboutTitle); | ||
| return view; | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Singers/app/src/main/java/ru/daria/singers/DataLoaderResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package ru.daria.singers; | ||
|
|
||
| /** | ||
| * Created by dsukmanova on 24.07.16. | ||
| */ | ||
|
|
||
| public class DataLoaderResult <T>{ | ||
| private Exception exception; | ||
| private T result; | ||
|
|
||
| public void setException(Exception exception) { | ||
| this.exception = exception; | ||
| } | ||
|
|
||
| public void setResult(T result) { | ||
| this.result = result; | ||
| } | ||
|
|
||
| public Exception getException() { | ||
|
|
||
| return exception; | ||
| } | ||
|
|
||
| public T getResult() { | ||
| return result; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,58 +1,70 @@ | ||
| package ru.daria.singers; | ||
|
|
||
| import android.content.Intent; | ||
| import android.app.Fragment; | ||
| import android.graphics.drawable.Drawable; | ||
| import android.os.Bundle; | ||
| import android.support.v7.app.AppCompatActivity; | ||
| import android.support.v7.widget.Toolbar; | ||
| import android.view.Menu; | ||
| import android.view.LayoutInflater; | ||
| import android.view.View; | ||
| import android.view.ViewGroup; | ||
| import android.widget.ImageView; | ||
| import android.widget.TextView; | ||
|
|
||
| import com.nostra13.universalimageloader.core.DisplayImageOptions; | ||
| import com.nostra13.universalimageloader.core.ImageLoader; | ||
| import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; | ||
|
|
||
| public class DetailsActivity extends AppCompatActivity { | ||
| //настройка кэширования изображений | ||
| import butterknife.BindView; | ||
| import butterknife.ButterKnife; | ||
|
|
||
| /** | ||
| * Created by dsukmanova on 16.07.16. | ||
| */ | ||
| public class DetailsFragment extends Fragment { | ||
| private static DisplayImageOptions options = new DisplayImageOptions.Builder(). | ||
| cacheInMemory(true).cacheOnDisk(true).build(); | ||
| private String albumsDescr; | ||
|
|
||
| @Override | ||
| protected void onCreate(Bundle savedInstanceState) { | ||
| public void onCreate(Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
| setContentView(R.layout.details); | ||
| //ButterKnife.bind(this); | ||
| } | ||
|
|
||
| Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
| @Override | ||
| public View onCreateView(LayoutInflater inflater, | ||
| ViewGroup container, | ||
| Bundle savedInstanceState) { | ||
| View view = inflater.inflate(R.layout.details, container, false); | ||
| final MainActivity activity = (MainActivity) getActivity(); | ||
|
|
||
| Toolbar toolbar = activity.getToolbar(); | ||
| toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha); | ||
| activity.showMenuVisible(toolbar.getMenu(), false); | ||
| toolbar.setNavigationOnClickListener(new View.OnClickListener() { | ||
| @Override | ||
| public void onClick(View v) { | ||
| //действие аналогично стандартной кнопке "Назад" | ||
| onBackPressed(); | ||
| activity.onBackPressed(); | ||
| } | ||
| }); | ||
|
|
||
| ImageView image = (ImageView) findViewById(R.id.image); | ||
| TextView description = (TextView) findViewById(R.id.descriprion); | ||
| TextView genres = (TextView) findViewById(R.id.genres); | ||
| TextView albums = (TextView) findViewById(R.id.albums); | ||
| ImageView image = ButterKnife.findById(view, R.id.image); | ||
| TextView description = ButterKnife.findById(view, R.id.descriprion); | ||
| TextView genres = ButterKnife.findById(view, R.id.genres); | ||
| TextView albums = ButterKnife.findById(view, R.id.albums); | ||
| //получаем экземпляр Singer из MainActivity | ||
| Intent intent = getIntent(); | ||
| Bundle b = intent.getExtras(); | ||
| Bundle b = getArguments(); | ||
| Singer singer = (Singer) b.get("SINGER"); | ||
|
|
||
| toolbar.setTitle(singer.getName()); | ||
| //пока подгружается изображение показываем стандартное | ||
| String uri = "@drawable/defaultimage"; | ||
| int imageResource = getResources().getIdentifier(uri, null, getPackageName()); | ||
| int imageResource = getResources().getIdentifier(uri, null, activity.getPackageName()); | ||
| Drawable res = getResources().getDrawable(imageResource); | ||
| image.setImageDrawable(res); | ||
|
|
||
| //Конфигурация для ImageLoader | ||
| ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build(); | ||
| ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(activity).build(); | ||
| final ImageLoader imageLoader = ImageLoader.getInstance(); | ||
| imageLoader.init(config); | ||
|
|
||
|
|
@@ -63,20 +75,13 @@ public void onClick(View v) { | |
| description.setText(singer.getDescription()); | ||
| genres.setText(singer.genresToString()); | ||
| int albumsNum = singer.getAlbums(); | ||
| String[] albumCases = {"альбом", "альбома", "альбомов"}; | ||
| int tracksNum = singer.getTracks(); | ||
| String[] trackCases = {"песня", "песни", "песен"}; | ||
| //склоняем альбомы и песни | ||
| String albumsDescr = "%d %s • %d %s"; | ||
| albumsDescr = String.format(albumsDescr, albumsNum, singer.getEnding(albumsNum, albumCases), | ||
| tracksNum, singer.getEnding(tracksNum, trackCases)); | ||
| String albumsDescr = "%s • %s"; | ||
| albumsDescr = String.format(albumsDescr, | ||
| getResources().getQuantityString(R.plurals.songs, albumsNum, albumsNum), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| getResources().getQuantityString(R.plurals.tracks, tracksNum, tracksNum)); | ||
| albums.setText(albumsDescr); | ||
|
|
||
| return view; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean onCreateOptionsMenu(Menu menu) { | ||
| return super.onCreateOptionsMenu(menu); | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Эта настройке место в Activity.