Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7abd29fdac
16 changed files with 204 additions and 105 deletions
|
|
@ -44,14 +44,11 @@ import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*
|
* A lot of hackery is done in this activity. Changing things may will brake the whole activity.
|
||||||
* A lot of hackery is done in this activity. Changing things may will brake the whole activity.
|
* <p/>
|
||||||
*
|
* Should be kinda stable ONLY AS IT IS!!!
|
||||||
* Should be kinda stable ONLY AS IT IS!!!
|
*/
|
||||||
*
|
|
||||||
* */
|
|
||||||
|
|
||||||
public class AlbumDetailActivity extends AbsFabActivity {
|
public class AlbumDetailActivity extends AbsFabActivity {
|
||||||
|
|
||||||
public static final String TAG = AlbumDetailActivity.class.getSimpleName();
|
public static final String TAG = AlbumDetailActivity.class.getSimpleName();
|
||||||
|
|
@ -127,6 +124,16 @@ public class AlbumDetailActivity extends AbsFabActivity {
|
||||||
setUpViews();
|
setUpViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorStatusBar() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorNavBar() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTag() {
|
public String getTag() {
|
||||||
return TAG;
|
return TAG;
|
||||||
|
|
|
||||||
|
|
@ -53,20 +53,14 @@ import com.squareup.otto.Subscribe;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
*
|
* A lot of hackery is done in this activity. Changing things may will brake the whole activity.
|
||||||
* A lot of hackery is done in this activity. Changing things may will brake the whole activity.
|
* <p/>
|
||||||
*
|
* Should be kinda stable ONLY AS IT IS!!!
|
||||||
* Should be kinda stable ONLY AS IT IS!!!
|
*/
|
||||||
*
|
|
||||||
* */
|
|
||||||
|
|
||||||
public class ArtistDetailActivity extends AbsFabActivity {
|
public class ArtistDetailActivity extends AbsFabActivity {
|
||||||
|
|
||||||
public static final String TAG = ArtistDetailActivity.class.getSimpleName();
|
public static final String TAG = ArtistDetailActivity.class.getSimpleName();
|
||||||
|
|
||||||
public static final String ARG_ARTIST_ID = "com.kabouzeid.gramophone.artist.id";
|
|
||||||
public static final String ARG_ARTIST_NAME = "com.kabouzeid.gramophone.artist.name";
|
|
||||||
|
|
||||||
private Artist artist;
|
private Artist artist;
|
||||||
|
|
||||||
private ObservableListView songListView;
|
private ObservableListView songListView;
|
||||||
|
|
@ -82,7 +76,6 @@ public class ArtistDetailActivity extends AbsFabActivity {
|
||||||
|
|
||||||
private View songListHeader;
|
private View songListHeader;
|
||||||
private RecyclerView albumRecyclerView;
|
private RecyclerView albumRecyclerView;
|
||||||
|
|
||||||
private Spanned biography;
|
private Spanned biography;
|
||||||
|
|
||||||
private final SmallObservableScrollViewCallbacks observableScrollViewCallbacks = new SmallObservableScrollViewCallbacks() {
|
private final SmallObservableScrollViewCallbacks observableScrollViewCallbacks = new SmallObservableScrollViewCallbacks() {
|
||||||
|
|
@ -133,13 +126,26 @@ public class ArtistDetailActivity extends AbsFabActivity {
|
||||||
getIntentExtras();
|
getIntentExtras();
|
||||||
initViews();
|
initViews();
|
||||||
setUpObservableListViewParams();
|
setUpObservableListViewParams();
|
||||||
setUpToolBar();
|
|
||||||
setUpViews();
|
setUpViews();
|
||||||
|
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
getSupportActionBar().setTitle(null);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
if (Util.hasLollipopSDK()) fixLollipopTransitionImageWrongSize();
|
if (Util.hasLollipopSDK()) fixLollipopTransitionImageWrongSize();
|
||||||
if (Util.hasLollipopSDK()) startPostponedEnterTransition();
|
if (Util.hasLollipopSDK()) startPostponedEnterTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorStatusBar() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorNavBar() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void initViews() {
|
private void initViews() {
|
||||||
artistImage = (ImageView) findViewById(R.id.artist_image);
|
artistImage = (ImageView) findViewById(R.id.artist_image);
|
||||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
|
@ -310,12 +316,6 @@ public class ArtistDetailActivity extends AbsFabActivity {
|
||||||
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpToolBar() {
|
|
||||||
setSupportActionBar(toolbar);
|
|
||||||
getSupportActionBar().setTitle(null);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getIntentExtras() {
|
private void getIntentExtras() {
|
||||||
Bundle intentExtras = getIntent().getExtras();
|
Bundle intentExtras = getIntent().getExtras();
|
||||||
final int artistId = intentExtras.getInt(AppKeys.E_ARTIST);
|
final int artistId = intentExtras.getInt(AppKeys.E_ARTIST);
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,8 @@ import java.util.List;
|
||||||
|
|
||||||
public class MainActivity extends AbsFabActivity
|
public class MainActivity extends AbsFabActivity
|
||||||
implements NavigationDrawerFragment.NavigationDrawerCallbacks, KabViewsDisableAble {
|
implements NavigationDrawerFragment.NavigationDrawerCallbacks, KabViewsDisableAble {
|
||||||
public static final String TAG = MainActivity.class.getSimpleName();
|
|
||||||
|
|
||||||
|
public static final String TAG = MainActivity.class.getSimpleName();
|
||||||
private DrawerLayout drawerLayout;
|
private DrawerLayout drawerLayout;
|
||||||
private ActionBarDrawerToggle drawerToggle;
|
private ActionBarDrawerToggle drawerToggle;
|
||||||
private NavigationDrawerFragment navigationDrawerFragment;
|
private NavigationDrawerFragment navigationDrawerFragment;
|
||||||
|
|
@ -81,6 +81,16 @@ public class MainActivity extends AbsFabActivity
|
||||||
handlePlaybackIntent(getIntent());
|
handlePlaybackIntent(getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorStatusBar() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorNavBar() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void setUpViewPager() {
|
private void setUpViewPager() {
|
||||||
pagerAdapter = new PagerAdapter(this, getSupportFragmentManager());
|
pagerAdapter = new PagerAdapter(this, getSupportFragmentManager());
|
||||||
final PagerAdapter.MusicFragments[] fragments = PagerAdapter.MusicFragments.values();
|
final PagerAdapter.MusicFragments[] fragments = PagerAdapter.MusicFragments.values();
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,8 @@ import com.squareup.otto.Subscribe;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class MusicControllerActivity extends AbsFabActivity {
|
public class MusicControllerActivity extends AbsFabActivity {
|
||||||
public static final String TAG = MusicControllerActivity.class.getSimpleName();
|
|
||||||
|
|
||||||
|
public static final String TAG = MusicControllerActivity.class.getSimpleName();
|
||||||
private static final int DEFAULT_DELAY = 350;
|
private static final int DEFAULT_DELAY = 350;
|
||||||
private static final int DEFAULT_ANIMATION_TIME = 1000;
|
private static final int DEFAULT_ANIMATION_TIME = 1000;
|
||||||
|
|
||||||
|
|
@ -88,7 +88,19 @@ public class MusicControllerActivity extends AbsFabActivity {
|
||||||
|
|
||||||
prepareViewsForOpenAnimation();
|
prepareViewsForOpenAnimation();
|
||||||
|
|
||||||
setUpToolBar();
|
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
|
||||||
|
getSupportActionBar().setTitle(null);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorStatusBar() {
|
||||||
|
return false; // let other code handle this below
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorNavBar() {
|
||||||
|
return false; // let other code handle this below
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveSeekBarIntoPlace() {
|
private void moveSeekBarIntoPlace() {
|
||||||
|
|
@ -235,12 +247,6 @@ public class MusicControllerActivity extends AbsFabActivity {
|
||||||
footer.setScaleY(0);
|
footer.setScaleY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpToolBar() {
|
|
||||||
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
|
|
||||||
getSupportActionBar().setTitle(null);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTag() {
|
public String getTag() {
|
||||||
return TAG;
|
return TAG;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
||||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||||
import com.kabouzeid.gramophone.util.PlaylistsUtil;
|
import com.kabouzeid.gramophone.util.PlaylistsUtil;
|
||||||
import com.kabouzeid.gramophone.util.PreferenceUtils;
|
import com.kabouzeid.gramophone.util.PreferenceUtils;
|
||||||
import com.kabouzeid.gramophone.util.Util;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
@ -37,13 +36,6 @@ public class PlaylistDetailActivity extends AbsFabActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_playlist_detail);
|
setContentView(R.layout.activity_playlist_detail);
|
||||||
|
|
||||||
final int primary = PreferenceUtils.getInstance(this).getThemeColorPrimary();
|
|
||||||
final int primaryDark = PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker();
|
|
||||||
if (Util.hasLollipopSDK()) {
|
|
||||||
getWindow().setStatusBarColor(primaryDark);
|
|
||||||
getWindow().setNavigationBarColor(primaryDark);
|
|
||||||
}
|
|
||||||
|
|
||||||
getIntentExtras();
|
getIntentExtras();
|
||||||
|
|
||||||
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
|
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
|
||||||
|
|
@ -70,12 +62,22 @@ public class PlaylistDetailActivity extends AbsFabActivity {
|
||||||
recyclerView.setOnScrollListener(dragSortRecycler.getScrollListener());
|
recyclerView.setOnScrollListener(dragSortRecycler.getScrollListener());
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
toolbar.setBackgroundColor(primary);
|
toolbar.setBackgroundColor(PreferenceUtils.getInstance(this).getThemeColorPrimary());
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setTitle(playlist.name);
|
getSupportActionBar().setTitle(playlist.name);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorStatusBar() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorNavBar() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void getIntentExtras() {
|
private void getIntentExtras() {
|
||||||
Bundle intentExtras = getIntent().getExtras();
|
Bundle intentExtras = getIntent().getExtras();
|
||||||
final int playlistId = intentExtras.getInt(AppKeys.E_PLAYLIST);
|
final int playlistId = intentExtras.getInt(AppKeys.E_PLAYLIST);
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SearchActivity extends AbsBaseActivity {
|
public class SearchActivity extends AbsBaseActivity {
|
||||||
public static final String TAG = SearchActivity.class.getSimpleName();
|
|
||||||
|
|
||||||
|
public static final String TAG = SearchActivity.class.getSimpleName();
|
||||||
private ListView listView;
|
private ListView listView;
|
||||||
private SearchView searchView;
|
private SearchView searchView;
|
||||||
|
|
||||||
|
|
@ -49,13 +49,6 @@ public class SearchActivity extends AbsBaseActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_search);
|
setContentView(R.layout.activity_search);
|
||||||
|
|
||||||
final int primary = PreferenceUtils.getInstance(this).getThemeColorPrimary();
|
|
||||||
final int primaryDark = PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker();
|
|
||||||
if (Util.hasLollipopSDK()) {
|
|
||||||
getWindow().setStatusBarColor(primaryDark);
|
|
||||||
getWindow().setNavigationBarColor(primaryDark);
|
|
||||||
}
|
|
||||||
|
|
||||||
listView = (ListView) findViewById(R.id.list);
|
listView = (ListView) findViewById(R.id.list);
|
||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -99,11 +92,21 @@ public class SearchActivity extends AbsBaseActivity {
|
||||||
});
|
});
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
toolbar.setBackgroundColor(primary);
|
toolbar.setBackgroundColor(PreferenceUtils.getInstance(this).getThemeColorPrimary());
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorStatusBar() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorNavBar() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTag() {
|
public String getTag() {
|
||||||
return TAG;
|
return TAG;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.media.audiofx.AudioEffect;
|
import android.media.audiofx.AudioEffect;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
|
|
@ -34,8 +33,6 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
||||||
setContentView(R.layout.activity_preferences);
|
setContentView(R.layout.activity_preferences);
|
||||||
mToolbar = (Toolbar) findViewById(R.id.toolbar);
|
mToolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
mToolbar.setBackgroundColor(PreferenceUtils.getInstance(this).getThemeColorPrimary());
|
mToolbar.setBackgroundColor(PreferenceUtils.getInstance(this).getThemeColorPrimary());
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
getWindow().setStatusBarColor(PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker());
|
|
||||||
setSupportActionBar(mToolbar);
|
setSupportActionBar(mToolbar);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
|
@ -43,6 +40,16 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
||||||
getFragmentManager().beginTransaction().replace(R.id.content_frame, new SettingsFragment()).commit();
|
getFragmentManager().beginTransaction().replace(R.id.content_frame, new SettingsFragment()).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorStatusBar() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorNavBar() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onColorSelection(int title, int color) {
|
public void onColorSelection(int title, int color) {
|
||||||
if (title == R.string.primary_color) {
|
if (title == R.string.primary_color) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.kabouzeid.gramophone.ui.activities.base;
|
package com.kabouzeid.gramophone.ui.activities.base;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
@ -17,9 +18,9 @@ import com.kabouzeid.gramophone.util.Util;
|
||||||
*/
|
*/
|
||||||
public abstract class ThemeBaseActivity extends ActionBarActivity implements KabViewsDisableAble {
|
public abstract class ThemeBaseActivity extends ActionBarActivity implements KabViewsDisableAble {
|
||||||
|
|
||||||
private boolean mLastDarkTheme;
|
// private boolean mLastDarkTheme;
|
||||||
private int mLastPrimary;
|
// private int mLastPrimary;
|
||||||
private int mLastAccent;
|
// private int mLastAccent;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
@ -28,40 +29,50 @@ public abstract class ThemeBaseActivity extends ActionBarActivity implements Kab
|
||||||
setupTheme();
|
setupTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
private void setupTheme() {
|
private void setupTheme() {
|
||||||
|
// Apply colors to system UI if necessary
|
||||||
|
final int primaryDark = PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker();
|
||||||
|
if (Util.hasLollipopSDK()) {
|
||||||
|
if (shouldColorStatusBar())
|
||||||
|
getWindow().setStatusBarColor(primaryDark);
|
||||||
|
if (shouldColorNavBar())
|
||||||
|
getWindow().setNavigationBarColor(primaryDark);
|
||||||
|
}
|
||||||
|
|
||||||
// Persist current values so the Activity knows if they change
|
// Persist current values so the Activity knows if they change
|
||||||
mLastDarkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == 1;
|
// mLastDarkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == 1;
|
||||||
mLastPrimary = PreferenceUtils.getInstance(this).getThemeColorPrimary();
|
// mLastPrimary = PreferenceUtils.getInstance(this).getThemeColorPrimary();
|
||||||
mLastAccent = PreferenceUtils.getInstance(this).getThemeColorAccent();
|
// mLastAccent = PreferenceUtils.getInstance(this).getThemeColorAccent();
|
||||||
|
|
||||||
// Accent colors in dialogs, and any dynamic views that pull from this singleton
|
// Accent colors in dialogs, and any dynamic views that pull from this singleton
|
||||||
ThemeSingleton.get().positiveColor = mLastAccent;
|
ThemeSingleton.get().positiveColor = PreferenceUtils.getInstance(this).getThemeColorAccent();
|
||||||
ThemeSingleton.get().negativeColor = ThemeSingleton.get().positiveColor;
|
ThemeSingleton.get().negativeColor = ThemeSingleton.get().positiveColor;
|
||||||
ThemeSingleton.get().neutralColor = ThemeSingleton.get().positiveColor;
|
ThemeSingleton.get().neutralColor = ThemeSingleton.get().positiveColor;
|
||||||
ThemeSingleton.get().widgetColor = ThemeSingleton.get().positiveColor;
|
ThemeSingleton.get().widgetColor = ThemeSingleton.get().positiveColor;
|
||||||
// Dark theme
|
// Dark theme
|
||||||
ThemeSingleton.get().darkTheme = mLastDarkTheme;
|
ThemeSingleton.get().darkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == 1;
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
// Sets color of entry in the system recents page
|
// Sets color of entry in the system recents page
|
||||||
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
|
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
|
||||||
getString(R.string.app_name),
|
getString(R.string.app_name),
|
||||||
BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher),
|
BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher),
|
||||||
mLastPrimary);
|
PreferenceUtils.getInstance(this).getThemeColorPrimary());
|
||||||
setTaskDescription(td);
|
setTaskDescription(td);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
protected void onResume() {
|
// protected void onResume() {
|
||||||
super.onResume();
|
// super.onResume();
|
||||||
if (mLastDarkTheme != (PreferenceUtils.getInstance(this).getGeneralTheme() == 1) ||
|
// if (mLastDarkTheme != (PreferenceUtils.getInstance(this).getGeneralTheme() == 1) ||
|
||||||
mLastPrimary != PreferenceUtils.getInstance(this).getThemeColorPrimary() ||
|
// mLastPrimary != PreferenceUtils.getInstance(this).getThemeColorPrimary() ||
|
||||||
mLastAccent != PreferenceUtils.getInstance(this).getThemeColorAccent()) {
|
// mLastAccent != PreferenceUtils.getInstance(this).getThemeColorAccent()) {
|
||||||
// Theme colors changed, recreate the Activity
|
// // Theme colors changed, recreate the Activity
|
||||||
recreate();
|
// recreate();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
protected void setUpTranslucence(boolean statusBarTranslucent, boolean navigationBarTranslucent) {
|
protected void setUpTranslucence(boolean statusBarTranslucent, boolean navigationBarTranslucent) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
|
|
@ -73,4 +84,8 @@ public abstract class ThemeBaseActivity extends ActionBarActivity implements Kab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract boolean shouldColorStatusBar();
|
||||||
|
|
||||||
|
protected abstract boolean shouldColorNavBar();
|
||||||
}
|
}
|
||||||
|
|
@ -96,7 +96,20 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
||||||
|
|
||||||
initViews();
|
initViews();
|
||||||
setUpViews();
|
setUpViews();
|
||||||
setUpToolBar();
|
|
||||||
|
setSupportActionBar(toolBar);
|
||||||
|
getSupportActionBar().setTitle(getResources().getString(R.string.tag_editor));
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorStatusBar() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean shouldColorNavBar() {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initViews() {
|
private void initViews() {
|
||||||
|
|
@ -130,8 +143,8 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
new MaterialDialog.Builder(AbsTagEditorActivity.this)
|
new MaterialDialog.Builder(AbsTagEditorActivity.this)
|
||||||
.title("Update image")
|
.title(R.string.update_image)
|
||||||
.items(new CharSequence[]{"Download from LastFM", "Pick from internal storage", "Web search", "Delete"})
|
.items(R.array.update_albumcover_options)
|
||||||
.itemsCallback(new MaterialDialog.ListCallback() {
|
.itemsCallback(new MaterialDialog.ListCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
|
public void onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
|
||||||
|
|
@ -150,9 +163,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}).show();
|
||||||
.build()
|
|
||||||
.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -202,12 +213,6 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpToolBar() {
|
|
||||||
setSupportActionBar(toolBar);
|
|
||||||
getSupportActionBar().setTitle(getResources().getString(R.string.tag_editor));
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract int getContentViewResId();
|
protected abstract int getContentViewResId();
|
||||||
|
|
||||||
protected abstract List<String> getSongPaths();
|
protected abstract List<String> getSongPaths();
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class AlbumTagEditorActivity extends AbsTagEditorActivity implements TextWatcher {
|
public class AlbumTagEditorActivity extends AbsTagEditorActivity implements TextWatcher {
|
||||||
public static final String TAG = AlbumTagEditorActivity.class.getSimpleName();
|
|
||||||
|
|
||||||
|
public static final String TAG = AlbumTagEditorActivity.class.getSimpleName();
|
||||||
private Bitmap albumArtBitmap;
|
private Bitmap albumArtBitmap;
|
||||||
private boolean deleteAlbumArt;
|
private boolean deleteAlbumArt;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SongTagEditorActivity extends AbsTagEditorActivity implements TextWatcher {
|
public class SongTagEditorActivity extends AbsTagEditorActivity implements TextWatcher {
|
||||||
public static final String TAG = SongTagEditorActivity.class.getSimpleName();
|
|
||||||
|
|
||||||
|
public static final String TAG = SongTagEditorActivity.class.getSimpleName();
|
||||||
private EditText songTitle;
|
private EditText songTitle;
|
||||||
private EditText albumTitle;
|
private EditText albumTitle;
|
||||||
private EditText artistName;
|
private EditText artistName;
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ public class NavigationDrawerFragment extends Fragment {
|
||||||
public void run() {
|
public void run() {
|
||||||
drawerLayout.closeDrawer(fragmentContainerView);
|
drawerLayout.closeDrawer(fragmentContainerView);
|
||||||
}
|
}
|
||||||
}, 400);
|
}, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (callbacks != null)
|
if (callbacks != null)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.kabouzeid.gramophone.views;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.v7.internal.widget.TintCheckBox;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.ThemeSingleton;
|
||||||
|
import com.afollestad.materialdialogs.internal.MDTintHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Aidan Follestad (afollestad)
|
||||||
|
*/
|
||||||
|
public class DynamicEditText extends TintCheckBox {
|
||||||
|
|
||||||
|
public DynamicEditText(Context context) {
|
||||||
|
super(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DynamicEditText(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DynamicEditText(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
final int color = ThemeSingleton.get().positiveColor;
|
||||||
|
MDTintHelper.setTint(this, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:paddingTop="8dp">
|
android:paddingTop="8dp">
|
||||||
|
|
||||||
<EditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
android:id="@+id/album_title"
|
android:id="@+id/album_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
android:text="@string/album_artist"
|
android:text="@string/album_artist"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
||||||
|
|
||||||
<EditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
android:id="@+id/album_artist"
|
android:id="@+id/album_artist"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -80,6 +80,7 @@
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||||
android:textColor="?attr/title_text_color" />
|
android:textColor="?attr/title_text_color" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
@ -95,7 +96,7 @@
|
||||||
android:text="@string/genre"
|
android:text="@string/genre"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
||||||
|
|
||||||
<EditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
android:id="@+id/genre"
|
android:id="@+id/genre"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -106,6 +107,7 @@
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||||
android:textColor="?attr/title_text_color" />
|
android:textColor="?attr/title_text_color" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
@ -121,7 +123,7 @@
|
||||||
android:text="@string/year"
|
android:text="@string/year"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
||||||
|
|
||||||
<EditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
android:id="@+id/year"
|
android:id="@+id/year"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -133,6 +135,7 @@
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||||
android:textColor="?attr/title_text_color" />
|
android:textColor="?attr/title_text_color" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
@ -140,13 +143,12 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
</com.github.ksoichiro.android.observablescrollview.ObservableScrollView>
|
</com.github.ksoichiro.android.observablescrollview.ObservableScrollView>
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
style="@style/Toolbar"
|
style="@style/Toolbar"
|
||||||
android:gravity="start|left|top"
|
android:gravity="start|left"
|
||||||
android:background="#00000000"
|
android:background="#00000000"
|
||||||
tools:ignore="RtlHardcoded" />
|
tools:ignore="RtlHardcoded" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:paddingTop="8dp">
|
android:paddingTop="8dp">
|
||||||
|
|
||||||
<EditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
android:id="@+id/title1"
|
android:id="@+id/title1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||||
android:textColor="@color/white" />
|
android:textColor="@color/white" />
|
||||||
|
|
||||||
<EditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
android:id="@+id/title2"
|
android:id="@+id/title2"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
android:text="@string/artist"
|
android:text="@string/artist"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
||||||
|
|
||||||
<EditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
android:id="@+id/artist"
|
android:id="@+id/artist"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -108,7 +108,7 @@
|
||||||
android:text="@string/genre"
|
android:text="@string/genre"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
||||||
|
|
||||||
<EditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
android:id="@+id/genre"
|
android:id="@+id/genre"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -134,7 +134,7 @@
|
||||||
android:text="@string/year"
|
android:text="@string/year"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
||||||
|
|
||||||
<EditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
android:id="@+id/year"
|
android:id="@+id/year"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -161,7 +161,7 @@
|
||||||
android:text="@string/track"
|
android:text="@string/track"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
|
||||||
|
|
||||||
<EditText
|
<com.kabouzeid.gramophone.views.DynamicEditText
|
||||||
android:id="@+id/track_number"
|
android:id="@+id/track_number"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -186,7 +186,7 @@
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
style="@style/Toolbar"
|
style="@style/Toolbar"
|
||||||
android:layout_gravity="start|left|top"
|
android:layout_gravity="start|left"
|
||||||
android:background="#00000000"
|
android:background="#00000000"
|
||||||
tools:ignore="RtlHardcoded" />
|
tools:ignore="RtlHardcoded" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,5 +97,13 @@
|
||||||
<string name="accent_color">Accent Color</string>
|
<string name="accent_color">Accent Color</string>
|
||||||
<string name="primary_color_desc">The primary theme color, defaults to indigo.</string>
|
<string name="primary_color_desc">The primary theme color, defaults to indigo.</string>
|
||||||
<string name="accent_color_desc">The accent theme color, defaults to pink.</string>
|
<string name="accent_color_desc">The accent theme color, defaults to pink.</string>
|
||||||
|
<string name="update_image">Update Image</string>
|
||||||
|
|
||||||
|
<string-array name="update_albumcover_options">
|
||||||
|
<item>Download from LastFM</item>
|
||||||
|
<item>Pick from Local Storage</item>
|
||||||
|
<item>Web Search</item>
|
||||||
|
<item>Delete</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue