CheckBox style will be applied only for settings

This commit is contained in:
Denis 2015-01-30 15:44:59 +02:00
parent 783ba4d182
commit c72280f55e
5 changed files with 24 additions and 16 deletions

View file

@ -64,6 +64,17 @@
<item name="windowActionBarOverlay">true</item>
</style>
<style name="SettingsLightTheme" parent="Theme.AppCompat.Light">
<item name="android:listChoiceIndicatorMultiple">@drawable/check_light</item>
<item name="actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
</style>
<style name="SettingsDarkTheme" parent="Theme.AppCompat">
<item name="actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/check_dark</item>
</style>
<style name="OsmandLightTheme" parent="Theme.AppCompat.Light">
<item name="expandable_category_color">@color/group_background</item>
@ -79,21 +90,18 @@
<item name="pstsTextColor">@color/color_white</item>
<item name="android:actionModeBackground">@color/actionbar_light_color</item>
<item name="actionModeBackground">@color/actionbar_light_color</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
<item name="android:actionModeCloseDrawable">@drawable/action_mode_back</item>
<item name="actionModeCloseDrawable">@drawable/action_mode_back</item>
<item name="android:actionModeStyle">@style/WhiteActionMode</item>
<item name="actionModeStyle">@style/WhiteActionMode</item>
<item name="android:actionMenuTextColor">@color/color_white</item>
<item name="actionMenuTextColor">@color/color_white</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
<item name="actionBarStyle">@style/Widget.Styled.ActionBarLight</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/check_light</item>
</style>
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
<item name="reset_image">@drawable/ic_action_delete_dark</item> <!-- @drawable/a_1_navigation_cancel_dark -->
<!--<item name="android:actionDropDownStyle">@style/Widget.DarkActionSpinner</item>-->
<!--<item name="actionDropDownStyle">@style/Widget.DarkActionSpinner</item>-->
<item name="expandable_category_color">?android:attr/colorBackground</item>
<item name="windowActionBarOverlay">true</item>
<item name="bottomToolBarColor">@color/tool_bar_color_dark</item>
@ -106,7 +114,6 @@
<item name="actionModeBackground">@color/actionbar_dark_color</item>
<item name="actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
<item name="android:actionBarStyle">@style/Widget.Styled.ActionBarDark</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/check_dark</item>
</style>
<style name="OsmandLightDarkActionBarTheme" parent="Theme.AppCompat.Light.DarkActionBar">
@ -142,7 +149,6 @@
<style name="Widget.DarkActionSpinner" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:popupBackground">@color/actionbar_dark_color</item>
<item name="android:textColor">@color/color_white</item>
</style>
<style name="Widget.LightSpinner" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar">

View file

@ -810,11 +810,7 @@ public class OsmandApplication extends Application {
if (c instanceof ActionBarActivity) {
ab = ((ActionBarActivity) c).getSupportActionBar();
}
// else if (c instanceof SherlockListActivity) {
// ab = ((SherlockListActivity) c).getSupportActionBar();
// } else if (c instanceof Expandable) {
// ab = ((SherlockExpandableListActivity) c).getSupportActionBar();
// }
if (ab != null) {
BitmapDrawable bg = (BitmapDrawable) getResources().getDrawable(R.drawable.bg_striped);
bg.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);

View file

@ -1,9 +1,7 @@
package net.osmand.plus.activities;
import android.app.Activity;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
@ -16,6 +14,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Spinner;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
@ -29,6 +28,15 @@ public abstract class ActionBarPreferenceActivity extends PreferenceActivity {
@SuppressWarnings("deprecation")
@Override
protected void onCreate(final Bundle savedInstanceState) {
//settings needed it's own theme because of check boxes not styled properly
OsmandSettings settings = ((OsmandApplication)getApplication()).getSettings();
int t = R.style.SettingsLightTheme;
if (settings.OSMAND_THEME.get() == OsmandSettings.OSMAND_DARK_THEME) {
t = R.style.SettingsDarkTheme;
} else if (settings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME) {
t = R.style.SettingsLightTheme;
}
setTheme(t);
super.onCreate(savedInstanceState);
setContentView(R.layout.preference_activity);
toolbar = (Toolbar) findViewById(R.id.toolbar);

View file

@ -304,10 +304,9 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
((OsmandApplication) getApplication()).applyTheme(this);
super.onCreate(savedInstanceState);
getToolbar().setTitle(R.string.settings_activity);
settings = getMyApplication().getSettings();
if (profileSettings) {
modes.clear();

View file

@ -64,7 +64,6 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
private ListPreference drivingRegionPreference;
@Override
public void onCreate(Bundle savedInstanceState) {
((OsmandApplication) getApplication()).applyTheme(this);