Light theme properly separated again, making it ready for palette changes.

This commit is contained in:
Vavassor 2017-03-26 22:59:16 -04:00
parent 79f067caf4
commit 4b136ce458
11 changed files with 55 additions and 40 deletions

View file

@ -12,9 +12,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <activity android:name=".SplashActivity">
android:name=".SplashActivity"
android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View file

@ -19,7 +19,6 @@ import android.app.NotificationManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.PorterDuff;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
@ -27,7 +26,6 @@ import android.os.Bundle;
import android.os.PersistableBundle; import android.os.PersistableBundle;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
@ -158,17 +156,19 @@ public class MainActivity extends BaseActivity {
Intent intent = getIntent(); Intent intent = getIntent();
int tabSelected = 0;
if (intent != null) { if (intent != null) {
int tabPosition = intent.getIntExtra("tab_position", 0); int tabPosition = intent.getIntExtra("tab_position", 0);
if (tabPosition != 0) { if (tabPosition != 0) {
tabLayout.getTabAt(tabPosition).select(); TabLayout.Tab tab = tabLayout.getTabAt(tabPosition);
tintTab(tabLayout.getTabAt(tabPosition), true); if (tab != null) {
} else { tab.select();
tintTab(tabLayout.getTabAt(0), true); tabSelected = tabPosition;
} }
} else { }
tintTab(tabLayout.getTabAt(0), true); }
for (int i = 0; i < 3; i++) {
tintTab(tabLayout.getTabAt(i), i == tabSelected);
} }
// Setup push notifications // Setup push notifications
@ -196,7 +196,8 @@ public class MainActivity extends BaseActivity {
} }
private void tintTab(TabLayout.Tab tab, boolean tinted) { private void tintTab(TabLayout.Tab tab, boolean tinted) {
tab.getIcon().setColorFilter(ContextCompat.getColor(this, tinted ? R.color.color_accent_dark : R.color.toolbar_icon_dark), PorterDuff.Mode.SRC_IN); int color = (tinted) ? R.attr.tab_icon_selected_tint : R.attr.toolbar_icon_tint;
ThemeUtils.setDrawableTint(this, tab.getIcon(), color);
} }
private void setupDrawer() { private void setupDrawer() {

View file

@ -15,23 +15,27 @@
package com.keylesspalace.tusky; package com.keylesspalace.tusky;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
public class SplashActivity extends Activity { public class SplashActivity extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 2000; private static final int SPLASH_TIME_OUT = 2000;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("lightTheme", false)) {
setTheme(R.style.AppTheme_Light);
}
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

View file

@ -12,7 +12,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/AppTheme.Account.AppBarLayout" android:theme="@style/AppTheme.Account.AppBarLayout"
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark"
android:id="@+id/account_app_bar_layout"> android:id="@+id/account_app_bar_layout">
<android.support.design.widget.CollapsingToolbarLayout <android.support.design.widget.CollapsingToolbarLayout

View file

@ -16,15 +16,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<!--<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/AppTheme.Account.AppBarLayout"
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark"
android:elevation="4dp"
android:background="?attr/toolbar_background_color" />-->
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager
android:id="@+id/pager" android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
@ -12,8 +12,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:elevation="4dp" android:elevation="4dp"
android:theme="@style/AppTheme.Account.AppBarLayout"
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark"
android:background="?attr/toolbar_background_color" /> android:background="?attr/toolbar_background_color" />
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView

View file

@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:background="@color/color_background_dark" android:background="?attr/splash_background_color"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.mikhaellopez.circularfillableloaders.CircularFillableLoaders <com.mikhaellopez.circularfillableloaders.CircularFillableLoaders
android:id="@+id/circularFillableLoaders" android:id="@+id/circularFillableLoaders"
@ -15,5 +15,5 @@
app:cfl_border_width="4dp" app:cfl_border_width="4dp"
app:cfl_progress="80" app:cfl_progress="80"
app:cfl_wave_amplitude="0.08" app:cfl_wave_amplitude="0.08"
app:cfl_wave_color="@color/color_primary_dark" /> app:cfl_wave_color="?attr/splash_wave_color" />
</LinearLayout> </LinearLayout>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_view_thread" android:id="@+id/activity_view_thread"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -16,8 +15,6 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:theme="@style/AppTheme.Account.AppBarLayout"
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark"
android:elevation="4dp" android:elevation="4dp"
android:background="?attr/toolbar_background_color" /> android:background="?attr/toolbar_background_color" />

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_view_thread" android:id="@+id/activity_view_thread"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -16,8 +16,6 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:theme="@style/AppTheme.Account.AppBarLayout"
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark"
android:elevation="4dp" android:elevation="4dp"
android:background="?attr/toolbar_background_color" /> android:background="?attr/toolbar_background_color" />

View file

@ -11,6 +11,8 @@
</declare-styleable> </declare-styleable>
<!--Themed Attributes--> <!--Themed Attributes-->
<attr name="splash_background_color" format="reference|color" />
<attr name="splash_wave_color" format="reference|color" />
<attr name="toolbar_background_color" format="reference" /> <attr name="toolbar_background_color" format="reference" />
<attr name="toolbar_icon_tint" format="reference" /> <attr name="toolbar_icon_tint" format="reference" />
<attr name="image_button_style" format="reference" /> <attr name="image_button_style" format="reference" />
@ -22,6 +24,7 @@
<attr name="sensitive_media_warning_background_color" format="reference|color" /> <attr name="sensitive_media_warning_background_color" format="reference|color" />
<attr name="media_preview_unloaded_drawable" format="reference" /> <attr name="media_preview_unloaded_drawable" format="reference" />
<attr name="status_divider_drawable" format="reference" /> <attr name="status_divider_drawable" format="reference" />
<attr name="tab_icon_selected_tint" format="reference|color" />
<attr name="tab_page_margin_drawable" format="reference" /> <attr name="tab_page_margin_drawable" format="reference" />
<attr name="notification_content" format="reference" /> <attr name="notification_content" format="reference" />
<attr name="notification_icon_tint" format="reference|color" /> <attr name="notification_icon_tint" format="reference|color" />

View file

@ -31,6 +31,8 @@
<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Dark</item> <item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Dark</item>
<item name="splash_background_color">@color/color_background_dark</item>
<item name="splash_wave_color">@color/color_primary_dark</item>
<item name="toolbar_background_color">@color/toolbar_background_dark</item> <item name="toolbar_background_color">@color/toolbar_background_dark</item>
<item name="toolbar_icon_tint">@color/toolbar_icon_dark</item> <item name="toolbar_icon_tint">@color/toolbar_icon_dark</item>
<item name="image_button_style">@style/AppTheme.ImageButton.Dark</item> <item name="image_button_style">@style/AppTheme.ImageButton.Dark</item>
@ -42,6 +44,7 @@
<item name="sensitive_media_warning_background_color">@color/color_background_dark</item> <item name="sensitive_media_warning_background_color">@color/color_background_dark</item>
<item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_dark</item> <item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_dark</item>
<item name="status_divider_drawable">@drawable/status_divider_dark</item> <item name="status_divider_drawable">@drawable/status_divider_dark</item>
<item name="tab_icon_selected_tint">@color/color_accent_dark</item>
<item name="tab_page_margin_drawable">@drawable/tab_page_margin_dark</item> <item name="tab_page_margin_drawable">@drawable/tab_page_margin_dark</item>
<item name="account_header_background_color">@color/account_header_background_dark</item> <item name="account_header_background_color">@color/account_header_background_dark</item>
<item name="account_toolbar_icon_tint_uncollapsed">@color/toolbar_icon_dark</item> <item name="account_toolbar_icon_tint_uncollapsed">@color/toolbar_icon_dark</item>
@ -75,7 +78,7 @@
<item name="floatingSearch_leftActionColor">@color/toolbar_icon_dark</item> <item name="floatingSearch_leftActionColor">@color/toolbar_icon_dark</item>
<item name="floatingSearch_menuItemIconColor">@color/toolbar_icon_dark</item> <item name="floatingSearch_menuItemIconColor">@color/toolbar_icon_dark</item>
<item name="floatingSearch_suggestionRightIconColor">@color/toolbar_icon_dark</item> <item name="floatingSearch_suggestionRightIconColor">@color/toolbar_icon_dark</item>
<item name="floatingSearch_actionMenuOverflowColor">@color/toolbar_icon_dark</item>--> <item name="floatingSearch_actionMenuOverflowColor">@color/toolbar_icon_dark</item>
</style> </style>
<style name="AppTheme.ImageButton.Dark" parent="@style/Widget.AppCompat.Button.Borderless.Colored"> <style name="AppTheme.ImageButton.Dark" parent="@style/Widget.AppCompat.Button.Borderless.Colored">
@ -119,6 +122,8 @@
<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Light</item> <item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Light</item>
<item name="splash_background_color">@color/color_background_light</item>
<item name="splash_wave_color">@color/color_primary_light</item>
<item name="toolbar_background_color">@color/toolbar_background_light</item> <item name="toolbar_background_color">@color/toolbar_background_light</item>
<item name="toolbar_icon_tint">@color/toolbar_icon_light</item> <item name="toolbar_icon_tint">@color/toolbar_icon_light</item>
<item name="image_button_style">@style/AppTheme.ImageButton.Light</item> <item name="image_button_style">@style/AppTheme.ImageButton.Light</item>
@ -130,6 +135,7 @@
<item name="sensitive_media_warning_background_color">@color/sensitive_media_warning_background_light</item> <item name="sensitive_media_warning_background_color">@color/sensitive_media_warning_background_light</item>
<item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_light</item> <item name="media_preview_unloaded_drawable">@drawable/media_preview_unloaded_light</item>
<item name="status_divider_drawable">@drawable/status_divider_light</item> <item name="status_divider_drawable">@drawable/status_divider_light</item>
<item name="tab_icon_selected_tint">@color/color_accent_light</item>
<item name="tab_page_margin_drawable">@drawable/tab_page_margin_light</item> <item name="tab_page_margin_drawable">@drawable/tab_page_margin_light</item>
<item name="account_toolbar_icon_tint_uncollapsed">@color/toolbar_icon_dark</item> <!--Default to dark on purpose, because header backgrounds with gradients are always dark.--> <item name="account_toolbar_icon_tint_uncollapsed">@color/toolbar_icon_dark</item> <!--Default to dark on purpose, because header backgrounds with gradients are always dark.-->
<item name="account_toolbar_icon_tint_collapsed">@color/account_toolbar_icon_collapsed_light</item> <item name="account_toolbar_icon_tint_collapsed">@color/account_toolbar_icon_collapsed_light</item>
@ -144,6 +150,26 @@
<item name="notification_icon_tint">@color/notification_icon_tint_light</item> <item name="notification_icon_tint">@color/notification_icon_tint_light</item>
<item name="report_status_background_color">@color/report_status_background_light</item> <item name="report_status_background_color">@color/report_status_background_light</item>
<item name="report_status_divider_drawable">@drawable/report_status_divider_light</item> <item name="report_status_divider_drawable">@drawable/report_status_divider_light</item>
<item name="material_drawer_background">@color/window_background_light</item>
<item name="material_drawer_primary_text">@color/text_color_primary_light</item>
<item name="material_drawer_primary_icon">@color/toolbar_icon_light</item>
<item name="material_drawer_secondary_text">@color/text_color_secondary_light</item>
<item name="material_drawer_hint_text">@color/text_color_tertiary_light</item>
<item name="material_drawer_divider">@color/color_primary_dark_light</item>
<item name="material_drawer_selected">@color/color_primary_light</item>
<item name="material_drawer_selected_text">@color/text_color_primary_light</item>
<item name="material_drawer_header_selection_text">@color/text_color_primary_dark</item> <!--Intentionally dark so it can be overlayed over the account's header image.-->
<item name="floatingSearch_backgroundColor">@color/toolbar_background_light</item>
<item name="floatingSearch_viewTextColor">@color/text_color_secondary_light</item>
<item name="floatingSearch_hintTextColor">@color/text_color_tertiary_light</item>
<item name="floatingSearch_dividerColor">@color/status_divider_light</item>
<item name="floatingSearch_clearBtnColor">@color/toolbar_icon_light</item>
<item name="floatingSearch_leftActionColor">@color/toolbar_icon_light</item>
<item name="floatingSearch_menuItemIconColor">@color/toolbar_icon_light</item>
<item name="floatingSearch_suggestionRightIconColor">@color/toolbar_icon_light</item>
<item name="floatingSearch_actionMenuOverflowColor">@color/toolbar_icon_light</item>
</style> </style>
<style name="AppTheme.ImageButton.Light" parent="Widget.AppCompat.Button.Borderless.Colored"> <style name="AppTheme.ImageButton.Light" parent="Widget.AppCompat.Button.Borderless.Colored">