TagEditor now closes the dialog just before the finish() call instead before the scanning process. AlbumDetail activity resets the colors if the new album art set in tag editor is empty or has no vibrant color
This commit is contained in:
parent
2c65373638
commit
f48301800d
3 changed files with 41 additions and 4 deletions
|
|
@ -189,6 +189,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
applyPalette(result);
|
||||
} else {
|
||||
albumArtImageView.setImageResource(R.drawable.default_album_art);
|
||||
resetColors();
|
||||
}
|
||||
if (Util.hasLollipopSDK()) startPostponedEnterTransition();
|
||||
}
|
||||
|
|
@ -210,11 +211,26 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
notifyTaskColorChange(toolbarColor);
|
||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(AlbumDetailActivity.this).coloredNavigationBarAlbumEnabled())
|
||||
getWindow().setNavigationBarColor(toolbarColor);
|
||||
} else {
|
||||
resetColors();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private void resetColors() {
|
||||
int titleTextColor = DialogUtils.resolveColor(this, R.attr.title_text_color);
|
||||
int defaultBarColor = DialogUtils.resolveColor(this, R.attr.default_bar_color);
|
||||
|
||||
toolbarColor = defaultBarColor;
|
||||
albumTitleView.setBackgroundColor(defaultBarColor);
|
||||
albumTitleView.setTextColor(titleTextColor);
|
||||
|
||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
|
||||
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean overrideTaskColor() {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.kabouzeid.gramophone.ui.activities.tageditor;
|
|||
import android.annotation.TargetApi;
|
||||
import android.app.SearchManager;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.media.MediaScannerConnection;
|
||||
|
|
@ -320,11 +321,15 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
Util.hideSoftKeyboard(this);
|
||||
final String writingFileStr = getResources().getString(R.string.writing_file_number);
|
||||
final String savingStr = getResources().getString(R.string.saving_changes);
|
||||
final String rescanningStr = getResources().getString(R.string.rescanning_changed_files);
|
||||
//TODO dialog currently disappears on orientation change and using DialogFragment causes an exception for some reason
|
||||
final MaterialDialog progressDialog = new MaterialDialog.Builder(AbsTagEditorActivity.this)
|
||||
.title(savingStr)
|
||||
.cancelable(false)
|
||||
.progress(true, 0)
|
||||
.build();
|
||||
if (Build.VERSION.SDK_INT >= 18)
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
|
||||
progressDialog.show();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
|
|
@ -369,13 +374,24 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
Ion.getDefault(AbsTagEditorActivity.this).getBitmapCache().clear();
|
||||
Ion.getDefault(AbsTagEditorActivity.this).getCache().clear();
|
||||
}
|
||||
progressDialog.dismiss();
|
||||
rescanMedia();
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
progressDialog.setContent(rescanningStr);
|
||||
}
|
||||
});
|
||||
rescanMediaAndQuitOnFinish(new OnScannedAllListener() {
|
||||
@Override
|
||||
public void onScannedAll() {
|
||||
progressDialog.dismiss();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void rescanMedia() {
|
||||
private void rescanMediaAndQuitOnFinish(final OnScannedAllListener listener) {
|
||||
String[] toBeScanned = new String[songPaths.size()];
|
||||
toBeScanned = songPaths.toArray(toBeScanned);
|
||||
final int toBeScannedLength = toBeScanned.length;
|
||||
|
|
@ -390,7 +406,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
if (i == 0 || i == toBeScannedLength - 1) {
|
||||
App.bus.post(new DataBaseChangedEvent(DataBaseChangedEvent.DATABASE_CHANGED));
|
||||
if (i == toBeScannedLength - 1)
|
||||
finish();
|
||||
listener.onScannedAll();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
|
@ -505,4 +521,8 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private interface OnScannedAllListener {
|
||||
void onScannedAll();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue