From 9f542099fd318737ebfe47ca815d2bcc39a19865 Mon Sep 17 00:00:00 2001 From: serso Date: Sat, 19 Mar 2016 18:33:20 +0100 Subject: [PATCH] Style changes --- app/src/main/AndroidManifest.xml | 3 +- .../android/calculator/BaseActivity.java | 9 +++ .../android/calculator/Preferences.java | 24 +++++-- .../main/res/drawable-v21/button_no_bg.xml | 2 +- .../main/res/layout-land/activity_tabs.xml | 67 ------------------- .../layout-land/activity_tabs_tablayout.xml | 22 ++++++ .../main/res/layout-sw600dp/activity_tabs.xml | 66 ------------------ app/src/main/res/layout/activity_tabs.xml | 17 +---- .../res/layout/activity_tabs_tablayout.xml | 21 ++++++ .../layout/cpp_wizard_step_choose_mode.xml | 2 +- .../cpp_wizard_step_choose_theme_preview.xml | 2 +- app/src/main/res/values/attributes.xml | 2 +- app/src/main/res/values/colors.xml | 3 +- app/src/main/res/values/dimens.xml | 1 - app/src/main/res/values/styles.xml | 10 +-- app/src/main/res/values/theme.xml | 21 +++--- app/src/main/res/values/theme_material.xml | 4 ++ .../main/res/values/theme_material_light.xml | 2 +- app/src/main/res/values/theme_metro_blue.xml | 14 ++++ app/src/main/res/values/theme_metro_green.xml | 10 +++ .../main/res/values/theme_metro_purple.xml | 10 +++ 21 files changed, 130 insertions(+), 182 deletions(-) delete mode 100644 app/src/main/res/layout-land/activity_tabs.xml create mode 100644 app/src/main/res/layout-land/activity_tabs_tablayout.xml delete mode 100644 app/src/main/res/layout-sw600dp/activity_tabs.xml create mode 100644 app/src/main/res/layout/activity_tabs_tablayout.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c662cea2..555df963 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -36,7 +36,8 @@ android:clearTaskOnLaunch="true" android:label="@string/c_app_name" android:launchMode="singleTop" - android:windowSoftInputMode="stateHidden|adjustPan"> + android:windowSoftInputMode="stateHidden|adjustPan" + android:theme="@style/Cpp.Theme.Material.Calculator"> diff --git a/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java b/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java index 2eff5c7d..6c59e238 100644 --- a/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/BaseActivity.java @@ -7,6 +7,7 @@ import android.os.Bundle; import android.support.annotation.DrawableRes; import android.support.annotation.LayoutRes; import android.support.annotation.StringRes; +import android.support.design.widget.AppBarLayout; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; @@ -171,6 +172,14 @@ public class BaseActivity extends AppCompatActivity { final ActionBar actionBar = getSupportActionBar(); Check.isNotNull(actionBar); actionBar.setDisplayHomeAsUpEnabled(true); + + if (App.isTablet(this)) { + final ViewGroup.LayoutParams lp = toolbar.getLayoutParams(); + if (lp instanceof AppBarLayout.LayoutParams) { + ((AppBarLayout.LayoutParams) lp).setScrollFlags(0); + toolbar.setLayoutParams(lp); + } + } } private void onPreCreate() { diff --git a/app/src/main/java/org/solovyev/android/calculator/Preferences.java b/app/src/main/java/org/solovyev/android/calculator/Preferences.java index e7bbd734..de0f6d3b 100644 --- a/app/src/main/java/org/solovyev/android/calculator/Preferences.java +++ b/app/src/main/java/org/solovyev/android/calculator/Preferences.java @@ -303,17 +303,19 @@ public final class Preferences { default_theme(R.style.Cpp_Theme_Gray), violet_theme(R.style.Cpp_Theme_Violet), light_blue_theme(R.style.Cpp_Theme_Blue), - metro_blue_theme(R.style.Cpp_Theme_Metro_Blue), - metro_purple_theme(R.style.Cpp_Theme_Metro_Purple), - metro_green_theme(R.style.Cpp_Theme_Metro_Green), - material_theme(R.style.Cpp_Theme_Material), - material_light_theme(R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Wizard_Light, R.style.Cpp_Theme_Material_Light_Dialog, R.style.Cpp_Theme_Material_Light_Dialog_Alert); + metro_blue_theme(R.style.Cpp_Theme_Metro_Blue, R.style.Cpp_Theme_Metro_Blue_Calculator, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Metro_Blue_Dialog, R.style.Cpp_Theme_Material_Dialog_Alert), + metro_purple_theme(R.style.Cpp_Theme_Metro_Purple, R.style.Cpp_Theme_Metro_Purple_Calculator, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Metro_Purple_Dialog, R.style.Cpp_Theme_Material_Dialog_Alert), + metro_green_theme(R.style.Cpp_Theme_Metro_Green, R.style.Cpp_Theme_Metro_Green_Calculator, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Metro_Green_Dialog, R.style.Cpp_Theme_Material_Dialog_Alert), + material_theme(R.style.Cpp_Theme_Material, R.style.Cpp_Theme_Material_Calculator), + material_light_theme(R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Wizard_Light, R.style.Cpp_Theme_Material_Light_Dialog, R.style.Cpp_Theme_Material_Light_Dialog_Alert); private static final SparseArray textColors = new SparseArray<>(); @StyleRes public final int theme; @StyleRes + public final int calculatorTheme; + @StyleRes public final int wizardTheme; @StyleRes public final int dialogTheme; @@ -322,11 +324,16 @@ public final class Preferences { public final boolean light; Theme(@StyleRes int theme) { - this(theme, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Material_Dialog, R.style.Cpp_Theme_Material_Dialog_Alert); + this(theme, theme); } - Theme(@StyleRes int theme, @StyleRes int wizardTheme, @StyleRes int dialogTheme, @StyleRes int alertDialogTheme) { + Theme(@StyleRes int theme, @StyleRes int calculatorTheme) { + this(theme, calculatorTheme, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Material_Dialog, R.style.Cpp_Theme_Material_Dialog_Alert); + } + + Theme(@StyleRes int theme, @StyleRes int calculatorTheme, @StyleRes int wizardTheme, @StyleRes int dialogTheme, @StyleRes int alertDialogTheme) { this.theme = theme; + this.calculatorTheme = calculatorTheme; this.wizardTheme = wizardTheme; this.dialogTheme = dialogTheme; this.alertDialogTheme = alertDialogTheme; @@ -334,6 +341,9 @@ public final class Preferences { } public int getThemeFor(@Nonnull Context context) { + if (context instanceof CalculatorActivity) { + return calculatorTheme; + } if (context instanceof WizardActivity) { return wizardTheme; } diff --git a/app/src/main/res/drawable-v21/button_no_bg.xml b/app/src/main/res/drawable-v21/button_no_bg.xml index 59c4ebb3..619bb60a 100644 --- a/app/src/main/res/drawable-v21/button_no_bg.xml +++ b/app/src/main/res/drawable-v21/button_no_bg.xml @@ -26,7 +26,7 @@ a:color="?attr/colorControlHighlight"> - + diff --git a/app/src/main/res/layout-land/activity_tabs.xml b/app/src/main/res/layout-land/activity_tabs.xml deleted file mode 100644 index 4d0c5ee4..00000000 --- a/app/src/main/res/layout-land/activity_tabs.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_tabs_tablayout.xml b/app/src/main/res/layout-land/activity_tabs_tablayout.xml new file mode 100644 index 00000000..3038c097 --- /dev/null +++ b/app/src/main/res/layout-land/activity_tabs_tablayout.xml @@ -0,0 +1,22 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-sw600dp/activity_tabs.xml b/app/src/main/res/layout-sw600dp/activity_tabs.xml deleted file mode 100644 index a6861469..00000000 --- a/app/src/main/res/layout-sw600dp/activity_tabs.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_tabs.xml b/app/src/main/res/layout/activity_tabs.xml index 9274a841..6c1f2b04 100644 --- a/app/src/main/res/layout/activity_tabs.xml +++ b/app/src/main/res/layout/activity_tabs.xml @@ -40,22 +40,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - + diff --git a/app/src/main/res/layout/activity_tabs_tablayout.xml b/app/src/main/res/layout/activity_tabs_tablayout.xml new file mode 100644 index 00000000..b21c8bff --- /dev/null +++ b/app/src/main/res/layout/activity_tabs_tablayout.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/cpp_wizard_step_choose_mode.xml b/app/src/main/res/layout/cpp_wizard_step_choose_mode.xml index 00620e4b..f4a1bb96 100644 --- a/app/src/main/res/layout/cpp_wizard_step_choose_mode.xml +++ b/app/src/main/res/layout/cpp_wizard_step_choose_mode.xml @@ -53,7 +53,7 @@ a:layout_width="wrap_content" a:layout_height="wrap_content" a:layout_marginBottom="10dp" - a:background="?attr/cpp_main_bg" + a:background="?attr/cpp_editor_bg" a:padding="3dp"> - + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index a7175d6d..3f3631a7 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -27,7 +27,8 @@ @color/cpp_text #ffffffff - @color/grey_950 + @color/grey_950 + @color/grey_850 @color/grey_100 @color/grey_600 diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 47cc6598..1118400f 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -6,7 +6,6 @@ 25sp 6dp 300dp - 20sp 1px 2dp 9dp diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a55df8bc..cd8f8883 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -22,10 +22,6 @@ - - @@ -140,7 +136,7 @@ @@ -287,8 +283,6 @@ + + + - diff --git a/app/src/main/res/values/theme_metro_blue.xml b/app/src/main/res/values/theme_metro_blue.xml index ea090aa4..b9d29c4a 100644 --- a/app/src/main/res/values/theme_metro_blue.xml +++ b/app/src/main/res/values/theme_metro_blue.xml @@ -69,6 +69,20 @@ @style/CppKeyboardButton.Metro.Blue.Control @style/CppKeyboardButton.Metro.Blue.Operation @style/CppKeyboardButton.Metro.Blue.Operation + @color/blue_900 + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/theme_metro_green.xml b/app/src/main/res/values/theme_metro_green.xml index d62211b5..77cb431d 100644 --- a/app/src/main/res/values/theme_metro_green.xml +++ b/app/src/main/res/values/theme_metro_green.xml @@ -32,4 +32,14 @@ @color/green_800 + + + + \ No newline at end of file diff --git a/app/src/main/res/values/theme_metro_purple.xml b/app/src/main/res/values/theme_metro_purple.xml index 5e3693f0..44be4593 100644 --- a/app/src/main/res/values/theme_metro_purple.xml +++ b/app/src/main/res/values/theme_metro_purple.xml @@ -32,4 +32,14 @@ @color/pink_900 + + + + \ No newline at end of file