dialog.getActionBar().setDisplayHomeAsUpEnabled(true);
dialog.getActionBar().setDisplayHomeAsUpEnabled(true);
@SuppressWarnings({"ConstantConditions", "deprecation"}) public static void applyTheme(Dialog dialog, Context context, SharedPreferences prefs) { if (prefs.getString("app_theme", "light").equals("device")) return; int colorPrimary = prefs.getInt("theme_colorPrimary", context.getResources().getColor(R.color.colorPrimary)); float[] hsv = new float[3]; Color.colorToHSV(colorPrimary, hsv); hsv[2] *= 0.8f; int colorPrimaryDark = Color.HSVToColor(hsv); dialog.getWindow().setStatusBarColor(colorPrimaryDark); try { dialog.getActionBar().setBackgroundDrawable(new ColorDrawable(colorPrimary)); } catch (NullPointerException ignore) { } }
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { boolean result = super.onPreferenceTreeClick(preferenceScreen, preference); // Set home as up if (preference instanceof PreferenceScreen) { Dialog dialog = ((PreferenceScreen) preference).getDialog(); ActionBar actionBar = dialog.getActionBar(); actionBar.setDisplayHomeAsUpEnabled(false); } return result; }
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { boolean result = super.onPreferenceTreeClick(preferenceScreen, preference); if (preference instanceof PreferenceScreen) { Dialog dialog = ((PreferenceScreen) preference).getDialog(); ActionBar actionBar = dialog.getActionBar(); actionBar.setDisplayHomeAsUpEnabled(false); } return result; }
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { boolean result = super.onPreferenceTreeClick(preferenceScreen, preference); if (preference instanceof PreferenceScreen) { Dialog dialog = ((PreferenceScreen) preference).getDialog(); ActionBar actionBar = dialog.getActionBar(); actionBar.setDisplayHomeAsUpEnabled(false); } return result; }
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { boolean result = super.onPreferenceTreeClick(preferenceScreen, preference); // Set home as up if (preference instanceof PreferenceScreen) { Dialog dialog = ((PreferenceScreen) preference).getDialog(); ActionBar actionBar = dialog.getActionBar(); actionBar.setDisplayHomeAsUpEnabled(false); } return result; }