Fixed the white on white problem. Settings reverted to black.

Correctly applying the theme
This commit is contained in:
Pavol Zibrita 2012-02-18 02:42:09 +01:00
parent 92a58c7afd
commit fc87d76126
4 changed files with 32 additions and 26 deletions

View file

@ -14,7 +14,8 @@
</TableRow> </TableRow>
<TableRow> <TableRow>
<Button android:text="&lt;Type&gt;" android:id="@+id/TypeButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <Button android:text="&lt;Type&gt;" android:id="@+id/TypeButton" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<AutoCompleteTextView style="@style/OsmandAutoCompleteTextView" android:text="" android:id="@+id/Type" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_width ="fill_parent"/> <AutoCompleteTextView
android:text="" android:id="@+id/Type" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_width ="fill_parent"/>
<!-- <EditText android:text="" android:id="@+id/Type" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_width = "fill_parent" /> --> <!-- <EditText android:text="" android:id="@+id/Type" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_height="wrap_content" android:layout_width = "fill_parent" /> -->
</TableRow> </TableRow>
<TableRow> <TableRow>

View file

@ -48,6 +48,9 @@
<!-- The gray theme related styles --> <!-- The gray theme related styles -->
<style name="WhiteTitleText" parent="android:style/TextAppearance.Large"> <style name="WhiteTitleText" parent="android:style/TextAppearance.Large">
</style> </style>
<style name="WhiteText" parent="android:style/TextAppearance">
<item name="android:textColor">@color/activity_text</item>
</style>
<style name="ListText"> <style name="ListText">
<item name="android:textSize">25sp</item> <item name="android:textSize">25sp</item>
</style> </style>
@ -59,40 +62,40 @@
<item name="android:textColor">@color/color_black</item> <item name="android:textColor">@color/color_black</item>
</style> </style>
<style name="OsmandTheme" parent="@android:style/Theme"> <style name="OsmandTheme" parent="@android:style/Theme">
<item name="android:windowContentOverlay">@null</item> <item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@color/activity_background</item> <item name="android:windowBackground">@color/activity_background</item>
<item name="android:textColor">@color/activity_text</item> <item name="android:colorBackground">@color/activity_background</item>
<item name="android:spinnerItemStyle">@style/OsmandSpinnerItem</item> <item name="android:colorBackgroundCacheHint">?android:attr/colorBackground</item>
<item name="android:autoCompleteTextViewStyle">@style/Widget.AutoCompleteTextViewLight</item>
</style>
<style name="OsmandAutoCompleteTextView"> <item name="android:textColorPrimary">@color/activity_text</item>
<item name="android:textColor">@color/color_black</item> <item name="android:textColorSecondary">@color/activity_text</item>
</style> <item name="android:textColorTertiary">@color/activity_text</item>
<style name="Widget.AutoCompleteTextViewLight" parent="@android:style/Widget.AutoCompleteTextView">
<item name="android:textColor">@color/color_black</item> <item name="android:listViewStyle">@style/OsmandListView</item> <!-- makes problem on preference sub-screen, because, that is still black-->
</style> </style>
<style name="Widget.DropDownItem" parent="@android:style/Widget.DropDownItem"> <style name="Widget.DropDownItem" parent="@android:style/Widget.DropDownItem">
<item name="android:textColor">@color/color_black</item> <item name="android:textColor">@color/color_black</item>
</style> </style>
<style name="OsmandSpinnerItem" parent="android:Widget.TextView.SpinnerItem">
<item name="android:textAppearance">@style/OsmandTextAppearanceSpinnerItem</item>
</style>
<style name="OsmandTextAppearanceSpinnerItem" parent="android:TextAppearance.Widget.TextView.SpinnerItem">
<item name="android:textColor">@color/color_black</item>
</style>
<style name="CustomWindowTitleBackground"> <style name="CustomWindowTitleBackground">
<item name="android:background">@color/activity_background</item> <item name="android:background">@color/activity_background</item>
</style> </style>
<style name="CustomTitleTheme" parent="OsmandTheme"> <style name="CustomTitleTheme" parent="OsmandTheme">
<item name="android:windowTitleSize">46dp</item> <item name="android:windowTitleSize">46dp</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item> <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
<item name="android:preferenceScreenStyle">@style/OsmandTheme</item>
</style> </style>
<style name="OsmandListView"> <style name="CustomTitleTheme.Preference" parent="CustomTitleTheme">
<item name="android:cacheColorHint">@color/activity_background</item> <item name="android:windowBackground">@android:color/background_dark</item>
<item name="android:colorBackground">@android:color/background_dark</item>
<item name="android:colorBackgroundCacheHint">?android:attr/colorBackground</item>
</style>
<style name="OsmandListView" parent="@android:style/Widget.ListView">
<item name="android:divider">@drawable/tab_text_separator</item> <item name="android:divider">@drawable/tab_text_separator</item>
</style> </style>
<style name="OsmandSpinner"> <style name="OsmandSpinner" parent="@android:style/Widget.TextView.SpinnerItem">
<item name="android:textColor">@color/color_black</item> <item name="android:textColor">@color/color_black</item>
</style> </style>
</resources> </resources>

View file

@ -15,11 +15,15 @@ public class CustomTitleBar {
private int titleImageRes; private int titleImageRes;
public CustomTitleBar(final Activity activity, int titleStringRes, int titleImageRes) { public CustomTitleBar(final Activity activity, int titleStringRes, int titleImageRes) {
this(activity,titleStringRes,titleImageRes,R.style.CustomTitleTheme);
}
public CustomTitleBar(final Activity activity, int titleStringRes, int titleImageRes, int style) {
this.activity = activity; this.activity = activity;
this.titleStringRes = titleStringRes; this.titleStringRes = titleStringRes;
this.titleImageRes = titleImageRes; this.titleImageRes = titleImageRes;
this.activity.setTheme(R.style.CustomTitleTheme); this.activity.setTheme(style);
this.activity.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); this.activity.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
} }

View file

@ -160,10 +160,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
CustomTitleBar titleBar = new CustomTitleBar(this, R.string.settings_activity, R.drawable.tab_settings_screen_icon); CustomTitleBar titleBar = new CustomTitleBar(this, R.string.settings_activity, R.drawable.tab_settings_screen_icon, R.style.CustomTitleTheme_Preference);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getListView().setCacheColorHint(getResources().getColor(R.color.activity_background));
getListView().setDivider(getResources().getDrawable(R.drawable.tab_text_separator));
addPreferencesFromResource(R.xml.settings_pref); addPreferencesFromResource(R.xml.settings_pref);
titleBar.afterSetContentView(); titleBar.afterSetContentView();