Material themes for widget
This commit is contained in:
parent
70a5e7e2e5
commit
a0ff19e4cd
@ -32,7 +32,7 @@ public class CalculatorBroadcasterTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
broadcaster = new CalculatorBroadcaster(application);
|
||||
broadcaster = new CalculatorBroadcaster(application, preferences);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -120,6 +120,7 @@
|
||||
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
|
||||
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
|
||||
<action android:name="org.solovyev.android.calculator.BUTTON_PRESSED"/>
|
||||
<action android:name="org.solovyev.android.calculator.THEME_CHANGED"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget"/>
|
||||
@ -133,6 +134,7 @@
|
||||
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
|
||||
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
|
||||
<action android:name="org.solovyev.android.calculator.BUTTON_PRESSED"/>
|
||||
<action android:name="org.solovyev.android.calculator.THEME_CHANGED"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info_3x3"/>
|
||||
@ -146,6 +148,7 @@
|
||||
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
|
||||
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
|
||||
<action android:name="org.solovyev.android.calculator.BUTTON_PRESSED"/>
|
||||
<action android:name="org.solovyev.android.calculator.THEME_CHANGED"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info_3x4"/>
|
||||
@ -159,6 +162,7 @@
|
||||
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
|
||||
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
|
||||
<action android:name="org.solovyev.android.calculator.BUTTON_PRESSED"/>
|
||||
<action android:name="org.solovyev.android.calculator.THEME_CHANGED"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info_4x4"/>
|
||||
@ -172,6 +176,7 @@
|
||||
<action android:name="org.solovyev.android.calculator.EDITOR_STATE_CHANGED"/>
|
||||
<action android:name="org.solovyev.android.calculator.DISPLAY_STATE_CHANGED"/>
|
||||
<action android:name="org.solovyev.android.calculator.BUTTON_PRESSED"/>
|
||||
<action android:name="org.solovyev.android.calculator.THEME_CHANGED"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data android:name="android.appwidget.provider" android:resource="@xml/calculator_widget_info_4x5"/>
|
||||
|
@ -96,6 +96,12 @@ public final class Check {
|
||||
throw new AssertionException(message);
|
||||
}
|
||||
|
||||
public static void isTrue(boolean expression) {
|
||||
if (!expression) {
|
||||
throw new AssertionException("");
|
||||
}
|
||||
}
|
||||
|
||||
public static void isTrue(boolean expression, @Nonnull String message) {
|
||||
if (!expression) {
|
||||
throw new AssertionException(message);
|
||||
|
@ -165,7 +165,7 @@ public final class App {
|
||||
}
|
||||
}
|
||||
});
|
||||
App.broadcaster = new CalculatorBroadcaster(application);
|
||||
App.broadcaster = new CalculatorBroadcaster(application, preferences);
|
||||
App.vibrator = new Vibrator(application, preferences);
|
||||
App.screenMetrics = new ScreenMetrics(application);
|
||||
|
||||
@ -285,15 +285,15 @@ public final class App {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static Preferences.Onscreen.Theme getOnscreenTheme() {
|
||||
return Preferences.Onscreen.getTheme(getPreferences());
|
||||
public static Preferences.SimpleTheme getWidgetTheme() {
|
||||
return Preferences.Widget.getTheme(getPreferences());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static Preferences.Gui.Theme getThemeIn(@Nonnull Context context) {
|
||||
if (context instanceof CalculatorOnscreenService) {
|
||||
final SharedPreferences p = getPreferences();
|
||||
final Preferences.Onscreen.Theme onscreenTheme = Preferences.Onscreen.getTheme(p);
|
||||
final Preferences.SimpleTheme onscreenTheme = Preferences.Onscreen.getTheme(p);
|
||||
final Preferences.Gui.Theme appTheme = Preferences.Gui.getTheme(p);
|
||||
return onscreenTheme.resolveThemeFor(appTheme).getAppTheme();
|
||||
} else {
|
||||
|
@ -2,21 +2,24 @@ package org.solovyev.android.calculator;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public final class CalculatorBroadcaster implements CalculatorEventListener {
|
||||
public final class CalculatorBroadcaster implements CalculatorEventListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
public static final String ACTION_INIT = "org.solovyev.android.calculator.INIT";
|
||||
public static final String ACTION_EDITOR_STATE_CHANGED = "org.solovyev.android.calculator.EDITOR_STATE_CHANGED";
|
||||
public static final String ACTION_DISPLAY_STATE_CHANGED = "org.solovyev.android.calculator.DISPLAY_STATE_CHANGED";
|
||||
public static final String ACTION_THEME_CHANGED = "org.solovyev.android.calculator.THEME_CHANGED";
|
||||
|
||||
@Nonnull
|
||||
private final Context context;
|
||||
|
||||
public CalculatorBroadcaster(@Nonnull Context context) {
|
||||
public CalculatorBroadcaster(@Nonnull Context context, @Nonnull SharedPreferences preferences) {
|
||||
this.context = context;
|
||||
preferences.registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,4 +46,11 @@ public final class CalculatorBroadcaster implements CalculatorEventListener {
|
||||
public void sendBroadcastIntent(@Nonnull String action) {
|
||||
context.sendBroadcast(new Intent(action));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (Preferences.Gui.theme.isSameKey(key) || Preferences.Widget.theme.isSameKey(key)) {
|
||||
sendBroadcastIntent(ACTION_THEME_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import android.support.annotation.StyleRes;
|
||||
import android.util.SparseArray;
|
||||
import android.view.ContextThemeWrapper;
|
||||
|
||||
import org.solovyev.android.Check;
|
||||
import org.solovyev.android.calculator.language.Languages;
|
||||
import org.solovyev.android.calculator.math.MathType;
|
||||
import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
|
||||
@ -44,7 +45,9 @@ import org.solovyev.android.prefs.Preference;
|
||||
import org.solovyev.android.prefs.StringPreference;
|
||||
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@ -65,38 +68,57 @@ public final class Preferences {
|
||||
public static final Preference<Integer> appVersion = IntegerPreference.of("application.version", -1);
|
||||
public static final Preference<Integer> appOpenedCounter = IntegerPreference.of("app_opened_counter", 0);
|
||||
|
||||
public static class Onscreen {
|
||||
public static final Preference<Boolean> startOnBoot = BooleanPreference.of("onscreen_start_on_boot", false);
|
||||
public static final Preference<Boolean> showAppIcon = BooleanPreference.of("onscreen_show_app_icon", true);
|
||||
public static final Preference<Theme> theme = StringPreference.ofEnum("onscreen.theme", Theme.default_theme, Theme.class);
|
||||
public enum SimpleTheme {
|
||||
|
||||
public enum Theme {
|
||||
|
||||
default_theme(0, null),
|
||||
metro_blue_theme(R.layout.onscreen_layout, Gui.Theme.metro_blue_theme),
|
||||
material_theme(R.layout.onscreen_layout_material, Gui.Theme.material_theme),
|
||||
material_light_theme(R.layout.onscreen_layout_material_light, Gui.Theme.material_light_theme);
|
||||
default_theme(0, 0, null),
|
||||
metro_blue_theme(R.layout.onscreen_layout, R.layout.widget_layout, Gui.Theme.metro_blue_theme),
|
||||
material_theme(R.layout.onscreen_layout_material, R.layout.widget_layout_material, Gui.Theme.material_theme),
|
||||
material_light_theme(R.layout.onscreen_layout_material_light, R.layout.widget_layout_material_light, Gui.Theme.material_light_theme);
|
||||
|
||||
@LayoutRes
|
||||
private final int layout;
|
||||
private final int onscreenLayout;
|
||||
|
||||
@LayoutRes
|
||||
private final int widgetLayout;
|
||||
|
||||
@Nullable
|
||||
private final Gui.Theme appTheme;
|
||||
|
||||
Theme(int layout, @Nullable Gui.Theme appTheme) {
|
||||
this.layout = layout;
|
||||
@Nonnull
|
||||
private final Map<Gui.Theme, SimpleTheme> cache = new EnumMap<>(Gui.Theme.class);
|
||||
|
||||
SimpleTheme(int onscreenLayout, int widgetLayout, @Nullable Gui.Theme appTheme) {
|
||||
this.onscreenLayout = onscreenLayout;
|
||||
this.widgetLayout = widgetLayout;
|
||||
this.appTheme = appTheme;
|
||||
}
|
||||
|
||||
public int getLayout(@Nonnull Gui.Theme appTheme) {
|
||||
return resolveThemeFor(appTheme).layout;
|
||||
public int getOnscreenLayout(@Nonnull Gui.Theme appTheme) {
|
||||
return resolveThemeFor(appTheme).onscreenLayout;
|
||||
}
|
||||
|
||||
public int getWidgetLayout(@Nonnull Gui.Theme appTheme) {
|
||||
return resolveThemeFor(appTheme).widgetLayout;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Theme resolveThemeFor(@Nonnull Gui.Theme appTheme) {
|
||||
public SimpleTheme resolveThemeFor(@Nonnull Gui.Theme appTheme) {
|
||||
if (this == default_theme) {
|
||||
SimpleTheme theme = cache.get(appTheme);
|
||||
if (theme == null) {
|
||||
theme = lookUpThemeFor(appTheme);
|
||||
cache.put(appTheme, theme);
|
||||
}
|
||||
return theme;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private SimpleTheme lookUpThemeFor(@Nonnull Gui.Theme appTheme) {
|
||||
Check.isTrue(this == default_theme);
|
||||
// find direct match
|
||||
for (Theme theme : values()) {
|
||||
for (SimpleTheme theme : values()) {
|
||||
if (theme.appTheme == appTheme) {
|
||||
return theme;
|
||||
}
|
||||
@ -110,8 +132,6 @@ public final class Preferences {
|
||||
// for old themes return dark material
|
||||
return material_theme;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Gui.Theme getAppTheme() {
|
||||
@ -119,9 +139,22 @@ public final class Preferences {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Widget {
|
||||
public static final Preference<SimpleTheme> theme = StringPreference.ofEnum("widget.theme", SimpleTheme.default_theme, SimpleTheme.class);
|
||||
|
||||
@Nonnull
|
||||
public static Theme getTheme(@Nonnull SharedPreferences preferences) {
|
||||
public static SimpleTheme getTheme(@Nonnull SharedPreferences preferences) {
|
||||
return theme.getPreferenceNoError(preferences);
|
||||
}
|
||||
|
||||
}
|
||||
public static class Onscreen {
|
||||
public static final Preference<Boolean> startOnBoot = BooleanPreference.of("onscreen_start_on_boot", false);
|
||||
public static final Preference<Boolean> showAppIcon = BooleanPreference.of("onscreen_show_app_icon", true);
|
||||
public static final Preference<SimpleTheme> theme = StringPreference.ofEnum("onscreen.theme", SimpleTheme.default_theme, SimpleTheme.class);
|
||||
|
||||
@Nonnull
|
||||
public static SimpleTheme getTheme(@Nonnull SharedPreferences preferences) {
|
||||
return theme.getPreferenceNoError(preferences);
|
||||
}
|
||||
}
|
||||
@ -345,6 +378,8 @@ public final class Preferences {
|
||||
applyDefaultPreference(preferences, Onscreen.startOnBoot);
|
||||
applyDefaultPreference(preferences, Onscreen.theme);
|
||||
|
||||
applyDefaultPreference(preferences, Widget.theme);
|
||||
|
||||
applyDefaultPreference(preferences, Ga.initialReportDone);
|
||||
|
||||
|
||||
|
@ -150,9 +150,9 @@ public class CalculatorOnscreenView {
|
||||
final CalculatorOnscreenView result = new CalculatorOnscreenView();
|
||||
|
||||
final SharedPreferences p = App.getPreferences();
|
||||
final Preferences.Onscreen.Theme theme = Preferences.Onscreen.theme.getPreferenceNoError(p);
|
||||
final Preferences.SimpleTheme theme = Preferences.Onscreen.theme.getPreferenceNoError(p);
|
||||
final Preferences.Gui.Theme appTheme = Preferences.Gui.theme.getPreferenceNoError(p);
|
||||
result.root = View.inflate(context, theme.getLayout(appTheme), null);
|
||||
result.root = View.inflate(context, theme.getOnscreenLayout(appTheme), null);
|
||||
result.context = context;
|
||||
result.viewListener = viewListener;
|
||||
|
||||
|
@ -35,6 +35,7 @@ public class PreferencesActivity extends BaseActivity implements SharedPreferenc
|
||||
preferences.append(R.xml.preferences_plot, new PrefDef("screen-plot", R.string.prefs_graph_screen_title));
|
||||
preferences.append(R.xml.preferences_other, new PrefDef("screen-other", R.string.c_prefs_other_category));
|
||||
preferences.append(R.xml.preferences_onscreen, new PrefDef("screen-onscreen", R.string.prefs_onscreen_title));
|
||||
preferences.append(R.xml.preferences_widget, new PrefDef("screen-widget", R.string.prefs_widget_title));
|
||||
}
|
||||
|
||||
static class PrefDef {
|
||||
|
@ -34,7 +34,15 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.widget.RemoteViews;
|
||||
import org.solovyev.android.calculator.*;
|
||||
|
||||
import org.solovyev.android.calculator.App;
|
||||
import org.solovyev.android.calculator.CalculatorButton;
|
||||
import org.solovyev.android.calculator.CalculatorButtons;
|
||||
import org.solovyev.android.calculator.CalculatorDisplayViewState;
|
||||
import org.solovyev.android.calculator.CalculatorEditorViewState;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
import org.solovyev.android.calculator.Preferences;
|
||||
import org.solovyev.android.calculator.R;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@ -42,6 +50,7 @@ import javax.annotation.Nullable;
|
||||
import static android.content.Intent.ACTION_CONFIGURATION_CHANGED;
|
||||
import static org.solovyev.android.calculator.CalculatorBroadcaster.ACTION_DISPLAY_STATE_CHANGED;
|
||||
import static org.solovyev.android.calculator.CalculatorBroadcaster.ACTION_EDITOR_STATE_CHANGED;
|
||||
import static org.solovyev.android.calculator.CalculatorBroadcaster.ACTION_THEME_CHANGED;
|
||||
import static org.solovyev.android.calculator.CalculatorReceiver.newButtonClickedIntent;
|
||||
|
||||
/**
|
||||
@ -56,36 +65,12 @@ public abstract class BaseCalculatorWidgetProvider extends AppWidgetProvider {
|
||||
private static final String OPTION_APPWIDGET_HOST_CATEGORY = "appWidgetCategory";
|
||||
private static final String ACTION_APPWIDGET_OPTIONS_CHANGED = "android.appwidget.action.APPWIDGET_UPDATE_OPTIONS";
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
*
|
||||
* FIELDS
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
@Nullable
|
||||
private String cursorColor;
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
*
|
||||
* CONSTRUCTORS
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
protected BaseCalculatorWidgetProvider() {
|
||||
}
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
*
|
||||
* METHODS
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onEnabled(Context context) {
|
||||
super.onEnabled(context);
|
||||
@ -127,8 +112,9 @@ public abstract class BaseCalculatorWidgetProvider extends AppWidgetProvider {
|
||||
final CalculatorDisplayViewState displayState = Locator.getInstance().getDisplay().getViewState();
|
||||
|
||||
final Resources resources = context.getResources();
|
||||
final Preferences.SimpleTheme theme = App.getWidgetTheme().resolveThemeFor(App.getTheme());
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
final RemoteViews views = new RemoteViews(context.getPackageName(), getLayout(appWidgetManager, appWidgetId, resources));
|
||||
final RemoteViews views = new RemoteViews(context.getPackageName(), getLayout(appWidgetManager, appWidgetId, resources, theme));
|
||||
|
||||
for (CalculatorButton button : CalculatorButton.values()) {
|
||||
final PendingIntent pendingIntent = PendingIntent.getBroadcast(context, button.getButtonId(), newButtonClickedIntent(context, button), PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
@ -138,7 +124,7 @@ public abstract class BaseCalculatorWidgetProvider extends AppWidgetProvider {
|
||||
}
|
||||
|
||||
updateEditorState(context, views, editorState);
|
||||
updateDisplayState(context, views, displayState);
|
||||
updateDisplayState(context, views, displayState, theme);
|
||||
|
||||
CalculatorButtons.initMultiplicationButton(views);
|
||||
|
||||
@ -146,15 +132,15 @@ public abstract class BaseCalculatorWidgetProvider extends AppWidgetProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private int getLayout(@Nonnull AppWidgetManager appWidgetManager, int appWidgetId, @Nonnull Resources resources) {
|
||||
private int getLayout(@Nonnull AppWidgetManager appWidgetManager, int appWidgetId, @Nonnull Resources resources, @Nonnull Preferences.SimpleTheme theme) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
return getLayoutJellyBean(appWidgetManager, appWidgetId, resources);
|
||||
return getLayoutJellyBean(appWidgetManager, appWidgetId, resources, theme);
|
||||
}
|
||||
return R.layout.widget_layout;
|
||||
return theme.getWidgetLayout(App.getTheme());
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
private int getLayoutJellyBean(AppWidgetManager appWidgetManager, int appWidgetId, Resources resources) {
|
||||
private int getLayoutJellyBean(@Nonnull AppWidgetManager appWidgetManager, int appWidgetId, Resources resources, @Nonnull Preferences.SimpleTheme theme) {
|
||||
final Bundle options = appWidgetManager.getAppWidgetOptions(appWidgetId);
|
||||
|
||||
if (options != null) {
|
||||
@ -164,7 +150,7 @@ public abstract class BaseCalculatorWidgetProvider extends AppWidgetProvider {
|
||||
if (category != -1) {
|
||||
// If the value is WIDGET_CATEGORY_KEYGUARD, it's a lockscreen widget
|
||||
final boolean keyguard = category == WIDGET_CATEGORY_KEYGUARD;
|
||||
if(keyguard) {
|
||||
if (keyguard) {
|
||||
final int minHeightDp = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, -1);
|
||||
final int minHeight = resources.getDimensionPixelSize(R.dimen.min_expanded_height_lock_screen);
|
||||
final boolean expanded = (minHeightDp >= minHeight / resources.getDisplayMetrics().density);
|
||||
@ -176,11 +162,11 @@ public abstract class BaseCalculatorWidgetProvider extends AppWidgetProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.layout.widget_layout;
|
||||
return theme.getWidgetLayout(App.getTheme());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
public void onReceive(@Nonnull Context context, @Nonnull Intent intent) {
|
||||
super.onReceive(context, intent);
|
||||
|
||||
final String action = intent.getAction();
|
||||
@ -192,15 +178,18 @@ public abstract class BaseCalculatorWidgetProvider extends AppWidgetProvider {
|
||||
updateState(context);
|
||||
} else if (ACTION_APPWIDGET_OPTIONS_CHANGED.equals(action)) {
|
||||
updateState(context);
|
||||
} else if (ACTION_THEME_CHANGED.equals(action)) {
|
||||
updateState(context);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDisplayState(@Nonnull Context context, @Nonnull RemoteViews views, @Nonnull CalculatorDisplayViewState displayState) {
|
||||
private void updateDisplayState(@Nonnull Context context, @Nonnull RemoteViews views, @Nonnull CalculatorDisplayViewState displayState, @Nonnull Preferences.SimpleTheme theme) {
|
||||
final Resources resources = context.getResources();
|
||||
if (displayState.isValid()) {
|
||||
views.setTextViewText(R.id.calculator_display, displayState.getText());
|
||||
views.setTextColor(R.id.calculator_display, context.getResources().getColor(R.color.cpp_text));
|
||||
views.setTextColor(R.id.calculator_display, resources.getColor(theme == Preferences.SimpleTheme.material_light_theme ? R.color.cpp_text_inverse : R.color.cpp_text));
|
||||
} else {
|
||||
views.setTextColor(R.id.calculator_display, context.getResources().getColor(R.color.cpp_text_error));
|
||||
views.setTextColor(R.id.calculator_display, resources.getColor(theme == Preferences.SimpleTheme.material_light_theme ? R.color.cpp_text_inverse_error : R.color.cpp_text_error));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button a:id="@id/cpp_button_operators"
|
||||
style="@style/CppKeyboardButton.Material.Simple.Control"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:text="∂,…"
|
||||
a:textStyle="italic" />
|
@ -0,0 +1,29 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button a:id="@id/cpp_button_operators"
|
||||
style="@style/CppKeyboardButton.Material.Light.Simple.Control"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:text="∂,…"
|
||||
a:textStyle="italic" />
|
@ -0,0 +1,29 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton a:id="@id/cpp_button_paste"
|
||||
style="@style/CppKeyboardButton.Material.Simple.Control.Image"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:contentDescription="Paste"
|
||||
a:src="@drawable/kb_paste" />
|
@ -0,0 +1,29 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton a:id="@id/cpp_button_paste"
|
||||
style="@style/CppKeyboardButton.Material.Light.Simple.Control.Image"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:contentDescription="Paste"
|
||||
a:src="@drawable/kb_paste" />
|
@ -0,0 +1,28 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button a:id="@id/cpp_button_right"
|
||||
style="@style/CppKeyboardButton.Material.Simple.Control"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:text="▷" />
|
@ -0,0 +1,28 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button a:id="@id/cpp_button_right"
|
||||
style="@style/CppKeyboardButton.Material.Light.Simple.Control"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:text="▷" />
|
@ -0,0 +1,29 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton a:id="@id/cpp_button_settings"
|
||||
style="@style/CppKeyboardButton.Material.Simple.Control.Image"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:contentDescription="Settings"
|
||||
a:src="@drawable/kb_settings" />
|
@ -0,0 +1,29 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton a:id="@id/cpp_button_settings"
|
||||
style="@style/CppKeyboardButton.Material.Light.Simple.Control.Image"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:contentDescription="Settings"
|
||||
a:src="@drawable/kb_settings" />
|
@ -0,0 +1,29 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button a:id="@id/cpp_button_vars"
|
||||
style="@style/CppKeyboardButton.Material.Simple.Control"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:text="π,…"
|
||||
a:textStyle="italic" />
|
@ -0,0 +1,29 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button a:id="@id/cpp_button_vars"
|
||||
style="@style/CppKeyboardButton.Material.Light.Simple.Control"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:text="π,…"
|
||||
a:textStyle="italic" />
|
15
android-app/src/main/res/layout/widget_display_light.xml
Normal file
15
android-app/src/main/res/layout/widget_display_light.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||
~ For more information, please, contact se.solovyev@gmail.com
|
||||
~ or visit http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<TextView a:id="@+id/calculator_display"
|
||||
style="@style/CppText.Display.Widget.Light"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:padding="@dimen/cpp_display_padding"
|
||||
a:scrollbars="vertical"
|
||||
a:singleLine="false"
|
||||
a:textIsSelectable="true" />
|
@ -6,8 +6,7 @@
|
||||
~ or visit http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<LinearLayout a:id="@+id/main_fragment_layout"
|
||||
style="@style/CppFragment"
|
||||
<FrameLayout a:id="@+id/main_fragment_layout"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
@ -21,4 +20,4 @@
|
||||
a:singleLine="false"
|
||||
a:textIsSelectable="true" />
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
23
android-app/src/main/res/layout/widget_editor_light.xml
Normal file
23
android-app/src/main/res/layout/widget_editor_light.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||
~ For more information, please, contact se.solovyev@gmail.com
|
||||
~ or visit http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<LinearLayout a:id="@+id/main_fragment_layout"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:padding="@dimen/cpp_editor_padding">
|
||||
|
||||
<TextView
|
||||
a:id="@+id/calculator_editor"
|
||||
style="@style/CppText.Editor.Widget.Light"
|
||||
a:hint="@string/c_calc_editor_hint"
|
||||
a:scrollbars="vertical"
|
||||
a:singleLine="false"
|
||||
a:textIsSelectable="true" />
|
||||
|
||||
</LinearLayout>
|
126
android-app/src/main/res/layout/widget_keyboard_material.xml
Normal file
126
android-app/src/main/res/layout/widget_keyboard_material.xml
Normal file
@ -0,0 +1,126 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1">
|
||||
|
||||
<include layout="@layout/cpp_simple_button_7_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_8_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_9_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_multiplication_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_percent_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_clear_material" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1">
|
||||
|
||||
<include layout="@layout/cpp_simple_button_4_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_5_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_6_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_division_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_power_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_erase_material" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1">
|
||||
|
||||
<include layout="@layout/cpp_simple_button_1_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_2_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_3_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_plus_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_settings_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_copy_material" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1">
|
||||
|
||||
<include layout="@layout/cpp_simple_button_round_brackets_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_0_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_dot_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_minus_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_app_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_paste_material" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1">
|
||||
|
||||
<include layout="@layout/cpp_simple_button_left_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_right_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_vars_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_functions_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_operators_material" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_history_material" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,126 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1">
|
||||
|
||||
<include layout="@layout/cpp_simple_button_7_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_8_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_9_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_multiplication_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_percent_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_clear_material_light" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1">
|
||||
|
||||
<include layout="@layout/cpp_simple_button_4_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_5_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_6_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_division_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_power_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_erase_material_light" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1">
|
||||
|
||||
<include layout="@layout/cpp_simple_button_1_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_2_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_3_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_plus_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_settings_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_copy_material_light" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1">
|
||||
|
||||
<include layout="@layout/cpp_simple_button_round_brackets_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_0_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_dot_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_minus_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_app_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_paste_material_light" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1">
|
||||
|
||||
<include layout="@layout/cpp_simple_button_left_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_right_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_vars_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_functions_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_operators_material_light" />
|
||||
|
||||
<include layout="@layout/cpp_simple_button_history_material_light" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -34,7 +34,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/cpp_simple_keyboard"
|
||||
layout="@layout/widget_keyboard"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="5"/>
|
||||
|
42
android-app/src/main/res/layout/widget_layout_material.xml
Normal file
42
android-app/src/main/res/layout/widget_layout_material.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/CppMain.Widget"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:orientation="vertical">
|
||||
|
||||
<include
|
||||
layout="@layout/widget_editor"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="2"/>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1"
|
||||
a:baselineAligned="false">
|
||||
|
||||
<include
|
||||
layout="@layout/cpp_simple_button_equals_material"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="match_parent"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<include
|
||||
layout="@layout/widget_display"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_weight="5"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/widget_keyboard_material"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="5"/>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout
|
||||
style="@style/CppMain.Widget.Light"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:orientation="vertical">
|
||||
|
||||
<include
|
||||
layout="@layout/widget_editor_light"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="2"/>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1"
|
||||
a:baselineAligned="false">
|
||||
|
||||
<include
|
||||
layout="@layout/cpp_simple_button_equals_material_light"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="match_parent"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<include
|
||||
layout="@layout/widget_display_light"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_weight="5"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/widget_keyboard_material_light"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="5"/>
|
||||
|
||||
</LinearLayout>
|
@ -36,13 +36,13 @@
|
||||
<item>metro_purple_theme</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="p_onscreen_theme_names">
|
||||
<item>@string/p_onscreen_use_app_theme</item>
|
||||
<string-array name="p_simple_theme_names">
|
||||
<item>@string/p_use_app_theme</item>
|
||||
<item>@string/p_material_theme</item>
|
||||
<item>@string/p_material_light_theme</item>
|
||||
<item>@string/p_metro_blue_theme</item>
|
||||
</string-array>
|
||||
<string-array name="p_onscreen_theme_values" translatable="false">
|
||||
<string-array name="p_simple_theme_values" translatable="false">
|
||||
<item>default_theme</item>
|
||||
<item>material_theme</item>
|
||||
<item>material_light_theme</item>
|
||||
|
@ -102,16 +102,28 @@
|
||||
<item name="android:layout_margin">@dimen/cpp_widget_margin</item>
|
||||
</style>
|
||||
|
||||
<style name="CppMain.Widget.Light" parent="CppMain.Widget">
|
||||
<item name="android:background">@color/cpp_main_bg_light</item>
|
||||
</style>
|
||||
|
||||
<style name="CppText.Editor.Widget" parent="CppText.Editor">
|
||||
<item name="android:textSize">@dimen/cpp_widget_editor_text_size</item>
|
||||
<item name="android:textColor">@color/cpp_text</item>
|
||||
</style>
|
||||
|
||||
<style name="CppText.Editor.Widget.Light" parent="CppText.Editor.Widget">
|
||||
<item name="android:textColor">@color/cpp_text_inverse</item>
|
||||
</style>
|
||||
|
||||
<style name="CppText.Display.Widget" parent="CppText.Display">
|
||||
<item name="android:textSize">@dimen/cpp_widget_display_text_size</item>
|
||||
<item name="android:textColor">@color/cpp_text</item>
|
||||
</style>
|
||||
|
||||
<style name="CppText.Display.Widget.Light" parent="CppText.Display.Widget">
|
||||
<item name="android:textColor">@color/cpp_text_inverse</item>
|
||||
</style>
|
||||
|
||||
<style name="CppMain.Onscreen" parent="CppMain">
|
||||
<item name="android:background">@color/cpp_main_bg</item>
|
||||
<item name="android:padding">@dimen/cpp_onscreen_main_padding</item>
|
||||
|
@ -64,7 +64,7 @@
|
||||
<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_onscreen_use_app_theme">App theme</string>
|
||||
<string name="p_use_app_theme">App theme</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 precision regardless of the value of this option)</string>
|
||||
@ -177,6 +177,7 @@
|
||||
<string name="c_app_widget_4x5_name">Calculator++ Widget (4x5)</string>
|
||||
<string name="open_onscreen_calculator">Click to open calculator in window mode</string>
|
||||
<string name="prefs_onscreen_title">Calculator (in separate window) settings</string>
|
||||
<string name="prefs_widget_title">Widget settings</string>
|
||||
<string name="prefs_onscreen_start_on_boot_title">Start on boot</string>
|
||||
<string name="prefs_onscreen_start_on_boot_summary">If turned on Calculator++ will appear in notification bar after device boot</string>
|
||||
<string name="prefs_onscreen_show_app_icon_title">Show separate icon (require reboot)</string>
|
||||
|
@ -50,5 +50,8 @@
|
||||
<Preference
|
||||
a:title="@string/prefs_onscreen_title"
|
||||
a:key="screen-onscreen" />
|
||||
<Preference
|
||||
a:title="@string/prefs_widget_title"
|
||||
a:key="screen-widget" />
|
||||
|
||||
</PreferenceScreen>
|
@ -25,10 +25,9 @@
|
||||
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<ListPreference
|
||||
a:entries="@array/p_onscreen_theme_names"
|
||||
a:entryValues="@array/p_onscreen_theme_values"
|
||||
a:entries="@array/p_simple_theme_names"
|
||||
a:entryValues="@array/p_simple_theme_values"
|
||||
a:key="onscreen.theme"
|
||||
a:summary="@string/c_calc_theme_summary"
|
||||
a:title="@string/c_calc_theme"/>
|
||||
|
||||
<android.preference.CheckBoxPreference
|
||||
|
33
android-app/src/main/res/xml/preferences_widget.xml
Normal file
33
android-app/src/main/res/xml/preferences_widget.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<ListPreference
|
||||
a:entries="@array/p_simple_theme_names"
|
||||
a:entryValues="@array/p_simple_theme_values"
|
||||
a:key="widget.theme"
|
||||
a:title="@string/c_calc_theme"/>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user