fix themes for 2.x devices

This commit is contained in:
Andrew Dolgov 2011-11-26 11:17:38 +03:00
parent 5b0c674f2b
commit e722a06651
6 changed files with 52 additions and 8 deletions

View File

@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:gravity="center_vertical" android:gravity="center_vertical"
android:background="?headlineNormalBackground"
android:id="@+id/headlines_row" android:orientation="horizontal" android:layout_height="wrap_content"> android:id="@+id/headlines_row" android:orientation="horizontal" android:layout_height="wrap_content">
<ImageView android:background="?headlineSeparatorNormal" android:paddingRight="4dip" android:layout_height="match_parent" android:layout_width="wrap_content"></ImageView> <ImageView android:background="?headlineSeparatorNormal" android:paddingRight="4dip" android:layout_height="match_parent" android:layout_width="wrap_content"></ImageView>
<CheckBox android:focusable="false" <CheckBox android:focusable="false"

View File

@ -20,12 +20,18 @@
android:title="@string/close_article" android:title="@string/close_article"
android:showAsAction="ifRoom|withText"/> android:showAsAction="ifRoom|withText"/>
<item android:id="@+id/load_more_articles" <item android:id="@+id/load_more_articles"
android:visible="false" android:visible="false"
android:icon="@android:drawable/ic_menu_more" android:icon="@android:drawable/ic_menu_more"
android:title="@string/load_more_articles" android:title="@string/load_more_articles"
android:showAsAction="ifRoom|withText"/> android:showAsAction="ifRoom|withText"/>
<item android:id="@+id/show_all_articles"
android:visible="false"
android:icon="@android:drawable/ic_menu_agenda"
android:title="@string/show_all_articles"
android:showAsAction="ifRoom|withText"/>
<item android:id="@+id/update_feeds" <item android:id="@+id/update_feeds"
android:enabled="false" android:enabled="false"
android:icon="@android:drawable/ic_menu_rotate" android:icon="@android:drawable/ic_menu_rotate"

View File

@ -8,6 +8,7 @@
<attr name="articleDivider" format="reference|color" /> <attr name="articleDivider" format="reference|color" />
<attr name="headlineSelectedBackground" format="reference|color" /> <attr name="headlineSelectedBackground" format="reference|color" />
<attr name="headlineUnreadBackground" format="reference|color" /> <attr name="headlineUnreadBackground" format="reference|color" />
<attr name="headlineNormalBackground" format="reference|color" />
<attr name="feedsSelectedBackground" format="reference|color" /> <attr name="feedsSelectedBackground" format="reference|color" />
<attr name="headlineSeparatorUnread" format="reference|color" /> <attr name="headlineSeparatorUnread" format="reference|color" />
<attr name="headlineSeparatorSelected" format="reference|color" /> <attr name="headlineSeparatorSelected" format="reference|color" />

View File

@ -34,4 +34,6 @@
<string name="could_not_decode_content">Could not decode content (UnsupportedEncodingException)</string> <string name="could_not_decode_content">Could not decode content (UnsupportedEncodingException)</string>
<string name="sort_feeds_by_unread">Sort feeds by unread count</string> <string name="sort_feeds_by_unread">Sort feeds by unread count</string>
<string name="load_more_articles">More headlines...</string> <string name="load_more_articles">More headlines...</string>
<string name="show_all_articles">Show all articles</string>
<string name="show_unread_articles">Show unread articles</string>
</resources> </resources>

View File

@ -8,6 +8,23 @@
<item name="articleHeader">@android:color/transparent</item> <item name="articleHeader">@android:color/transparent</item>
<item name="headlineSelectedBackground">#fff7d5</item> <item name="headlineSelectedBackground">#fff7d5</item>
<item name="headlineUnreadBackground">#ffffff</item> <item name="headlineUnreadBackground">#ffffff</item>
<item name="headlineNormalBackground">@android:color/transparent</item>
<item name="feedsSelectedBackground">#96C5FF</item>
<item name="headlineSeparatorUnread">#96C5FF</item>
<item name="headlineSeparatorNormal">#909090</item>
<item name="headlineSeparatorSelected">#DBC981</item>
</style>
<style name="LightCompatTheme" parent="android:Theme.Light">
<item name="feedlistDivider">@android:drawable/divider_horizontal_bright</item>
<item name="feedlistBackground">#fafafa</item>
<item name="unreadCounterColor">#0000ff</item>
<item name="headlinesBackground">#ffffff</item>
<item name="articleDivider">#96c5ff</item>
<item name="articleHeader">@android:color/transparent</item>
<item name="headlineSelectedBackground">#fff7d5</item>
<item name="headlineUnreadBackground">#ffffff</item>
<item name="headlineNormalBackground">#f0f0f0</item>
<item name="feedsSelectedBackground">#96C5FF</item> <item name="feedsSelectedBackground">#96C5FF</item>
<item name="headlineSeparatorUnread">#96C5FF</item> <item name="headlineSeparatorUnread">#96C5FF</item>
<item name="headlineSeparatorNormal">#909090</item> <item name="headlineSeparatorNormal">#909090</item>
@ -23,11 +40,27 @@
<item name="articleHeader">@android:color/transparent</item> <item name="articleHeader">@android:color/transparent</item>
<item name="headlineSelectedBackground">#303060</item> <item name="headlineSelectedBackground">#303060</item>
<item name="headlineUnreadBackground">#303030</item> <item name="headlineUnreadBackground">#303030</item>
<item name="headlineNormalBackground">@android:color/transparent</item>
<item name="feedsSelectedBackground">#303060</item> <item name="feedsSelectedBackground">#303060</item>
<item name="headlineSeparatorUnread">#303060</item> <item name="headlineSeparatorUnread">#303060</item>
<item name="headlineSeparatorNormal">#303030</item> <item name="headlineSeparatorNormal">#303030</item>
<item name="headlineSeparatorSelected">#47478E</item> <item name="headlineSeparatorSelected">#47478E</item>
</style>
<style name="DarkCompatTheme" parent="android:Theme">
<item name="feedlistDivider">@android:drawable/divider_horizontal_dark</item>
<item name="feedlistBackground">#101010</item>
<item name="unreadCounterColor">#303030</item>
<item name="headlinesBackground">#000000</item>
<item name="articleDivider">#303060</item>
<item name="articleHeader">@android:color/transparent</item>
<item name="headlineSelectedBackground">#303060</item>
<item name="headlineUnreadBackground">#303030</item>
<item name="headlineNormalBackground">@android:color/transparent</item>
<item name="feedsSelectedBackground">#303060</item>
<item name="headlineSeparatorUnread">#303060</item>
<item name="headlineSeparatorNormal">#303030</item>
<item name="headlineSeparatorSelected">#47478E</item>
</style> </style>
</resources> </resources>

View File

@ -75,16 +75,16 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
m_prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); m_prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) { if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
setTheme(R.style.DarkTheme); setTheme(android.os.Build.VERSION.SDK_INT > 10 ? R.style.DarkTheme : R.style.DarkCompatTheme);
} else { } else {
setTheme(R.style.LightTheme); setTheme(android.os.Build.VERSION.SDK_INT > 10 ? R.style.LightTheme : R.style.LightCompatTheme);
} }
super.onCreate(savedInstanceState);
m_themeName = m_prefs.getString("theme", "THEME_DARK"); m_themeName = m_prefs.getString("theme", "THEME_DARK");
if (savedInstanceState != null) { if (savedInstanceState != null) {
@ -336,6 +336,7 @@ public class MainActivity extends FragmentActivity implements FeedsFragment.OnFe
} }
m_menu.findItem(R.id.load_more_articles).setVisible(m_activeFeed != null); m_menu.findItem(R.id.load_more_articles).setVisible(m_activeFeed != null);
m_menu.findItem(R.id.show_all_articles).setVisible(m_activeFeed != null);
} else { } else {
m_menu.findItem(R.id.login).setVisible(true); m_menu.findItem(R.id.login).setVisible(true);