EditHistoryFragment

This commit is contained in:
serso 2016-01-15 13:58:45 +01:00
parent 4dc87854d8
commit e5d0a8d822
16 changed files with 213 additions and 187 deletions

View File

@ -62,6 +62,7 @@ dependencies {
compile 'org.solovyev:common-security:1.0.7' compile 'org.solovyev:common-security:1.0.7'
compile 'com.android.support:support-v4:23.1.1' compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile('ch.acra:acra:4.7.0') { compile('ch.acra:acra:4.7.0') {
exclude group: 'org.json' exclude group: 'org.json'
} }

View File

@ -84,13 +84,7 @@
-keep interface android.support.v7.** { *; } -keep interface android.support.v7.** { *; }
# ## ACRA
#*********************************************************************
#
# ACRA
#
#*********************************************************************
#
# keep this class so that logging will show 'ACRA' and not a obfuscated name like 'a'. # keep this class so that logging will show 'ACRA' and not a obfuscated name like 'a'.
# Note: if you are removing log messages elsewhere in this file then this isn't necessary # Note: if you are removing log messages elsewhere in this file then this isn't necessary
@ -122,3 +116,25 @@
-keep public class org.acra.ErrorReporter { -keep public class org.acra.ErrorReporter {
public void handleSilentException(java.lang.Throwable); public void handleSilentException(java.lang.Throwable);
} }
## BUTTERKNIFE
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }
-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}
## OTTO BUS
-keepattributes *Annotation*
-keepclassmembers class ** {
@com.squareup.otto.Subscribe public *;
@com.squareup.otto.Produce public *;
}

View File

@ -82,13 +82,7 @@
-keep class !android.support.v7.internal.view.menu.MenuBuilder, !android.support.v7.internal.view.menu.SubMenuBuilder, android.support.v7.** { *; } -keep class !android.support.v7.internal.view.menu.MenuBuilder, !android.support.v7.internal.view.menu.SubMenuBuilder, android.support.v7.** { *; }
-keep interface android.support.v7.** { *; } -keep interface android.support.v7.** { *; }
# ## LOGS
#*********************************************************************
#
# LOGS
#
#*********************************************************************
#
-assumenosideeffects class android.util.Log { -assumenosideeffects class android.util.Log {
public static int v(...); public static int v(...);
@ -98,23 +92,13 @@
public static int e(...); public static int e(...);
} }
## ASSERTIONS
-assumenosideeffects class org.solovyev.android.Check { -assumenosideeffects class org.solovyev.android.Check {
*; *;
} }
# ## ACRA
#*********************************************************************
#
# ACRA
#
#*********************************************************************
#
# keep this class so that logging will show 'ACRA' and not a obfuscated name like 'a'.
# Note: if you are removing log messages elsewhere in this file then this isn't necessary
-keep class org.acra.ACRA {
*;
}
# keep this around for some enums that ACRA needs # keep this around for some enums that ACRA needs
-keep class org.acra.ReportingInteractionMode { -keep class org.acra.ReportingInteractionMode {
@ -140,3 +124,25 @@
-keep public class org.acra.ErrorReporter { -keep public class org.acra.ErrorReporter {
public void handleSilentException(java.lang.Throwable); public void handleSilentException(java.lang.Throwable);
} }
## BUTTERKNIFE
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }
-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}
## OTTO BUS
-keepattributes *Annotation*
-keepclassmembers class ** {
@com.squareup.otto.Subscribe public *;
@com.squareup.otto.Produce public *;
}

View File

@ -1,6 +1,7 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import org.solovyev.android.calculator.history.BaseHistoryFragment; import org.solovyev.android.calculator.history.BaseHistoryFragment;
import org.solovyev.android.calculator.history.EditHistoryFragment;
import org.solovyev.android.calculator.onscreen.CalculatorOnscreenService; import org.solovyev.android.calculator.onscreen.CalculatorOnscreenService;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -16,4 +17,5 @@ public interface AppComponent {
void inject(CalculatorOnscreenService service); void inject(CalculatorOnscreenService service);
void inject(BaseHistoryFragment fragment); void inject(BaseHistoryFragment fragment);
void inject(BaseDialogFragment fragment); void inject(BaseDialogFragment fragment);
void inject(EditHistoryFragment fragment);
} }

