Layouts
This commit is contained in:
parent
9b6e3337c5
commit
999299d9bb
@ -6,11 +6,23 @@
|
|||||||
~ or visit http://se.solovyev.org
|
~ or visit http://se.solovyev.org
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<org.solovyev.android.calculator.AndroidCalculatorDisplayView
|
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
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">
|
||||||
|
|
||||||
|
<TextView a:id="@+id/fragmentTitle"
|
||||||
|
a:layout_height="wrap_content"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
style="?fragmentTitleStyle"/>
|
||||||
|
|
||||||
|
<org.solovyev.android.calculator.AndroidCalculatorDisplayView
|
||||||
a:id="@+id/calculatorDisplay"
|
a:id="@+id/calculatorDisplay"
|
||||||
style="@style/display_style"
|
style="@style/display_style"
|
||||||
a:inputType="textMultiLine"
|
a:inputType="textMultiLine"
|
||||||
a:maxLines="3"
|
a:maxLines="3"
|
||||||
a:scrollHorizontally="false"
|
a:scrollHorizontally="false"
|
||||||
a:scrollbars="none"/>
|
a:scrollbars="none"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -29,7 +29,7 @@
|
|||||||
a:layout_height="0dp"
|
a:layout_height="0dp"
|
||||||
a:layout_width="match_parent"
|
a:layout_width="match_parent"
|
||||||
style="?paneStyle"
|
style="?paneStyle"
|
||||||
a:layout_weight="4"/>
|
a:layout_weight="3"/>
|
||||||
|
|
||||||
<LinearLayout a:id="@+id/displayContainer"
|
<LinearLayout a:id="@+id/displayContainer"
|
||||||
a:layout_height="0dp"
|
a:layout_height="0dp"
|
||||||
|
28
calculatorpp/res/layout-large/calc_display.xml
Normal file
28
calculatorpp/res/layout-large/calc_display.xml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<TextView a:id="@+id/fragmentTitle"
|
||||||
|
a:layout_height="wrap_content"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
style="?fragmentTitleStyle"/>
|
||||||
|
|
||||||
|
<org.solovyev.android.calculator.AndroidCalculatorDisplayView
|
||||||
|
a:id="@+id/calculatorDisplay"
|
||||||
|
style="@style/display_style"
|
||||||
|
a:inputType="textMultiLine"
|
||||||
|
a:maxLines="3"
|
||||||
|
a:scrollHorizontally="false"
|
||||||
|
a:scrollbars="none"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
28
calculatorpp/res/layout-large/calc_editor.xml
Normal file
28
calculatorpp/res/layout-large/calc_editor.xml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<TextView a:id="@+id/fragmentTitle"
|
||||||
|
a:layout_height="wrap_content"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
style="?fragmentTitleStyle"/>
|
||||||
|
|
||||||
|
<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>
|
53
calculatorpp/res/layout-large/calc_keyboard.xml
Normal file
53
calculatorpp/res/layout-large/calc_keyboard.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>
|
57
calculatorpp/res/layout-large/main_calculator.xml
Normal file
57
calculatorpp/res/layout-large/main_calculator.xml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?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="?mainMultiPaneLayoutStyle">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
a:layout_height="0dp"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_weight="3"
|
||||||
|
a:orientation="horizontal"
|
||||||
|
a:baselineAligned="false">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
a:layout_height="match_parent"
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_weight="1"
|
||||||
|
a:orientation="vertical"
|
||||||
|
a:layout_gravity="center">
|
||||||
|
|
||||||
|
<LinearLayout a:id="@+id/editorContainer"
|
||||||
|
a:layout_height="0dp"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
style="?paneStyle"
|
||||||
|
a:layout_weight="4"/>
|
||||||
|
|
||||||
|
<LinearLayout a:id="@+id/displayContainer"
|
||||||
|
a:layout_height="0dp"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
style="?paneStyle"
|
||||||
|
a:layout_weight="1"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout a:id="@+id/main_second_pane"
|
||||||
|
a:layout_height="match_parent"
|
||||||
|
a:layout_width="0dp"
|
||||||
|
a:layout_weight="1"
|
||||||
|
a:orientation="vertical"
|
||||||
|
style="?paneStyle"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout a:id="@+id/keyboardContainer"
|
||||||
|
a:layout_height="0dp"
|
||||||
|
a:layout_width="match_parent"
|
||||||
|
a:layout_weight="1"
|
||||||
|
style="?paneStyleTransparent"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -1,3 +1,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<dimen name="keyboard_button_text_size">40dp</dimen>
|
<dimen name="editor_text_size">15sp</dimen>
|
||||||
|
<dimen name="display_text_size">15sp</dimen>
|
||||||
|
<dimen name="keyboard_button_text_size">20dp</dimen>
|
||||||
</resources>
|
</resources>
|
@ -208,5 +208,6 @@
|
|||||||
<string name="convert_to_dec">Convert to dec</string>
|
<string name="convert_to_dec">Convert to dec</string>
|
||||||
|
|
||||||
<string name="editor">Editor</string>
|
<string name="editor">Editor</string>
|
||||||
|
<string name="result">Result</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -71,9 +71,10 @@ public final class CalculatorButtons {
|
|||||||
if (AndroidUtils.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT || !CalculatorPreferences.Gui.autoOrientation.getPreference(preferences)) {
|
if (AndroidUtils.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT || !CalculatorPreferences.Gui.autoOrientation.getPreference(preferences)) {
|
||||||
final Display display = activity.getWindowManager().getDefaultDisplay();
|
final Display display = activity.getWindowManager().getDefaultDisplay();
|
||||||
|
|
||||||
final DragButton button = (DragButton)activity.findViewById(R.id.equalsButton);
|
final DragButton equalsButton = (DragButton)activity.findViewById(R.id.equalsButton);
|
||||||
|
if (equalsButton != null) {
|
||||||
if (CalculatorPreferences.Gui.showEqualsButton.getPreference(preferences)) {
|
if (CalculatorPreferences.Gui.showEqualsButton.getPreference(preferences)) {
|
||||||
button.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT, 1f));
|
equalsButton.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT, 1f));
|
||||||
if (display.getWidth() <= 480) {
|
if (display.getWidth() <= 480) {
|
||||||
// mobile phones
|
// mobile phones
|
||||||
final AndroidCalculatorDisplayView calculatorDisplayView = getCalculatorDisplayView();
|
final AndroidCalculatorDisplayView calculatorDisplayView = getCalculatorDisplayView();
|
||||||
@ -82,7 +83,7 @@ public final class CalculatorButtons {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
button.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT, 0f));
|
equalsButton.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT, 0f));
|
||||||
if (display.getWidth() <= 480) {
|
if (display.getWidth() <= 480) {
|
||||||
// mobile phones
|
// mobile phones
|
||||||
final AndroidCalculatorDisplayView calculatorDisplayView = getCalculatorDisplayView();
|
final AndroidCalculatorDisplayView calculatorDisplayView = getCalculatorDisplayView();
|
||||||
@ -91,8 +92,7 @@ public final class CalculatorButtons {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
processButtons(false, theme, root);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package org.solovyev.android.calculator;
|
package org.solovyev.android.calculator;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import com.actionbarsherlock.app.SherlockFragment;
|
import com.actionbarsherlock.app.SherlockFragment;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: Solovyev_S
|
* User: Solovyev_S
|
||||||
@ -14,20 +14,53 @@ import com.actionbarsherlock.app.SherlockFragment;
|
|||||||
*/
|
*/
|
||||||
public class CalculatorDisplayFragment extends SherlockFragment {
|
public class CalculatorDisplayFragment extends SherlockFragment {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private final CalculatorFragmentHelper fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.calc_display, R.string.result);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
return inflater.inflate(R.layout.calc_display, container, false);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
fragmentHelper.onCreate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
return fragmentHelper.onCreateView(this, inflater, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View root, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(root, savedInstanceState);
|
||||||
|
|
||||||
((AndroidCalculator) CalculatorLocatorImpl.getInstance().getCalculator()).setDisplay(getActivity());
|
((AndroidCalculator) CalculatorLocatorImpl.getInstance().getCalculator()).setDisplay(getActivity());
|
||||||
|
|
||||||
|
fragmentHelper.onViewCreated(this, root);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
|
||||||
|
fragmentHelper.onResume(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
fragmentHelper.onPause(this);
|
||||||
|
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
fragmentHelper.onDestroy(this);
|
||||||
|
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,14 +20,14 @@ public interface CalculatorFragmentHelper {
|
|||||||
|
|
||||||
void onCreate(@NotNull Fragment fragment);
|
void onCreate(@NotNull Fragment fragment);
|
||||||
|
|
||||||
void onResume(@NotNull Fragment fragment);
|
|
||||||
|
|
||||||
void onPause(@NotNull Fragment fragment);
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
View onCreateView(@NotNull Fragment fragment, @NotNull LayoutInflater inflater, @Nullable ViewGroup container);
|
View onCreateView(@NotNull Fragment fragment, @NotNull LayoutInflater inflater, @Nullable ViewGroup container);
|
||||||
|
|
||||||
void onViewCreated(@NotNull Fragment fragment, @NotNull View root);
|
void onViewCreated(@NotNull Fragment fragment, @NotNull View root);
|
||||||
|
|
||||||
|
void onResume(@NotNull Fragment fragment);
|
||||||
|
|
||||||
|
void onPause(@NotNull Fragment fragment);
|
||||||
|
|
||||||
void onDestroy(@NotNull Fragment fragment);
|
void onDestroy(@NotNull Fragment fragment);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user