Material Light theme

This commit is contained in:
serso 2015-02-08 01:08:44 +01:00
parent c46a276f3f
commit 655f4dc3bf
24 changed files with 303 additions and 162 deletions

View File

@ -66,7 +66,7 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:hardwareAccelerated="false" android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotActivity"/> <activity android:hardwareAccelerated="false" android:label="@string/c_plot_graph" android:name=".plot.CalculatorPlotActivity" android:theme="@style/Cpp.Theme.Material"/>
<activity android:label="@string/cpp_plot_functions" android:name=".plot.CalculatorPlotFunctionsActivity" android:theme="@style/Cpp.Theme.Dialog.Material"/> <activity android:label="@string/cpp_plot_functions" android:name=".plot.CalculatorPlotFunctionsActivity" android:theme="@style/Cpp.Theme.Dialog.Material"/>
<activity android:label="@string/cpp_plot_function_settings" android:name=".plot.CalculatorPlotFunctionSettingsActivity" android:theme="@style/Cpp.Theme.Dialog.Material"/> <activity android:label="@string/cpp_plot_function_settings" android:name=".plot.CalculatorPlotFunctionSettingsActivity" android:theme="@style/Cpp.Theme.Dialog.Material"/>
<activity android:label="@string/cpp_plot_range" android:name=".plot.CalculatorPlotRangeActivity" android:theme="@style/Cpp.Theme.Dialog.Material"/> <activity android:label="@string/cpp_plot_range" android:name=".plot.CalculatorPlotRangeActivity" android:theme="@style/Cpp.Theme.Dialog.Material"/>

View File

@ -74,7 +74,7 @@ public class ActivityUi extends BaseUi {
Locator.getInstance().getCalculator().addCalculatorEventListener((CalculatorEventListener) activity); Locator.getInstance().getCalculator().addCalculatorEventListener((CalculatorEventListener) activity);
} }
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity); final SharedPreferences preferences = App.getPreferences();
theme = Preferences.Gui.getTheme(preferences); theme = Preferences.Gui.getTheme(preferences);
activity.setTheme(theme.getThemeId(activity)); activity.setTheme(theme.getThemeId(activity));

View File

@ -220,4 +220,9 @@ public final class App {
public static boolean isLargeScreen() { public static boolean isLargeScreen() {
return Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, App.getApplication().getResources().getConfiguration()); return Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, App.getApplication().getResources().getConfiguration());
} }
@Nonnull
public static SharedPreferences getPreferences() {
return preferences;
}
} }

View File