View File

@ -20,7 +20,11 @@ public abstract class BaseDialogFragment extends DialogFragment {
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
((CalculatorApplication) getActivity().getApplication()).getComponent().inject(this); inject(((CalculatorApplication) getActivity().getApplication()).getComponent());
}
protected void inject(@NonNull AppComponent component) {
component.inject(this);
} }
@NonNull @NonNull

View File

@ -107,6 +107,7 @@ public class CalculatorApplication extends android.app.Application implements Sh
.build(); .build();
component.inject(this); component.inject(this);
history.init(initThread); history.init(initThread);
display.init();
onPostCreate(preferences, languages); onPostCreate(preferences, languages);
} }

View File

@ -40,30 +40,15 @@ import static org.solovyev.android.calculator.CalculatorEventType.conversion_res
@Singleton @Singleton
public class Display implements CalculatorEventListener { public class Display implements CalculatorEventListener {
public static class ChangedEvent {
@Nonnull
public final DisplayState oldState;
@Nonnull
public final DisplayState newState;
public ChangedEvent(@Nonnull DisplayState oldState, @Nonnull DisplayState newState) {
this.oldState = oldState;
this.newState = newState;
}
}
@Nonnull @Nonnull
private final CalculatorEventHolder lastEvent; private final CalculatorEventHolder lastEvent;
@Inject
Bus bus;
@Nullable @Nullable
private DisplayView view; private DisplayView view;
@Nonnull @Nonnull
private DisplayState state = DisplayState.empty(); private DisplayState state = DisplayState.empty();
@Inject
Bus bus;
@Inject @Inject
public Display(@Nonnull Calculator calculator) { public Display(@Nonnull Calculator calculator) {
lastEvent = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId()); lastEvent = new CalculatorEventHolder(CalculatorUtils.createFirstEventDataId());
@ -175,4 +160,18 @@ public class Display implements CalculatorEventListener {
final DisplayState displayState = calculatorEventData.getDisplayState(); final DisplayState displayState = calculatorEventData.getDisplayState();
setState(DisplayState.createValid(displayState.getOperation(), displayState.getResult(), result, calculatorEventData.getSequenceId())); setState(DisplayState.createValid(displayState.getOperation(), displayState.getResult(), result, calculatorEventData.getSequenceId()));
} }
public static class ChangedEvent {
@Nonnull
public final DisplayState oldState;
@Nonnull
public final DisplayState newState;
public ChangedEvent(@Nonnull DisplayState oldState, @Nonnull DisplayState newState) {
this.oldState = oldState;
this.newState = newState;
}
}
} }

View File

@ -71,7 +71,7 @@ public class DisplayState implements Parcelable {
private DisplayState(Parcel in) { private DisplayState(Parcel in) {
text = in.readString(); text = in.readString();
valid = in.readByte() != 0; valid = in.readByte() != 0;
sequence = in.readLong(); sequence = EditorState.NO_SEQUENCE;
} }
@Nonnull @Nonnull
@ -143,6 +143,5 @@ public class DisplayState implements Parcelable {
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeString(text); dest.writeString(text);
dest.writeByte((byte) (valid ? 1 : 0)); dest.writeByte((byte) (valid ? 1 : 0));
dest.writeLong(sequence);
} }
} }

View File

