Make it possible to fetch the current theme directly

This commit is contained in:
Daniel Martí 2014-08-05 12:53:28 +02:00
parent 05e99c666d
commit 2f7ee04032
2 changed files with 8 additions and 4 deletions

View File

@ -86,7 +86,7 @@ public class FDroidApp extends Application {
BluetoothAdapter bluetoothAdapter = null;
private static enum Theme {
public static enum Theme {
dark, light, lightWithDarkActionBar
}
@ -112,6 +112,10 @@ public class FDroidApp extends Application {
}
}
public static Theme getCurTheme() {
return curTheme;
}
@Override
public void onCreate() {
super.onCreate();

View File

@ -23,6 +23,7 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Spinner;
import org.fdroid.fdroid.FDroidApp;
import org.fdroid.fdroid.Preferences;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.compat.ArrayAdapterCompat;
@ -112,9 +113,8 @@ public class AvailableAppsFragment extends AppListFragment implements
// with holo, the menu gets lost since it looks the same as an app list item
if (Build.VERSION.SDK_INT >= 14) {
Drawable menuButton = getResources().getDrawable(android.R.drawable.btn_dropdown);
if (TextUtils.equals("dark",
PreferenceManager.getDefaultSharedPreferences(getActivity())
.getString(Preferences.PREF_THEME, "dark"))) {
if (((FDroidApp)getActivity().getApplication()).getCurTheme()
== FDroidApp.Theme.dark) {
menuButton.setAlpha(32); // make it darker via alpha
}
categorySpinner.setBackgroundDrawable(menuButton);