Added logic to switch between now playing screens.
This commit is contained in:
parent
ea69dcde9c
commit
ea3f95d401
15 changed files with 333 additions and 18 deletions
|
|
@ -106,18 +106,18 @@ dependencies {
|
||||||
transitive = true
|
transitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
compile('com.github.afollestad.material-dialogs:core:0.8.5.6@aar') {
|
compile('com.github.afollestad.material-dialogs:core:0.8.5.8@aar') {
|
||||||
transitive = true
|
transitive = true
|
||||||
}
|
}
|
||||||
compile('com.github.afollestad.material-dialogs:commons:0.8.5.6@aar') {
|
compile('com.github.afollestad.material-dialogs:commons:0.8.5.8@aar') {
|
||||||
transitive = true
|
transitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
compile('com.afollestad:material-cab:0.1.9@aar') {
|
compile('com.afollestad:material-cab:0.1.11@aar') {
|
||||||
transitive = true
|
transitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
compile('com.github.kabouzeid:app-theme-helper:1.0.1@aar') {
|
compile('com.github.kabouzeid:app-theme-helper:454b062475@aar') {
|
||||||
transitive = true
|
transitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.kabouzeid.gramophone.preferences;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
import com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEDialogPreference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Karim Abou Zeid (kabouzeid)
|
||||||
|
*/
|
||||||
|
public class NowPlayingScreenPreference extends ATEDialogPreference {
|
||||||
|
public NowPlayingScreenPreference(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NowPlayingScreenPreference(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NowPlayingScreenPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NowPlayingScreenPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,135 @@
|
||||||
|
package com.kabouzeid.gramophone.preferences;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
|
import android.support.v4.view.PagerAdapter;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.DialogAction;
|
||||||
|
import com.afollestad.materialdialogs.MaterialDialog;
|
||||||
|
import com.heinrichreimersoftware.materialintro.view.InkPageIndicator;
|
||||||
|
import com.kabouzeid.gramophone.R;
|
||||||
|
import com.kabouzeid.gramophone.ui.fragments.player.NowPlayingScreen;
|
||||||
|
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
||||||
|
import com.kabouzeid.gramophone.util.ViewUtil;
|
||||||
|
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Karim Abou Zeid (kabouzeid)
|
||||||
|
*/
|
||||||
|
public class NowPlayingScreenPreferenceDialog extends DialogFragment implements MaterialDialog.SingleButtonCallback, ViewPager.OnPageChangeListener {
|
||||||
|
public static final String TAG = NowPlayingScreenPreferenceDialog.class.getSimpleName();
|
||||||
|
|
||||||
|
private DialogAction whichButtonClicked;
|
||||||
|
private int viewPagerPosition;
|
||||||
|
|
||||||
|
public static NowPlayingScreenPreferenceDialog newInstance() {
|
||||||
|
return new NowPlayingScreenPreferenceDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
@SuppressLint("InflateParams") View view = LayoutInflater.from(getContext()).inflate(R.layout.preference_dialog_now_playing_screen, null);
|
||||||
|
ViewPager viewPager = ButterKnife.findById(view, R.id.now_playing_screen_view_pager);
|
||||||
|
viewPager.setAdapter(new NowPlayingScreenAdapter(getContext()));
|
||||||
|
viewPager.addOnPageChangeListener(this);
|
||||||
|
viewPager.setPageMargin((int) ViewUtil.convertDpToPixel(32, getResources()));
|
||||||
|
viewPager.setCurrentItem(PreferenceUtil.getInstance(getContext()).getNowPlayingScreen().ordinal());
|
||||||
|
|
||||||
|
InkPageIndicator pageIndicator = ButterKnife.findById(view, R.id.page_indicator);
|
||||||
|
pageIndicator.setViewPager(viewPager);
|
||||||
|
|
||||||
|
return new MaterialDialog.Builder(getContext())
|
||||||
|
.title(R.string.pref_title_now_playing_screen_appearance)
|
||||||
|
.positiveText(android.R.string.ok)
|
||||||
|
.negativeText(android.R.string.cancel)
|
||||||
|
.onAny(this)
|
||||||
|
.customView(view, false)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
|
||||||
|
whichButtonClicked = which;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
super.onDismiss(dialog);
|
||||||
|
if (whichButtonClicked == DialogAction.POSITIVE) {
|
||||||
|
PreferenceUtil.getInstance(getContext()).setNowPlayingScreen(NowPlayingScreen.values()[viewPagerPosition]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageSelected(int position) {
|
||||||
|
this.viewPagerPosition = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageScrollStateChanged(int state) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class NowPlayingScreenAdapter extends PagerAdapter {
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
public NowPlayingScreenAdapter(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object instantiateItem(ViewGroup collection, int position) {
|
||||||
|
NowPlayingScreen nowPlayingScreen = NowPlayingScreen.values()[position];
|
||||||
|
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
|
ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.preference_now_playing_screen_item, collection, false);
|
||||||
|
collection.addView(layout);
|
||||||
|
|
||||||
|
ImageView image = ButterKnife.findById(layout, R.id.image);
|
||||||
|
TextView title = ButterKnife.findById(layout, R.id.title);
|
||||||
|
image.setImageResource(nowPlayingScreen.drawableResId);
|
||||||
|
title.setText(nowPlayingScreen.titleRes);
|
||||||
|
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroyItem(ViewGroup collection, int position, Object view) {
|
||||||
|
collection.removeView((View) view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return NowPlayingScreen.values().length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isViewFromObject(View view, Object object) {
|
||||||
|
return view == object;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getPageTitle(int position) {
|
||||||
|
return context.getString(NowPlayingScreen.values()[position].titleRes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.kabouzeid.gramophone.ui.activities;
|
package com.kabouzeid.gramophone.ui.activities;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
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;
|
||||||
|
|
@ -9,6 +10,7 @@ import android.os.Bundle;
|
||||||
import android.support.annotation.ColorInt;
|
import android.support.annotation.ColorInt;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v7.preference.ListPreference;
|
import android.support.v7.preference.ListPreference;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.support.v7.preference.PreferenceManager;
|
import android.support.v7.preference.PreferenceManager;
|
||||||
|
|
@ -23,6 +25,8 @@ import com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEColorPreference;
|
||||||
import com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEPreferenceFragmentCompat;
|
import com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEPreferenceFragmentCompat;
|
||||||
import com.kabouzeid.appthemehelper.util.ColorUtil;
|
import com.kabouzeid.appthemehelper.util.ColorUtil;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
|
import com.kabouzeid.gramophone.preferences.NowPlayingScreenPreference;
|
||||||
|
import com.kabouzeid.gramophone.preferences.NowPlayingScreenPreferenceDialog;
|
||||||
import com.kabouzeid.gramophone.ui.activities.base.AbsBaseActivity;
|
import com.kabouzeid.gramophone.ui.activities.base.AbsBaseActivity;
|
||||||
import com.kabouzeid.gramophone.util.NavigationUtil;
|
import com.kabouzeid.gramophone.util.NavigationUtil;
|
||||||
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
||||||
|
|
@ -86,7 +90,7 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SettingsFragment extends ATEPreferenceFragmentCompat {
|
public static class SettingsFragment extends ATEPreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
private static void setSummary(@NonNull Preference preference) {
|
private static void setSummary(@NonNull Preference preference) {
|
||||||
setSummary(preference, PreferenceManager
|
setSummary(preference, PreferenceManager
|
||||||
|
|
@ -119,11 +123,27 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
||||||
addPreferencesFromResource(R.xml.pref_audio);
|
addPreferencesFromResource(R.xml.pref_audio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public DialogFragment onCreatePreferenceDialog(Preference preference) {
|
||||||
|
if (preference instanceof NowPlayingScreenPreference) {
|
||||||
|
return NowPlayingScreenPreferenceDialog.newInstance();
|
||||||
|
}
|
||||||
|
return super.onCreatePreferenceDialog(preference);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
getListView().setPadding(0, 0, 0, 0);
|
getListView().setPadding(0, 0, 0, 0);
|
||||||
invalidateSettings();
|
invalidateSettings();
|
||||||
|
PreferenceUtil.getInstance(getActivity()).registerOnSharedPreferenceChangedListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
PreferenceUtil.getInstance(getActivity()).unregisterOnSharedPreferenceChangedListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invalidateSettings() {
|
private void invalidateSettings() {
|
||||||
|
|
@ -223,6 +243,8 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updateNowPlayingScreenSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasEqualizer() {
|
private boolean hasEqualizer() {
|
||||||
|
|
@ -231,5 +253,18 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
||||||
ResolveInfo ri = pm.resolveActivity(effects, 0);
|
ResolveInfo ri = pm.resolveActivity(effects, 0);
|
||||||
return ri != null;
|
return ri != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
|
switch (key) {
|
||||||
|
case PreferenceUtil.NOW_PLAYING_SCREEN_ID:
|
||||||
|
updateNowPlayingScreenSummary();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateNowPlayingScreenSummary() {
|
||||||
|
findPreference("now_playing_screen_id").setSummary(PreferenceUtil.getInstance(getActivity()).getNowPlayingScreen().titleRes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import android.os.Bundle;
|
||||||
import android.support.annotation.ColorInt;
|
import android.support.annotation.ColorInt;
|
||||||
import android.support.annotation.FloatRange;
|
import android.support.annotation.FloatRange;
|
||||||
import android.support.annotation.LayoutRes;
|
import android.support.annotation.LayoutRes;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
|
|
@ -18,7 +19,10 @@ import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.player.AbsPlayerFragment;
|
import com.kabouzeid.gramophone.ui.fragments.player.AbsPlayerFragment;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.player.MiniPlayerFragment;
|
import com.kabouzeid.gramophone.ui.fragments.player.MiniPlayerFragment;
|
||||||
|
import com.kabouzeid.gramophone.ui.fragments.player.NowPlayingScreen;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.player.card.CardPlayerFragment;
|
import com.kabouzeid.gramophone.ui.fragments.player.card.CardPlayerFragment;
|
||||||
|
import com.kabouzeid.gramophone.ui.fragments.player.flat.FlatPlayerFragment;
|
||||||
|
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
||||||
import com.kabouzeid.gramophone.util.ViewUtil;
|
import com.kabouzeid.gramophone.util.ViewUtil;
|
||||||
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
||||||
|
|
||||||
|
|
@ -41,6 +45,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
private int taskColor;
|
private int taskColor;
|
||||||
private boolean lightStatusbar;
|
private boolean lightStatusbar;
|
||||||
|
|
||||||
|
private NowPlayingScreen currentNowPlayingScreen;
|
||||||
private AbsPlayerFragment playerFragment;
|
private AbsPlayerFragment playerFragment;
|
||||||
private MiniPlayerFragment miniPlayerFragment;
|
private MiniPlayerFragment miniPlayerFragment;
|
||||||
|
|
||||||
|
|
@ -53,7 +58,21 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
setContentView(createContentView());
|
setContentView(createContentView());
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
playerFragment = (AbsPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.player_fragment);
|
currentNowPlayingScreen = PreferenceUtil.getInstance(this).getNowPlayingScreen();
|
||||||
|
Fragment fragment; // must implement AbsPlayerFragment
|
||||||
|
switch (currentNowPlayingScreen) {
|
||||||
|
case FLAT:
|
||||||
|
fragment = new FlatPlayerFragment();
|
||||||
|
break;
|
||||||
|
case CARD:
|
||||||
|
default:
|
||||||
|
fragment = new CardPlayerFragment();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
getSupportFragmentManager().beginTransaction().replace(R.id.player_fragment_container, fragment).commit();
|
||||||
|
getSupportFragmentManager().executePendingTransactions();
|
||||||
|
|
||||||
|
playerFragment = (AbsPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.player_fragment_container);
|
||||||
miniPlayerFragment = (MiniPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.mini_player_fragment);
|
miniPlayerFragment = (MiniPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.mini_player_fragment);
|
||||||
|
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
|
|
@ -74,12 +93,20 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
onPanelExpanded(slidingUpPanelLayout);
|
onPanelExpanded(slidingUpPanelLayout);
|
||||||
} else if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
} else if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
onPanelCollapsed(slidingUpPanelLayout);
|
onPanelCollapsed(slidingUpPanelLayout);
|
||||||
|
} else {
|
||||||
|
playerFragment.onHide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
slidingUpPanelLayout.addPanelSlideListener(this);
|
slidingUpPanelLayout.addPanelSlideListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
playerFragment.onHide();
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (currentNowPlayingScreen != PreferenceUtil.getInstance(this).getNowPlayingScreen()) {
|
||||||
|
postRecreate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAntiDragView(View antiDragView) {
|
public void setAntiDragView(View antiDragView) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.kabouzeid.gramophone.ui.fragments.player;
|
||||||
|
|
||||||
|
import android.support.annotation.DrawableRes;
|
||||||
|
import android.support.annotation.StringRes;
|
||||||
|
|
||||||
|
import com.kabouzeid.gramophone.R;
|
||||||
|
|
||||||
|
public enum NowPlayingScreen {
|
||||||
|
CARD(R.string.card, R.drawable.np_card, 0),
|
||||||
|
FLAT(R.string.flat, R.drawable.np_flat, 1);
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
public final int titleRes;
|
||||||
|
@DrawableRes
|
||||||
|
public final int drawableResId;
|
||||||
|
public final int id;
|
||||||
|
|
||||||
|
NowPlayingScreen(@StringRes int titleRes, @DrawableRes int drawableResId, int id) {
|
||||||
|
this.titleRes = titleRes;
|
||||||
|
this.drawableResId = drawableResId;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,7 @@ import android.support.annotation.StyleRes;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.helper.SortOrder;
|
import com.kabouzeid.gramophone.helper.SortOrder;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.mainactivity.folders.FoldersFragment;
|
import com.kabouzeid.gramophone.ui.fragments.mainactivity.folders.FoldersFragment;
|
||||||
|
import com.kabouzeid.gramophone.ui.fragments.player.NowPlayingScreen;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
|
@ -18,6 +19,7 @@ public final class PreferenceUtil {
|
||||||
public static final String DEFAULT_START_PAGE = "default_start_page";
|
public static final String DEFAULT_START_PAGE = "default_start_page";
|
||||||
public static final String LAST_PAGE = "last_start_page";
|
public static final String LAST_PAGE = "last_start_page";
|
||||||
public static final String LAST_MUSIC_CHOOSER = "last_music_chooser";
|
public static final String LAST_MUSIC_CHOOSER = "last_music_chooser";
|
||||||
|
public static final String NOW_PLAYING_SCREEN_ID = "now_playing_screen_id";
|
||||||
|
|
||||||
public static final String ARTIST_SORT_ORDER = "artist_sort_order";
|
public static final String ARTIST_SORT_ORDER = "artist_sort_order";
|
||||||
public static final String ARTIST_SONG_SORT_ORDER = "artist_song_sort_order";
|
public static final String ARTIST_SONG_SORT_ORDER = "artist_song_sort_order";
|
||||||
|
|
@ -127,6 +129,21 @@ public final class PreferenceUtil {
|
||||||
return mPreferences.getInt(LAST_MUSIC_CHOOSER, 0);
|
return mPreferences.getInt(LAST_MUSIC_CHOOSER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final NowPlayingScreen getNowPlayingScreen() {
|
||||||
|
int id = mPreferences.getInt(NOW_PLAYING_SCREEN_ID, 0);
|
||||||
|
for (NowPlayingScreen nowPlayingScreen : NowPlayingScreen.values()) {
|
||||||
|
if (nowPlayingScreen.id == id) return nowPlayingScreen;
|
||||||
|
}
|
||||||
|
return NowPlayingScreen.CARD;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CommitPrefEdits")
|
||||||
|
public void setNowPlayingScreen(NowPlayingScreen nowPlayingScreen) {
|
||||||
|
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||||
|
editor.putInt(NOW_PLAYING_SCREEN_ID, nowPlayingScreen.id);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean coloredNotification() {
|
public final boolean coloredNotification() {
|
||||||
return mPreferences.getBoolean(COLORED_NOTIFICATION, true);
|
return mPreferences.getBoolean(COLORED_NOTIFICATION, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
app/src/main/res/drawable-xxxhdpi/np_card.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/np_card.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/np_flat.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/np_flat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<android.support.v4.view.ViewPager
|
||||||
|
android:id="@+id/now_playing_screen_view_pager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:paddingLeft="72dp"
|
||||||
|
android:paddingRight="72dp" />
|
||||||
|
|
||||||
|
<com.heinrichreimersoftware.materialintro.view.InkPageIndicator
|
||||||
|
android:id="@+id/page_indicator"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="16dp"
|
||||||
|
app:currentPageIndicatorColor="?android:textColorPrimary"
|
||||||
|
app:dotDiameter="8dp"
|
||||||
|
app:dotGap="8dp"
|
||||||
|
app:pageIndicatorColor="?android:textColorHint" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:ignore="ContentDescription">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:textColor="?android:textColorSecondary"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||||
|
tools:text="Card layout" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/image"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
tools:src="@drawable/tutorial_queue_swipe_up" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -19,9 +19,8 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?android:colorBackground">
|
android:background="?android:colorBackground">
|
||||||
|
|
||||||
<fragment android:id="@+id/player_fragment"
|
<FrameLayout
|
||||||
class="com.kabouzeid.gramophone.ui.fragments.player.flat.FlatPlayerFragment"
|
android:id="@+id/player_fragment_container"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@
|
||||||
<string name="twitter" translatable="false">Twitter</string>
|
<string name="twitter" translatable="false">Twitter</string>
|
||||||
<string name="git_hub" translatable="false">GitHub</string>
|
<string name="git_hub" translatable="false">GitHub</string>
|
||||||
|
|
||||||
|
<string name="card">Card</string>
|
||||||
|
<string name="flat">Flat</string>
|
||||||
|
|
||||||
<string-array name="donation_ids" translatable="false">
|
<string-array name="donation_ids" translatable="false">
|
||||||
<item>donation_1</item>
|
<item>donation_1</item>
|
||||||
<item>donation_2</item>
|
<item>donation_2</item>
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@
|
||||||
<string name="website">Website</string>
|
<string name="website">Website</string>
|
||||||
<string name="loading_products">Loading products…</string>
|
<string name="loading_products">Loading products…</string>
|
||||||
<string name="up_next">Up next</string>
|
<string name="up_next">Up next</string>
|
||||||
<string name="pref_title_now_playing_layout">Now playing layout</string>
|
<string name="pref_title_now_playing_screen_appearance">Appearance</string>
|
||||||
<string name="intro_label">Introduction</string>
|
<string name="intro_label">Introduction</string>
|
||||||
<string name="press_back_again_to_exit_intro">Press back again to skip the intro.</string>
|
<string name="press_back_again_to_exit_intro">Press back again to skip the intro.</string>
|
||||||
<string name="welcome_to_phonograph">"Welcome to Phonograph, a beautiful and lightweight music player for Android. "</string>
|
<string name="welcome_to_phonograph">"Welcome to Phonograph, a beautiful and lightweight music player for Android. "</string>
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,9 @@
|
||||||
|
|
||||||
<com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory android:title="@string/pref_header_now_playing_screen">
|
<com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory android:title="@string/pref_header_now_playing_screen">
|
||||||
|
|
||||||
<com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEListPreference
|
<com.kabouzeid.gramophone.preferences.NowPlayingScreenPreference
|
||||||
android:enabled="false"
|
android:key="now_playing_screen_id"
|
||||||
android:key="now_playing_layout"
|
android:title="@string/pref_title_now_playing_screen_appearance" />
|
||||||
android:negativeButtonText="@null"
|
|
||||||
android:positiveButtonText="@null"
|
|
||||||
android:summary="Coming soon"
|
|
||||||
android:title="@string/pref_title_now_playing_layout" />
|
|
||||||
|
|
||||||
</com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
</com.kabouzeid.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue