History UI styles update

This commit is contained in:
serso 2015-01-26 22:06:43 +01:00
parent 13fb8203ea
commit 141741c446
30 changed files with 179 additions and 223 deletions

View File

@ -23,13 +23,10 @@
package org.solovyev.android.calculator; package org.solovyev.android.calculator;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.about.CalculatorAboutFragment; import org.solovyev.android.calculator.about.CalculatorAboutFragment;
import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment; import org.solovyev.android.calculator.about.CalculatorReleaseNotesFragment;
import org.solovyev.android.calculator.history.CalculatorHistoryFragment; import org.solovyev.android.calculator.history.HistoryFragment;
import org.solovyev.android.calculator.history.CalculatorSavedHistoryFragment; import org.solovyev.android.calculator.history.SavedHistoryFragment;
import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragment; import org.solovyev.android.calculator.math.edit.CalculatorFunctionsFragment;
import org.solovyev.android.calculator.math.edit.CalculatorOperatorsFragment; import org.solovyev.android.calculator.math.edit.CalculatorOperatorsFragment;
import org.solovyev.android.calculator.math.edit.CalculatorVarsFragment; import org.solovyev.android.calculator.math.edit.CalculatorVarsFragment;
@ -39,6 +36,8 @@ import org.solovyev.android.calculator.plot.CalculatorPlotFunctionSettingsActivi
import org.solovyev.android.calculator.plot.CalculatorPlotFunctionsActivity; import org.solovyev.android.calculator.plot.CalculatorPlotFunctionsActivity;
import org.solovyev.android.calculator.plot.CalculatorPlotRangeActivity; import org.solovyev.android.calculator.plot.CalculatorPlotRangeActivity;
import javax.annotation.Nonnull;
/** /**
* User: Solovyev_S * User: Solovyev_S
* Date: 03.10.12 * Date: 03.10.12
@ -49,8 +48,8 @@ public enum CalculatorFragmentType {
editor(CalculatorEditorFragment.class, R.layout.cpp_app_editor, R.string.editor), editor(CalculatorEditorFragment.class, R.layout.cpp_app_editor, R.string.editor),
//display(CalculatorHistoryFragment.class, "history", R.layout.history_fragment, R.string.c_history), //display(CalculatorHistoryFragment.class, "history", R.layout.history_fragment, R.string.c_history),
//keyboard(CalculatorHistoryFragment.class, "history", R.layout.history_fragment, R.string.c_history), //keyboard(CalculatorHistoryFragment.class, "history", R.layout.history_fragment, R.string.c_history),
history(CalculatorHistoryFragment.class, R.layout.history_fragment, R.string.c_history), history(HistoryFragment.class, R.layout.history_fragment, R.string.c_history),
saved_history(CalculatorSavedHistoryFragment.class, R.layout.history_fragment, R.string.c_saved_history), saved_history(SavedHistoryFragment.class, R.layout.history_fragment, R.string.c_saved_history),
variables(CalculatorVarsFragment.class, R.layout.vars_fragment, R.string.c_vars), variables(CalculatorVarsFragment.class, R.layout.vars_fragment, R.string.c_vars),
functions(CalculatorFunctionsFragment.class, R.layout.math_entities_fragment, R.string.c_functions), functions(CalculatorFunctionsFragment.class, R.layout.math_entities_fragment, R.string.c_functions),
operators(CalculatorOperatorsFragment.class, R.layout.math_entities_fragment, R.string.c_operators), operators(CalculatorOperatorsFragment.class, R.layout.math_entities_fragment, R.string.c_operators),

View File

@ -62,12 +62,7 @@ import java.util.List;
import static org.solovyev.android.calculator.CalculatorEventType.clear_history_requested; import static org.solovyev.android.calculator.CalculatorEventType.clear_history_requested;
/** public abstract class BaseHistoryFragment extends SherlockListFragment implements CalculatorEventListener {
* User: serso
* Date: 10/15/11
* Time: 1:13 PM
*/
public abstract class AbstractCalculatorHistoryFragment extends SherlockListFragment implements CalculatorEventListener {
/* /*
********************************************************************** **********************************************************************
@ -115,7 +110,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
@Nonnull @Nonnull
private final SharedPreferences.OnSharedPreferenceChangeListener preferencesListener = new HistoryOnPreferenceChangeListener(); private final SharedPreferences.OnSharedPreferenceChangeListener preferencesListener = new HistoryOnPreferenceChangeListener();
protected AbstractCalculatorHistoryFragment(@Nonnull CalculatorFragmentType fragmentType) { protected BaseHistoryFragment(@Nonnull CalculatorFragmentType fragmentType) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(fragmentType.getDefaultLayoutId(), fragmentType.getDefaultTitleResId(), false); fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(fragmentType.getDefaultLayoutId(), fragmentType.getDefaultTitleResId(), false);
} }
@ -411,7 +406,7 @@ public abstract class AbstractCalculatorHistoryFragment extends SherlockListFrag
if (menuItem instanceof IdentifiableMenuItem<?>) { if (menuItem instanceof IdentifiableMenuItem<?>) {
switch (((IdentifiableMenuItem) menuItem).getItemId()) { switch (((IdentifiableMenuItem) menuItem).getItemId()) {
case R.id.menu_history_fullscreen: case R.id.menu_history_fullscreen:
result = !fragmentHelper.isPane(AbstractCalculatorHistoryFragment.this); result = !fragmentHelper.isPane(BaseHistoryFragment.this);
break; break;
} }
} }

View File

@ -23,26 +23,21 @@
package org.solovyev.android.calculator.history; package org.solovyev.android.calculator.history;
import android.content.Context; import android.content.Context;
import android.text.format.DateUtils;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
import org.solovyev.common.text.Strings; import org.solovyev.common.text.Strings;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
import static android.view.View.GONE; import static android.view.View.*;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static org.solovyev.android.calculator.CalculatorFragmentType.saved_history; import static org.solovyev.android.calculator.CalculatorFragmentType.saved_history;
import static org.solovyev.android.calculator.history.AbstractCalculatorHistoryFragment.isAlreadySaved; import static org.solovyev.android.calculator.history.BaseHistoryFragment.isAlreadySaved;
/** /**
* User: serso * User: serso
@ -51,6 +46,7 @@ import static org.solovyev.android.calculator.history.AbstractCalculatorHistoryF
*/ */
public class HistoryArrayAdapter extends ArrayAdapter<CalculatorHistoryState> { public class HistoryArrayAdapter extends ArrayAdapter<CalculatorHistoryState> {
private static final int DATETIME_FORMAT = DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_ABBREV_TIME;
private boolean showDatetime; private boolean showDatetime;
HistoryArrayAdapter(Context context, int resource, int textViewResourceId, @Nonnull List<CalculatorHistoryState> historyList, boolean showDatetime) { HistoryArrayAdapter(Context context, int resource, int textViewResourceId, @Nonnull List<CalculatorHistoryState> historyList, boolean showDatetime) {
@ -67,25 +63,24 @@ public class HistoryArrayAdapter extends ArrayAdapter<CalculatorHistoryState> {
final TextView time = (TextView) result.findViewById(R.id.history_time); final TextView time = (TextView) result.findViewById(R.id.history_time);
if (showDatetime) { if (showDatetime) {
time.setVisibility(VISIBLE); time.setVisibility(VISIBLE);
time.setText(new SimpleDateFormat().format(new Date(state.getTime()))); time.setText(DateUtils.formatDateTime(getContext(), state.getTime(), DATETIME_FORMAT));
} else { } else {
time.setVisibility(GONE); time.setVisibility(GONE);
time.setText(null); time.setText(null);
} }
final TextView editor = (TextView) result.findViewById(R.id.history_item); final TextView editor = (TextView) result.findViewById(R.id.history_item);
editor.setText(AbstractCalculatorHistoryFragment.getHistoryText(state)); editor.setText(BaseHistoryFragment.getHistoryText(state));
final View commentLayout = result.findViewById(R.id.history_item_comment_layout);
final TextView commentView = (TextView) result.findViewById(R.id.history_item_comment); final TextView commentView = (TextView) result.findViewById(R.id.history_item_comment);
if (commentLayout != null && commentView != null) { if (commentView != null) {
final String comment = state.getComment(); final String comment = state.getComment();
if (!Strings.isEmpty(comment)) { if (!Strings.isEmpty(comment)) {
commentView.setText(comment); commentView.setText(comment);
commentLayout.setVisibility(VISIBLE); commentView.setVisibility(VISIBLE);
} else { } else {
commentView.setText(null); commentView.setText(null);
commentLayout.setVisibility(GONE); commentView.setVisibility(GONE);
} }
} }
@ -115,7 +110,7 @@ public class HistoryArrayAdapter extends ArrayAdapter<CalculatorHistoryState> {
@Override @Override
public void notifyDataSetChanged() { public void notifyDataSetChanged() {
this.setNotifyOnChange(false); this.setNotifyOnChange(false);
this.sort(AbstractCalculatorHistoryFragment.COMPARATOR); this.sort(BaseHistoryFragment.COMPARATOR);
this.setNotifyOnChange(true); this.setNotifyOnChange(true);
super.notifyDataSetChanged(); super.notifyDataSetChanged();
} }

View File

@ -35,14 +35,9 @@ import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** public class HistoryFragment extends BaseHistoryFragment {
* User: serso
* Date: 12/18/11
* Time: 7:39 PM
*/
public class CalculatorHistoryFragment extends AbstractCalculatorHistoryFragment {
public CalculatorHistoryFragment() { public HistoryFragment() {
super(CalculatorFragmentType.history); super(CalculatorFragmentType.history);
} }

View File

@ -50,7 +50,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
use(R.string.c_use) { use(R.string.c_use) {
@Override @Override
public void onClick(@Nonnull HistoryItemMenuData data, @Nonnull Context context) { public void onClick(@Nonnull HistoryItemMenuData data, @Nonnull Context context) {
AbstractCalculatorHistoryFragment.useHistoryItem(data.getHistoryState()); BaseHistoryFragment.useHistoryItem(data.getHistoryState());
} }
}, },
@ -123,7 +123,7 @@ public enum HistoryItemMenuItem implements LabeledMenuItem<HistoryItemMenuData>
final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View editView = layoutInflater.inflate(R.layout.history_edit, null); final View editView = layoutInflater.inflate(R.layout.history_edit, null);
final TextView historyExpression = (TextView) editView.findViewById(R.id.history_edit_expression); final TextView historyExpression = (TextView) editView.findViewById(R.id.history_edit_expression);
historyExpression.setText(AbstractCalculatorHistoryFragment.getHistoryText(historyState)); historyExpression.setText(BaseHistoryFragment.getHistoryText(historyState));
final EditText comment = (EditText) editView.findViewById(R.id.history_edit_comment); final EditText comment = (EditText) editView.findViewById(R.id.history_edit_comment);
comment.setText(historyState.getComment()); comment.setText(historyState.getComment());

View File

@ -22,23 +22,17 @@
package org.solovyev.android.calculator.history; package org.solovyev.android.calculator.history;
import javax.annotation.Nonnull;
import org.solovyev.android.calculator.CalculatorFragmentType; import org.solovyev.android.calculator.CalculatorFragmentType;
import org.solovyev.android.calculator.Locator; import org.solovyev.android.calculator.Locator;
import org.solovyev.android.calculator.R; import org.solovyev.android.calculator.R;
import javax.annotation.Nonnull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** public class SavedHistoryFragment extends BaseHistoryFragment {
* User: serso
* Date: 12/18/11
* Time: 7:40 PM
*/
public class CalculatorSavedHistoryFragment extends AbstractCalculatorHistoryFragment {
public CalculatorSavedHistoryFragment() { public SavedHistoryFragment() {
super(CalculatorFragmentType.saved_history); super(CalculatorFragmentType.saved_history);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -33,25 +33,25 @@
a:layout_weight="1" a:layout_weight="1"
a:layout_height="wrap_content"> a:layout_height="wrap_content">
<TextView
a:id="@+id/history_time"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
style="@style/history_time"/>
<TextView <TextView
a:id="@+id/history_item" a:id="@+id/history_item"
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_height="fill_parent" a:layout_height="fill_parent"
style="@style/history_item"/> style="@style/history_item"/>
<TextView
a:id="@+id/history_time"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
style="@style/history_time"/>
</LinearLayout> </LinearLayout>
<ImageView a:id="@+id/history_item_status_icon" <ImageView a:id="@+id/history_item_status_icon"
a:layout_gravity="center_vertical" a:layout_gravity="center_vertical"
a:scaleType="centerInside" a:scaleType="centerInside"
a:padding="6dp" a:padding="6dp"
a:src="@drawable/ab_disk" a:src="@drawable/ic_save_grey600_48dp"
a:visibility="invisible" a:visibility="invisible"
a:layout_width="wrap_content" a:layout_width="wrap_content"
a:layout_height="match_parent"/> a:layout_height="match_parent"/>

View File

@ -23,39 +23,24 @@
--> -->
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:orientation="vertical" a:orientation="vertical"
style="?cpp_fragment_list_view_item_style"> style="?cpp_fragment_list_view_item_style">
<TextView <TextView
a:id="@+id/history_time" a:id="@+id/history_item"
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_height="fill_parent" a:layout_height="fill_parent"
style="@style/history_time"/> style="@style/history_item" />
<TextView <TextView
a:id="@+id/history_item" a:id="@+id/history_item_comment"
a:layout_width="fill_parent" a:layout_width="fill_parent"
a:layout_height="fill_parent" a:layout_height="fill_parent"
style="@style/history_item"/> style="@style/history_time" />
<LinearLayout
a:id="@+id/history_item_comment_layout"
a:orientation="horizontal"
a:layout_width="fill_parent"
a:layout_height="fill_parent">
<TextView
a:id="@+id/history_item_comment_label"
a:layout_width="wrap_content"
a:layout_height="fill_parent"
a:text="@string/c_history_item_comment"
style="@style/history_item_label"/>
<TextView
a:id="@+id/history_item_comment"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
style="@style/history_item"/>
</LinearLayout>
<TextView
a:id="@+id/history_time"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
style="@style/history_time" />
</LinearLayout> </LinearLayout>

View File

@ -32,13 +32,13 @@
<item <item
a:id="@+id/menu_history_toggle_datetime" a:id="@+id/menu_history_toggle_datetime"
a:icon="@drawable/ab_clock" a:icon="@drawable/ic_access_time_grey600_48dp"
a:title="@string/c_toggle_datetime" a:title="@string/c_toggle_datetime"
a:showAsAction="always"/> a:showAsAction="always"/>
<item <item
a:id="@+id/menu_history_clear_history" a:id="@+id/menu_history_clear_history"
a:icon="@drawable/ab_remove" a:icon="@drawable/ic_delete_grey600_48dp"
a:title="@string/c_clear_history" a:title="@string/c_clear_history"
a:showAsAction="always"/> a:showAsAction="always"/>

View File

@ -23,7 +23,4 @@
<resources> <resources>
<dimen name="cpp_fragment_text_size">17sp</dimen> <dimen name="cpp_fragment_text_size">17sp</dimen>
<dimen name="cpp_fragment_title_text_size">25sp</dimen> <dimen name="cpp_fragment_title_text_size">25sp</dimen>
<dimen name="cpp_math_entity_text_size">20sp</dimen>
<dimen name="cpp_math_entity_description_text_size">17sp</dimen>
</resources> </resources>

View File

@ -24,9 +24,6 @@
<dimen name="cpp_fragment_text_size">15sp</dimen> <dimen name="cpp_fragment_text_size">15sp</dimen>
<dimen name="cpp_fragment_title_text_size">20sp</dimen> <dimen name="cpp_fragment_title_text_size">20sp</dimen>
<dimen name="cpp_math_entity_text_size">20sp</dimen>
<dimen name="cpp_math_entity_description_text_size">15sp</dimen>
<dimen name="cpp_editor_text_size">30sp</dimen> <dimen name="cpp_editor_text_size">30sp</dimen>
<dimen name="cpp_editor_text_size_mobile">30sp</dimen> <dimen name="cpp_editor_text_size_mobile">30sp</dimen>

View File

@ -24,9 +24,6 @@
<dimen name="cpp_fragment_text_size">15sp</dimen> <dimen name="cpp_fragment_text_size">15sp</dimen>
<dimen name="cpp_fragment_title_text_size">20sp</dimen> <dimen name="cpp_fragment_title_text_size">20sp</dimen>
<dimen name="cpp_math_entity_text_size">16sp</dimen>
<dimen name="cpp_math_entity_description_text_size">12sp</dimen>
<dimen name="cpp_editor_text_size">20sp</dimen> <dimen name="cpp_editor_text_size">20sp</dimen>
<dimen name="cpp_editor_text_size_mobile">20sp</dimen> <dimen name="cpp_editor_text_size_mobile">20sp</dimen>

View File

@ -23,7 +23,4 @@
<resources> <resources>
<dimen name="cpp_fragment_text_size">30sp</dimen> <dimen name="cpp_fragment_text_size">30sp</dimen>
<dimen name="cpp_fragment_title_text_size">40sp</dimen> <dimen name="cpp_fragment_title_text_size">40sp</dimen>
<dimen name="cpp_math_entity_text_size">40sp</dimen>
<dimen name="cpp_math_entity_description_text_size">30sp</dimen>
</resources> </resources>

View File

@ -37,4 +37,6 @@
<color name="cpp_metro_purple_color">#651456</color> <color name="cpp_metro_purple_color">#651456</color>
<color name="cpp_metro_light_button_background">#393939</color> <color name="cpp_metro_light_button_background">#393939</color>
<color name="cpp_widget_cursor_color">#ff707070</color> <color name="cpp_widget_cursor_color">#ff707070</color>
<color name="cpp_text_primary">#ddffffff</color>
<color name="cpp_text_secondary">#89ffffff</color>
</resources> </resources>

View File

@ -23,9 +23,9 @@
<dimen name="cpp_display_text_size">25sp</dimen> <dimen name="cpp_display_text_size">25sp</dimen>
<dimen name="cpp_editor_text_size">25sp</dimen> <dimen name="cpp_editor_text_size">25sp</dimen>
<dimen name="cpp_pane_margin">5dp</dimen> <dimen name="cpp_pane_margin">5dp</dimen>
<dimen name="cpp_pane_padding">5dp</dimen> <dimen name="cpp_pane_padding">0dp</dimen>
<dimen name="cpp_math_entity_text_size">20sp</dimen> <dimen name="cpp_li_text_size">16sp</dimen>
<dimen name="cpp_math_entity_description_text_size">15sp</dimen> <dimen name="cpp_li_secondary_text_size">14sp</dimen>
<dimen name="cpp_onscreen_display_text_size">20sp</dimen> <dimen name="cpp_onscreen_display_text_size">20sp</dimen>
<dimen name="cpp_onscreen_header_button_text_size">10dp</dimen> <dimen name="cpp_onscreen_header_button_text_size">10dp</dimen>

View File

@ -22,9 +22,9 @@
<resources> <resources>
<style name="history_time" parent="math_entity_text"/> <style name="history_time" parent="math_entity_description"/>
<style name="history_item" parent="math_entity_description"/> <style name="history_item" parent="math_entity_text"/>
<style name="history_item_label" parent="math_entity_description"> <style name="history_item_label" parent="math_entity_description">
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>

View File

@ -23,14 +23,13 @@
<resources> <resources>
<style name="math_entity_text"> <style name="math_entity_text">
<item name="android:textStyle">bold</item> <item name="android:textColor">@color/cpp_text_primary</item>
<item name="android:textColor">@android:color/white</item> <item name="android:textSize">@dimen/cpp_li_text_size</item>
<item name="android:textSize">@dimen/cpp_math_entity_text_size</item>
</style> </style>
<style name="math_entity_description"> <style name="math_entity_description">
<item name="android:textColor">#bebebe</item> <item name="android:textColor">@color/cpp_text_secondary</item>
<item name="android:textSize">@dimen/cpp_math_entity_description_text_size</item> <item name="android:textSize">@dimen/cpp_li_secondary_text_size</item>
</style> </style>
<style name="add_var_button"> <style name="add_var_button">

View File

@ -48,9 +48,13 @@
</style> </style>
<style name="cpp_default_fragment_list_view_item_style"> <style name="cpp_default_fragment_list_view_item_style">
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
<item name="android:paddingBottom">20dp</item>
<item name="android:paddingTop">20dp</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">match_parent</item> <item name="android:layout_width">match_parent</item>
<item name="android:minHeight">50dp</item> <item name="android:minHeight">72dp</item>
<item name="android:gravity">center_vertical|left</item> <item name="android:gravity">center_vertical|left</item>
</style> </style>