From 6339da1b7bc510b7e927779ed27b30e2f06e82cb Mon Sep 17 00:00:00 2001 From: serso Date: Sun, 21 Feb 2016 14:24:11 +0100 Subject: [PATCH] Layout for large screens --- .../calculator/CalculatorActivity.java | 6 +- .../android/calculator/EditorView.java | 2 + .../main/res/layout-land/activity_main.xml | 10 +- .../main/res/layout-sw600dp/activity_main.xml | 79 ++++++++++++ .../res/layout-sw600dp/cpp_app_keyboard.xml | 122 ++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 7 +- .../res/layout/cpp_app_display_mobile.xml | 29 ----- .../main/res/layout/cpp_app_editor_mobile.xml | 41 ------ .../main/res/layout/matrix_edit_fragment.xml | 6 - app/src/main/res/values-large-hdpi/dimens.xml | 4 - app/src/main/res/values-large-mdpi/dimens.xml | 4 - .../main/res/values-large-tvdpi/dimens.xml | 4 - app/src/main/res/values-normal/dimens.xml | 5 - app/src/main/res/values-small/dimens.xml | 5 - .../main/res/values-xlarge-hdpi/dimens.xml | 4 - .../main/res/values-xlarge-mdpi/dimens.xml | 4 - app/src/main/res/values/dimens.xml | 3 - app/src/main/res/values/styles.xml | 9 -- 18 files changed, 215 insertions(+), 129 deletions(-) create mode 100644 app/src/main/res/layout-sw600dp/activity_main.xml create mode 100644 app/src/main/res/layout-sw600dp/cpp_app_keyboard.xml delete mode 100644 app/src/main/res/layout/cpp_app_display_mobile.xml delete mode 100644 app/src/main/res/layout/cpp_app_editor_mobile.xml diff --git a/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java index 483b4761..7bfc528b 100644 --- a/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java +++ b/app/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java @@ -83,6 +83,9 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference Toolbar toolbar; @Bind(R.id.editor) FrameLayout editor; + @Nullable + @Bind(R.id.card) + CardView card; private boolean useBackAsPrev; public CalculatorActivity() { @@ -292,10 +295,9 @@ public class CalculatorActivity extends BaseActivity implements SharedPreference } private void prepareCardAndToolbar() { - if (!(editor instanceof CardView)) { + if (card == null) { return; } - final CardView card = (CardView) editor; final Resources resources = getResources(); final int cardTopMargin = resources.getDimensionPixelSize(R.dimen.cpp_card_margin); final int preLollipopCardTopPadding = Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? card.getPaddingTop() : 0; diff --git a/app/src/main/java/org/solovyev/android/calculator/EditorView.java b/app/src/main/java/org/solovyev/android/calculator/EditorView.java index 8017b788..70e5f740 100644 --- a/app/src/main/java/org/solovyev/android/calculator/EditorView.java +++ b/app/src/main/java/org/solovyev/android/calculator/EditorView.java @@ -32,6 +32,7 @@ import android.view.ContextMenu; import org.solovyev.android.Check; import org.solovyev.android.calculator.floating.FloatingCalculatorService; import org.solovyev.android.calculator.view.EditTextCompat; +import org.solovyev.android.views.Adjuster; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -64,6 +65,7 @@ public class EditorView extends EditTextCompat { } private void init() { + Adjuster.adjustText(this, 0.25f); addTextChangedListener(new MyTextWatcher()); dontShowSoftInputOnFocusCompat(); // changes should only be reported after the view has been set up completely, i.e. now diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml index c16fd7c2..63f2ba2f 100644 --- a/app/src/main/res/layout-land/activity_main.xml +++ b/app/src/main/res/layout-land/activity_main.xml @@ -21,12 +21,13 @@ ~ Email: se.solovyev@gmail.com ~ Site: http://se.solovyev.org --> - - + - + a:layout_weight="3" /> diff --git a/app/src/main/res/layout-sw600dp/activity_main.xml b/app/src/main/res/layout-sw600dp/activity_main.xml new file mode 100644 index 00000000..fb8f3557 --- /dev/null +++ b/app/src/main/res/layout-sw600dp/activity_main.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-sw600dp/cpp_app_keyboard.xml b/app/src/main/res/layout-sw600dp/cpp_app_keyboard.xml new file mode 100644 index 00000000..a271e8b7 --- /dev/null +++ b/app/src/main/res/layout-sw600dp/cpp_app_keyboard.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 835d6377..c4d128b2 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -30,7 +30,7 @@ a:layout_height="match_parent" a:orientation="vertical"> - + - + a:layout_weight="5" /> diff --git a/app/src/main/res/layout/cpp_app_display_mobile.xml b/app/src/main/res/layout/cpp_app_display_mobile.xml deleted file mode 100644 index 53a8b09d..00000000 --- a/app/src/main/res/layout/cpp_app_display_mobile.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/cpp_app_editor_mobile.xml b/app/src/main/res/layout/cpp_app_editor_mobile.xml deleted file mode 100644 index 12b49a2a..00000000 --- a/app/src/main/res/layout/cpp_app_editor_mobile.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/matrix_edit_fragment.xml b/app/src/main/res/layout/matrix_edit_fragment.xml index 028d2d4b..a206e32e 100644 --- a/app/src/main/res/layout/matrix_edit_fragment.xml +++ b/app/src/main/res/layout/matrix_edit_fragment.xml @@ -31,12 +31,6 @@ a:layout_width="match_parent" a:layout_height="match_parent"> - - 20sp - 40sp - 20sp - 40sp - 24dp \ No newline at end of file diff --git a/app/src/main/res/values-large-mdpi/dimens.xml b/app/src/main/res/values-large-mdpi/dimens.xml index 2d7bd5fa..5be31bbb 100644 --- a/app/src/main/res/values-large-mdpi/dimens.xml +++ b/app/src/main/res/values-large-mdpi/dimens.xml @@ -22,10 +22,6 @@ 25sp - 45sp - 20sp - 35sp - 35dp \ No newline at end of file diff --git a/app/src/main/res/values-large-tvdpi/dimens.xml b/app/src/main/res/values-large-tvdpi/dimens.xml index 0bc7d60c..492b4c8f 100644 --- a/app/src/main/res/values-large-tvdpi/dimens.xml +++ b/app/src/main/res/values-large-tvdpi/dimens.xml @@ -22,10 +22,6 @@ 30sp - 40sp - 30sp - 35sp - 33dp \ No newline at end of file diff --git a/app/src/main/res/values-normal/dimens.xml b/app/src/main/res/values-normal/dimens.xml index 496d1b4c..17f5d575 100644 --- a/app/src/main/res/values-normal/dimens.xml +++ b/app/src/main/res/values-normal/dimens.xml @@ -22,11 +22,6 @@ 15sp - 20sp - 30sp - 30sp - 30sp - 30sp \ No newline at end of file diff --git a/app/src/main/res/values-small/dimens.xml b/app/src/main/res/values-small/dimens.xml index 955f7d3c..de7c6e5a 100644 --- a/app/src/main/res/values-small/dimens.xml +++ b/app/src/main/res/values-small/dimens.xml @@ -22,12 +22,7 @@ 15sp - 20sp - 20sp - 20sp - 20sp - 20sp 40dp \ No newline at end of file diff --git a/app/src/main/res/values-xlarge-hdpi/dimens.xml b/app/src/main/res/values-xlarge-hdpi/dimens.xml index 943d2702..99175d81 100644 --- a/app/src/main/res/values-xlarge-hdpi/dimens.xml +++ b/app/src/main/res/values-xlarge-hdpi/dimens.xml @@ -22,10 +22,6 @@ 30sp - 75sp - - 75sp 30sp - 40dp \ No newline at end of file diff --git a/app/src/main/res/values-xlarge-mdpi/dimens.xml b/app/src/main/res/values-xlarge-mdpi/dimens.xml index 449ff642..42fba28f 100644 --- a/app/src/main/res/values-xlarge-mdpi/dimens.xml +++ b/app/src/main/res/values-xlarge-mdpi/dimens.xml @@ -22,10 +22,6 @@ 40sp - 75sp - - 75sp 30sp - 35dp \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 73e622fd..d2b8c8c7 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -16,9 +16,6 @@ 30dp 12dp - 25sp - 25sp - 25sp 25sp 2dp diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 14df9e37..15b08291 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -66,10 +66,6 @@ textMultiLine|textNoSuggestions - - - -