diff options
5 files changed, 28 insertions, 10 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java index ab68a59a..f1dd21e9 100644 --- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -191,6 +191,9 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte protected void createCustomActionBarView() { View customActionbar = getLayoutInflater().inflate(R.layout.actionbar_spinner, null); actionBarSpinner = (Spinner)customActionbar.findViewById(R.id.spinner); + if(Util.getThemeRes(this) == R.style.Theme_DSub_Light_No_Actionbar) { + actionBarSpinner.setBackgroundResource(R.drawable.abc_spinner_mtrl_am_alpha); + } spinnerAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item); spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); actionBarSpinner.setOnItemSelectedListener(this); diff --git a/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java b/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java index d8107158..38bd483d 100644 --- a/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java +++ b/app/src/main/java/github/daneren2005/dsub/adapter/SectionAdapter.java @@ -19,12 +19,11 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Build; +import android.support.v7.view.ActionMode; import android.support.v7.widget.PopupMenu; import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.Toolbar; import android.util.Log; import android.util.TypedValue; -import android.view.ActionMode; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -33,7 +32,6 @@ import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; -import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -398,9 +396,7 @@ public abstract class SectionAdapter<T> extends RecyclerView.Adapter<UpdateViewH final UpdateView<T> updateView = holder.getUpdateView(); if (context instanceof SubsonicFragmentActivity && currentActionMode == null) { final SubsonicFragmentActivity fragmentActivity = (SubsonicFragmentActivity) context; - Toolbar toolbar = fragmentActivity.getActiveToolbar(); - - toolbar.startActionMode(new ActionMode.Callback() { + fragmentActivity.startSupportActionMode(new ActionMode.Callback() { @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { currentActionMode = mode; @@ -413,7 +409,7 @@ public abstract class SectionAdapter<T> extends RecyclerView.Adapter<UpdateViewH setChecked(updateView, true); mode.setTitle(context.getResources().getString(R.string.select_album_n_selected, selected.size())); - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true)) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true)) { TypedValue typedValue = new TypedValue(); Resources.Theme theme = context.getTheme(); theme.resolveAttribute(R.attr.colorPrimaryDark, typedValue, true); @@ -446,12 +442,12 @@ public abstract class SectionAdapter<T> extends RecyclerView.Adapter<UpdateViewH public void onDestroyActionMode(ActionMode mode) { currentActionMode = null; selected.clear(); - for(UpdateView<T> updateView: selectedViews) { + for (UpdateView<T> updateView : selectedViews) { updateView.setChecked(false); } selectedViews.clear(); - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_COLOR_ACTION_BAR, true)) { Window window = ((SubsonicFragmentActivity) context).getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java index e7d44e6d..6215bb4d 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -1222,6 +1222,12 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR List<Integer> headers = new ArrayList<>(); List<String> details = new ArrayList<>(); + + if(!song.isDirectory()) { + headers.add(R.string.details_title); + details.add(song.getTitle()); + } + if(song instanceof PodcastEpisode) { headers.add(R.string.details_podcast); details.add(song.getArtist()); diff --git a/app/src/main/res/layout/actionbar_spinner.xml b/app/src/main/res/layout/actionbar_spinner.xml index 4d9f95a4..22fa7f43 100644 --- a/app/src/main/res/layout/actionbar_spinner.xml +++ b/app/src/main/res/layout/actionbar_spinner.xml @@ -10,5 +10,5 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" android:prompt="@string/common.appname" - android:background="@drawable/abc_spinner_mtrl_am_alpha"/> + style="?attr/android:spinnerItemStyle"/> </RelativeLayout> diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index dd156170..4ed67e27 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -177,15 +177,21 @@ <item name="add_person">@drawable/ic_menu_add_person_light</item> <item name="password">@drawable/ic_menu_password_light</item> <item name="radio">@drawable/ic_menu_radio_light</item> + <item name="actionModeBackground">@color/background_material_light</item> + <item name="actionModeStyle">@style/LightActionMode</item> + <item name="actionModeCloseButtonStyle">@style/DarkCloseButton</item> </style> <style name="Theme.DSub.Black.No_Color.Base" parent="Theme.DSub.Black.No_Actionbar"> <item name="actionbarBackgroundColor">@android:color/transparent</item> + <item name="actionModeBackground">@android:color/black</item> </style> <style name="Theme.DSub.Dark.No_Color.Base" parent="Theme.DSub.Dark.No_Actionbar"> <item name="actionbarBackgroundColor">@android:color/transparent</item> + <item name="actionModeBackground">@color/background_material_dark</item> </style> <style name="Theme.DSub.Holo.No_Color.Base" parent="Theme.DSub.Holo.No_Actionbar"> <item name="actionbarBackgroundColor">@android:color/transparent</item> + <item name="actionModeBackground">@drawable/background</item> </style> <style name="Theme.DSub.Light.No_Color" parent="Theme.DSub.Light.No_Color.Base"> @@ -207,4 +213,11 @@ <style name="DarkSpinnerItem" parent="Widget.AppCompat.TextView.SpinnerItem"> <item name="android:textColor">?android:attr/textColorPrimaryInverse</item> </style> + <style name="LightActionMode" parent="@style/Widget.AppCompat.ActionMode"> + <item name="titleTextStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse</item> + <item name="subtitleTextStyle">@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle.Inverse</item> + </style> + <style name="DarkCloseButton" parent="@style/Widget.AppCompat.ActionButton.CloseMode"> + <item name="colorControlNormal">@android:color/black</item> + </style> </resources> |