Layout for large screens
This commit is contained in:
parent
96b4290260
commit
6339da1b7b
@ -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;
|
||||
|
@ -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
|
||||
|
@ -21,7 +21,8 @@
|
||||
~ Email: se.solovyev@gmail.com
|
||||
~ Site: http://se.solovyev.org
|
||||
-->
|
||||
<LinearLayout a:id="@+id/main"
|
||||
<LinearLayout
|
||||
a:id="@+id/main"
|
||||
style="@style/CppMain"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:orientation="vertical">
|
||||
@ -69,11 +70,10 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
a:id="@+id/keyboard"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="3"
|
||||
a:orientation="horizontal" />
|
||||
a:layout_weight="3" />
|
||||
|
||||
</LinearLayout>
|
||||
|
79
app/src/main/res/layout-sw600dp/activity_main.xml
Normal file
79
app/src/main/res/layout-sw600dp/activity_main.xml
Normal file
@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright 2013 serso aka se.solovyev
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
~
|
||||
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ Contact details
|
||||
~
|
||||
~ Email: se.solovyev@gmail.com
|
||||
~ Site: http://se.solovyev.org
|
||||
-->
|
||||
<LinearLayout
|
||||
a:id="@+id/main"
|
||||
style="@style/CppMain"
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="3">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
a:id="@+id/toolbar"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="?actionBarSize" />
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
a:id="@+id/card"
|
||||
style="?attr/cpp_card_style"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:layout_margin="@dimen/cpp_card_margin">
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
a:id="@+id/editor"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="2" />
|
||||
|
||||
<View
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="1px"
|
||||
a:background="?android:attr/listDivider" />
|
||||
|
||||
<FrameLayout
|
||||
a:id="@+id/display"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
a:id="@+id/keyboard"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="4" />
|
||||
|
||||
</LinearLayout>
|
122
app/src/main/res/layout-sw600dp/cpp_app_keyboard.xml
Normal file
122
app/src/main/res/layout-sw600dp/cpp_app_keyboard.xml
Normal file
@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright 2013 serso aka se.solovyev
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
~
|
||||
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ Contact details
|
||||
~
|
||||
~ Email: se.solovyev@gmail.com
|
||||
~ Site: http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1"
|
||||
a:baselineAligned="false"
|
||||
a:orientation="horizontal">
|
||||
|
||||
<include layout="@layout/cpp_app_button_left" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_erase" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_copy" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_paste" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_donate" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_clear" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_right" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1"
|
||||
a:baselineAligned="false"
|
||||
a:orientation="horizontal">
|
||||
|
||||
<include layout="@layout/cpp_app_button_vars" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_7" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_8" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_9" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_multiplication" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_division" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_equals" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1"
|
||||
a:baselineAligned="false"
|
||||
a:orientation="horizontal">
|
||||
|
||||
<include layout="@layout/cpp_app_button_functions" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_4" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_5" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_6" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_plus" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_minus" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_round_brackets" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="1"
|
||||
a:baselineAligned="false"
|
||||
a:orientation="horizontal">
|
||||
|
||||
<include layout="@layout/cpp_app_button_operators" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_1" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_2" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_3" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_0" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_dot" />
|
||||
|
||||
<include layout="@layout/cpp_app_button_history" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -53,11 +53,10 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
a:id="@+id/keyboard"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:layout_weight="5"
|
||||
a:orientation="vertical" />
|
||||
a:layout_weight="5" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright 2013 serso aka se.solovyev
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
~
|
||||
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ Contact details
|
||||
~
|
||||
~ Email: se.solovyev@gmail.com
|
||||
~ Site: http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<org.solovyev.android.calculator.DisplayView
|
||||
android:id="@+id/calculator_display"
|
||||
style="@style/CppText.Display"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:padding="@dimen/cpp_display_padding" />
|
@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright 2013 serso aka se.solovyev
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
~
|
||||
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ Contact details
|
||||
~
|
||||
~ Email: se.solovyev@gmail.com
|
||||
~ Site: http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/main_fragment_layout"
|
||||
style="@style/CppFragment"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:padding="@dimen/cpp_editor_padding">
|
||||
|
||||
<org.solovyev.android.calculator.EditorView
|
||||
a:id="@+id/calculator_editor"
|
||||
style="@style/CppText.Editor.Mobile"
|
||||
a:hint="@string/c_calc_editor_hint"
|
||||
a:scrollbars="vertical"
|
||||
a:singleLine="false"
|
||||
a:textIsSelectable="true" />
|
||||
|
||||
</LinearLayout>
|
@ -31,12 +31,6 @@
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
a:id="@+id/fragmentTitle"
|
||||
style="@style/CppFragmentTitle"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="wrap_content" />
|
||||
|
||||
<org.solovyev.android.calculator.AdView style="@style/CppAd" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -22,10 +22,6 @@
|
||||
|
||||
<resources>
|
||||
<dimen name="cpp_editor_text_size">20sp</dimen>
|
||||
<dimen name="cpp_editor_text_size_mobile">40sp</dimen>
|
||||
|
||||
<dimen name="cpp_display_text_size">20sp</dimen>
|
||||
<dimen name="cpp_display_text_size_mobile">40sp</dimen>
|
||||
|
||||
<dimen name="cpp_keyboard_button_text_size">24dp</dimen>
|
||||
</resources>
|
@ -22,10 +22,6 @@
|
||||
|
||||
<resources>
|
||||
<dimen name="cpp_editor_text_size">25sp</dimen>
|
||||
<dimen name="cpp_editor_text_size_mobile">45sp</dimen>
|
||||
|
||||
<dimen name="cpp_display_text_size">20sp</dimen>
|
||||
<dimen name="cpp_display_text_size_mobile">35sp</dimen>
|
||||
|
||||
<dimen name="cpp_keyboard_button_text_size">35dp</dimen>
|
||||
</resources>
|
@ -22,10 +22,6 @@
|
||||
|
||||
<resources>
|
||||
<dimen name="cpp_editor_text_size">30sp</dimen>
|
||||
<dimen name="cpp_editor_text_size_mobile">40sp</dimen>
|
||||
|
||||
<dimen name="cpp_display_text_size">30sp</dimen>
|
||||
<dimen name="cpp_display_text_size_mobile">35sp</dimen>
|
||||
|
||||
<dimen name="cpp_keyboard_button_text_size">33dp</dimen>
|
||||
</resources>
|
@ -22,11 +22,6 @@
|
||||
|
||||
<resources>
|
||||
<dimen name="cpp_fragment_text_size">15sp</dimen>
|
||||
<dimen name="cpp_fragment_title_text_size">20sp</dimen>
|
||||
|
||||
<dimen name="cpp_editor_text_size">30sp</dimen>
|
||||
<dimen name="cpp_editor_text_size_mobile">30sp</dimen>
|
||||
|
||||
<dimen name="cpp_display_text_size">30sp</dimen>
|
||||
<dimen name="cpp_display_text_size_mobile">30sp</dimen>
|
||||
</resources>
|
@ -22,12 +22,7 @@
|
||||
|
||||
<resources>
|
||||
<dimen name="cpp_fragment_text_size">15sp</dimen>
|
||||
<dimen name="cpp_fragment_title_text_size">20sp</dimen>
|
||||
|
||||
<dimen name="cpp_editor_text_size">20sp</dimen>
|
||||
<dimen name="cpp_editor_text_size_mobile">20sp</dimen>
|
||||
|
||||
<dimen name="cpp_display_text_size">20sp</dimen>
|
||||
<dimen name="cpp_display_text_size_mobile">20sp</dimen>
|
||||
<dimen name="cpp_clickable_area_size">40dp</dimen>
|
||||
</resources>
|
@ -22,10 +22,6 @@
|
||||
|
||||
<resources>
|
||||
<dimen name="cpp_editor_text_size">30sp</dimen>
|
||||
<dimen name="cpp_editor_text_size_mobile">75sp</dimen>
|
||||
|
||||
<dimen name="cpp_display_text_size_mobile">75sp</dimen>
|
||||
<dimen name="cpp_display_text_size">30sp</dimen>
|
||||
|
||||
<dimen name="cpp_keyboard_button_text_size">40dp</dimen>
|
||||
</resources>
|
@ -22,10 +22,6 @@
|
||||
|
||||
<resources>
|
||||
<dimen name="cpp_editor_text_size">40sp</dimen>
|
||||
<dimen name="cpp_editor_text_size_mobile">75sp</dimen>
|
||||
|
||||
<dimen name="cpp_display_text_size_mobile">75sp</dimen>
|
||||
<dimen name="cpp_display_text_size">30sp</dimen>
|
||||
|
||||
<dimen name="cpp_keyboard_button_text_size">35dp</dimen>
|
||||
</resources>
|
@ -16,9 +16,6 @@
|
||||
<dimen name="cpp_keyboard_button_text_size">30dp</dimen>
|
||||
<dimen name="cpp_keyboard_simple_image_button_padding">12dp</dimen>
|
||||
|
||||
<dimen name="cpp_display_text_size_mobile">25sp</dimen>
|
||||
<dimen name="cpp_editor_text_size_mobile">25sp</dimen>
|
||||
|
||||
<dimen name="cpp_display_text_size">25sp</dimen>
|
||||
<dimen name="cpp_editor_text_size">25sp</dimen>
|
||||
<dimen name="cpp_pane_margin">2dp</dimen>
|
||||
|
@ -66,10 +66,6 @@
|
||||
<item name="android:inputType">textMultiLine|textNoSuggestions</item>
|
||||
</style>
|
||||
|
||||
<style name="CppText.Editor.Mobile" parent="CppText.Editor">
|
||||
<item name="android:textSize">@dimen/cpp_editor_text_size_mobile</item>
|
||||
</style>
|
||||
|
||||
<style name="CppText.Display" parent="CppText">
|
||||
<item name="android:gravity">center_vertical|right</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
@ -203,11 +199,6 @@
|
||||
<item name="android:textAppearance">@android:style/TextAppearance.Medium</item>
|
||||
</style>
|
||||
|
||||
<style name="CppFragmentTitle">
|
||||
<item name="android:textColor">?android:attr/textColorPrimary</item>
|
||||
<item name="android:textSize">@dimen/cpp_fragment_title_text_size</item>
|
||||
</style>
|
||||
|
||||
<style name="CppPane.Multipane.Left" parent="CppPane.Multipane">
|
||||
<item name="android:layout_marginLeft">0dp</item>
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user