diff options
author | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-05-03 15:07:25 +0200 |
---|---|---|
committer | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-05-03 15:07:25 +0200 |
commit | a92220f8dbb3339ea101abeac0cf77bd87d9b544 (patch) | |
tree | df951c60f4691d875cb9a83787d965a35cfeedae /app/src/main/java/de/danoeh/antennapod/menuhandler | |
parent | 103fb635d16f270796adde0e6f3d212a671b7214 (diff) | |
download | AntennaPod-a92220f8dbb3339ea101abeac0cf77bd87d9b544.zip |
Show lock icon always, use correct search view text color on older devices
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/menuhandler')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java index b2e3f8968..edefb7d46 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java @@ -1,7 +1,9 @@ package de.danoeh.antennapod.menuhandler; import android.content.Context; +import android.content.res.Resources; import android.content.res.TypedArray; +import android.os.Build; import android.support.v4.view.MenuItemCompat; import android.support.v7.widget.SearchView; import android.view.Menu; @@ -17,8 +19,18 @@ public class MenuItemUtils extends de.danoeh.antennapod.core.menuhandler.MenuIte public static MenuItem addSearchItem(Menu menu, SearchView searchView) { MenuItem item = menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label); - MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); + MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW | MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); MenuItemCompat.setActionView(item, searchView); + + if(Build.VERSION.SDK_INT < 14) { + SearchView.SearchAutoComplete textField = (SearchView.SearchAutoComplete) searchView.findViewById(de.danoeh.antennapod.R.id.search_src_text); + if(UserPreferences.getTheme() == de.danoeh.antennapod.R.style.Theme_AntennaPod_Dark) { + textField.setTextColor(Resources.getSystem().getColor(android.R.color.white)); + } else { + textField.setTextColor(Resources.getSystem().getColor(android.R.color.black)); + } + } + return item; } |