@ -73,7 +73,7 @@ public class EditorState implements Parcelable {
} }
private EditorState(Parcel in) { private EditorState(Parcel in) {
sequence = in.readLong(); sequence = NO_SEQUENCE;
selection = in.readInt(); selection = in.readInt();
textString = in.readString(); textString = in.readString();
text = textString; text = textString;
@ -135,7 +135,6 @@ public class EditorState implements Parcelable {
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(sequence);
dest.writeInt(selection); dest.writeInt(selection);
dest.writeString(textString); dest.writeString(textString);
} }

View File

@ -37,9 +37,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.melnykov.fab.FloatingActionButton; import com.melnykov.fab.FloatingActionButton;
@ -81,7 +79,6 @@ public abstract class BaseHistoryFragment extends ListFragment {
History history; History history;
@Inject @Inject
Bus bus; Bus bus;
@Nonnull
private HistoryArrayAdapter adapter; private HistoryArrayAdapter adapter;
@Nonnull @Nonnull
private FragmentUi ui; private FragmentUi ui;
@ -165,9 +162,7 @@ public abstract class BaseHistoryFragment extends ListFragment {
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
ui.onResume(this); ui.onResume(this);
updateAdapter(); updateAdapter();
} }
@ -222,10 +217,10 @@ public abstract class BaseHistoryFragment extends ListFragment {
} }
return true; return true;
case R.string.c_save: case R.string.c_save:
EditHistoryFragment.show(state, getFragmentManager()); EditHistoryFragment.show(state, true, getFragmentManager());
return true; return true;
case R.string.c_edit: case R.string.c_edit:
createEditHistoryDialog(state, context, false); EditHistoryFragment.show(state, false, getFragmentManager());
return true; return true;
case R.string.c_remove: case R.string.c_remove:
getAdapter().remove(state); getAdapter().remove(state);
@ -238,41 +233,6 @@ public abstract class BaseHistoryFragment extends ListFragment {
return super.onContextItemSelected(item); return super.onContextItemSelected(item);
} }
private void createEditHistoryDialog(@Nonnull final HistoryState state, @Nonnull final Context context, final boolean save) {
final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View editView = layoutInflater.inflate(R.layout.history_edit, null);
final TextView historyExpression = (TextView) editView.findViewById(R.id.history_edit_expression);
historyExpression.setText(BaseHistoryFragment.getHistoryText(state));
final EditText comment = (EditText) editView.findViewById(R.id.history_edit_comment);
comment.setText(state.getComment());
final AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setTitle(save ? R.string.c_save_history : R.string.c_edit_history)
.setCancelable(true)
.setNegativeButton(R.string.c_cancel, null)
.setPositiveButton(R.string.c_save, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
/*if (save) {
final HistoryState savedHistoryItem = Locator.getInstance().getHistory().addSaved(state);
savedHistoryItem.setComment(comment.getText().toString());
Locator.getInstance().getHistory().save();
// we don't need to add element to the adapter as adapter of another activity must be updated and not this
//data.getAdapter().add(savedHistoryItem);
} else {
state.setComment(comment.getText().toString());
Locator.getInstance().getHistory().save();
}
getAdapter().notifyDataSetChanged();*/
Toast.makeText(context, context.getText(R.string.c_history_saved), Toast.LENGTH_LONG).show();
}
})
.setView(editView);
builder.create().show();
}
private boolean shouldHaveCopyResult(@Nonnull HistoryState state) { private boolean shouldHaveCopyResult(@Nonnull HistoryState state) {
return !state.display.valid || !Strings.isEmpty(state.display.text); return !state.display.valid || !Strings.isEmpty(state.display.text);
} }

View File

