EditHistoryFragment

This commit is contained in:
serso 2016-01-14 17:34:19 +01:00
parent 6eb6b3cabe
commit 4dc87854d8
18 changed files with 342 additions and 46 deletions

View File

@ -99,6 +99,7 @@ dependencies {
} }
compile 'commons-cli:commons-cli:1.2' compile 'commons-cli:commons-cli:1.2'
compile 'com.squareup:otto:1.3.8' compile 'com.squareup:otto:1.3.8'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.dagger:dagger:2.0.2' compile 'com.google.dagger:dagger:2.0.2'
apt "com.google.dagger:dagger-compiler:2.0.2" apt "com.google.dagger:dagger-compiler:2.0.2"

View File

@ -76,7 +76,7 @@
android:finishOnTaskLaunch="true" android:finishOnTaskLaunch="true"
android:label="@string/calculation_messages_dialog_title" android:label="@string/calculation_messages_dialog_title"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@style/Cpp.Theme.Dialog.Material" /> android:theme="@style/Cpp.Theme.Material.Dialog" />
<activity <activity
android:name=".about.CalculatorAboutActivity" android:name=".about.CalculatorAboutActivity"
@ -110,24 +110,24 @@
<activity <activity
android:name=".plot.CalculatorPlotFunctionsActivity" android:name=".plot.CalculatorPlotFunctionsActivity"
android:label="@string/cpp_plot_functions" android:label="@string/cpp_plot_functions"
android:theme="@style/Cpp.Theme.Dialog.Material" /> android:theme="@style/Cpp.Theme.Material.Dialog" />
<activity <activity
android:name=".plot.CalculatorPlotFunctionSettingsActivity" android:name=".plot.CalculatorPlotFunctionSettingsActivity"
android:label="@string/cpp_plot_function_settings" android:label="@string/cpp_plot_function_settings"
android:theme="@style/Cpp.Theme.Dialog.Material" /> android:theme="@style/Cpp.Theme.Material.Dialog" />
<activity <activity
android:name=".plot.CalculatorPlotRangeActivity" android:name=".plot.CalculatorPlotRangeActivity"
android:label="@string/cpp_plot_range" android:label="@string/cpp_plot_range"
android:theme="@style/Cpp.Theme.Dialog.Material" /> android:theme="@style/Cpp.Theme.Material.Dialog" />
<activity <activity
android:name=".preferences.PurchaseDialogActivity" android:name=".preferences.PurchaseDialogActivity"
android:label="@string/cpp_purchase_title" android:label="@string/cpp_purchase_title"
android:theme="@style/Cpp.Theme.Dialog.Material" /> android:theme="@style/Cpp.Theme.Material.Dialog" />
<activity <activity
android:name=".CalculatorDialogActivity" android:name=".CalculatorDialogActivity"
android:theme="@style/Cpp.Theme.Dialog.Material" /> android:theme="@style/Cpp.Theme.Material.Dialog" />
<!-- todo serso: strings--> <!-- todo serso: strings-->
<activity <activity
@ -145,7 +145,7 @@
android:icon="@drawable/ic_launcher_window" android:icon="@drawable/ic_launcher_window"
android:label="@string/c_app_name_on_screen" android:label="@string/c_app_name_on_screen"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/Cpp.Theme.Dialog.Material"> android:theme="@style/Cpp.Theme.Material.Dialog">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@ -1,11 +1,12 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import dagger.Component;
import org.solovyev.android.calculator.history.BaseHistoryFragment; import org.solovyev.android.calculator.history.BaseHistoryFragment;
import org.solovyev.android.calculator.onscreen.CalculatorOnscreenService; import org.solovyev.android.calculator.onscreen.CalculatorOnscreenService;
import javax.inject.Singleton; import javax.inject.Singleton;
import dagger.Component;
@Singleton @Singleton
@Component(modules = AppModule.class) @Component(modules = AppModule.class)
public interface AppComponent { public interface AppComponent {
@ -14,4 +15,5 @@ public interface AppComponent {
void inject(BaseUi ui); void inject(BaseUi ui);
void inject(CalculatorOnscreenService service); void inject(CalculatorOnscreenService service);
void inject(BaseHistoryFragment fragment); void inject(BaseHistoryFragment fragment);
void inject(BaseDialogFragment fragment);
} }

View File

@ -0,0 +1,44 @@
package org.solovyev.android.calculator;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import javax.inject.Inject;
public abstract class BaseDialogFragment extends DialogFragment {
@Inject
SharedPreferences preferences;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((CalculatorApplication) getActivity().getApplication()).getComponent().inject(this);
}
@NonNull
@Override
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
final Preferences.Gui.Theme theme = Preferences.Gui.getTheme(preferences);
final Context context = getActivity();
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = onCreateDialogView(context, inflater, savedInstanceState);
final int spacing = context.getResources().getDimensionPixelSize(R.dimen.cpp_dialog_spacing);
final AlertDialog.Builder b = new AlertDialog.Builder(context, theme.alertDialogTheme);
b.setView(view, spacing, spacing, spacing, spacing);
onPrepareDialog(b);
return b.create();
}
protected abstract void onPrepareDialog(@NonNull AlertDialog.Builder builder);
@NonNull
protected abstract View onCreateDialogView(@NonNull Context context, @NonNull LayoutInflater inflater, @Nullable Bundle savedInstanceState);
}

