Merge pull request #2993 from pachecosf/add-highlighting-of-drawer-item
Adding highlighting of drawer item functionality
This commit is contained in:
commit
20def27f22
|
@ -8,6 +8,7 @@ import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -214,10 +215,17 @@ public class NavListAdapter extends BaseAdapter
|
||||||
}
|
}
|
||||||
if (v != null && viewType != VIEW_TYPE_SECTION_DIVIDER) {
|
if (v != null && viewType != VIEW_TYPE_SECTION_DIVIDER) {
|
||||||
TextView txtvTitle = v.findViewById(R.id.txtvTitle);
|
TextView txtvTitle = v.findViewById(R.id.txtvTitle);
|
||||||
|
TypedValue typedValue = new TypedValue();
|
||||||
|
|
||||||
if (position == itemAccess.getSelectedItemIndex()) {
|
if (position == itemAccess.getSelectedItemIndex()) {
|
||||||
txtvTitle.setTypeface(null, Typeface.BOLD);
|
txtvTitle.setTypeface(null, Typeface.BOLD);
|
||||||
|
v.getContext().getTheme().resolveAttribute(de.danoeh.antennapod.core.R.attr.drawer_activated_color, typedValue, true);
|
||||||
|
v.setBackgroundResource(typedValue.resourceId);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
txtvTitle.setTypeface(null, Typeface.NORMAL);
|
txtvTitle.setTypeface(null, Typeface.NORMAL);
|
||||||
|
v.getContext().getTheme().resolveAttribute(de.danoeh.antennapod.core.R.attr.nav_drawer_background, typedValue, true);
|
||||||
|
v.setBackgroundResource(typedValue.resourceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
<attr name="overlay_background" format="color"/>
|
<attr name="overlay_background" format="color"/>
|
||||||
|
|
||||||
<attr name="nav_drawer_background" format="color"/>
|
<attr name="nav_drawer_background" format="color"/>
|
||||||
|
<attr name="drawer_activated_color" format="color"/>
|
||||||
|
|
||||||
<attr name="about_screen_background" format="color"/>
|
<attr name="about_screen_background" format="color"/>
|
||||||
<attr name="about_screen_card_background" format="color"/>
|
<attr name="about_screen_card_background" format="color"/>
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
<!-- Theme colors -->
|
<!-- Theme colors -->
|
||||||
<color name="primary_light">#FFFFFF</color>
|
<color name="primary_light">#FFFFFF</color>
|
||||||
<color name="primary_darktheme">#212121</color>
|
<color name="primary_darktheme">#212121</color>
|
||||||
|
<color name="nav_drawer_background_dark">#3B3B3B</color>
|
||||||
|
<color name="nav_drawer_highlighted_dark">#212121</color>
|
||||||
<color name="highlight_light">#DDDDDD</color>
|
<color name="highlight_light">#DDDDDD</color>
|
||||||
<color name="highlight_dark">#414141</color>
|
<color name="highlight_dark">#414141</color>
|
||||||
<color name="highlight_trueblack">#414141</color>
|
<color name="highlight_trueblack">#414141</color>
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_grey600_48dp</item>
|
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_grey600_48dp</item>
|
||||||
<item type="attr" name="dragview_float_background">@color/white</item>
|
<item type="attr" name="dragview_float_background">@color/white</item>
|
||||||
<item type="attr" name="nav_drawer_background">@color/white</item>
|
<item type="attr" name="nav_drawer_background">@color/white</item>
|
||||||
|
<item type="attr" name="drawer_activated_color">@color/highlight_light</item>
|
||||||
<item type="attr" name="ic_new">@drawable/ic_new_releases_grey600_24dp</item>
|
<item type="attr" name="ic_new">@drawable/ic_new_releases_grey600_24dp</item>
|
||||||
<item type="attr" name="ic_history">@drawable/ic_history_grey600_24dp</item>
|
<item type="attr" name="ic_history">@drawable/ic_history_grey600_24dp</item>
|
||||||
<item type="attr" name="ic_folder">@drawable/ic_folder_grey600_24dp</item>
|
<item type="attr" name="ic_folder">@drawable/ic_folder_grey600_24dp</item>
|
||||||
|
@ -125,7 +126,8 @@
|
||||||
<item type="attr" name="overlay_drawable">@drawable/overlay_drawable_dark</item>
|
<item type="attr" name="overlay_drawable">@drawable/overlay_drawable_dark</item>
|
||||||
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_white_48dp</item>
|
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_white_48dp</item>
|
||||||
<item type="attr" name="dragview_float_background">@color/black</item>
|
<item type="attr" name="dragview_float_background">@color/black</item>
|
||||||
<item type="attr" name="nav_drawer_background">#3B3B3B</item>
|
<item type="attr" name="nav_drawer_background">@color/nav_drawer_background_dark</item>
|
||||||
|
<item type="attr" name="drawer_activated_color">@color/nav_drawer_highlighted_dark</item>
|
||||||
<item type="attr" name="ic_new">@drawable/ic_new_releases_white_24dp</item>
|
<item type="attr" name="ic_new">@drawable/ic_new_releases_white_24dp</item>
|
||||||
<item type="attr" name="ic_history">@drawable/ic_history_white_24dp</item>
|
<item type="attr" name="ic_history">@drawable/ic_history_white_24dp</item>
|
||||||
<item type="attr" name="ic_folder">@drawable/ic_folder_white_24dp</item>
|
<item type="attr" name="ic_folder">@drawable/ic_folder_white_24dp</item>
|
||||||
|
@ -175,6 +177,7 @@
|
||||||
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_white_48dp</item>
|
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_white_48dp</item>
|
||||||
<item type="attr" name="dragview_float_background">@color/black</item>
|
<item type="attr" name="dragview_float_background">@color/black</item>
|
||||||
<item type="attr" name="nav_drawer_background">@color/black</item>
|
<item type="attr" name="nav_drawer_background">@color/black</item>
|
||||||
|
<item type="attr" name="drawer_activated_color">@color/highlight_trueblack</item>
|
||||||
<item name="android:textColorPrimary">@color/white</item>
|
<item name="android:textColorPrimary">@color/white</item>
|
||||||
<item name="android:color">@color/white</item>
|
<item name="android:color">@color/white</item>
|
||||||
<item name="android:colorBackground">@color/black</item>
|
<item name="android:colorBackground">@color/black</item>
|
||||||
|
@ -228,6 +231,7 @@
|
||||||
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_grey600_48dp</item>
|
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_grey600_48dp</item>
|
||||||
<item type="attr" name="dragview_float_background">@color/white</item>
|
<item type="attr" name="dragview_float_background">@color/white</item>
|
||||||
<item type="attr" name="nav_drawer_background">@color/white</item>
|
<item type="attr" name="nav_drawer_background">@color/white</item>
|
||||||
|
<item type="attr" name="drawer_activated_color">@color/highlight_light</item>
|
||||||
<item type="attr" name="ic_new">@drawable/ic_new_releases_grey600_24dp</item>
|
<item type="attr" name="ic_new">@drawable/ic_new_releases_grey600_24dp</item>
|
||||||
<item type="attr" name="ic_history">@drawable/ic_history_grey600_24dp</item>
|
<item type="attr" name="ic_history">@drawable/ic_history_grey600_24dp</item>
|
||||||
<item type="attr" name="ic_folder">@drawable/ic_folder_grey600_24dp</item>
|
<item type="attr" name="ic_folder">@drawable/ic_folder_grey600_24dp</item>
|
||||||
|
@ -309,7 +313,8 @@
|
||||||
<item type="attr" name="overlay_drawable">@drawable/overlay_drawable_dark</item>
|
<item type="attr" name="overlay_drawable">@drawable/overlay_drawable_dark</item>
|
||||||
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_white_48dp</item>
|
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_white_48dp</item>
|
||||||
<item type="attr" name="dragview_float_background">@color/black</item>
|
<item type="attr" name="dragview_float_background">@color/black</item>
|
||||||
<item type="attr" name="nav_drawer_background">#3B3B3B</item>
|
<item type="attr" name="nav_drawer_background">@color/nav_drawer_background_dark</item>
|
||||||
|
<item type="attr" name="drawer_activated_color">@color/nav_drawer_highlighted_dark</item>
|
||||||
<item type="attr" name="ic_new">@drawable/ic_new_releases_white_24dp</item>
|
<item type="attr" name="ic_new">@drawable/ic_new_releases_white_24dp</item>
|
||||||
<item type="attr" name="ic_history">@drawable/ic_history_white_24dp</item>
|
<item type="attr" name="ic_history">@drawable/ic_history_white_24dp</item>
|
||||||
<item type="attr" name="ic_folder">@drawable/ic_folder_white_24dp</item>
|
<item type="attr" name="ic_folder">@drawable/ic_folder_white_24dp</item>
|
||||||
|
@ -359,6 +364,7 @@
|
||||||
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_white_48dp</item>
|
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_white_48dp</item>
|
||||||
<item type="attr" name="dragview_float_background">@color/black</item>
|
<item type="attr" name="dragview_float_background">@color/black</item>
|
||||||
<item type="attr" name="nav_drawer_background">@color/black</item>
|
<item type="attr" name="nav_drawer_background">@color/black</item>
|
||||||
|
<item type="attr" name="drawer_activated_color">@color/highlight_trueblack</item>
|
||||||
<item type="attr" name="currently_playing_background">@color/highlight_trueblack</item>
|
<item type="attr" name="currently_playing_background">@color/highlight_trueblack</item>
|
||||||
<item name="android:textColorPrimary">@color/white</item>
|
<item name="android:textColorPrimary">@color/white</item>
|
||||||
<item name="android:color">@color/white</item>
|
<item name="android:color">@color/white</item>
|
||||||
|
|
Loading…
Reference in New Issue