This commit is contained in:
serso 2015-02-08 17:04:16 +01:00
parent b7a05b66bc
commit 362189f6ad
57 changed files with 298 additions and 421 deletions

View File

@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Tests" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="android-app-tests" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -noverify" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
</component>

View File

@ -32,8 +32,10 @@ dependencies {
testCompile 'junit:junit:4.11'
testCompile 'org.robolectric:robolectric:2.3'
testCompile "org.mockito:mockito-all:1.9.5"
testCompile "org.skyscreamer:jsonassert:1.2.3"
testCompile 'org.mockito:mockito-all:1.9.5'
testCompile 'org.skyscreamer:jsonassert:1.2.3'
testCompile 'com.android.support:support-v4:21.0.3'
testCompile 'com.android.support:appcompat-v7:21.0.3'
}
tasks.withType(Test) {

View File

@ -35,6 +35,8 @@ import java.util.Date;
import java.util.Random;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* User: serso
@ -50,7 +52,7 @@ public class TextHighlighterTest {
@Test
public void testProcess() throws Exception {
TextProcessor<?, String> textHighlighter = new TextHighlighter(0, false);
TextProcessor<?, String> textHighlighter = new TextHighlighter(Color.TRANSPARENT, false);
final Random random = new Random(new Date().getTime());
for (int i = 0; i < 1000; i++) {
@ -176,4 +178,19 @@ public class TextHighlighterTest {
long endTime = System.currentTimeMillis();
System.out.println("Total time, ms: " + (endTime - startTime));
}
@Test
public void testDarkColor() throws Exception {
final TextProcessor<?, String> textHighlighter = new TextHighlighter(Color.BLACK, false);
assertEquals("", textHighlighter.process("sin(2cos(3))"));
}
@Test
public void testIsDark() throws Exception {
assertFalse(TextHighlighter.isDark(Color.WHITE));
assertFalse(TextHighlighter.isDark(Color.LTGRAY));
assertTrue(TextHighlighter.isDark(Color.DKGRAY));
assertTrue(TextHighlighter.isDark(Color.BLACK));
}
}

View File

@ -22,21 +22,19 @@
package org.solovyev.android.calculator.wizard;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.util.ActivityController;
import org.solovyev.android.CalculatorTestRunner;
import org.solovyev.android.calculator.Preferences;
import org.solovyev.android.wizard.WizardUi;
import javax.annotation.Nonnull;
import java.lang.reflect.Field;
import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@RunWith(CalculatorTestRunner.class)
public class OnScreenCalculatorWizardStepTest {
@ -86,22 +84,4 @@ public class OnScreenCalculatorWizardStepTest {
controller.restart();
assertFalse(fragment.getCheckbox().isChecked());
}
@Test
public void testShouldBeEnabledIfIconIsShown() throws Exception {
testShouldBeEqualsToIconState(true);
}
@Test
public void testShouldBeDisabledIfIconIsNotShown() throws Exception {
testShouldBeEqualsToIconState(false);
}
private void testShouldBeEqualsToIconState(boolean iconEnabled) throws IllegalAccessException {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(Robolectric.application);
Preferences.OnscreenCalculator.showAppIcon.putPreference(preferences, iconEnabled);
createActivity();
setFragment();
assertEquals(iconEnabled, fragment.isOnscreenCalculatorEnabled());
}
}

View File

@ -1,181 +0,0 @@
/*
* 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
*/
package org.solovyev.android.calculator.wizard;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.annotation.Config;
import org.solovyev.android.CalculatorTestRunner;
import org.solovyev.android.calculator.Preferences;
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.solovyev.android.calculator.CalculatorApplication.getPreferences;
import static org.solovyev.android.calculator.Preferences.Gui.Layout.main_calculator;
import static org.solovyev.android.calculator.Preferences.Gui.Layout.main_calculator_mobile;
import static org.solovyev.android.calculator.Preferences.OnscreenCalculator.showAppIcon;
import static org.solovyev.android.calculator.wizard.CalculatorLayout.big_buttons;
import static org.solovyev.android.calculator.wizard.CalculatorLayout.optimized;
import static org.solovyev.android.calculator.wizard.CalculatorMode.engineer;
import static org.solovyev.android.calculator.wizard.CalculatorMode.simple;
import static org.solovyev.android.calculator.wizard.CalculatorWizardStep.*;
import static org.solovyev.android.calculator.wizard.ChooseLayoutWizardStep.LAYOUT;
import static org.solovyev.android.calculator.wizard.ChooseModeWizardStep.MODE;
import static org.solovyev.android.calculator.wizard.OnScreenCalculatorWizardStep.ONSCREEN_CALCULATOR_ENABLED;
@RunWith(CalculatorTestRunner.class)
public class WizardStepTest {
private FragmentActivity activity;
@Before
public void setUp() throws Exception {
activity = Robolectric.buildActivity(FragmentActivity.class).create().get();
}
@Test
public void testFragmentsShouldBeInstantiated() throws Exception {
for (CalculatorWizardStep wizardStep : CalculatorWizardStep.values()) {
Fragment.instantiate(Robolectric.application, wizardStep.getFragmentClass().getName());
}
}
@Test
public void testShouldBeMainMobileLayout() throws Exception {
chooseLayout(big_buttons);
chooseMode(engineer);
assertUiLayoutEquals(main_calculator_mobile);
}
@Test
public void testShouldBeMainLayout() throws Exception {
chooseLayout(optimized);
chooseMode(engineer);
assertUiLayoutEquals(main_calculator);
}
@Test
public void testShouldBeSimpleLayout() throws Exception {
chooseLayout(optimized);
chooseMode(simple);
assertUiLayoutEquals(Preferences.Gui.Layout.simple);
}
@Test
public void testShouldBeSimpleMobileLayout() throws Exception {
chooseLayout(big_buttons);
chooseMode(simple);
assertUiLayoutEquals(Preferences.Gui.Layout.simple_mobile);
}
private void assertUiLayoutEquals(Preferences.Gui.Layout uiLayout) {
Assert.assertEquals(uiLayout, Preferences.Gui.layout.getPreference(PreferenceManager.getDefaultSharedPreferences(Robolectric.application)));
}
private void chooseMode(CalculatorMode mode) {
final ChooseModeWizardStep modeFragment = mock(ChooseModeWizardStep.class);
when(modeFragment.getSelectedMode()).thenReturn(mode);
when(modeFragment.getActivity()).thenReturn(activity);
CalculatorWizardStep.choose_mode.onNext(modeFragment);
}
private void chooseLayout(CalculatorLayout layout) {
final ChooseLayoutWizardStep layoutFragment = mock(ChooseLayoutWizardStep.class);
when(layoutFragment.getSelectedLayout()).thenReturn(layout);
when(layoutFragment.getActivity()).thenReturn(activity);
choose_layout.onNext(layoutFragment);
}
/* @Config(qualifiers = "large")
@Test
public void testChooseLayoutShouldBeVisibleForTablet() throws Exception {
assertTrue(CalculatorWizardStep.choose_layout.isVisible());
}*/
@Config(qualifiers = "normal")
@Test
public void testChooseLayoutShouldNotBeVisibleForMobile() throws Exception {
assertFalse(choose_layout.isVisible());
}
@Test
public void testOnscreenCalculatorShouldNotBeShown() throws Exception {
doOnscreenStep(false);
assertFalse(showAppIcon.getPreference(getPreferences()));
}
@Test
public void testOnscreenCalculatorShouldBeShown() throws Exception {
doOnscreenStep(true);
assertTrue(showAppIcon.getPreference(getPreferences()));
}
private void doOnscreenStep(boolean onscreenCalculatorEnabled) {
final OnScreenCalculatorWizardStep f = mock(OnScreenCalculatorWizardStep.class);
when(f.isOnscreenCalculatorEnabled()).thenReturn(onscreenCalculatorEnabled);
when(f.getActivity()).thenReturn(activity);
CalculatorWizardStep.on_screen_calculator.onNext(f);
}
@SuppressWarnings("ConstantConditions")
@Test
public void testChooseLayoutFragmentArgs() throws Exception {
Preferences.Gui.layout.putPreference(getPreferences(), Preferences.Gui.Layout.simple);
assertEquals(CalculatorLayout.optimized, choose_layout.getFragmentArgs().getSerializable(LAYOUT));
Preferences.Gui.layout.putPreference(getPreferences(), Preferences.Gui.Layout.simple_mobile);
assertEquals(CalculatorLayout.big_buttons, choose_layout.getFragmentArgs().getSerializable(LAYOUT));
}
@SuppressWarnings("ConstantConditions")
@Test
public void testChooseModeFragmentArgs() throws Exception {
Preferences.Gui.layout.putPreference(getPreferences(), Preferences.Gui.Layout.main_calculator);
assertEquals(CalculatorMode.engineer, choose_mode.getFragmentArgs().getSerializable(MODE));
Preferences.Gui.layout.putPreference(getPreferences(), Preferences.Gui.Layout.simple_mobile);
assertEquals(CalculatorMode.simple, choose_mode.getFragmentArgs().getSerializable(MODE));
}
@SuppressWarnings("ConstantConditions")
@Test
public void testOnscreenFragmentArgs() throws Exception {
Preferences.OnscreenCalculator.showAppIcon.putPreference(getPreferences(), true);
assertTrue(on_screen_calculator.getFragmentArgs().getBoolean(ONSCREEN_CALCULATOR_ENABLED));
Preferences.OnscreenCalculator.showAppIcon.putPreference(getPreferences(), false);
assertFalse(on_screen_calculator.getFragmentArgs().getBoolean(ONSCREEN_CALCULATOR_ENABLED));
}
}

View File

@ -78,6 +78,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>

View File

@ -26,7 +26,7 @@
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17"/>
<application android:allowBackup="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/cpp_metro_blue_theme">
<application android:allowBackup="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/Cpp.Theme.Material">
<activity android:clearTaskOnLaunch="true" android:label="@string/c_app_name" android:launchMode="singleTop" android:name=".CalculatorActivity" android:windowSoftInputMode="adjustPan">

View File

@ -66,6 +66,15 @@ public class ActivityUi extends BaseUi {
this.layoutId = layoutId;
}
public void onPreCreate(@Nonnull Activity activity) {
final SharedPreferences preferences = App.getPreferences();
theme = Preferences.Gui.getTheme(preferences);
activity.setTheme(theme.getThemeId(activity));
layout = Preferences.Gui.getLayout(preferences);
}
@Override
public void onCreate(@Nonnull Activity activity) {
super.onCreate(activity);
@ -74,13 +83,6 @@ public class ActivityUi extends BaseUi {
Locator.getInstance().getCalculator().addCalculatorEventListener((CalculatorEventListener) activity);
}
final SharedPreferences preferences = App.getPreferences();
theme = Preferences.Gui.getTheme(preferences);
activity.setTheme(theme.getThemeId(activity));
this.layout = Preferences.Gui.getLayout(preferences);
activity.setContentView(layoutId);
final View root = activity.findViewById(R.id.main_layout);

View File

@ -24,7 +24,6 @@ package org.solovyev.android.calculator;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
@ -38,8 +37,6 @@ import org.solovyev.android.view.AutoResizeTextView;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* User: serso
@ -57,7 +54,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
*/
@Nonnull
private final static TextProcessor<TextProcessorEditorResult, String> textHighlighter = new TextHighlighter(Color.WHITE, false);
private final TextProcessor<TextProcessorEditorResult, String> textHighlighter;
/*
**********************************************************************
@ -70,17 +67,12 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
@Nonnull
private volatile CalculatorDisplayViewState state = CalculatorDisplayViewStateImpl.newDefaultInstance();
private volatile boolean viewStateChange = false;
@Nonnull
private final Object lock = new Object();
@Nonnull
private final Handler uiHandler = new Handler();
@Nonnull
private final ExecutorService bgExecutor = Executors.newSingleThreadExecutor();
private volatile boolean initialized = false;
/*
@ -93,15 +85,17 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
public AndroidCalculatorDisplayView(Context context) {
super(context);
textHighlighter = new TextHighlighter(getTextColors().getDefaultColor(), false);
}
public AndroidCalculatorDisplayView(Context context, AttributeSet attrs) {
super(context, attrs);
textHighlighter = new TextHighlighter(getTextColors().getDefaultColor(), false);
}
public AndroidCalculatorDisplayView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
textHighlighter = new TextHighlighter(getTextColors().getDefaultColor(), false);
}
/*
@ -121,14 +115,12 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
public void run() {
synchronized (lock) {
try {
viewStateChange = true;
final CharSequence text = prepareText(state.getStringResult(), state.isValid());
AndroidCalculatorDisplayView.this.state = state;
if (state.isValid()) {
setTextColor(getResources().getColor(R.color.cpp_text));
setTextColor(getTextColor().normal);
setText(text);
adjustTextSize();
@ -136,20 +128,21 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
} else {
// update text in order to get rid of HTML tags
setText(getText().toString());
setTextColor(getResources().getColor(R.color.cpp_text_error));
setTextColor(getTextColor().error);
// error messages are never shown -> just greyed out text (error message will be shown on click)
//setText(state.getErrorMessage());
//redraw();
}
} finally {
viewStateChange = false;
}
}
}
});
}
private Preferences.Gui.TextColor getTextColor() {
return App.getTheme().getTextColor(App.getApplication());
}
@Nonnull
@Override
public CalculatorDisplayViewState getState() {
@ -159,13 +152,10 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
}
@Nullable
private static CharSequence prepareText(@Nullable String text, boolean valid) {
private CharSequence prepareText(@Nullable String text, boolean valid) {
CharSequence result;
if (valid && text != null) {
//Log.d(this.getClass().getName(), text);
try {
final TextProcessorEditorResult processedText = textHighlighter.process(text);
text = processedText.toString();

View File

@ -225,4 +225,9 @@ public final class App {
public static SharedPreferences getPreferences() {
return preferences;
}
@Nonnull
public static Preferences.Gui.Theme getTheme() {
return Preferences.Gui.getTheme(getPreferences());
}
}

View File

@ -31,6 +31,7 @@ public class BaseActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
ui.onPreCreate(this);
super.onCreate(savedInstanceState);
ui.onCreate(this);
}

View File

@ -22,9 +22,13 @@
package org.solovyev.android.calculator;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.support.annotation.StyleRes;
import android.util.SparseArray;
import android.view.ContextThemeWrapper;
import jscl.AngleUnit;
import jscl.NumeralBase;
import org.solovyev.android.calculator.math.MathType;
@ -110,9 +114,11 @@ public final class Preferences {
metro_purple_theme(R.style.cpp_metro_purple_theme),
metro_green_theme(R.style.cpp_metro_green_theme),
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),
material_light_theme(R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Settings_Light),
;
private static final SparseArray<TextColor> textColors = new SparseArray<>();
private final int themeId;
private final int wizardThemeId;
private final int settingsThemeId;
@ -120,6 +126,7 @@ public final class Preferences {
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.wizardThemeId = wizardThemeId;
@ -130,15 +137,41 @@ public final class Preferences {
return getThemeId(null);
}
public int getThemeId(@Nullable Activity activity) {
if (activity instanceof WizardActivity) {
public int getThemeId(@Nullable Context context) {
if (context instanceof WizardActivity) {
return wizardThemeId;
}
if (activity instanceof BasePreferencesActivity) {
if (context instanceof BasePreferencesActivity) {
return settingsThemeId;
}
return themeId;
}
@Nonnull
public TextColor getTextColor(@Nonnull Context context) {
final int themeId = getThemeId(context);
TextColor textColor = textColors.get(themeId);
if (textColor == null) {
final ContextThemeWrapper themeContext = new ContextThemeWrapper(context, themeId);
final TypedArray a = themeContext.obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary, android.R.attr.textColorPrimaryInverse});
final int normal = a.getColor(0, Color.BLACK);
final int error = a.getColor(1, Color.WHITE);
a.recycle();
textColor = new TextColor(normal, error);
textColors.append(themeId, textColor);
}
return textColor;
}
}
public static final class TextColor{
public final int normal;
public final int error;
TextColor(int normal, int error) {
this.normal = normal;
this.error = error;
}
}
public static enum Layout {
main_calculator(R.layout.main_calculator, R.string.p_layout_calculator, true),

View File

@ -26,7 +26,7 @@ import android.graphics.Bitmap;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import org.solovyev.android.calculator.App;
import org.solovyev.android.calculator.R;
import javax.annotation.Nonnull;
@ -69,7 +69,8 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment {
graphView = new CalculatorGraph2dView(getActivity());
}
graphView.init(PlotViewDef.newInstance(Color.WHITE, Color.WHITE, Color.DKGRAY, getBgColor()));
final int color = App.getTheme().getTextColor(getActivity()).normal;
graphView.init(PlotViewDef.newInstance(color, color, Color.DKGRAY, getBgColor()));
final PlotBoundaries boundaries = plotData.getBoundaries();
graphView.setXRange(boundaries.getXMin(), boundaries.getXMax());

View File

@ -1,18 +1,22 @@
package org.solovyev.android.calculator.view;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.text.Html;
import android.util.Log;
import org.solovyev.android.calculator.App;
import org.solovyev.android.calculator.CalculatorParseException;
import org.solovyev.android.calculator.Preferences;
import org.solovyev.android.calculator.text.TextProcessor;
import org.solovyev.android.calculator.text.TextProcessorEditorResult;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static org.solovyev.android.calculator.Preferences.Gui.colorDisplay;
import static org.solovyev.android.calculator.view.TextHighlighter.WHITE;
import static org.solovyev.android.calculator.Preferences.Gui.theme;
/**
* User: serso
@ -23,7 +27,8 @@ public final class EditorTextProcessor implements TextProcessor<TextProcessorEdi
private boolean highlightText = true;
private final TextProcessor<TextProcessorEditorResult, String> textHighlighter = new TextHighlighter(WHITE, true);
@Nullable
private TextProcessor<TextProcessorEditorResult, String> textHighlighter;
public EditorTextProcessor() {
}
@ -42,7 +47,7 @@ public final class EditorTextProcessor implements TextProcessor<TextProcessorEdi
if (highlightText) {
try {
final TextProcessorEditorResult processesText = textHighlighter.process(text);
final TextProcessorEditorResult processesText = getTextHighlighter().process(text);
result = new TextProcessorEditorResult(Html.fromHtml(processesText.toString()), processesText.getOffset());
} catch (CalculatorParseException e) {
@ -58,6 +63,14 @@ public final class EditorTextProcessor implements TextProcessor<TextProcessorEdi
return result;
}
@Nonnull
private TextProcessor<TextProcessorEditorResult, String> getTextHighlighter() {
if (textHighlighter == null) {
onSharedPreferenceChanged(App.getPreferences(), theme.getKey());
}
return textHighlighter;
}
public boolean isHighlightText() {
return highlightText;
}
@ -68,8 +81,17 @@ public final class EditorTextProcessor implements TextProcessor<TextProcessorEdi
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
if (colorDisplay.getKey().equals(key)) {
this.setHighlightText(colorDisplay.getPreference(preferences));
if (colorDisplay.isSameKey(key)) {
setHighlightText(colorDisplay.getPreference(preferences));
} else if (theme.isSameKey(key)) {
final int color = getTextColor(preferences);
textHighlighter = new TextHighlighter(color, true);
}
}
private int getTextColor(@Nonnull SharedPreferences preferences) {
final Preferences.Gui.Theme theme = Preferences.Gui.getTheme(preferences);
final Application application = App.getApplication();
return theme.getTextColor(application).normal;
}
}

View File

@ -48,21 +48,42 @@ public class TextHighlighter implements TextProcessor<TextProcessorEditorResult,
nbFontAttributes.put("color", "#008000");
}
private final int color;
private final int colorRed;
private final int colorGreen;
private final int colorBlue;
private final int red;
private final int green;
private final int blue;
private final boolean formatNumber;
private final boolean dark;
public TextHighlighter(int baseColor, boolean formatNumber) {
this.color = baseColor;
public TextHighlighter(int color, boolean formatNumber) {
this.formatNumber = formatNumber;
//this.colorRed = Color.red(baseColor);
this.colorRed = (baseColor >> 16) & 0xFF;
//this.colorGreen = Color.green(baseColor);
this.colorGreen = (color >> 8) & 0xFF;
//this.colorBlue = Color.blue(baseColor);
this.colorBlue = color & 0xFF;
//this.red = Color.red(baseColor);
red = red(color);
//this.green = Color.green(baseColor);
green = green(color);
//this.blue = Color.blue(baseColor);
blue = blue(color);
dark = isDark(red, green, blue);
}
private static int blue(int color) {
return color & 0xFF;
}
private static int green(int color) {
return (color >> 8) & 0xFF;
}
private static int red(int color) {
return (color >> 16) & 0xFF;
}
public static boolean isDark(int color) {
return isDark(red(color), green(color), color & 0xFF);
}
public static boolean isDark(int red, int green, int blue) {
final float y = 0.2126f * red + 0.7152f * green + 0.0722f * blue;
return y < 128;
}
@Nonnull
@ -201,13 +222,14 @@ public class TextHighlighter implements TextProcessor<TextProcessorEditorResult,
}
private String getColor(int totalNumberOfOpenings, int numberOfOpenings) {
double c = 0.8;
int offset = ((int) (255 * c)) * numberOfOpenings / (totalNumberOfOpenings + 1);
int offset = ((int) (255 * 0.8)) * numberOfOpenings / (totalNumberOfOpenings + 1);
if (!dark) {
offset = -offset;
}
// for tests:
// innt result = Color.rgb(BASE_COLOUR_RED_COMPONENT - offset, BASE_COLOUR_GREEN_COMPONENT - offset, BASE_COLOUR_BLUE_COMPONENT - offset);
int result = (0xFF << 24) | ((colorRed - offset) << 16) | ((colorGreen - offset) << 8) | (colorBlue - offset);
// int result = Color.rgb(BASE_COLOUR_RED_COMPONENT - offset, BASE_COLOUR_GREEN_COMPONENT - offset, BASE_COLOUR_BLUE_COMPONENT - offset);
int result = (0xFF << 24) | ((red + offset) << 16) | ((green + offset) << 8) | (blue + offset);
return "#" + Integer.toHexString(result).substring(2);
}

View File

@ -23,6 +23,6 @@
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
a:color="@color/ripple_material_dark">
<item a:drawable="@drawable/cpp_wizard_button_shape_normal" />
</ripple>

View File

@ -23,7 +23,7 @@
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
a:color="@color/ripple_material_dark">
<item>
<shape>
<solid a:color="@color/cpp_material_blue" />

View File

@ -23,7 +23,7 @@
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
a:color="@color/ripple_material_dark">
<item>
<shape>
<solid a:color="@color/cpp_metro_button" />

View File

@ -23,7 +23,7 @@
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
a:color="@color/ripple_material_dark">
<item>
<shape>
<solid a:color="@color/cpp_metro_button_light" />

View File

@ -23,7 +23,7 @@
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
a:color="@color/ripple_material_dark">
<item>
<shape>
<solid a:color="@color/cpp_material_light" />

View File

@ -23,6 +23,6 @@
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
a:color="@color/ripple_material_dark">
<item a:drawable="@drawable/metro_blue_button_shape" />
</ripple>

View File

@ -23,6 +23,6 @@
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
a:color="@color/ripple_material_dark">
<item a:drawable="@drawable/metro_button_dark_shape" />
</ripple>

View File

@ -23,6 +23,6 @@
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
a:color="@color/ripple_material_dark">
<item a:drawable="@drawable/metro_button_green_shape" />
</ripple>

View File

@ -23,6 +23,6 @@
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
a:color="@color/ripple_material_dark">
<item a:drawable="@drawable/metro_button_light_shape" />
</ripple>

View File

@ -23,6 +23,6 @@
-->
<ripple xmlns:a="http://schemas.android.com/apk/res/android"
a:color="?attr/colorControlHighlight">
a:color="@color/ripple_material_dark">
<item a:drawable="@drawable/metro_button_purple_shape" />
</ripple>

View File

@ -25,8 +25,7 @@
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:orientation="vertical"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
a:background="#ff000000">
a:layout_height="fill_parent">
<ImageView
a:layout_width="wrap_content"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -8,7 +9,8 @@
android:id="@+id/action_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize" />
android:minHeight="?attr/actionBarSize"
app:theme="?attr/cpp_toolbar_theme"/>
<FrameLayout
android:id="@+id/content_wrapper"

View File

@ -37,13 +37,13 @@
a:id="@+id/history_item"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
style="@style/history_item"/>
style="@style/CppListViewItemTextPrimary.History"/>
<TextView
a:id="@+id/history_time"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
style="@style/history_time"/>
style="@style/CppListViewItemTextSecondary"/>
</LinearLayout>

View File

@ -38,13 +38,13 @@
a:id="@+id/math_entity_text"
a:layout_height="wrap_content"
a:layout_width="match_parent"
style="@style/math_entity_text"/>
style="@style/CppListViewItemTextPrimary"/>
<TextView
a:id="@+id/math_entity_short_description"
a:layout_height="wrap_content"
a:layout_width="match_parent"
style="@style/math_entity_description"/>
style="@style/CppListViewItemTextSecondary"/>
</LinearLayout>
<ImageView

View File

@ -25,8 +25,7 @@
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:orientation="vertical"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
a:background="#ff000000">
a:layout_height="fill_parent">
<TextView
a:id="@+id/releaseNotesTextView"

View File

@ -30,17 +30,17 @@
a:id="@+id/history_item"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
style="@style/history_item" />
style="@style/CppListViewItemTextPrimary.History" />
<TextView
a:id="@+id/history_item_comment"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
style="@style/history_time" />
style="@style/CppListViewItemTextSecondary" />
<TextView
a:id="@+id/history_time"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
style="@style/history_time" />
style="@style/CppListViewItemTextSecondary" />
</LinearLayout>

View File

@ -78,7 +78,7 @@
<string name="p_default_theme">Šedá</string>
<string name="p_violet_theme">Fialová</string>
<string name="p_light_blue_theme">Světle modrá</string>
<string name="p_metro_blue_theme">Metro Modrá (výchozí)</string>
<string name="p_metro_blue_theme">Metro Modrá</string>
<string name="p_metro_green_theme">Metro Zelená</string>
<string name="p_metro_purple_theme">Metro Fialová</string>
<string name="c_calc_result_precision_summary">Přesnost výsledku (všechny výpočty jsou prováděny s maximální přesností bez ohledu na tuto hodnotu)</string>

View File

@ -78,7 +78,7 @@
<string name="p_default_theme">Grau</string>
<string name="p_violet_theme">Violett</string>
<string name="p_light_blue_theme">Hellblau</string>
<string name="p_metro_blue_theme">Metro Blau (Standard)</string>
<string name="p_metro_blue_theme">Metro Blau</string>
<string name="p_metro_green_theme">Metro Grün</string>
<string name="p_metro_purple_theme">Metro Lila</string>
<string name="c_calc_result_precision_summary">Genauigkeit des Resultats (alle Berechnungen sind mit höchster Genauigkeit unabhängig von dieser Option)</string>

View File

@ -84,7 +84,7 @@
<string name="p_default_theme">Γκρι</string>
<string name="p_violet_theme">Βιολετί</string>
<string name="p_light_blue_theme">Ανοιχτό μπλε</string>
<string name="p_metro_blue_theme">Metro Blue (Default)</string>
<string name="p_metro_blue_theme">Metro Blue</string>
<string name="p_metro_green_theme">Metro Green</string>
<string name="p_metro_purple_theme">Metro Purple</string>
<string name="c_calc_result_precision_summary">Ακρίβεια τιμής αποτελέσματος (όλοι οι υπολογισμοί γίνονται με τη μεγαλύτερη ακρίβεια

View File

@ -81,7 +81,7 @@
<string name="p_default_theme">Gris</string>
<string name="p_violet_theme">Violeta</string>
<string name="p_light_blue_theme">Azul claro</string>
<string name="p_metro_blue_theme">Metro Azul (Predeterminado)</string>
<string name="p_metro_blue_theme">Metro Azul</string>
<string name="p_metro_green_theme">Metro Verde</string>
<string name="p_metro_purple_theme">Metro Morado</string>
<string name="c_calc_result_precision_summary">Precisión en el valor del resultado (todos los cálculos se realizan con la máxima precisión, independientemente del valor de esta opción)</string>

View File

@ -78,7 +78,7 @@
<string name="p_default_theme">Harmaa</string>
<string name="p_violet_theme">Violetti</string>
<string name="p_light_blue_theme">Vaaleansininen</string>
<string name="p_metro_blue_theme">Metron Sininen (oletus)</string>
<string name="p_metro_blue_theme">Metron Sininen</string>
<string name="p_metro_green_theme">Metron vihreä</string>
<string name="p_metro_purple_theme">Metro violetti</string>
<string name="c_calc_result_precision_summary">Tarkkuus tuloksen arvoa (kaikki laskelmat ovat tehneet tarkkuudella riippumatta tämän asetuksen arvosta) </string>

View File

@ -78,7 +78,7 @@
<string name="p_default_theme">Gris</string>
<string name="p_violet_theme">Violet</string>
<string name="p_light_blue_theme">Bleu clair</string>
<string name="p_metro_blue_theme">Métro bleu (par défaut)</string>
<string name="p_metro_blue_theme">Métro bleu</string>
<string name="p_metro_green_theme">Métro vert</string>
<string name="p_metro_purple_theme">Métro violet</string>
<string name="c_calc_result_precision_summary">Précision de la valeur du résultat (tous les calculs sont faits avec la précision maximale quelle que soit la valeur de cette option)</string>

View File

@ -81,7 +81,7 @@
<string name="p_default_theme">Predefinito</string>
<string name="p_violet_theme">Viola</string>
<string name="p_light_blue_theme">Blu chiaro</string>
<string name="p_metro_blue_theme">Metro Blue (Default)</string>
<string name="p_metro_blue_theme">Metro Blue</string>
<string name="p_metro_green_theme">Metro Green</string>
<string name="p_metro_purple_theme">Metro Purple</string>
<string name="c_calc_result_precision_summary">Precisione del risultato (tutti i calcoli sono fatti con la massima

View File

@ -80,7 +80,7 @@
<string name="p_default_theme">グレー</string>
<string name="p_violet_theme">バイオレット</string>
<string name="p_light_blue_theme">ライトブルー</string>
<string name="p_metro_blue_theme">メトロブルー(デフォルト)</string>
<string name="p_metro_blue_theme">メトロブルー</string>
<string name="p_metro_green_theme">メトログリーン</string>
<string name="p_metro_purple_theme">メトロパープル</string>
<string name="c_calc_result_precision_summary">計算結果の有効桁数(計算はこの設定に関係なく最大精度で行われます)</string>

View File

@ -78,7 +78,7 @@
<string name="p_default_theme">Grijs</string>
<string name="p_violet_theme">Violet</string>
<string name="p_light_blue_theme">Lichtblauw</string>
<string name="p_metro_blue_theme">Metro blauw (standaard)</string>
<string name="p_metro_blue_theme">Metro blauw</string>
<string name="p_metro_green_theme">Metro groen</string>
<string name="p_metro_purple_theme">Metro paars</string>
<string name="c_calc_result_precision_summary">Nauwkeurigheid van de uitkomst (alle berekeningen worden gedaan met maximale nauwkeurigheid, onafhankelijk van deze optie)</string>

View File

@ -78,7 +78,7 @@
<string name="p_default_theme">Szary</string>
<string name="p_violet_theme">Fioletowy</string>
<string name="p_light_blue_theme">Jasnoniebieski</string>
<string name="p_metro_blue_theme">Niebieski Metro (domyślny)</string>
<string name="p_metro_blue_theme">Niebieski Metro</string>
<string name="p_metro_green_theme">Zielony Metro</string>
<string name="p_metro_purple_theme">Fioletowy Metro</string>
<string name="c_calc_result_precision_summary">Dokładność wyświetlanego wyniku (wszystkie obliczenia są wykonywane przy maksymalnej dokładności, niezależnie od tej opcji)</string>

View File

@ -78,7 +78,7 @@
<string name="p_default_theme">Cinza</string>
<string name="p_violet_theme">Violeta</string>
<string name="p_light_blue_theme">Azul Claro</string>
<string name="p_metro_blue_theme">Metro Blue (Padrão)</string>
<string name="p_metro_blue_theme">Metro Blue</string>
<string name="p_metro_green_theme">Metro Green</string>
<string name="p_metro_purple_theme">Metro Purple (Roxo)</string>
<string name="c_calc_result_precision_summary">Precisão do resultado (todos os cálculos são feitos com precisão máxima, independentemente do valor desta opção)</string>

View File

@ -89,7 +89,7 @@
<string name="p_default_theme">Серая</string>
<string name="p_violet_theme">Фиолетовая</string>
<string name="p_light_blue_theme">Голубая</string>
<string name="p_metro_blue_theme">Метро Синяя (По умолчанию)</string>
<string name="p_metro_blue_theme">Метро Синяя</string>
<string name="p_metro_green_theme">Метро Зелёная</string>
<string name="p_metro_purple_theme">Метро Фиолетовая</string>
<string name="c_calc_result_precision_summary">Точность результата(все вычисления производятся максимально точно)

View File

@ -82,7 +82,7 @@
<string name="p_default_theme">Сіра</string>
<string name="p_violet_theme">Фіолетова</string>
<string name="p_light_blue_theme">Блакитна</string>
<string name="p_metro_blue_theme">Метро Синя (типова)</string>
<string name="p_metro_blue_theme">Метро Синя</string>
<string name="p_metro_green_theme">Метро Зелена</string>
<string name="p_metro_purple_theme">Метро Пурпурова</string>
<string name="c_calc_result_precision_summary">Точність відображення результату (усі обчислення проводяться максимально точно, незалежно від цього параметру)

View File

@ -78,7 +78,7 @@
<string name="p_default_theme">Xám</string>
<string name="p_violet_theme">Tím</string>
<string name="p_light_blue_theme">Xanh nhạt</string>
<string name="p_metro_blue_theme">Metro Blue (Mặc định)</string>
<string name="p_metro_blue_theme">Metro Blue</string>
<string name="p_metro_green_theme">Metro Green</string>
<string name="p_metro_purple_theme">Metro Purple</string>
<string name="c_calc_result_precision_summary">Độ chính xác của giá trị kết quả (Tất cả tính toán được thực hiện với độ chính xác tối đa bất kể giá trị của tùy chọn này)</string>

View File

@ -78,7 +78,7 @@
<string name="p_default_theme">灰色</string>
<string name="p_violet_theme">紫色</string>
<string name="p_light_blue_theme">浅蓝色</string>
<string name="p_metro_blue_theme">Metro蓝 (默认)</string>
<string name="p_metro_blue_theme">Metro蓝</string>
<string name="p_metro_green_theme">Metro绿</string>
<string name="p_metro_purple_theme">Metro紫</string>
<string name="c_calc_result_precision_summary">结果显示的精确度(无论此项如何设置,所有的计算都使用最大

View File

@ -83,7 +83,7 @@
<string name="p_default_theme">灰色</string>
<string name="p_violet_theme">紫色</string>
<string name="p_light_blue_theme">淺藍色</string>
<string name="p_metro_blue_theme">現代藍(預設)</string>
<string name="p_metro_blue_theme">現代藍</string>
<string name="p_metro_green_theme">現代綠</string>
<string name="p_metro_purple_theme">現代紫</string>
<string name="c_calc_result_precision_summary">計算結果值的精確度(不論選項值為多少,所有計算都使用最大精確度)

View File

@ -22,24 +22,18 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<string-array name="p_theme_names">
<item>@string/p_default_theme</item>
<item>@string/p_violet_theme</item>
<item>@string/p_light_blue_theme</item>
<item>@string/p_material_theme</item>
<item>@string/p_material_light_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>
<item>@string/p_material_light_theme</item>
</string-array>
<string-array name="p_theme_values" translatable="false">
<item>default_theme</item>
<item>violet_theme</item>
<item>light_blue_theme</item>
<item>material_theme</item>
<item>material_light_theme</item>
<item>metro_blue_theme</item>
<item>metro_green_theme</item>
<item>metro_purple_theme</item>
<item>material_theme</item>
<item>material_light_theme</item>
</string-array>
<string-array name="p_grouping_separator_names">

View File

@ -28,5 +28,10 @@
<attr name="cpp_button_style_control_image" format="reference"/>
<attr name="cpp_button_style_operation" format="reference"/>
<attr name="cpp_main_bg" format="reference"/>
<attr name="cpp_fab_bg" format="reference"/>
<attr name="cpp_toolbar_theme" format="reference"/>
<attr name="cpp_text_color" format="reference"/>
<attr name="cpp_text_error_color" format="reference"/>
</resources>

View File

@ -22,8 +22,12 @@
<resources>
<color name="cpp_list_divider">#ff2e2e2e</color>
<color name="cpp_text">#ffeeeeee</color>
<color name="cpp_text_error">#ff393939</color>
<color name="cpp_text">#ffe6e6e6</color>
<color name="cpp_text_inverse">#424242</color>
<color name="cpp_text_error">@color/cpp_text_inverse</color>
<color name="cpp_text_error_inverse">@color/cpp_text</color>
<color name="cpp_button_text">#ffffffff</color>
<color name="cpp_button_text_operator">#ffffff99</color>
<color name="cpp_button_text_ce">#ffffffff</color>
@ -32,7 +36,6 @@
<color name="cpp_main_light_bg">#fff6f1ef</color>
<color name="cpp_wizard_primary">#FAFAFA</color>
<color name="cpp_wizard_secondary">#9E9E9E</color>
<color name="cpp_wizard_bg">@color/cpp_material_grey</color>
<color name="cpp_wizard_overscroll">#FAFAFA</color>
<color name="cpp_wizard_button_normal">#424242</color>
<color name="cpp_wizard_button_disabled">#616161</color>

View File

@ -74,7 +74,7 @@
<item name="android:textSize">@dimen/cpp_editor_text_size_mobile</item>
</style>
<style name="CppText.Display">
<style name="CppText.Display" parent="CppText">
<item name="android:gravity">top|right</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
@ -95,7 +95,7 @@
<style name="CppText">
<item name="android:background">@android:color/transparent</item>
<item name="android:textColor">@color/cpp_text</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="cpp_simple_metro_digit_button_style" parent="metro_digit_button_style">
@ -251,11 +251,28 @@
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">bottom|end</item>
<item name="android:layout_margin">16dp</item>
<item name="fab_colorNormal">@color/cpp_material_grey</item>
<item name="fab_colorPressed">@color/cpp_material_grey</item>
<item name="fab_colorNormal">?attr/cpp_fab_bg</item>
<item name="fab_colorPressed">?attr/cpp_fab_bg</item>
<item name="fab_colorRipple">?attr/colorControlHighlight</item>
</style>
<style name="CppListViewItemTextPrimary">
<item name="android:textAppearance">@style/TextAppearance.AppCompat</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">@dimen/cpp_li_text_size</item>
</style>
<style name="CppListViewItemTextSecondary">
<item name="android:textAppearance">@style/TextAppearance.AppCompat</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
<item name="android:textSize">@dimen/cpp_li_secondary_text_size</item>
</style>
<style name="CppListViewItemTextPrimary.History" parent="CppListViewItemTextPrimary">
<item name="android:maxLines">2</item>
<item name="android:ellipsize">end</item>
</style>
<style name="CppListView">
<item name="android:id">@android:id/list</item>
<item name="android:dividerHeight">1px</item>

View File

@ -1,37 +0,0 @@
<!--
~ 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="history_time" parent="math_entity_description" />
<style name="history_item" parent="math_entity_text">
<item name="android:maxLines">2</item>
<item name="android:ellipsize">end</item>
</style>
<style name="history_item_label" parent="math_entity_description">
<item name="android:textStyle">bold</item>
<item name="android:textColor">@android:color/white</item>
</style>
</resources>

View File

@ -1,40 +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="math_entity_text">
<item name="android:textColor">@color/cpp_text_primary</item>
<item name="android:textSize">@dimen/cpp_li_text_size</item>
</style>
<style name="math_entity_description">
<item name="android:textColor">@color/cpp_text_secondary</item>
<item name="android:textSize">@dimen/cpp_li_secondary_text_size</item>
</style>
<style name="add_var_button">
<item name="android:paddingLeft">40dp</item>
<item name="android:paddingRight">40dp</item>
</style>
</resources>

View File

@ -86,7 +86,7 @@
<string name="p_default_theme">Grey</string>
<string name="p_violet_theme">Violet</string>
<string name="p_light_blue_theme">Light Blue</string>
<string name="p_metro_blue_theme">Metro Blue (Default)</string>
<string name="p_metro_blue_theme">Metro Blue</string>
<string name="p_metro_green_theme">Metro Green</string>
<string name="p_metro_purple_theme">Metro Purple</string>
<string name="p_material_theme">Material</string>

View File

@ -21,15 +21,15 @@
<string name="cpp_restart_wizard">Start wizard</string>
<string name="cpp_wizard_dragbutton_action_end">Excellent! Tap the button one more time to try again</string>
<string name="cpp_wizard_dragbutton_action_center">Tap the button below once to use 9</string>
<string name="cpp_wizard_dragbutton_action_up">Drag from the center of the button up to use %</string>
<string name="cpp_wizard_dragbutton_action_left">Drag from the center of the button to the left to use sin</string>
<string name="cpp_wizard_dragbutton_action_down">Drag from the center of the button down to use ^2</string>
<string name="cpp_wizard_dragbutton_action_up">Swipe from the center of the button up to use %</string>
<string name="cpp_wizard_dragbutton_action_left">Swipe from the center of the button to the left to use sin</string>
<string name="cpp_wizard_dragbutton_action_down">Swipe from the center of the button down to use ^2</string>
<string name="cpp_wizard_welcome_title">Welcome</string>
<string name="cpp_wizard_layout_title">Choose layout</string>
<string name="cpp_wizard_mode_title">Choose mode</string>
<string name="cpp_wizard_theme_title">Choose theme</string>
<string name="cpp_wizard_onscreen_calculator_title">Calculator in a separate window</string>
<string name="cpp_wizard_dragbutton_title">Drag button basics</string>
<string name="cpp_wizard_dragbutton_title">Swipe button basics</string>
<string name="cpp_wizard_final_done">The app is set up and ready to use.</string>
<string name="cpp_wizard_final_title">Almost done!</string>
<string name="cpp_wizard_final_free_and_opensource">Calculator++ is free and open-source: all the features are free
@ -44,7 +44,7 @@
using other apps on your device
</string>
<string name="cpp_wizard_onscreen_checkbox">Enable</string>
<string name="cpp_wizard_dragbutton_description">Drag button is an exclusive feature of Calculator++ which provides
<string name="cpp_wizard_dragbutton_description">Swipe button is an exclusive feature of Calculator++ which provides
fast access to the secondary functions
</string>
<string name="cpp_wizard_finish_confirmation">Do you really want to finish wizard?</string>

View File

@ -37,6 +37,9 @@
<item name="android:actionBarStyle">@style/CppActionBar</item>
<item name="cpp_main_bg">@color/cpp_main_bg</item>
<item name="cpp_fab_bg">@color/cpp_material_grey</item>
<item name="android:textColorPrimary">@color/cpp_text</item>
<item name="android:textColorPrimaryInverse">@color/cpp_text_error</item>
</style>
<style name="Cpp.Theme.Dialog" parent="@style/Theme.AppCompat.Dialog">
@ -54,35 +57,40 @@
<item name="android:windowCloseOnTouchOutside">false</item>
<item name="cpp_main_bg">@color/cpp_main_bg</item>
<item name="cpp_fab_bg">@color/cpp_material_grey</item>
<item name="android:textColorPrimary">@color/cpp_text</item>
<item name="android:textColorPrimaryInverse">@color/cpp_text_error</item>
</style>
<style name="Cpp.Theme.Light" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowBackground">@color/cpp_main_light_bg</item>
<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="colorAccent">@color/cpp_material_light</item>
<item name="android:colorAccent">@color/cpp_material_light</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>
<item name="cpp_fab_bg">@color/cpp_material_light</item>
<item name="android:textColorPrimary">@color/cpp_text_inverse</item>
<item name="android:textColorPrimaryInverse">@color/cpp_text_error_inverse</item>
</style>
<style name="Cpp.Theme.Light.Dialog" parent="@style/Theme.AppCompat.Light.Dialog">
<item name="android:windowBackground">@color/cpp_main_light_bg</item>
<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="colorAccent">@color/cpp_material_light</item>
<item name="android:colorAccent">@color/cpp_material_light</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>
@ -90,15 +98,13 @@
<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">
<item name="android:windowNoTitle">true</item>
<item name="android:background">@color/cpp_metro_button_light</item>
<item name="cpp_fab_bg">@color/cpp_material_light</item>
<item name="android:textColorPrimary">@color/cpp_text_inverse</item>
<item name="android:textColorPrimaryInverse">@color/cpp_text_error_inverse</item>
</style>
<style name="Cpp.Theme.Wizard" parent="Cpp.Theme.Material">
<item name="android:windowBackground">@color/cpp_wizard_bg</item>
<item name="android:windowBackground">@color/cpp_material_grey</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>
@ -107,7 +113,7 @@
</style>
<style name="Cpp.Theme.Wizard.Light" parent="Cpp.Theme.Material.Light">
<item name="android:windowBackground">@color/cpp_wizard_bg</item>
<item name="android:windowBackground">@color/cpp_material_grey</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>
@ -118,15 +124,24 @@
<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>
<item name="cpp_toolbar_theme">@style/Cpp.Theme.Toolbar</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="cpp_toolbar_theme">@style/Cpp.Theme.Toolbar.Light</item>
</style>
<style name="Cpp.Theme.Toolbar" parent="Cpp.Theme">
<item name="toolbarStyle">@style/CppToolbar</item>
<item name="android:toolbarStyle">@style/CppToolbar</item>
</style>
<style name="Cpp.Theme.Toolbar.Light" parent="Cpp.Theme">
<item name="toolbarStyle">@style/CppToolbar.Light</item>
<item name="android:toolbarStyle">@style/CppToolbar.Light</item>
</style>
</resources>

View File

@ -32,7 +32,7 @@ import javax.annotation.Nonnull;
public enum PlotLineColor {
// Color.WHITE
white(0xFFFFFFFF),
white(0xFFBBBBBB),
blue(0xFF10648C),