Mobile layout for tablets
This commit is contained in:
parent
ef141ed054
commit
0ab3afa453
@ -7,12 +7,12 @@
|
||||
<parent>
|
||||
<groupId>org.solovyev.android</groupId>
|
||||
<artifactId>calculatorpp-parent</artifactId>
|
||||
<version>1.4.3-b1-SNAPSHOT</version>
|
||||
<version>1.4.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.solovyev.android</groupId>
|
||||
<artifactId>calculatorpp-core</artifactId>
|
||||
<version>1.4.3-b1-SNAPSHOT</version>
|
||||
<version>1.4.3-SNAPSHOT</version>
|
||||
<name>Calculator++ Application Core</name>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.solovyev.android</groupId>
|
||||
<artifactId>calculatorpp-parent</artifactId>
|
||||
<version>1.4.3-b1-SNAPSHOT</version>
|
||||
<version>1.4.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="103" android:versionName="1.4.3-b1-SNAPSHOT" package="org.solovyev.android.calculator">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="104" android:versionName="1.4.3-b1-SNAPSHOT" package="org.solovyev.android.calculator">
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
|
||||
|
||||
<application android:debuggable="true" android:hardwareAccelerated="false" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/metro_blue_theme">
|
||||
<application android:debuggable="false" android:hardwareAccelerated="false" android:icon="@drawable/icon" android:label="@string/c_app_name" android:name=".CalculatorApplication" android:theme="@style/metro_blue_theme">
|
||||
|
||||
<activity android:clearTaskOnLaunch="true" android:label="@string/c_app_name" android:name=".CalculatorActivity" android:windowSoftInputMode="adjustPan">
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.solovyev.android</groupId>
|
||||
<artifactId>calculatorpp-parent</artifactId>
|
||||
<version>1.4.3-b1-SNAPSHOT</version>
|
||||
<version>1.4.3-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -23,7 +23,7 @@
|
||||
<dependency>
|
||||
<groupId>org.solovyev.android</groupId>
|
||||
<artifactId>calculatorpp-core</artifactId>
|
||||
<version>1.4.3-b1-SNAPSHOT</version>
|
||||
<version>1.4.3-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
53
calculatorpp/res/layout-land/calc_keyboard_mobile.xml
Normal file
53
calculatorpp/res/layout-land/calc_keyboard_mobile.xml
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<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_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/calc_vars_button"/>
|
||||
<include layout="@layout/calc_copy_button"/>
|
||||
<include layout="@layout/calc_seven_digit_button"/>
|
||||
<include layout="@layout/calc_eight_digit_button"/>
|
||||
<include layout="@layout/calc_nine_digit_button"/>
|
||||
<include layout="@layout/calc_multiplication_button"/>
|
||||
<include layout="@layout/calc_division_button"/>
|
||||
<include layout="@layout/calc_equals_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/calc_functions_button"/>
|
||||
<include layout="@layout/calc_paste_button"/>
|
||||
<include layout="@layout/calc_four_digit_button"/>
|
||||
<include layout="@layout/calc_five_digit_button"/>
|
||||
<include layout="@layout/calc_six_digit_button"/>
|
||||
<include layout="@layout/calc_plus_button"/>
|
||||
<include layout="@layout/calc_subtraction_button"/>
|
||||
<include layout="@layout/calc_round_brackets_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/calc_operators_button"/>
|
||||
<include layout="@layout/calc_donate_button"/>
|
||||
<include layout="@layout/calc_one_digit_button"/>
|
||||
<include layout="@layout/calc_two_digit_button"/>
|
||||
<include layout="@layout/calc_three_digit_button"/>
|
||||
<include layout="@layout/calc_zero_digit_button"/>
|
||||
<include layout="@layout/calc_dot_button"/>
|
||||
<include layout="@layout/calc_history_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
16
calculatorpp/res/layout-land/main_calculator_mobile.xml
Normal file
16
calculatorpp/res/layout-land/main_calculator_mobile.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||
~ For more information, please, contact se.solovyev@gmail.com
|
||||
~ or visit http://se.solovyev.org
|
||||
-->
|
||||
<LinearLayout
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/main_layout"
|
||||
a:orientation="vertical"
|
||||
style="?mainLayoutStyle">
|
||||
|
||||
<include layout="@layout/main_first_pane_mobile"/>
|
||||
|
||||
</LinearLayout>
|
62
calculatorpp/res/layout-land/main_first_pane_mobile.xml
Normal file
62
calculatorpp/res/layout-land/main_first_pane_mobile.xml
Normal file
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||
~ For more information, please, contact se.solovyev@gmail.com
|
||||
~ or visit 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"
|
||||
a:layout_gravity="center">
|
||||
|
||||
<LinearLayout a:id="@+id/editorContainer"
|
||||
a:layout_weight="2"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"/>
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/calc_left_button"
|
||||
a:layout_margin="@dimen/button_margin"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="match_parent"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<include layout="@layout/calc_erase_button"
|
||||
a:layout_margin="@dimen/button_margin"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="match_parent"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<LinearLayout a:id="@+id/displayContainer"
|
||||
a:layout_height="match_parent"
|
||||
a:layout_width="0dp"
|
||||
a:layout_weight="4"
|
||||
a:layout_margin="@dimen/display_margin_land"/>
|
||||
|
||||
<include layout="@layout/calc_clear_button"
|
||||
a:layout_margin="@dimen/button_margin"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="match_parent"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
<include layout="@layout/calc_right_button"
|
||||
a:layout_margin="@dimen/button_margin"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="match_parent"
|
||||
a:layout_weight="1"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:id="@+id/keyboardContainer"
|
||||
a:layout_weight="3"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
17
calculatorpp/res/layout/calc_display_mobile.xml
Normal file
17
calculatorpp/res/layout/calc_display_mobile.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||
~ For more information, please, contact se.solovyev@gmail.com
|
||||
~ or visit http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<org.solovyev.android.calculator.AndroidCalculatorDisplayView
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/calculatorDisplay"
|
||||
style="@style/display_style"
|
||||
a:padding="@dimen/display_padding"
|
||||
a:inputType="textMultiLine"
|
||||
a:maxLines="3"
|
||||
a:scrollHorizontally="false"
|
||||
a:scrollbars="none"/>
|
24
calculatorpp/res/layout/calc_editor_mobile.xml
Normal file
24
calculatorpp/res/layout/calc_editor_mobile.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||
~ For more information, please, contact se.solovyev@gmail.com
|
||||
~ or visit http://se.solovyev.org
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/main_fragment_layout"
|
||||
style="?fragmentLayoutStyle"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:padding="@dimen/editor_padding">
|
||||
|
||||
<org.solovyev.android.calculator.AndroidCalculatorEditorView
|
||||
a:id="@+id/calculatorEditor"
|
||||
style="@style/editor_style"
|
||||
a:textIsSelectable="true"
|
||||
a:singleLine="false"
|
||||
a:scrollbars="vertical"
|
||||
a:hint="@string/c_calc_editor_hint"/>
|
||||
|
||||
</LinearLayout>
|
69
calculatorpp/res/layout/calc_keyboard_mobile.xml
Normal file
69
calculatorpp/res/layout/calc_keyboard_mobile.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<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_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/calc_seven_digit_button"/>
|
||||
<include layout="@layout/calc_eight_digit_button"/>
|
||||
<include layout="@layout/calc_nine_digit_button"/>
|
||||
<include layout="@layout/calc_multiplication_button"/>
|
||||
<include layout="@layout/calc_clear_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/calc_four_digit_button"/>
|
||||
<include layout="@layout/calc_five_digit_button"/>
|
||||
<include layout="@layout/calc_six_digit_button"/>
|
||||
<include layout="@layout/calc_division_button"/>
|
||||
<include layout="@layout/calc_erase_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/calc_one_digit_button"/>
|
||||
<include layout="@layout/calc_two_digit_button"/>
|
||||
<include layout="@layout/calc_three_digit_button"/>
|
||||
<include layout="@layout/calc_plus_button"/>
|
||||
<include layout="@layout/calc_copy_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/calc_round_brackets_button"/>
|
||||
<include layout="@layout/calc_zero_digit_button"/>
|
||||
<include layout="@layout/calc_dot_button"/>
|
||||
<include layout="@layout/calc_subtraction_button"/>
|
||||
<include layout="@layout/calc_paste_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/calc_left_button"/>
|
||||
<include layout="@layout/calc_right_button"/>
|
||||
<include layout="@layout/calc_vars_button"/>
|
||||
<include layout="@layout/calc_functions_button"/>
|
||||
<include layout="@layout/calc_history_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
44
calculatorpp/res/layout/main_calculator_mobile.xml
Normal file
44
calculatorpp/res/layout/main_calculator_mobile.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
|
||||
~ For more information, please, contact se.solovyev@gmail.com
|
||||
~ or visit 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:id="@+id/main_layout"
|
||||
a:orientation="vertical"
|
||||
style="?mainLayoutStyle">
|
||||
|
||||
<LinearLayout a:id="@+id/editorContainer"
|
||||
a:layout_weight="2"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"/>
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/calc_equals_button"
|
||||
a:layout_margin="@dimen/button_margin"
|
||||
a:layout_weight="1"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="match_parent"/>
|
||||
|
||||
<LinearLayout a:id="@+id/displayContainer"
|
||||
a:layout_weight="4"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:id="@+id/keyboardContainer"
|
||||
a:layout_weight="5"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"/>
|
||||
|
||||
</LinearLayout>
|
@ -224,4 +224,11 @@
|
||||
2. Переменная ans (последний вычисленный результат)
|
||||
</string>
|
||||
|
||||
<string name="c_release_notes_for_103">
|
||||
1. Виджет для рабочего стола (работает только если приложение установлено на внутреннюю память телефона)\n
|
||||
2. Раскладка от мобильного телефона для планшета (Настройки->Настройки внешнего вида->Раскладка->Научная (телефон))\n
|
||||
3. Ручные вычисления (Настройки->Настройки вычислений->Результат вычисляется…)
|
||||
</string>
|
||||
|
||||
|
||||
</resources>
|
@ -10,4 +10,7 @@
|
||||
|
||||
<string name="prefs_history_show_intermediate_calculations_title">Показывать промежуточные вычисления на экране истории</string>
|
||||
<string name="prefs_history_show_intermediate_calculations_summary">Если включено, то все вычисления будут показаны на экране истории</string>
|
||||
|
||||
<string name="p_calculations_calculate_on_fly_title">Результат вычисляется по мере ввода выражения</string>
|
||||
<string name="p_calculations_calculate_on_fly_summary">Если включено, то результат вычисляется по мере ввода выражения</string>
|
||||
</resources>
|
@ -115,7 +115,8 @@
|
||||
<string name="c_calc_layout">Раскладка</string>
|
||||
<string name="p_layout_cellphone">Научная (телефон)</string>
|
||||
<string name="p_layout_calculator">Научная</string>
|
||||
<string name="p_layout_simple">Простая</string>
|
||||
<string name="p_layout_calculator_mobile">Научная (телефон)</string>
|
||||
<string name="p_layout_simple">Простая</string>
|
||||
<string name="c_calc_layout_summary">Устанавливает раскладку кнопок</string>
|
||||
|
||||
<string name="c_calc_haptic_feedback_title">Отклик на нажатие</string>
|
||||
|
@ -41,10 +41,12 @@
|
||||
|
||||
<string-array name="p_layout_names">
|
||||
<item>@string/p_layout_calculator</item>
|
||||
<item>@string/p_layout_calculator_mobile</item>
|
||||
<item>@string/p_layout_simple</item>
|
||||
</string-array>
|
||||
<string-array name="p_layout_values">
|
||||
<item>main_calculator</item>
|
||||
<item>main_calculator_mobile</item>
|
||||
<item>simple</item>
|
||||
</string-array>
|
||||
|
||||
|
@ -223,4 +223,10 @@
|
||||
2. Ans variable (last calculated value)
|
||||
</string>
|
||||
|
||||
<string name="c_release_notes_for_103">
|
||||
1. Calculator++ widget for home screen (works only if app installed in phone memory)\n
|
||||
2. Mobile phone layout for tablets (Preferences->Appearance Preferences->Layout->Scientific (Mobile))\n
|
||||
3. Manual calculations (Preferences->Calculations Preferences->Result is calculated…)
|
||||
</string>
|
||||
|
||||
</resources>
|
@ -115,6 +115,7 @@
|
||||
<string name="c_calc_layout">Layout</string>
|
||||
<string name="p_layout_cellphone">Scientific (cellphone)</string>
|
||||
<string name="p_layout_calculator">Scientific</string>
|
||||
<string name="p_layout_calculator_mobile">Scientific (Mobile)</string>
|
||||
<string name="p_layout_simple">Simple</string>
|
||||
<string name="c_calc_layout_summary">Sets layout of buttons</string>
|
||||
|
||||
|
@ -69,7 +69,8 @@ public final class CalculatorButtons {
|
||||
@NotNull Activity activity) {
|
||||
preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences;
|
||||
|
||||
final boolean large = AndroidUtils.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration());
|
||||
final boolean large = AndroidUtils.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration()) &&
|
||||
CalculatorPreferences.Gui.getLayout(preferences) != CalculatorPreferences.Gui.Layout.main_calculator_mobile;
|
||||
|
||||
if (!large) {
|
||||
if (AndroidUtils.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT
|
||||
|
@ -1,6 +1,8 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -15,12 +17,20 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class CalculatorDisplayFragment extends SherlockFragment {
|
||||
|
||||
@NotNull
|
||||
private final CalculatorFragmentHelper fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.calc_display, R.string.result);
|
||||
private CalculatorFragmentHelper fragmentHelper;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getActivity());
|
||||
final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(prefs);
|
||||
if (layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile) {
|
||||
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.calc_display_mobile, R.string.result);
|
||||
} else {
|
||||
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.calc_display, R.string.result);
|
||||
}
|
||||
|
||||
fragmentHelper.onCreate(this);
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,17 @@
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuInflater;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.solovyev.android.calculator.about.CalculatorFragmentType;
|
||||
import org.solovyev.android.menu.ActivityMenu;
|
||||
import org.solovyev.android.menu.ListActivityMenu;
|
||||
import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
|
||||
@ -16,29 +21,82 @@ import org.solovyev.android.sherlock.menu.SherlockMenuHelper;
|
||||
* Date: 25.09.12
|
||||
* Time: 10:49
|
||||
*/
|
||||
public class CalculatorEditorFragment extends CalculatorFragment {
|
||||
public class CalculatorEditorFragment extends SherlockFragment {
|
||||
|
||||
@NotNull
|
||||
private CalculatorFragmentHelper fragmentHelper;
|
||||
|
||||
@NotNull
|
||||
private ActivityMenu<Menu, MenuItem> menu = ListActivityMenu.fromList(CalculatorMenu.class, SherlockMenuHelper.getInstance());
|
||||
|
||||
public CalculatorEditorFragment() {
|
||||
super(CalculatorFragmentType.editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
fragmentHelper.onViewCreated(this, view);
|
||||
|
||||
((AndroidCalculator) CalculatorLocatorImpl.getInstance().getCalculator()).setEditor(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getActivity());
|
||||
final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(prefs);
|
||||
if (layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile) {
|
||||
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.calc_editor_mobile, R.string.result);
|
||||
} else {
|
||||
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.calc_editor, R.string.result);
|
||||
}
|
||||
|
||||
fragmentHelper.onCreate(this);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return fragmentHelper.onCreateView(this, inflater, container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
this.fragmentHelper.onResume(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
this.fragmentHelper.onPause(this);
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
fragmentHelper.onDestroy(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
*
|
||||
|
@ -30,7 +30,13 @@ public class CalculatorKeyboardFragment extends SherlockFragment implements Shar
|
||||
|
||||
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this.getActivity());
|
||||
|
||||
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.calc_keyboard);
|
||||
final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(preferences);
|
||||
if (layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile) {
|
||||
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.calc_keyboard_mobile);
|
||||
} else {
|
||||
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.calc_keyboard);
|
||||
}
|
||||
|
||||
fragmentHelper.onCreate(this);
|
||||
|
||||
preferences.registerOnSharedPreferenceChangeListener(this);
|
||||
|
@ -95,6 +95,7 @@ public final class CalculatorPreferences {
|
||||
|
||||
public static enum Layout {
|
||||
main_calculator(R.layout.main_calculator),
|
||||
main_calculator_mobile(R.layout.main_calculator_mobile),
|
||||
|
||||
// not used anymore
|
||||
@Deprecated
|
||||
|
Loading…
Reference in New Issue
Block a user