View File

@ -22,6 +22,8 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils; import android.text.TextUtils;
import org.json.JSONException; import org.json.JSONException;
@ -33,8 +35,19 @@ import javax.annotation.Nullable;
import jscl.math.Generic; import jscl.math.Generic;
public class DisplayState { public class DisplayState implements Parcelable {
public static final Creator<DisplayState> CREATOR = new Creator<DisplayState>() {
@Override
public DisplayState createFromParcel(Parcel in) {
return new DisplayState(in);
}
@Override
public DisplayState[] newArray(int size) {
return new DisplayState[size];
}
};
private static final String JSON_TEXT = "t"; private static final String JSON_TEXT = "t";
@Nonnull @Nonnull
public final String text; public final String text;
@ -55,6 +68,12 @@ public class DisplayState {
this(json.optString(JSON_TEXT), true, EditorState.NO_SEQUENCE); this(json.optString(JSON_TEXT), true, EditorState.NO_SEQUENCE);
} }
private DisplayState(Parcel in) {
text = in.readString();
valid = in.readByte() != 0;
sequence = in.readLong();
}
@Nonnull @Nonnull
public static DisplayState empty() { public static DisplayState empty() {
return new DisplayState("", true, EditorState.NO_SEQUENCE); return new DisplayState("", true, EditorState.NO_SEQUENCE);
@ -114,4 +133,16 @@ public class DisplayState {
", operation=" + operation + ", operation=" + operation +
'}'; '}';
} }
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(text);
dest.writeByte((byte) (valid ? 1 : 0));
dest.writeLong(sequence);
}
} }

View File

@ -22,6 +22,8 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils; import android.text.TextUtils;
import org.json.JSONException; import org.json.JSONException;
@ -32,13 +34,23 @@ import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class EditorState { public class EditorState implements Parcelable {
public static final long NO_SEQUENCE = -1; public static final long NO_SEQUENCE = -1;
public static final Creator<EditorState> CREATOR = new Creator<EditorState>() {
@Override
public EditorState createFromParcel(Parcel in) {
return new EditorState(in);
}
@Override
public EditorState[] newArray(int size) {
return new EditorState[size];
}
};
private static final String JSON_TEXT = "t"; private static final String JSON_TEXT = "t";
private static final String JSON_SELECTION = "s"; private static final String JSON_SELECTION = "s";
private static AtomicLong counter = new AtomicLong(NO_SEQUENCE + 1); private static AtomicLong counter = new AtomicLong(NO_SEQUENCE + 1);
public final long sequence; public final long sequence;
@Nonnull @Nonnull
public final CharSequence text; public final CharSequence text;
@ -60,6 +72,13 @@ public class EditorState {
this(json.optString(JSON_TEXT), json.optInt(JSON_SELECTION)); this(json.optString(JSON_TEXT), json.optInt(JSON_SELECTION));
} }
private EditorState(Parcel in) {
sequence = in.readLong();
selection = in.readInt();
textString = in.readString();
text = textString;
}
@Nonnull @Nonnull
public static EditorState empty() { public static EditorState empty() {
return new EditorState(); return new EditorState();
@ -108,4 +127,16 @@ public class EditorState {
json.put(JSON_SELECTION, selection); json.put(JSON_SELECTION, selection);
return json; return json;
} }
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(sequence);
dest.writeInt(selection);
dest.writeString(textString);
}
} }