@ -1,9 +1,11 @@
package org.solovyev.android.calculator.history; package org.solovyev.android.calculator.history;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -11,27 +13,41 @@ import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import org.solovyev.android.calculator.AppComponent;
import org.solovyev.android.calculator.BaseDialogFragment; import org.solovyev.android.calculator.BaseDialogFragment;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
import javax.inject.Inject;
import butterknife.Bind; import butterknife.Bind;
import butterknife.ButterKnife; import butterknife.ButterKnife;
public class EditHistoryFragment extends BaseDialogFragment { public class EditHistoryFragment extends BaseDialogFragment {
public static final String ARG_STATE = "state"; public static final String ARG_STATE = "state";
public static final String ARG_NEW = "new";
@Bind(R.id.history_edit_expression) @Inject
History history;
HistoryState state;
boolean newState;
@Bind(R.id.history_expression)
TextView expressionView; TextView expressionView;
@Bind(R.id.history_edit_comment) @Bind(R.id.history_comment)
EditText commentView; EditText commentView;
private HistoryState state;
public static void show(@NonNull HistoryState state, @NonNull FragmentManager fm) { @Bind(R.id.history_comment_label)
TextInputLayout commentLabel;
public static void show(@NonNull HistoryState state, boolean newState, @NonNull FragmentManager fm) {
final EditHistoryFragment fragment = new EditHistoryFragment(); final EditHistoryFragment fragment = new EditHistoryFragment();
final Bundle args = new Bundle(); final Bundle args = new Bundle();
args.putParcelable(ARG_STATE, state); args.putParcelable(ARG_STATE, state);
args.putBoolean(ARG_NEW, newState);
fragment.setArguments(args); fragment.setArguments(args);
fragment.show(fm, "edit-history-fragment"); fragment.show(fm, "edit-history-fragment");
} }
@ -39,12 +55,40 @@ public class EditHistoryFragment extends BaseDialogFragment {
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
state = getArguments().getParcelable(ARG_STATE); final Bundle arguments = getArguments();
state = arguments.getParcelable(ARG_STATE);
newState = arguments.getBoolean(ARG_NEW);
}
@Override
protected void inject(@NonNull AppComponent component) {
super.inject(component);
component.inject(this);
}
@NonNull
@Override
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
final AlertDialog dialog = super.onCreateDialog(savedInstanceState);
dialog.setCanceledOnTouchOutside(false);
return dialog;
} }
@Override @Override
protected void onPrepareDialog(@NonNull AlertDialog.Builder builder) { protected void onPrepareDialog(@NonNull AlertDialog.Builder builder) {
builder.setTitle(newState ? R.string.c_save_history : R.string.c_edit_history);
builder.setNegativeButton(R.string.c_cancel, null);
builder.setPositiveButton(R.string.c_save, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final HistoryState.Builder b = HistoryState.builder(state)
.withComment(commentView.getText().toString());
if (newState) {
b.withNowTime();
}
history.updateSaved(b.build());
}
});
} }
@NonNull @NonNull

View File

