When you download/select album art in the tag editor, the album detail screen will refresh its art when it's returned to.

This commit is contained in:
Aidan Follestad 2015-04-18 22:57:25 -05:00
commit 6c5bff9b25
3 changed files with 17 additions and 4 deletions

View file

@ -52,6 +52,7 @@ import java.util.ArrayList;
public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorHolder { public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorHolder {
public static final String TAG = AlbumDetailActivity.class.getSimpleName(); public static final String TAG = AlbumDetailActivity.class.getSimpleName();
private static final int TAG_EDITOR_REQUEST = 2001;
private Album album; private Album album;
private ObservableRecyclerView recyclerView; private ObservableRecyclerView recyclerView;
@ -300,7 +301,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
case R.id.action_tag_editor: case R.id.action_tag_editor:
Intent intent = new Intent(this, AlbumTagEditorActivity.class); Intent intent = new Intent(this, AlbumTagEditorActivity.class);
intent.putExtra(AppKeys.E_ID, album.id); intent.putExtra(AppKeys.E_ID, album.id);
startActivity(intent); startActivityForResult(intent, TAG_EDITOR_REQUEST);
return true; return true;
case R.id.action_go_to_artist: case R.id.action_go_to_artist:
Pair[] artistPairs = getSharedViewsWithFab(null); Pair[] artistPairs = getSharedViewsWithFab(null);
@ -310,6 +311,13 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == TAG_EDITOR_REQUEST)
setUpAlbumArtAndApplyPalette();
}
@Subscribe @Subscribe
public void onUIPreferenceChanged(UIPreferenceChangedEvent event) { public void onUIPreferenceChanged(UIPreferenceChangedEvent event) {
switch (event.getAction()) { switch (event.getAction()) {

View file

@ -103,13 +103,15 @@ public class AlbumTagEditorActivity extends AbsTagEditorActivity implements Text
.setCallback(new FutureCallback<Bitmap>() { .setCallback(new FutureCallback<Bitmap>() {
@Override @Override
public void onCompleted(Exception e, Bitmap result) { public void onCompleted(Exception e, Bitmap result) {
if(result != null) { if (result != null) {
albumArtBitmap = result; albumArtBitmap = result;
setImageBitmap(albumArtBitmap); setImageBitmap(albumArtBitmap);
deleteAlbumArt = false; deleteAlbumArt = false;
dataChanged(); dataChanged();
setResult(RESULT_OK);
} else { } else {
//TODO Toast failed message Toast.makeText(AlbumTagEditorActivity.this,
R.string.failed_download_albumart, Toast.LENGTH_SHORT).show();
} }
} }
}); });
@ -117,7 +119,8 @@ public class AlbumTagEditorActivity extends AbsTagEditorActivity implements Text
@Override @Override
public void onError() { public void onError() {
//TODO Toast failed message Toast.makeText(AlbumTagEditorActivity.this,
R.string.failed_download_albumart, Toast.LENGTH_SHORT).show();
} }
} }
); );
@ -194,6 +197,7 @@ public class AlbumTagEditorActivity extends AbsTagEditorActivity implements Text
setImageBitmap(albumArtBitmap); setImageBitmap(albumArtBitmap);
deleteAlbumArt = false; deleteAlbumArt = false;
dataChanged(); dataChanged();
setResult(RESULT_OK);
} }
} }
}); });

View file

@ -124,6 +124,7 @@
<string name="pref_only_lollipop">Only available on Lollipop.</string> <string name="pref_only_lollipop">Only available on Lollipop.</string>
<string name="pref_summary_transparent_toolbar">Content scrolling underneath the toolbar is visible.</string> <string name="pref_summary_transparent_toolbar">Content scrolling underneath the toolbar is visible.</string>
<string name="pref_summary_colored_album_footers">Album footers in the grid are colored with the album cover\'s palette.</string> <string name="pref_summary_colored_album_footers">Album footers in the grid are colored with the album cover\'s palette.</string>
<string name="failed_download_albumart">Unable to download the art for this album.</string>
<string-array name="update_albumcover_options"> <string-array name="update_albumcover_options">
<item>Download from LastFM</item> <item>Download from LastFM</item>