@ -26,21 +26,14 @@ import android.app.Activity;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.Menu; import android.view.*;
import android.view.MenuInflater; import org.solovyev.android.menu.ActivityMenu;
import android.view.MenuItem; import org.solovyev.android.menu.AndroidMenuHelper;
import org.solovyev.android.menu.ListActivityMenu;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import org.solovyev.android.menu.ActivityMenu;
import org.solovyev.android.menu.ListActivityMenu;
import org.solovyev.android.menu.AndroidMenuHelper;
/** /**
* User: Solovyev_S * User: Solovyev_S
* Date: 25.09.12 * Date: 25.09.12
@ -49,7 +42,7 @@ import org.solovyev.android.menu.AndroidMenuHelper;
public class CalculatorEditorFragment extends Fragment { public class CalculatorEditorFragment extends Fragment {
@Nonnull @Nonnull
private FragmentUi fragmentHelper; private FragmentUi fragmentUi;
@Nonnull @Nonnull
private ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromEnum(CalculatorMenu.class, AndroidMenuHelper.getInstance()); private ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromEnum(CalculatorMenu.class, AndroidMenuHelper.getInstance());
@ -61,7 +54,7 @@ public class CalculatorEditorFragment extends Fragment {
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
fragmentHelper.onViewCreated(this, view); fragmentUi.onViewCreated(this, view);
((AndroidCalculator) Locator.getInstance().getCalculator()).setEditor(getActivity()); ((AndroidCalculator) Locator.getInstance().getCalculator()).setEditor(getActivity());
} }
@ -78,31 +71,29 @@ public class CalculatorEditorFragment extends Fragment {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getActivity()); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getActivity());
final Preferences.Gui.Layout layout = Preferences.Gui.getLayout(prefs); final Preferences.Gui.Layout layout = Preferences.Gui.getLayout(prefs);
if (!layout.isOptimized()) { if (!layout.isOptimized()) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_editor_mobile, R.string.editor); fragmentUi = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_editor_mobile, R.string.editor);
} else { } else {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_editor, R.string.editor); fragmentUi = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_editor, R.string.editor);
} }
fragmentHelper.onCreate(this); fragmentUi.onCreate(this);
setHasOptionsMenu(true); setHasOptionsMenu(true);
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return fragmentHelper.onCreateView(this, inflater, container); return fragmentUi.onCreateView(this, inflater, container);
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
this.fragmentUi.onResume(this);
this.fragmentHelper.onResume(this);
} }
@Override @Override
public void onPause() { public void onPause() {
this.fragmentHelper.onPause(this); this.fragmentUi.onPause(this);
super.onPause(); super.onPause();
} }
@ -113,7 +104,7 @@ public class CalculatorEditorFragment extends Fragment {
@Override @Override
public void onDestroy() { public void onDestroy() {
fragmentHelper.onDestroy(this); fragmentUi.onDestroy(this);
super.onDestroy(); super.onDestroy();
} }

View File

@ -24,10 +24,12 @@ package org.solovyev.android.calculator;
import android.app.Activity; import android.app.Activity;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.support.annotation.StyleRes;
import jscl.AngleUnit; import jscl.AngleUnit;
import jscl.NumeralBase; import jscl.NumeralBase;
import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.math.MathType;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine; import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
import org.solovyev.android.calculator.preferences.BasePreferencesActivity;
import org.solovyev.android.calculator.wizard.WizardActivity; import org.solovyev.android.calculator.wizard.WizardActivity;
import org.solovyev.android.prefs.*; import org.solovyev.android.prefs.*;
import org.solovyev.android.view.VibratorContainer; import org.solovyev.android.view.VibratorContainer;
@ -101,21 +103,27 @@ public final class Preferences {
public static enum Theme { public static enum Theme {
default_theme(R.style.Cpp_Theme_Gray, R.style.Cpp_Theme_Wizard), default_theme(R.style.Cpp_Theme_Gray),
violet_theme(R.style.Cpp_Theme_Violet, R.style.Cpp_Theme_Wizard), violet_theme(R.style.Cpp_Theme_Violet),
light_blue_theme(R.style.Cpp_Theme_Blue, R.style.Cpp_Theme_Wizard), light_blue_theme(R.style.Cpp_Theme_Blue),
metro_blue_theme(R.style.cpp_metro_blue_theme, R.style.Cpp_Theme_Wizard), metro_blue_theme(R.style.cpp_metro_blue_theme),
metro_purple_theme(R.style.cpp_metro_purple_theme, R.style.Cpp_Theme_Wizard), metro_purple_theme(R.style.cpp_metro_purple_theme),
metro_green_theme(R.style.cpp_metro_green_theme, R.style.Cpp_Theme_Wizard), metro_green_theme(R.style.cpp_metro_green_theme),
material_theme(R.style.Cpp_Theme_Material, R.style.Cpp_Theme_Wizard), 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_Settings_Light),
; ;
private final int themeId; private final int themeId;
private final int wizardThemeId; private final int wizardThemeId;
private final int settingsThemeId;
Theme(int themeId, int wizardThemeId) { Theme(@StyleRes int themeId) {
this(themeId, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Settings);
}
Theme(@StyleRes int themeId, @StyleRes int wizardThemeId, @StyleRes int settingsThemeId) {
this.themeId = themeId; this.themeId = themeId;
this.wizardThemeId = wizardThemeId; this.wizardThemeId = wizardThemeId;
this.settingsThemeId = settingsThemeId;
} }
public int getThemeId() { public int getThemeId() {
@ -126,6 +134,9 @@ public final class Preferences {
if (activity instanceof WizardActivity) { if (activity instanceof WizardActivity) {
return wizardThemeId; return wizardThemeId;
} }
if (activity instanceof BasePreferencesActivity) {
return settingsThemeId;
}
return themeId; return themeId;
} }
} }

View File

@ -24,9 +24,8 @@ package org.solovyev.android.calculator.plot;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import org.solovyev.android.calculator.EmptyActivity;
import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.EmptyActivity;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;

View File

@ -1,6 +1,7 @@
package org.solovyev.android.calculator.preferences; package org.solovyev.android.calculator.preferences;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
@ -10,10 +11,8 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import org.solovyev.android.calculator.ActivityUi; import org.solovyev.android.Activities;
import org.solovyev.android.calculator.AdView; import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.App;
import org.solovyev.android.calculator.R;
import org.solovyev.android.checkout.ActivityCheckout; import org.solovyev.android.checkout.ActivityCheckout;
import org.solovyev.android.checkout.Checkout; import org.solovyev.android.checkout.Checkout;
import org.solovyev.android.checkout.Inventory; import org.solovyev.android.checkout.Inventory;
@ -21,16 +20,23 @@ import org.solovyev.android.checkout.ProductTypes;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public abstract class BasePreferencesActivity extends PreferenceActivity { public abstract class BasePreferencesActivity extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
private static boolean SUPPORT_HEADERS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; private static boolean SUPPORT_HEADERS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
private final ActivityCheckout checkout = Checkout.forActivity(this, App.getBilling(), App.getProducts()); private final ActivityCheckout checkout = Checkout.forActivity(this, App.getBilling(), App.getProducts());
private Inventory inventory; private Inventory inventory;
private AdView adView; private AdView adView;
private Toolbar actionBar; private Toolbar actionBar;
private Preferences.Gui.Theme theme;
private boolean paused = true;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
final SharedPreferences preferences = App.getPreferences();
preferences.registerOnSharedPreferenceChangeListener(this);
theme = Preferences.Gui.getTheme(preferences);
setTheme(theme.getThemeId(this));
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
actionBar.setTitle(getTitle()); actionBar.setTitle(getTitle());
@ -57,6 +63,15 @@ public abstract class BasePreferencesActivity extends PreferenceActivity {
getWindow().setContentView(contentView); getWindow().setContentView(contentView);
} }
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
if (!paused && Preferences.Gui.theme.isSameKey(key)) {
final Preferences.Gui.Theme newTheme = Preferences.Gui.theme.getPreference(preferences);
if (!theme.equals(newTheme)) {
Activities.restartActivity(this);
}
}
}
private class InventoryListener implements Inventory.Listener { private class InventoryListener implements Inventory.Listener {
@Override @Override
@ -113,10 +128,16 @@ public abstract class BasePreferencesActivity extends PreferenceActivity {
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
paused = false;
if (adView != null) { if (adView != null) {
adView.resume(); adView.resume();
} }
inventory.whenLoaded(new InventoryListener()); inventory.whenLoaded(new InventoryListener());
final Preferences.Gui.Theme newTheme = Preferences.Gui.theme.getPreference(App.getPreferences());
if (!theme.equals(newTheme)) {
Activities.restartActivity(this);
}
} }
@Override @Override
@ -136,6 +157,7 @@ public abstract class BasePreferencesActivity extends PreferenceActivity {
if (adView != null) { if (adView != null) {
adView.pause(); adView.pause();
} }
paused = true;
super.onPause(); super.onPause();
} }
@ -145,6 +167,7 @@ public abstract class BasePreferencesActivity extends PreferenceActivity {
adView.destroy(); adView.destroy();
} }
checkout.stop(); checkout.stop();
App.getPreferences().unregisterOnSharedPreferenceChangeListener(this);
super.onDestroy(); super.onDestroy();
} }
} }

View File

@ -26,8 +26,8 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceManager;
import android.util.SparseArray; import android.util.SparseArray;
import org.solovyev.android.calculator.App;
import org.solovyev.android.calculator.CalculatorApplication; import org.solovyev.android.calculator.CalculatorApplication;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
@ -42,7 +42,7 @@ import static org.solovyev.android.view.VibratorContainer.Preferences.hapticFeed
import static org.solovyev.android.wizard.WizardUi.startWizard; import static org.solovyev.android.wizard.WizardUi.startWizard;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class PreferencesActivity extends BasePreferencesActivity implements SharedPreferences.OnSharedPreferenceChangeListener { public class PreferencesActivity extends BasePreferencesActivity {
@Nonnull @Nonnull
private static final SparseArray<String> preferences = new SparseArray<String>(); private static final SparseArray<String> preferences = new SparseArray<String>();
@ -100,8 +100,7 @@ public class PreferencesActivity extends BasePreferencesActivity implements Shar
setTitle(title); setTitle(title);
} }
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); final SharedPreferences preferences = App.getPreferences();
preferences.registerOnSharedPreferenceChangeListener(this);
onSharedPreferenceChanged(preferences, roundResult.getKey()); onSharedPreferenceChanged(preferences, roundResult.getKey());
onSharedPreferenceChanged(preferences, hapticFeedbackEnabled.getKey()); onSharedPreferenceChanged(preferences, hapticFeedbackEnabled.getKey());
} }
@ -120,14 +119,9 @@ public class PreferencesActivity extends BasePreferencesActivity implements Shar
} }
} }
@Override
protected void onDestroy() {
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this);
super.onDestroy();
}
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) { public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
super.onSharedPreferenceChanged(preferences, key);
if (roundResult.getKey().equals(key)) { if (roundResult.getKey().equals(key)) {
final Preference preference = findPreference(precision.getKey()); final Preference preference = findPreference(precision.getKey());
if (preference != null) { if (preference != null) {

View File

@ -59,6 +59,7 @@ public class ChooseThemeWizardStep extends WizardFragment implements AdapterView
final Spinner spinner = (Spinner) root.findViewById(R.id.wizard_theme_spinner); final Spinner spinner = (Spinner) root.findViewById(R.id.wizard_theme_spinner);
themes.clear(); themes.clear();
themes.add(new ThemeUi(Preferences.Gui.Theme.material_theme, R.string.p_material_theme)); themes.add(new ThemeUi(Preferences.Gui.Theme.material_theme, R.string.p_material_theme));
themes.add(new ThemeUi(Preferences.Gui.Theme.material_light_theme, R.string.p_material_light_theme));
themes.add(new ThemeUi(Preferences.Gui.Theme.metro_blue_theme, R.string.p_metro_blue_theme)); themes.add(new ThemeUi(Preferences.Gui.Theme.metro_blue_theme, R.string.p_metro_blue_theme));
themes.add(new ThemeUi(Preferences.Gui.Theme.metro_green_theme, R.string.p_metro_green_theme)); themes.add(new ThemeUi(Preferences.Gui.Theme.metro_green_theme, R.string.p_metro_green_theme));
themes.add(new ThemeUi(Preferences.Gui.Theme.metro_purple_theme, R.string.p_metro_purple_theme)); themes.add(new ThemeUi(Preferences.Gui.Theme.metro_purple_theme, R.string.p_metro_purple_theme));

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2013 serso aka se.solovyev
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Contact details
~
~ Email: se.solovyev@gmail.com
~ Site: http://se.solovyev.org
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
<item>
<shape>
<solid a:color="@color/cpp_material_light" />
</shape>
</item>
</ripple>

View File

@ -2,7 +2,7 @@
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:orientation="vertical" a:orientation="vertical"
style="@style/cpp_onscreen_main_layout_style"> style="@style/CppMain.Onscreen">
<include <include
a:id="@+id/onscreen_header" a:id="@+id/onscreen_header"

View File

@ -4,7 +4,7 @@
a:layout_width="match_parent" a:layout_width="match_parent"
a:layout_height="match_parent" a:layout_height="match_parent"
a:orientation="vertical" a:orientation="vertical"
style="@style/cpp_widget_main_layout_style"> style="@style/CppMain.Widget">
<include <include
layout="@layout/widget_editor" layout="@layout/widget_editor"

View File

@ -4,7 +4,7 @@
a:layout_width="match_parent" a:layout_width="match_parent"
a:layout_height="match_parent" a:layout_height="match_parent"
a:orientation="vertical" a:orientation="vertical"
style="@style/cpp_widget_main_layout_style"> style="@style/CppMain.Widget">
<include <include
layout="@layout/widget_editor" layout="@layout/widget_editor"

View File

@ -4,7 +4,7 @@
a:layout_width="match_parent" a:layout_width="match_parent"
a:layout_height="match_parent" a:layout_height="match_parent"
a:orientation="vertical" a:orientation="vertical"
style="@style/cpp_widget_main_layout_style"> style="@style/CppMain.Widget">
<LinearLayout <LinearLayout
a:id="@+id/main_fragment_layout" a:id="@+id/main_fragment_layout"

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string-array name="p_theme_names" tools:ignore="InconsistentArrays">
<item>@string/p_default_theme</item>
<item>@string/p_violet_theme</item>
<item>@string/p_light_blue_theme</item>
<item>@string/p_metro_blue_theme</item>
<item>@string/p_metro_green_theme</item>
<item>@string/p_metro_purple_theme</item>
<item>@string/p_material_theme</item>
</string-array>
<string-array name="p_theme_values" translatable="false" tools:ignore="InconsistentArrays">
<item>default_theme</item>
<item>violet_theme</item>
<item>light_blue_theme</item>
<item>metro_blue_theme</item>
<item>metro_green_theme</item>
<item>metro_purple_theme</item>
<item>material_theme</item>
</string-array>
</resources>

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2013 serso aka se.solovyev
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Contact details
~
~ Email: se.solovyev@gmail.com
~ Site: http://se.solovyev.org
-->
<resources>
<style name="Cpp.Theme" parent="Cpp.Theme.Base">
<item name="android:colorPrimary">@color/cpp_metro_button</item>
<item name="android:colorPrimaryDark">@color/cpp_metro_button_dark</item>
</style>
<style name="Cpp.Theme.Dialog" parent="Cpp.Theme.Base.Dialog">
<item name="android:colorPrimary">@color/cpp_metro_button</item>
<item name="android:colorPrimaryDark">@color/cpp_metro_button_dark</item>
</style>
<style name="Cpp.Theme.Wizard" parent="@style/cpp_metro_blue_theme">
<item name="android:windowBackground">@color/cpp_wizard_bg</item>
<item name="android:colorEdgeEffect">@color/cpp_wizard_overscroll</item>
<item name="colorAccent">@color/cpp_wizard_primary</item>
<item name="android:colorAccent">@color/cpp_wizard_primary</item>
<item name="android:textColorSecondary">@color/cpp_wizard_secondary</item>
<item name="android:textColorPrimary">@color/cpp_wizard_primary</item>
</style>
<style name="Cpp.Theme.Settings" parent="Cpp.Theme.Settings.Base">
<item name="android:colorEdgeEffect">@color/cpp_wizard_overscroll</item>
<item name="colorAccent">@color/cpp_wizard_primary</item>
<item name="android:colorAccent">@color/cpp_wizard_primary</item>
</style>
</resources>

View File

@ -28,6 +28,8 @@
<item>@string/p_metro_blue_theme</item> <item>@string/p_metro_blue_theme</item>
<item>@string/p_metro_green_theme</item> <item>@string/p_metro_green_theme</item>
<item>@string/p_metro_purple_theme</item> <item>@string/p_metro_purple_theme</item>
<item>@string/p_material_theme</item>
<item>@string/p_material_light_theme</item>
</string-array> </string-array>
<string-array name="p_theme_values" translatable="false"> <string-array name="p_theme_values" translatable="false">
<item>default_theme</item> <item>default_theme</item>
@ -36,6 +38,8 @@
<item>metro_blue_theme</item> <item>metro_blue_theme</item>
<item>metro_green_theme</item> <item>metro_green_theme</item>
<item>metro_purple_theme</item> <item>metro_purple_theme</item>
<item>material_theme</item>
<item>material_light_theme</item>
</string-array> </string-array>
<string-array name="p_grouping_separator_names"> <string-array name="p_grouping_separator_names">

View File

@ -29,19 +29,21 @@
<color name="cpp_button_text_ce">#ffffffff</color> <color name="cpp_button_text_ce">#ffffffff</color>
<color name="cpp_selected_angle_unit_text">#ffffff99</color> <color name="cpp_selected_angle_unit_text">#ffffff99</color>
<color name="cpp_main_bg">#101010</color> <color name="cpp_main_bg">#101010</color>
<color name="cpp_main_light_bg">#fff6f1ef</color>
<color name="cpp_wizard_primary">#FAFAFA</color> <color name="cpp_wizard_primary">#FAFAFA</color>
<color name="cpp_wizard_secondary">#9E9E9E</color> <color name="cpp_wizard_secondary">#9E9E9E</color>
<color name="cpp_wizard_bg">#212121</color> <color name="cpp_wizard_bg">@color/cpp_material_grey</color>
<color name="cpp_wizard_overscroll">#FAFAFA</color> <color name="cpp_wizard_overscroll">#FAFAFA</color>
<color name="cpp_wizard_button_normal">#424242</color> <color name="cpp_wizard_button_normal">#424242</color>
<color name="cpp_wizard_button_disabled">#616161</color> <color name="cpp_wizard_button_disabled">#616161</color>
<color name="cpp_wizard_button_pressed">#757575</color> <color name="cpp_wizard_button_pressed">#757575</color>
<color name="cpp_pane_background">#212121</color> <color name="cpp_pane_background">@color/cpp_material_grey</color>
<color name="cpp_metro_button_dark">#ff000000</color> <color name="cpp_metro_button_dark">#ff000000</color>
<color name="cpp_metro_button">#212121</color> <color name="cpp_metro_button">@color/cpp_material_grey</color>
<color name="cpp_metro_button_light">#393939</color> <color name="cpp_metro_button_light">@color/cpp_material_grey_light</color>
<color name="cpp_metro_blue">#10648c</color> <color name="cpp_metro_blue">#10648c</color>
<color name="cpp_material_blue">#ff0d4663</color> <color name="cpp_material_blue">#ff0d4663</color>
<color name="cpp_material_light">#2196F3</color>
<color name="cpp_metro_blue_dark">#ff092c39</color> <color name="cpp_metro_blue_dark">#ff092c39</color>
<color name="cpp_metro_green">#088e3a</color> <color name="cpp_metro_green">#088e3a</color>
<color name="cpp_metro_purple">#651456</color> <color name="cpp_metro_purple">#651456</color>
@ -51,4 +53,9 @@
<color name="cpp_widget_ripple">#40ffffff</color> <color name="cpp_widget_ripple">#40ffffff</color>
<color name="cpp_wizard_disabled_text">#66ffffff</color> <color name="cpp_wizard_disabled_text">#66ffffff</color>
<color name="cpp_material_grey">#212121</color>
<color name="cpp_material_grey_light">#393939</color>
<color name="cpp_material_actionbar">@color/cpp_material_grey</color>
<color name="cpp_material_actionbar_light">@color/cpp_material_grey_light</color>
</resources> </resources>

View File

@ -62,7 +62,7 @@
<item name="android:scrollbars">horizontal</item> <item name="android:scrollbars">horizontal</item>
</style> </style>
<style name="CppText.Editor" parent="CppText"> <style name="CppText.Editor">
<item name="android:text">""</item> <item name="android:text">""</item>
<item name="android:gravity">left|top</item> <item name="android:gravity">left|top</item>
<item name="android:layout_width">fill_parent</item> <item name="android:layout_width">fill_parent</item>
@ -74,7 +74,7 @@
<item name="android:textSize">@dimen/cpp_editor_text_size_mobile</item> <item name="android:textSize">@dimen/cpp_editor_text_size_mobile</item>
</style> </style>
<style name="CppText.Display" parent="CppText"> <style name="CppText.Display">
<item name="android:gravity">top|right</item> <item name="android:gravity">top|right</item>
<item name="android:layout_width">match_parent</item> <item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item> <item name="android:layout_height">match_parent</item>
@ -85,7 +85,7 @@
<item name="android:textSize">@dimen/cpp_onscreen_display_text_size</item> <item name="android:textSize">@dimen/cpp_onscreen_display_text_size</item>
</style> </style>
<style name="CppText.About" parent="CppText"> <style name="CppText.About">
<item name="android:gravity">center</item> <item name="android:gravity">center</item>
<item name="android:layout_width">fill_parent</item> <item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item> <item name="android:layout_height">fill_parent</item>
@ -117,7 +117,7 @@
<item name="android:background">@drawable/metro_widget_button_light</item> <item name="android:background">@drawable/metro_widget_button_light</item>
</style> </style>
<style name="cpp_widget_main_layout_style" parent="CppMain"> <style name="CppMain.Widget" parent="CppMain">
<item name="android:background">@color/cpp_main_bg</item> <item name="android:background">@color/cpp_main_bg</item>
<item name="android:padding">1dp</item> <item name="android:padding">1dp</item>
<item name="android:layout_margin">@dimen/cpp_widget_margin</item> <item name="android:layout_margin">@dimen/cpp_widget_margin</item>
@ -131,7 +131,7 @@
<item name="android:textSize">@dimen/cpp_widget_display_text_size</item> <item name="android:textSize">@dimen/cpp_widget_display_text_size</item>
</style> </style>
<style name="cpp_onscreen_main_layout_style" parent="CppMain"> <style name="CppMain.Onscreen" parent="CppMain">
<item name="android:background">@color/cpp_main_bg</item> <item name="android:background">@color/cpp_main_bg</item>
<item name="android:padding">1dp</item> <item name="android:padding">1dp</item>
</style> </style>
@ -251,8 +251,8 @@
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">bottom|end</item> <item name="android:layout_gravity">bottom|end</item>
<item name="android:layout_margin">16dp</item> <item name="android:layout_margin">16dp</item>
<item name="fab_colorNormal">@color/cpp_metro_button</item> <item name="fab_colorNormal">@color/cpp_material_grey</item>
<item name="fab_colorPressed">@color/cpp_metro_button</item> <item name="fab_colorPressed">@color/cpp_material_grey</item>
<item name="fab_colorRipple">?attr/colorControlHighlight</item> <item name="fab_colorRipple">?attr/colorControlHighlight</item>
</style> </style>
@ -270,4 +270,43 @@
<item name="android:layout_marginBottom">@dimen/cpp_pane_padding</item> <item name="android:layout_marginBottom">@dimen/cpp_pane_padding</item>
</style> </style>
<style name="CppActionBar" parent="@style/Widget.AppCompat.ActionBar">
<item name="background">@color/cpp_material_actionbar</item>
<item name="android:background">@color/cpp_material_actionbar</item>
<item name="backgroundStacked">@color/cpp_material_actionbar</item>
<item name="android:backgroundStacked">@color/cpp_material_actionbar</item>
<item name="backgroundSplit">@color/cpp_material_actionbar</item>
<item name="android:backgroundSplit">@color/cpp_material_actionbar</item>
</style>
<style name="CppActionBar.Light" parent="CppActionBar">
<item name="background">@color/cpp_material_actionbar_light</item>
<item name="android:background">@color/cpp_material_actionbar_light</item>
<item name="backgroundStacked">@color/cpp_material_actionbar_light</item>
<item name="android:backgroundStacked">@color/cpp_material_actionbar_light</item>
<item name="backgroundSplit">@color/cpp_material_actionbar_light</item>
<item name="android:backgroundSplit">@color/cpp_material_actionbar_light</item>
</style>
<style name="CppToolbar" parent="@style/Widget.AppCompat.Toolbar">
<item name="background">@color/cpp_material_actionbar</item>
<item name="android:background">@color/cpp_material_actionbar</item>
<item name="backgroundStacked">@color/cpp_material_actionbar</item>
<item name="android:backgroundStacked">@color/cpp_material_actionbar</item>
<item name="backgroundSplit">@color/cpp_material_actionbar</item>
<item name="android:backgroundSplit">@color/cpp_material_actionbar</item>
<item name="navigationIcon">?attr/homeAsUpIndicator</item>
<item name="android:navigationIcon">?attr/homeAsUpIndicator</item>
</style>
<style name="CppToolbar.Light" parent="CppToolbar">
<item name="background">@color/cpp_material_actionbar_light</item>
<item name="android:background">@color/cpp_material_actionbar_light</item>
<item name="backgroundStacked">@color/cpp_material_actionbar_light</item>
<item name="android:backgroundStacked">@color/cpp_material_actionbar_light</item>
<item name="backgroundSplit">@color/cpp_material_actionbar_light</item>
<item name="android:backgroundSplit">@color/cpp_material_actionbar_light</item>
</style>
</resources> </resources>

View File

@ -90,6 +90,7 @@
<string name="p_metro_green_theme">Metro Green</string> <string name="p_metro_green_theme">Metro Green</string>
<string name="p_metro_purple_theme">Metro Purple</string> <string name="p_metro_purple_theme">Metro Purple</string>
<string name="p_material_theme">Material</string> <string name="p_material_theme">Material</string>
<string name="p_material_light_theme">Material Light</string>
<string name="c_calc_result_precision_summary">Precision of the result value (all calculations are done with maximum <string name="c_calc_result_precision_summary">Precision of the result value (all calculations are done with maximum
precision regardless of the value of this option) precision regardless of the value of this option)
</string> </string>

View File

@ -22,17 +22,32 @@
<resources> <resources>
<style name="Cpp.Theme" parent="Cpp.Theme.Base"/> <style name="Cpp.Theme" parent="@style/Theme.AppCompat">
<item name="colorPrimary">@color/cpp_metro_button</item>
<item name="android:colorPrimary">@color/cpp_metro_button</item>
<item name="colorPrimaryDark">@color/cpp_metro_button_dark</item>
<item name="android:colorPrimaryDark">@color/cpp_metro_button_dark</item>
<item name="colorAccent">@color/cpp_wizard_primary</item>
<item name="android:colorAccent">@color/cpp_wizard_primary</item>
<item name="android:colorEdgeEffect">@color/cpp_wizard_overscroll</item>
<style name="Cpp.Theme.Dialog" parent="Cpp.Theme.Base.Dialog"/>
<style name="Cpp.Theme.Base" parent="@style/Theme.AppCompat">
<item name="android:windowBackground">@color/cpp_main_bg</item> <item name="android:windowBackground">@color/cpp_main_bg</item>
<item name="actionBarStyle">@style/CppActionBar</item>
<item name="android:actionBarStyle">@style/CppActionBar</item>
<item name="cpp_main_bg">@color/cpp_main_bg</item> <item name="cpp_main_bg">@color/cpp_main_bg</item>
</style> </style>
<style name="Cpp.Theme.Base.Dialog" parent="@style/Theme.AppCompat.Dialog"> <style name="Cpp.Theme.Dialog" parent="@style/Theme.AppCompat.Dialog">
<item name="colorPrimary">@color/cpp_metro_button</item>
<item name="android:colorPrimary">@color/cpp_metro_button</item>
<item name="colorPrimaryDark">@color/cpp_metro_button_dark</item>
<item name="android:colorPrimaryDark">@color/cpp_metro_button_dark</item>
<item name="colorAccent">@color/cpp_wizard_primary</item>
<item name="android:colorAccent">@color/cpp_wizard_primary</item>
<item name="android:colorEdgeEffect">@color/cpp_wizard_overscroll</item>
<item name="android:windowNoTitle">false</item> <item name="android:windowNoTitle">false</item>
<item name="android:windowTitleBackgroundStyle">@android:color/transparent</item> <item name="android:windowTitleBackgroundStyle">@android:color/transparent</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
@ -41,31 +56,77 @@
<item name="cpp_main_bg">@color/cpp_main_bg</item> <item name="cpp_main_bg">@color/cpp_main_bg</item>
</style> </style>
<style name="Cpp.Theme.Light" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/cpp_material_light</item>
<item name="android:colorPrimary">@color/cpp_material_light</item>
<item name="colorPrimaryDark">@color/cpp_material_light</item>
<item name="android:colorPrimaryDark">@color/cpp_material_light</item>
<item name="colorAccent">@color/cpp_wizard_primary</item>
<item name="android:colorAccent">@color/cpp_wizard_primary</item>
<item name="android:colorEdgeEffect">@color/cpp_wizard_overscroll</item>
<item name="android:windowBackground">@color/cpp_main_light_bg</item>
<item name="actionBarStyle">@style/CppActionBar.Light</item>
<item name="android:actionBarStyle">@style/CppActionBar.Light</item>
<item name="cpp_main_bg">@color/cpp_main_light_bg</item>
</style>
<style name="Cpp.Theme.Light.Dialog" parent="@style/Theme.AppCompat.Light.Dialog">
<item name="colorPrimary">@color/cpp_material_light</item>
<item name="android:colorPrimary">@color/cpp_material_light</item>
<item name="colorPrimaryDark">@color/cpp_material_light</item>
<item name="android:colorPrimaryDark">@color/cpp_material_light</item>
<item name="colorAccent">@color/cpp_wizard_primary</item>
<item name="android:colorAccent">@color/cpp_wizard_primary</item>
<item name="android:colorEdgeEffect">@color/cpp_wizard_overscroll</item>
<item name="android:windowBackground">@color/cpp_main_light_bg</item>
<item name="android:windowNoTitle">false</item>
<item name="android:windowTitleBackgroundStyle">@android:color/transparent</item>
<item name="windowActionBar">false</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowCloseOnTouchOutside">false</item>
<item name="cpp_main_bg">@color/cpp_main_light_bg</item>
</style>
<style name="Cpp.Theme.Wizard.Purchase" parent="cpp_metro_blue_theme"> <style name="Cpp.Theme.Wizard.Purchase" parent="cpp_metro_blue_theme">
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="android:background">@color/cpp_metro_button_light</item> <item name="android:background">@color/cpp_metro_button_light</item>
</style> </style>
<style name="Cpp.Theme.Wizard" parent="@style/cpp_metro_blue_theme"> <style name="Cpp.Theme.Wizard.Light" parent="Cpp.Theme.Light">
<item name="android:windowBackground">@color/cpp_wizard_bg</item> <item name="android:windowBackground">@color/cpp_wizard_bg</item>
</style> <item name="android:colorEdgeEffect">@color/cpp_wizard_overscroll</item>
<item name="colorAccent">@color/cpp_wizard_primary</item>
<style name="Cpp.Theme.Settings.Base" parent="@style/cpp_metro_blue_theme"> <item name="android:colorAccent">@color/cpp_wizard_primary</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="toolbarStyle">@style/Widget.Toolbar</item>
<item name="android:windowBackground">@color/cpp_main_bg</item>
<item name="android:textColorSecondary">@color/cpp_wizard_secondary</item> <item name="android:textColorSecondary">@color/cpp_wizard_secondary</item>
<item name="android:textColorPrimary">@color/cpp_wizard_primary</item> <item name="android:textColorPrimary">@color/cpp_wizard_primary</item>
</style> </style>
<style name="Cpp.Theme.Settings" parent="Cpp.Theme.Settings.Base"/> <style name="Cpp.Theme.Wizard" parent="Cpp.Theme">
<item name="android:windowBackground">@color/cpp_wizard_bg</item>
<style name="Widget.Toolbar" parent="@style/Widget.AppCompat.Toolbar"> <item name="android:colorEdgeEffect">@color/cpp_wizard_overscroll</item>
<item name="android:background">?attr/colorPrimary</item> <item name="colorAccent">@color/cpp_wizard_primary</item>
<item name="android:navigationIcon">?attr/homeAsUpIndicator</item> <item name="android:colorAccent">@color/cpp_wizard_primary</item>
<item name="navigationIcon">?attr/homeAsUpIndicator</item> <item name="android:textColorSecondary">@color/cpp_wizard_secondary</item>
<item name="android:textColorPrimary">@color/cpp_wizard_primary</item>
</style> </style>
<style name="Cpp.Theme.Settings" parent="Cpp.Theme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="toolbarStyle">@style/CppToolbar</item>
<item name="android:toolbarStyle">@style/CppToolbar</item>
</style>
<style name="Cpp.Theme.Settings.Light" parent="Cpp.Theme.Light">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="toolbarStyle">@style/CppToolbar.Light</item>
<item name="android:toolbarStyle">@style/CppToolbar.Light</item>
</style>
</resources> </resources>

View File

@ -0,0 +1,52 @@
<!--
~ Copyright 2013 serso aka se.solovyev
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Contact details
~
~ Email: se.solovyev@gmail.com
~ Site: http://se.solovyev.org
-->
<resources>
<style name="CppKeyboardButton.Material.Light.Digit" parent="CppKeyboardButton">
<item name="android:background">@drawable/material_button_light</item>
<item name="android:stateListAnimator">@null</item>
</style>
<style name="CppKeyboardButton.Material.Light.Operation" parent="CppKeyboardButton.Material.Digit">
<item name="android:background">@drawable/material_button_light_primary</item>
</style>
<style name="CppKeyboardButton.Material.Light.Control.Image" parent="CppKeyboardButton.Material.Light.Digit">
<item name="android:padding">6dp</item>
</style>
<style name="Cpp.Theme.Material.Light" parent="Cpp.Theme.Light">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Light.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Light.Digit</item>
<item name="cpp_button_style_control_image">@style/CppKeyboardButton.Material.Light.Control.Image</item>
<item name="cpp_button_style_operation">@style/CppKeyboardButton.Material.Light.Operation</item>
</style>
<style name="Cpp.Theme.Dialog.Material.Light" parent="Cpp.Theme.Light.Dialog">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Light.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Light.Digit</item>
<item name="cpp_button_style_control_image">@style/CppKeyboardButton.Material.Light.Control.Image</item>
<item name="cpp_button_style_operation">@style/CppKeyboardButton.Material.Light.Operation</item>
</style>
</resources>

View File

@ -39,7 +39,6 @@
<item name="android:background">@drawable/metro_widget_button_light</item> <item name="android:background">@drawable/metro_widget_button_light</item>
</style> </style>
<style name="metro_blue_operation_button_style" parent="metro_digit_button_style"> <style name="metro_blue_operation_button_style" parent="metro_digit_button_style">
<item name="android:background">@drawable/metro_blue_button</item> <item name="android:background">@drawable/metro_blue_button</item>
</style> </style>
@ -55,11 +54,4 @@
<item name="cpp_button_style_operation">@style/metro_blue_operation_button_style</item> <item name="cpp_button_style_operation">@style/metro_blue_operation_button_style</item>
</style> </style>
<style name="Cpp.Theme.Dialog.Material" parent="Cpp.Theme.Dialog">
<item name="cpp_button_style_digit">@style/metro_digit_button_style</item>
<item name="cpp_button_style_control">@style/metro_control_button_style</item>
<item name="cpp_button_style_control_image">@style/metro_control_image_button_style</item>
<item name="cpp_button_style_operation">@style/metro_blue_operation_button_style</item>
</style>
</resources> </resources>