@ -110,7 +110,7 @@ public class History {
final String editorText = oldEditor.getText(); final String editorText = oldEditor.getText();
final EditorState editor = EditorState.create(Strings.nullToEmpty(editorText), oldEditor.getCursorPosition()); final EditorState editor = EditorState.create(Strings.nullToEmpty(editorText), oldEditor.getCursorPosition());
final DisplayState display = DisplayState.createValid(oldDisplay.getJsclOperation(), null, Strings.nullToEmpty(oldDisplay.getEditorState().getText()), EditorState.NO_SEQUENCE); final DisplayState display = DisplayState.createValid(oldDisplay.getJsclOperation(), null, Strings.nullToEmpty(oldDisplay.getEditorState().getText()), EditorState.NO_SEQUENCE);
states.add(HistoryState.newBuilder(editor, display).withTime(state.getTime()).withComment(state.getComment()).build()); states.add(HistoryState.builder(editor, display).withTime(state.getTime()).withComment(state.getComment()).build());
} }
return states; return states;
} }
@ -249,9 +249,14 @@ public class History {
onRecentChanged(); onRecentChanged();
} }
public void addSaved(@Nonnull HistoryState state) { public void updateSaved(@Nonnull HistoryState state) {
Check.isMainThread(); Check.isMainThread();
saved.add(state); final int i = saved.indexOf(state);
if(i >= 0) {
saved.set(i, state);
} else {
saved.add(state);
}
onSavedChanged(); onSavedChanged();
} }
@ -358,7 +363,7 @@ public class History {
if (editorState.sequence != displayState.sequence) { if (editorState.sequence != displayState.sequence) {
return; return;
} }
addRecent(HistoryState.newBuilder(editorState, displayState).build()); addRecent(HistoryState.builder(editorState, displayState).build());
} }
public static class ChangedEvent { public static class ChangedEvent {

View File

@ -32,6 +32,7 @@ public class HistoryState implements Parcelable {
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";
public final int id;
@Nonnull @Nonnull
public final EditorState editor; public final EditorState editor;
@Nonnull @Nonnull
@ -41,10 +42,19 @@ public class HistoryState implements Parcelable {
protected String comment = ""; protected String comment = "";
private HistoryState(@Nonnull EditorState editor, @Nonnull DisplayState display) { private HistoryState(@Nonnull EditorState editor, @Nonnull DisplayState display) {
this.id = System.identityHashCode(this);
this.editor = editor; this.editor = editor;
this.display = display; this.display = display;
} }
private HistoryState(@Nonnull HistoryState state) {
this.id = state.id;
this.editor = state.editor;
this.display = state.display;
this.time = state.time;
this.comment = state.comment;
}
private HistoryState(@Nonnull JSONObject json) throws JSONException { private HistoryState(@Nonnull JSONObject json) throws JSONException {
this(EditorState.create(json.getJSONObject(JSON_EDITOR)), DisplayState.create(json.getJSONObject(JSON_DISPLAY))); this(EditorState.create(json.getJSONObject(JSON_EDITOR)), DisplayState.create(json.getJSONObject(JSON_DISPLAY)));
this.time = json.optLong(JSON_TIME, 0L); this.time = json.optLong(JSON_TIME, 0L);
@ -52,6 +62,7 @@ public class HistoryState implements Parcelable {
} }
private HistoryState(Parcel in) { private HistoryState(Parcel in) {
id = in.readInt();
editor = in.readParcelable(EditorState.class.getClassLoader()); editor = in.readParcelable(EditorState.class.getClassLoader());
display = in.readParcelable(DisplayState.class.getClassLoader()); display = in.readParcelable(DisplayState.class.getClassLoader());
time = in.readLong(); time = in.readLong();
@ -59,10 +70,15 @@ public class HistoryState implements Parcelable {
} }
@Nonnull @Nonnull
public static Builder newBuilder(@Nonnull EditorState editor, @Nonnull DisplayState display) { public static Builder builder(@Nonnull EditorState editor, @Nonnull DisplayState display) {
return new Builder(editor, display); return new Builder(editor, display);
} }
@Nonnull
public static Builder builder(@Nonnull HistoryState state) {
return new Builder(state);
}
@Nonnull @Nonnull
public static HistoryState create(@Nonnull JSONObject json) throws JSONException { public static HistoryState create(@Nonnull JSONObject json) throws JSONException {
return new HistoryState(json); return new HistoryState(json);
@ -103,10 +119,27 @@ public class HistoryState implements Parcelable {
return this.editor.same(that.editor) && this.display.same(that.display); return this.editor.same(that.editor) && this.display.same(that.display);
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final HistoryState that = (HistoryState) o;
return id == that.id;
}
@Override
public int hashCode() {
return id;
}
@Override @Override
public String toString() { public String toString() {
return "HistoryState{" + return "HistoryState{" +
"editor=" + editor + "id=" + id +
", editor=" + editor +
", display=" + display + ", display=" + display +
", time=" + time + ", time=" + time +
", comment='" + comment + '\'' + ", comment='" + comment + '\'' +
@ -120,6 +153,7 @@ public class HistoryState implements Parcelable {
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
dest.writeParcelable(editor, flags); dest.writeParcelable(editor, flags);
dest.writeParcelable(display, flags); dest.writeParcelable(display, flags);
dest.writeLong(time); dest.writeLong(time);
@ -133,7 +167,16 @@ public class HistoryState implements Parcelable {
private Builder(@Nonnull EditorState editor, @Nonnull DisplayState display) { private Builder(@Nonnull EditorState editor, @Nonnull DisplayState display) {
super(editor, display); super(editor, display);
withTime(System.currentTimeMillis()); withNowTime();
}
private Builder(@Nonnull HistoryState state) {
super(state);
}
@Nonnull
public Builder withNowTime() {
return withTime(System.currentTimeMillis());
} }
@Nonnull @Nonnull

View File

@ -22,45 +22,41 @@
~ Site: http://se.solovyev.org ~ Site: http://se.solovyev.org
--> -->
<ScrollView xmlns:a="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
a:layout_width="wrap_content" a:layout_width="wrap_content"
a:layout_height="wrap_content"> a:layout_height="wrap_content"
a:orientation="vertical">
<LinearLayout <android.support.design.widget.TextInputLayout
a:id="@+id/history_edit"
a:layout_width="match_parent" a:layout_width="match_parent"
a:layout_height="wrap_content" a:layout_height="wrap_content">
a:orientation="vertical"
a:scrollbarAlwaysDrawVerticalTrack="true"
a:scrollbars="vertical">
<TextView
a:layout_width="fill_parent"
a:layout_height="fill_parent"
a:padding="6dp"
a:text="@string/c_history_expression" />
<TextView
a:id="@+id/history_edit_expression"
a:layout_width="fill_parent"
a:layout_height="wrap_content"
a:padding="6dp"
a:textStyle="bold" />
<TextView
a:layout_width="fill_parent"
a:layout_height="fill_parent"
a:padding="6dp"
a:text="@string/c_history_comment" />
<EditText <EditText
a:id="@+id/history_edit_comment" a:id="@+id/history_expression"
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_height="wrap_content" a:layout_height="wrap_content"
a:editable="false"
a:hint="@string/c_history_expression"
a:inputType="none"
a:padding="6dp"
a:textStyle="bold"
tools:ignore="Deprecated" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
a:id="@+id/history_comment_label"
a:layout_width="match_parent"
a:layout_height="wrap_content">
<EditText
a:id="@+id/history_comment"
a:layout_width="fill_parent"
a:layout_height="wrap_content"
a:hint="@string/c_history_comment"
a:inputType="text"
a:maxLines="4" a:maxLines="4"
a:minLines="4" a:minLines="4" />
a:inputType="text" /> </android.support.design.widget.TextInputLayout>
</LinearLayout> </LinearLayout>
</ScrollView>

View File

@ -24,18 +24,12 @@
<style name="Cpp.Theme" parent="@style/Theme.AppCompat"> <style name="Cpp.Theme" parent="@style/Theme.AppCompat">
<item name="colorPrimary">@color/cpp_metro_button</item> <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="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="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="android:windowBackground">@color/cpp_main_bg</item> <item name="android:windowBackground">@color/cpp_main_bg</item>
<item name="actionBarStyle">@style/CppActionBar</item> <item name="actionBarStyle">@style/CppActionBar</item>
<item name="android:actionBarStyle">@style/CppActionBar</item>
<item name="cpp_main_bg">@color/cpp_main_bg</item> <item name="cpp_main_bg">@color/cpp_main_bg</item>
<item name="cpp_pane_bg">@drawable/pane</item> <item name="cpp_pane_bg">@drawable/pane</item>
@ -46,20 +40,13 @@
<style name="Cpp.Theme.Dialog" parent="@style/Theme.AppCompat.Dialog"> <style name="Cpp.Theme.Dialog" parent="@style/Theme.AppCompat.Dialog">
<item name="colorPrimary">@color/cpp_metro_button</item> <item name="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="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="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="windowNoTitle">false</item>
<item name="android:windowNoTitle">false</item> <item name="android:windowNoTitle">false</item>
<item name="android:windowTitleBackgroundStyle">@android:color/transparent</item> <item name="android:windowTitleBackgroundStyle">@android:color/transparent</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<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_main_bg">@color/cpp_main_bg</item>
<item name="cpp_pane_bg">@drawable/pane</item> <item name="cpp_pane_bg">@drawable/pane</item>
@ -70,20 +57,8 @@
<style name="Cpp.Theme.Dialog.Alert" parent="@style/Theme.AppCompat.Dialog.Alert"> <style name="Cpp.Theme.Dialog.Alert" parent="@style/Theme.AppCompat.Dialog.Alert">
<item name="colorPrimary">@color/cpp_metro_button</item> <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="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="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_main_bg">@color/cpp_main_bg</item>
<item name="cpp_pane_bg">@drawable/pane</item> <item name="cpp_pane_bg">@drawable/pane</item>
@ -96,15 +71,10 @@
<item name="android:windowBackground">@color/cpp_main_bg_light</item> <item name="android:windowBackground">@color/cpp_main_bg_light</item>
<item name="colorPrimary">@color/cpp_material_light</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="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="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="actionBarStyle">@style/CppActionBar.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_bg_light</item> <item name="cpp_main_bg">@color/cpp_main_bg_light</item>
<item name="cpp_pane_bg">@drawable/pane_light</item> <item name="cpp_pane_bg">@drawable/pane_light</item>
@ -115,19 +85,13 @@
<style name="Cpp.Theme.Light.Dialog" parent="@style/Theme.AppCompat.Light.Dialog"> <style name="Cpp.Theme.Light.Dialog" parent="@style/Theme.AppCompat.Light.Dialog">
<item name="colorPrimary">@color/cpp_material_light</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="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="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="windowNoTitle">false</item>
<item name="android:windowNoTitle">false</item> <item name="android:windowNoTitle">false</item>
<item name="android:windowTitleBackgroundStyle">@android:color/transparent</item> <item name="android:windowTitleBackgroundStyle">@android:color/transparent</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<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_main_bg">@color/cpp_main_bg_light</item>
<item name="cpp_pane_bg">@drawable/pane_light</item> <item name="cpp_pane_bg">@drawable/pane_light</item>
@ -138,19 +102,8 @@
<style name="Cpp.Theme.Light.Dialog.Alert" parent="@style/Theme.AppCompat.Light.Dialog.Alert"> <style name="Cpp.Theme.Light.Dialog.Alert" parent="@style/Theme.AppCompat.Light.Dialog.Alert">
<item name="colorPrimary">@color/cpp_material_light</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="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="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_main_bg">@color/cpp_main_bg_light</item>
<item name="cpp_pane_bg">@drawable/pane_light</item> <item name="cpp_pane_bg">@drawable/pane_light</item>
@ -163,7 +116,6 @@
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="android:windowActionBar">false</item>
<item name="cpp_wizard_button_bg">@color/cpp_wizard_button_selector</item> <item name="cpp_wizard_button_bg">@color/cpp_wizard_button_selector</item>
</style> </style>
@ -171,7 +123,6 @@
<item name="windowNoTitle">true</item> <item name="windowNoTitle">true</item>
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item> <item name="windowActionBar">false</item>
<item name="android:windowActionBar">false</item>
<item name="cpp_wizard_button_bg">@color/cpp_wizard_button_selector_light</item> <item name="cpp_wizard_button_bg">@color/cpp_wizard_button_selector_light</item>
</style> </style>

View File

@ -143,7 +143,7 @@ public class HistoryTest {
} }
private void addState(@Nonnull String text) { private void addState(@Nonnull String text) {
history.addRecent(HistoryState.newBuilder(EditorState.create(text, 3), DisplayState.empty())); history.addRecent(HistoryState.builder(EditorState.create(text, 3), DisplayState.empty()));
} }
private static final String oldXml1 = "<history>\n" + private static final String oldXml1 = "<history>\n" +