View File

@ -31,23 +31,31 @@ import android.support.annotation.LayoutRes;
import android.support.annotation.StyleRes; import android.support.annotation.StyleRes;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
import jscl.AngleUnit;
import jscl.NumeralBase;
import org.solovyev.android.Check; import org.solovyev.android.Check;
import org.solovyev.android.calculator.language.Languages; import org.solovyev.android.calculator.language.Languages;
import org.solovyev.android.calculator.math.MathType; import org.solovyev.android.calculator.math.MathType;
import org.solovyev.android.calculator.model.AndroidCalculatorEngine; import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
import org.solovyev.android.calculator.preferences.PurchaseDialogActivity; import org.solovyev.android.calculator.preferences.PurchaseDialogActivity;
import org.solovyev.android.calculator.wizard.WizardActivity; import org.solovyev.android.calculator.wizard.WizardActivity;
import org.solovyev.android.prefs.*; import org.solovyev.android.prefs.BooleanPreference;
import org.solovyev.android.prefs.IntegerPreference;
import org.solovyev.android.prefs.LongPreference;
import org.solovyev.android.prefs.NumberToStringPreference;
import org.solovyev.android.prefs.Preference;
import org.solovyev.android.prefs.StringPreference;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import jscl.AngleUnit;
import jscl.NumeralBase;
import static org.solovyev.android.Android.isPhoneModel; import static org.solovyev.android.Android.isPhoneModel;
import static org.solovyev.android.DeviceModel.samsung_galaxy_s; import static org.solovyev.android.DeviceModel.samsung_galaxy_s;
import static org.solovyev.android.DeviceModel.samsung_galaxy_s_2; import static org.solovyev.android.DeviceModel.samsung_galaxy_s_2;
@ -275,11 +283,11 @@ public final class Preferences {
default_theme(R.style.Cpp_Theme_Gray), default_theme(R.style.Cpp_Theme_Gray),
violet_theme(R.style.Cpp_Theme_Violet), violet_theme(R.style.Cpp_Theme_Violet),
light_blue_theme(R.style.Cpp_Theme_Blue), light_blue_theme(R.style.Cpp_Theme_Blue),
metro_blue_theme(R.style.cpp_metro_blue_theme), metro_blue_theme(R.style.Cpp_Theme_Metro_Blue),
metro_purple_theme(R.style.cpp_metro_purple_theme), metro_purple_theme(R.style.Cpp_Theme_Metro_Purple),
metro_green_theme(R.style.cpp_metro_green_theme), metro_green_theme(R.style.Cpp_Theme_Metro_Green),
material_theme(R.style.Cpp_Theme_Material), 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_Dialog_Material_Light); material_light_theme(R.style.Cpp_Theme_Material_Light, R.style.Cpp_Theme_Wizard_Light, R.style.Cpp_Theme_Material_Light_Dialog, R.style.Cpp_Theme_Material_Light_Dialog_Alert);
private static final SparseArray<TextColor> textColors = new SparseArray<>(); private static final SparseArray<TextColor> textColors = new SparseArray<>();
@ -289,16 +297,19 @@ public final class Preferences {
public final int wizardTheme; public final int wizardTheme;
@StyleRes @StyleRes
public final int dialogTheme; public final int dialogTheme;
@StyleRes
public final int alertDialogTheme;
public final boolean light; public final boolean light;
Theme(@StyleRes int theme) { Theme(@StyleRes int theme) {
this(theme, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Dialog_Material); this(theme, R.style.Cpp_Theme_Wizard, R.style.Cpp_Theme_Material_Dialog, R.style.Cpp_Theme_Material_Dialog_Alert);
} }
Theme(@StyleRes int theme, @StyleRes int wizardTheme, @StyleRes int dialogTheme) { Theme(@StyleRes int theme, @StyleRes int wizardTheme, @StyleRes int dialogTheme, @StyleRes int alertDialogTheme) {
this.theme = theme; this.theme = theme;
this.wizardTheme = wizardTheme; this.wizardTheme = wizardTheme;
this.dialogTheme = dialogTheme; this.dialogTheme = dialogTheme;
this.alertDialogTheme = alertDialogTheme;
this.light = theme == R.style.Cpp_Theme_Material_Light; this.light = theme == R.style.Cpp_Theme_Material_Light;
} }

View File

@ -30,20 +30,37 @@ import android.os.Bundle;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment; import android.support.v4.app.ListFragment;
import android.text.ClipboardManager; import android.text.ClipboardManager;
import android.view.*; import android.view.ContextMenu;
import android.widget.*; import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.melnykov.fab.FloatingActionButton; import com.melnykov.fab.FloatingActionButton;
import com.squareup.otto.Bus; import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe; import com.squareup.otto.Subscribe;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.App;
import org.solovyev.android.calculator.CalculatorActivity;
import org.solovyev.android.calculator.CalculatorApplication;
import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.FragmentUi;
import org.solovyev.android.calculator.R;
import org.solovyev.android.calculator.jscl.JsclOperation; import org.solovyev.android.calculator.jscl.JsclOperation;
import org.solovyev.common.text.Strings; import org.solovyev.common.text.Strings;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
import static android.view.Menu.NONE; import static android.view.Menu.NONE;
@ -160,8 +177,7 @@ public abstract class BaseHistoryFragment extends ListFragment {
final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
final HistoryState state = (HistoryState) getListView().getItemAtPosition(info.position); final HistoryState state = (HistoryState) getListView().getItemAtPosition(info.position);
// todo serso: fix if (!isRecentHistory()) {
if (true) {
menu.add(NONE, R.string.c_use, NONE, R.string.c_use); menu.add(NONE, R.string.c_use, NONE, R.string.c_use);
menu.add(NONE, R.string.c_copy_expression, NONE, R.string.c_copy_expression); menu.add(NONE, R.string.c_copy_expression, NONE, R.string.c_copy_expression);
if (shouldHaveCopyResult(state)) { if (shouldHaveCopyResult(state)) {
@ -206,7 +222,7 @@ public abstract class BaseHistoryFragment extends ListFragment {
} }
return true; return true;
case R.string.c_save: case R.string.c_save:
createEditHistoryDialog(state, context, true); EditHistoryFragment.show(state, getFragmentManager());
return true; return true;
case R.string.c_edit: case R.string.c_edit:
createEditHistoryDialog(state, context, false); createEditHistoryDialog(state, context, false);

View File

@ -0,0 +1,61 @@
package org.solovyev.android.calculator.history;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import org.solovyev.android.calculator.BaseDialogFragment;
import org.solovyev.android.calculator.R;
import butterknife.Bind;
import butterknife.ButterKnife;
public class EditHistoryFragment extends BaseDialogFragment {
public static final String ARG_STATE = "state";
@Bind(R.id.history_edit_expression)
TextView expressionView;
@Bind(R.id.history_edit_comment)
EditText commentView;
private HistoryState state;
public static void show(@NonNull HistoryState state, @NonNull FragmentManager fm) {
final EditHistoryFragment fragment = new EditHistoryFragment();
final Bundle args = new Bundle();
args.putParcelable(ARG_STATE, state);
fragment.setArguments(args);
fragment.show(fm, "edit-history-fragment");
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
state = getArguments().getParcelable(ARG_STATE);
}
@Override
protected void onPrepareDialog(@NonNull AlertDialog.Builder builder) {
}
@NonNull
@Override
protected View onCreateDialogView(@NonNull Context context, @NonNull LayoutInflater inflater, @Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.history_edit, null);
ButterKnife.bind(this, view);
if (savedInstanceState == null) {
expressionView.setText(BaseHistoryFragment.getHistoryText(state));
commentView.setText(state.getComment());
}
return view;
}
}

View File

@ -1,5 +1,9 @@
package org.solovyev.android.calculator.history; package org.solovyev.android.calculator.history;
import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.solovyev.android.Check; import org.solovyev.android.Check;
@ -11,13 +15,23 @@ import javax.annotation.Nullable;
import static android.text.TextUtils.isEmpty; import static android.text.TextUtils.isEmpty;
public class HistoryState { public class HistoryState implements Parcelable {
public static final Creator<HistoryState> CREATOR = new Creator<HistoryState>() {
@Override
public HistoryState createFromParcel(Parcel in) {
return new HistoryState(in);
}
@Override
public HistoryState[] newArray(int size) {
return new HistoryState[size];
}
};
private static final String JSON_EDITOR = "e"; private static final String JSON_EDITOR = "e";
private static final String JSON_DISPLAY = "d"; private static final String JSON_DISPLAY = "d";
private static final String JSON_TIME = "t"; private static final String JSON_TIME = "t";
private static final String JSON_COMMENT = "c"; private static final String JSON_COMMENT = "c";
@Nonnull @Nonnull
public final EditorState editor; public final EditorState editor;
@Nonnull @Nonnull
@ -37,6 +51,13 @@ public class HistoryState {
this.comment = json.optString(JSON_COMMENT, ""); this.comment = json.optString(JSON_COMMENT, "");
} }
private HistoryState(Parcel in) {
editor = in.readParcelable(EditorState.class.getClassLoader());
display = in.readParcelable(DisplayState.class.getClassLoader());
time = in.readLong();
comment = in.readString();
}
@Nonnull @Nonnull
public static Builder newBuilder(@Nonnull EditorState editor, @Nonnull DisplayState display) { public static Builder newBuilder(@Nonnull EditorState editor, @Nonnull DisplayState display) {
return new Builder(editor, display); return new Builder(editor, display);
@ -92,6 +113,20 @@ public class HistoryState {
'}'; '}';
} }
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(editor, flags);
dest.writeParcelable(display, flags);
dest.writeLong(time);
dest.writeString(comment);
}
@SuppressLint("ParcelCreator")
public static final class Builder extends HistoryState { public static final class Builder extends HistoryState {
private boolean built; private boolean built;

View File

@ -23,8 +23,8 @@
--> -->
<ScrollView xmlns:a="http://schemas.android.com/apk/res/android" <ScrollView xmlns:a="http://schemas.android.com/apk/res/android"
a:layout_width="fill_parent" a:layout_width="wrap_content"
a:layout_height="fill_parent"> a:layout_height="wrap_content">
<LinearLayout <LinearLayout
a:id="@+id/history_edit" a:id="@+id/history_edit"
@ -35,7 +35,6 @@
a:scrollbars="vertical"> a:scrollbars="vertical">
<TextView <TextView
style="@style/cpp_default_text_size"
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_height="fill_parent" a:layout_height="fill_parent"
a:padding="6dp" a:padding="6dp"
@ -43,14 +42,12 @@
<TextView <TextView
a:id="@+id/history_edit_expression" a:id="@+id/history_edit_expression"
style="@style/cpp_default_text_size"
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_height="wrap_content" a:layout_height="wrap_content"
a:padding="6dp" a:padding="6dp"
a:textStyle="bold"></TextView> a:textStyle="bold" />
<TextView <TextView
style="@style/cpp_default_text_size"
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_height="fill_parent" a:layout_height="fill_parent"
a:padding="6dp" a:padding="6dp"
@ -58,12 +55,11 @@
<EditText <EditText
a:id="@+id/history_edit_comment" a:id="@+id/history_edit_comment"
style="@style/cpp_default_text_size"
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_height="wrap_content" a:layout_height="wrap_content"
a:gravity="top|left"
a:maxLines="4" a:maxLines="4"
a:minLines="4"></EditText> a:minLines="4"
a:inputType="text" />
</LinearLayout> </LinearLayout>

View File

@ -37,4 +37,6 @@
<dimen name="activity_vertical_margin">5dp</dimen> <dimen name="activity_vertical_margin">5dp</dimen>
<dimen name="control_margin">5dp</dimen> <dimen name="control_margin">5dp</dimen>
<dimen name="cpp_onscreen_main_padding">1dp</dimen> <dimen name="cpp_onscreen_main_padding">1dp</dimen>
<dimen name="cpp_dialog_spacing">20dp</dimen>
</resources> </resources>

View File

@ -68,6 +68,30 @@
<item name="cpp_text_color_error">@color/cpp_text_error</item> <item name="cpp_text_color_error">@color/cpp_text_error</item>
</style> </style>
<style name="Cpp.Theme.Dialog.Alert" parent="@style/Theme.AppCompat.Dialog.Alert">
<item name="colorPrimary">@color/cpp_metro_button</item>
<item name="android:colorPrimary">@color/cpp_metro_button</item>
<item name="colorPrimaryDark">@color/cpp_metro_button_dark</item>
<item name="android:colorPrimaryDark">@color/cpp_metro_button_dark</item>
<item name="colorAccent">@color/cpp_material_accent</item>
<item name="android:colorAccent">@color/cpp_material_accent</item>
<item name="android:colorEdgeEffect">@color/cpp_material_accent</item>
<item name="android:statusBarColor">@color/cpp_status_bar</item>
<item name="windowNoTitle">false</item>
<item name="android:windowNoTitle">false</item>
<item name="android:windowTitleBackgroundStyle">@android:color/transparent</item>
<item name="windowActionBar">false</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowCloseOnTouchOutside">false</item>
<item name="cpp_main_bg">@color/cpp_main_bg</item>
<item name="cpp_pane_bg">@drawable/pane</item>
<item name="cpp_fab_bg">@color/cpp_material_grey</item>
<item name="cpp_text_color">@color/cpp_text</item>
<item name="cpp_text_color_error">@color/cpp_text_error</item>
</style>
<style name="Cpp.Theme.Light" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <style name="Cpp.Theme.Light" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowBackground">@color/cpp_main_bg_light</item> <item name="android:windowBackground">@color/cpp_main_bg_light</item>
@ -112,6 +136,29 @@
<item name="cpp_text_color_error">@color/cpp_text_inverse_error</item> <item name="cpp_text_color_error">@color/cpp_text_inverse_error</item>
</style> </style>
<style name="Cpp.Theme.Light.Dialog.Alert" parent="@style/Theme.AppCompat.Light.Dialog.Alert">
<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_material_light</item>
<item name="android:colorAccent">@color/cpp_material_light</item>
<item name="android:statusBarColor">@color/cpp_status_bar_light</item>
<item name="windowNoTitle">false</item>
<item name="android:windowNoTitle">false</item>
<item name="android:windowTitleBackgroundStyle">@android:color/transparent</item>
<item name="windowActionBar">false</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowCloseOnTouchOutside">false</item>
<item name="cpp_main_bg">@color/cpp_main_bg_light</item>
<item name="cpp_pane_bg">@drawable/pane_light</item>
<item name="cpp_fab_bg">@color/cpp_material_light</item>
<item name="cpp_text_color">@color/cpp_text_inverse</item>
<item name="cpp_text_color_error">@color/cpp_text_inverse_error</item>
</style>
<style name="Cpp.Theme.Wizard" parent="Cpp.Theme.Material"> <style name="Cpp.Theme.Wizard" parent="Cpp.Theme.Material">
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>

View File

@ -68,7 +68,16 @@
<item name="cpp_button_style_operation">@style/CppKeyboardButton.Material.Operation</item> <item name="cpp_button_style_operation">@style/CppKeyboardButton.Material.Operation</item>
</style> </style>
<style name="Cpp.Theme.Dialog.Material" parent="Cpp.Theme.Dialog"> <style name="Cpp.Theme.Material.Dialog" parent="Cpp.Theme.Dialog">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Digit</item>
<item name="cpp_button_style_control_image">
@style/CppKeyboardButton.Material.Control.Image
</item>
<item name="cpp_button_style_operation">@style/CppKeyboardButton.Material.Operation</item>
</style>
<style name="Cpp.Theme.Material.Dialog.Alert" parent="Cpp.Theme.Dialog.Alert">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Digit</item> <item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Digit</item> <item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Digit</item>
<item name="cpp_button_style_control_image"> <item name="cpp_button_style_control_image">

View File

@ -69,7 +69,17 @@
</item> </item>
</style> </style>
<style name="Cpp.Theme.Dialog.Material.Light" parent="Cpp.Theme.Light.Dialog"> <style name="Cpp.Theme.Material.Light.Dialog" parent="Cpp.Theme.Light.Dialog">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Light.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Light.Digit</item>
<item name="cpp_button_style_control_image">
@style/CppKeyboardButton.Material.Light.Control.Image
</item>
<item name="cpp_button_style_operation">@style/CppKeyboardButton.Material.Light.Operation
</item>
</style>
<style name="Cpp.Theme.Material.Light.Dialog.Alert" parent="Cpp.Theme.Light.Dialog.Alert">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Light.Digit</item> <item name="cpp_button_style_digit">@style/CppKeyboardButton.Material.Light.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Light.Digit</item> <item name="cpp_button_style_control">@style/CppKeyboardButton.Material.Light.Digit</item>
<item name="cpp_button_style_control_image"> <item name="cpp_button_style_control_image">

View File

@ -66,7 +66,7 @@
<item name="android:background">@drawable/metro_widget_button_light</item> <item name="android:background">@drawable/metro_widget_button_light</item>
</style> </style>
<style name="cpp_metro_blue_theme" parent="Cpp.Theme"> <style name="Cpp.Theme.Metro.Blue" parent="Cpp.Theme">
<item name="cpp_button_style_digit">@style/CppKeyboardButton.Metro.Blue.Digit</item> <item name="cpp_button_style_digit">@style/CppKeyboardButton.Metro.Blue.Digit</item>
<item name="cpp_button_style_control">@style/CppKeyboardButton.Metro.Blue.Control</item> <item name="cpp_button_style_control">@style/CppKeyboardButton.Metro.Blue.Control</item>
<item name="cpp_button_style_control_image"> <item name="cpp_button_style_control_image">

View File

@ -26,7 +26,7 @@
<item name="android:background">@drawable/metro_button_green</item> <item name="android:background">@drawable/metro_button_green</item>
</style> </style>
<style name="cpp_metro_green_theme" parent="cpp_metro_blue_theme"> <style name="Cpp.Theme.Metro.Green" parent="Cpp.Theme.Metro.Blue">
<item name="cpp_button_style_operation">@style/metro_green_operation_button_style</item> <item name="cpp_button_style_operation">@style/metro_green_operation_button_style</item>
</style> </style>

View File

@ -26,7 +26,7 @@
<item name="android:background">@drawable/metro_button_purple</item> <item name="android:background">@drawable/metro_button_purple</item>
</style> </style>
<style name="cpp_metro_purple_theme" parent="cpp_metro_blue_theme"> <style name="Cpp.Theme.Metro.Purple" parent="Cpp.Theme.Metro.Blue">
<item name="cpp_button_style_operation">@style/metro_purple_operation_button_style</item> <item name="cpp_button_style_operation">@style/metro_purple_operation_button_style</item>
</style> </style>