changes
This commit is contained in:
13
android-app-widget/res/layout/widget_app_button.xml
Normal file
13
android-app-widget/res/layout/widget_app_button.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/appButton"
|
||||
a:src="@drawable/kb_logo"
|
||||
style="@style/widget_metro_control_image_button_style"
|
||||
a:contentDescription="App"/>
|
13
android-app-widget/res/layout/widget_clear_button.xml
Normal file
13
android-app-widget/res/layout/widget_clear_button.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/clearButton"
|
||||
a:text="@string/c_clear"
|
||||
a:textStyle="bold"
|
||||
style="@style/widget_metro_control_button_style"/>
|
13
android-app-widget/res/layout/widget_copy_button.xml
Normal file
13
android-app-widget/res/layout/widget_copy_button.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/copyButton"
|
||||
a:src="@drawable/kb_copy"
|
||||
style="@style/widget_metro_control_image_button_style"
|
||||
a:contentDescription="Copy"/>
|
16
android-app-widget/res/layout/widget_display.xml
Normal file
16
android-app-widget/res/layout/widget_display.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
|
||||
-->
|
||||
|
||||
<TextView
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/calculator_display"
|
||||
style="@style/cpp_widget_display_style"
|
||||
a:textIsSelectable="true"
|
||||
a:padding="@dimen/cpp_display_padding"
|
||||
a:singleLine="false"
|
||||
a:scrollbars="vertical"/>
|
12
android-app-widget/res/layout/widget_division_button.xml
Normal file
12
android-app-widget/res/layout/widget_division_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/divisionButton"
|
||||
a:text="/"
|
||||
style="@style/widget_metro_blue_operation_button_style"/>
|
12
android-app-widget/res/layout/widget_dot_button.xml
Normal file
12
android-app-widget/res/layout/widget_dot_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/periodButton"
|
||||
a:text="."
|
||||
style="@style/metro_digit_button_style"/>
|
24
android-app-widget/res/layout/widget_editor.xml
Normal file
24
android-app-widget/res/layout/widget_editor.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="@style/cpp_default_fragment_layout_style"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="match_parent"
|
||||
a:padding="@dimen/cpp_editor_padding">
|
||||
|
||||
<TextView
|
||||
a:id="@+id/calculator_editor"
|
||||
style="@style/cpp_widget_editor_style"
|
||||
a:textIsSelectable="true"
|
||||
a:singleLine="false"
|
||||
a:scrollbars="vertical"
|
||||
a:hint="@string/c_calc_editor_hint"/>
|
||||
|
||||
</LinearLayout>
|
12
android-app-widget/res/layout/widget_eight_digit_button.xml
Normal file
12
android-app-widget/res/layout/widget_eight_digit_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/eightDigitButton"
|
||||
a:text="8"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
12
android-app-widget/res/layout/widget_equals_button.xml
Normal file
12
android-app-widget/res/layout/widget_equals_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
<Button
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/equalsButton"
|
||||
a:text="="
|
||||
style="@style/widget_metro_control_button_style"/>
|
13
android-app-widget/res/layout/widget_erase_button.xml
Normal file
13
android-app-widget/res/layout/widget_erase_button.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/eraseButton"
|
||||
a:src="@drawable/kb_delete"
|
||||
style="@style/widget_metro_control_image_button_style"
|
||||
a:contentDescription="Erase"/>
|
11
android-app-widget/res/layout/widget_five_digit_button.xml
Normal file
11
android-app-widget/res/layout/widget_five_digit_button.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?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
|
||||
-->
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/fiveDigitButton"
|
||||
a:text="5"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
11
android-app-widget/res/layout/widget_four_digit_button.xml
Normal file
11
android-app-widget/res/layout/widget_four_digit_button.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?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
|
||||
-->
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/fourDigitButton"
|
||||
a:text="4"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
13
android-app-widget/res/layout/widget_functions_button.xml
Normal file
13
android-app-widget/res/layout/widget_functions_button.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/functions_button"
|
||||
a:text="ƒ(x)"
|
||||
a:textStyle="italic"
|
||||
style="@style/widget_metro_control_button_style"/>
|
12
android-app-widget/res/layout/widget_history_button.xml
Normal file
12
android-app-widget/res/layout/widget_history_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/historyButton"
|
||||
a:text="@string/c_history_button"
|
||||
style="@style/widget_metro_control_button_style"
|
||||
a:textStyle="bold"/>
|
74
android-app-widget/res/layout/widget_keyboard.xml
Normal file
74
android-app-widget/res/layout/widget_keyboard.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<?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/widget_seven_digit_button"/>
|
||||
<include layout="@layout/widget_eight_digit_button"/>
|
||||
<include layout="@layout/widget_nine_digit_button"/>
|
||||
<include layout="@layout/widget_multiplication_button"/>
|
||||
<include layout="@layout/widget_percent_button"/>
|
||||
<include layout="@layout/widget_clear_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/widget_four_digit_button"/>
|
||||
<include layout="@layout/widget_five_digit_button"/>
|
||||
<include layout="@layout/widget_six_digit_button"/>
|
||||
<include layout="@layout/widget_division_button"/>
|
||||
<include layout="@layout/widget_power_button"/>
|
||||
<include layout="@layout/widget_erase_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/widget_one_digit_button"/>
|
||||
<include layout="@layout/widget_two_digit_button"/>
|
||||
<include layout="@layout/widget_three_digit_button"/>
|
||||
<include layout="@layout/widget_plus_button"/>
|
||||
<include layout="@layout/widget_like_button"/>
|
||||
<include layout="@layout/widget_copy_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/widget_round_brackets_button"/>
|
||||
<include layout="@layout/widget_zero_digit_button"/>
|
||||
<include layout="@layout/widget_dot_button"/>
|
||||
<include layout="@layout/widget_subtraction_button"/>
|
||||
<include layout="@layout/widget_settings_button"/>
|
||||
<include layout="@layout/widget_paste_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout a:layout_weight="1"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp">
|
||||
|
||||
<include layout="@layout/widget_left_button"/>
|
||||
<include layout="@layout/widget_right_button"/>
|
||||
<include layout="@layout/widget_vars_button"/>
|
||||
<include layout="@layout/widget_functions_button"/>
|
||||
<include layout="@layout/widget_app_button"/>
|
||||
<include layout="@layout/widget_history_button"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
36
android-app-widget/res/layout/widget_layout.xml
Normal file
36
android-app-widget/res/layout/widget_layout.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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"
|
||||
style="@style/cpp_widget_main_layout_style">
|
||||
|
||||
<include layout="@layout/widget_editor"
|
||||
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/widget_equals_button"
|
||||
a:layout_margin="@dimen/cpp_button_margin"
|
||||
a:layout_weight="1"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="match_parent"/>
|
||||
|
||||
<include layout="@layout/widget_display"
|
||||
a:layout_weight="5"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/widget_keyboard"
|
||||
a:layout_weight="5"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"/>
|
||||
|
||||
</LinearLayout>
|
12
android-app-widget/res/layout/widget_left_button.xml
Normal file
12
android-app-widget/res/layout/widget_left_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/leftButton"
|
||||
a:text="◀"
|
||||
style="@style/widget_metro_control_button_style"/>
|
13
android-app-widget/res/layout/widget_like_button.xml
Normal file
13
android-app-widget/res/layout/widget_like_button.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/likeButton"
|
||||
a:src="@drawable/kb_facebook"
|
||||
style="@style/widget_metro_control_image_button_style"
|
||||
a:contentDescription="Like"/>
|
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/multiplicationButton"
|
||||
a:text="×"
|
||||
style="@style/widget_metro_blue_operation_button_style"/>
|
12
android-app-widget/res/layout/widget_nine_digit_button.xml
Normal file
12
android-app-widget/res/layout/widget_nine_digit_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/nineDigitButton"
|
||||
a:text="9"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
12
android-app-widget/res/layout/widget_one_digit_button.xml
Normal file
12
android-app-widget/res/layout/widget_one_digit_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/oneDigitButton"
|
||||
a:text="1"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
13
android-app-widget/res/layout/widget_paste_button.xml
Normal file
13
android-app-widget/res/layout/widget_paste_button.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/pasteButton"
|
||||
a:src="@drawable/kb_paste"
|
||||
style="@style/widget_metro_control_image_button_style"
|
||||
a:contentDescription="Paste"/>
|
12
android-app-widget/res/layout/widget_percent_button.xml
Normal file
12
android-app-widget/res/layout/widget_percent_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/percentButton"
|
||||
a:text="%"
|
||||
style="@style/widget_metro_blue_operation_button_style"/>
|
11
android-app-widget/res/layout/widget_plus_button.xml
Normal file
11
android-app-widget/res/layout/widget_plus_button.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?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
|
||||
-->
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/plusButton"
|
||||
a:text="+"
|
||||
style="@style/widget_metro_blue_operation_button_style"/>
|
12
android-app-widget/res/layout/widget_power_button.xml
Normal file
12
android-app-widget/res/layout/widget_power_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/powerButton"
|
||||
a:text="^"
|
||||
style="@style/widget_metro_blue_operation_button_style"/>
|
12
android-app-widget/res/layout/widget_right_button.xml
Normal file
12
android-app-widget/res/layout/widget_right_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/rightButton"
|
||||
a:text="▶"
|
||||
style="@style/widget_metro_control_button_style"/>
|
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/roundBracketsButton"
|
||||
a:text="()"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
13
android-app-widget/res/layout/widget_settings_button.xml
Normal file
13
android-app-widget/res/layout/widget_settings_button.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<ImageButton xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/settingsButton"
|
||||
a:src="@drawable/kb_settings"
|
||||
style="@style/widget_metro_control_image_button_style"
|
||||
a:contentDescription="Settings"/>
|
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/sevenDigitButton"
|
||||
a:text="7"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
12
android-app-widget/res/layout/widget_six_digit_button.xml
Normal file
12
android-app-widget/res/layout/widget_six_digit_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/sixDigitButton"
|
||||
a:text="6"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
11
android-app-widget/res/layout/widget_subtraction_button.xml
Normal file
11
android-app-widget/res/layout/widget_subtraction_button.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?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
|
||||
-->
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/subtractionButton"
|
||||
a:text="-"
|
||||
style="@style/widget_metro_blue_operation_button_style"/>
|
12
android-app-widget/res/layout/widget_three_digit_button.xml
Normal file
12
android-app-widget/res/layout/widget_three_digit_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/threeDigitButton"
|
||||
a:text="3"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
12
android-app-widget/res/layout/widget_two_digit_button.xml
Normal file
12
android-app-widget/res/layout/widget_two_digit_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/twoDigitButton"
|
||||
a:text="2"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
13
android-app-widget/res/layout/widget_vars_button.xml
Normal file
13
android-app-widget/res/layout/widget_vars_button.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/vars_button"
|
||||
a:text="π,…"
|
||||
a:textStyle="italic"
|
||||
style="@style/widget_metro_control_button_style"/>
|
12
android-app-widget/res/layout/widget_zero_digit_button.xml
Normal file
12
android-app-widget/res/layout/widget_zero_digit_button.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
<Button xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
a:id="@+id/zeroDigitButton"
|
||||
a:text="0"
|
||||
style="@style/widget_metro_digit_button_style"/>
|
4
android-app-widget/res/values/colors.xml
Normal file
4
android-app-widget/res/values/colors.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="cpp_widget_cursor_color">#ff707070</color>
|
||||
</resources>
|
7
android-app-widget/res/values/dimens.xml
Normal file
7
android-app-widget/res/values/dimens.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="cpp_widget_editor_text_size">25sp</dimen>
|
||||
<dimen name="cpp_widget_keyboard_button_text_size">20dp</dimen>
|
||||
<dimen name="cpp_widget_display_text_size">25sp</dimen>
|
||||
<dimen name="cpp_widget_margin">6dp</dimen>
|
||||
</resources>
|
32
android-app-widget/res/values/styles.xml
Normal file
32
android-app-widget/res/values/styles.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="cpp_widget_main_layout_style" parent="cpp_default_main_layout_style">
|
||||
<item name="android:padding">1dp</item>
|
||||
<item name="android:layout_margin">@dimen/cpp_widget_margin</item>
|
||||
</style>
|
||||
|
||||
<style name="cpp_widget_editor_style" parent="cpp_editor_style">
|
||||
<item name="android:textSize">@dimen/cpp_widget_editor_text_size</item>
|
||||
</style>
|
||||
|
||||
<style name="cpp_widget_display_style" parent="cpp_display_style">
|
||||
<item name="android:textSize">@dimen/cpp_widget_display_text_size</item>
|
||||
</style>
|
||||
|
||||
<style name="widget_metro_digit_button_style" parent="metro_digit_button_style">
|
||||
<item name="android:textSize">@dimen/cpp_widget_keyboard_button_text_size</item>
|
||||
</style>
|
||||
|
||||
<style name="widget_metro_control_button_style" parent="metro_control_button_style">
|
||||
<item name="android:textSize">@dimen/cpp_widget_keyboard_button_text_size</item>
|
||||
</style>
|
||||
|
||||
<style name="widget_metro_blue_operation_button_style" parent="metro_blue_operation_button_style">
|
||||
<item name="android:textSize">@dimen/cpp_widget_keyboard_button_text_size</item>
|
||||
</style>
|
||||
|
||||
<style name="widget_metro_control_image_button_style" parent="metro_control_image_button_style">
|
||||
<item name="android:scaleType">center</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@@ -0,0 +1,163 @@
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.Html;
|
||||
import android.widget.RemoteViews;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.solovyev.android.calculator.CalculatorButtons;
|
||||
import org.solovyev.android.calculator.CalculatorDisplayViewState;
|
||||
import org.solovyev.android.calculator.CalculatorEditorViewState;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
import org.solovyev.android.calculator.external.ExternalCalculatorIntentHandler;
|
||||
import org.solovyev.android.calculator.external.ExternalCalculatorStateUpdater;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 19.10.12
|
||||
* Time: 16:18
|
||||
*/
|
||||
abstract class AbstractCalculatorWidgetProvider extends AppWidgetProvider implements ExternalCalculatorStateUpdater {
|
||||
|
||||
static final String BUTTON_ID_EXTRA = "buttonId";
|
||||
static final String BUTTON_PRESSED_ACTION = "org.solovyev.android.calculator.widget.BUTTON_PRESSED";
|
||||
|
||||
private static final String TAG = "Calculator++ Widget";
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
*
|
||||
* FIELDS
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
@Nullable
|
||||
private String cursorColor;
|
||||
|
||||
@NotNull
|
||||
private ExternalCalculatorIntentHandler intentHandler = new CalculatorWidgetIntentHandler(this);
|
||||
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
*
|
||||
* CONSTRUCTORS
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
protected AbstractCalculatorWidgetProvider() {
|
||||
final Class<? extends AppWidgetProvider> componentClass = this.getComponentClass();
|
||||
|
||||
Locator.getInstance().getExternalListenersContainer().addExternalListener(componentClass);
|
||||
}
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
*
|
||||
* METHODS
|
||||
*
|
||||
**********************************************************************
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onEnabled(Context context) {
|
||||
super.onEnabled(context);
|
||||
|
||||
getCursorColor(context);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getCursorColor(@NotNull Context context) {
|
||||
if (cursorColor == null) {
|
||||
cursorColor = Integer.toHexString(context.getResources().getColor(R.color.cpp_widget_cursor_color)).substring(2);
|
||||
}
|
||||
return cursorColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(@NotNull Context context,
|
||||
@NotNull AppWidgetManager appWidgetManager,
|
||||
@NotNull int[] appWidgetIds) {
|
||||
super.onUpdate(context, appWidgetManager, appWidgetIds);
|
||||
|
||||
updateWidget(context, appWidgetManager, appWidgetIds, Locator.getInstance().getEditor().getViewState(), Locator.getInstance().getDisplay().getViewState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(@NotNull Context context,
|
||||
@NotNull CalculatorEditorViewState editorState,
|
||||
@NotNull CalculatorDisplayViewState displayState) {
|
||||
final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||
final int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getComponentClass()));
|
||||
updateWidget(context, appWidgetManager, appWidgetIds, editorState, displayState);
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
protected Class<? extends AbstractCalculatorWidgetProvider> getComponentClass(){
|
||||
return this.getClass();
|
||||
}
|
||||
|
||||
private void updateWidget(@NotNull Context context,
|
||||
@NotNull AppWidgetManager appWidgetManager,
|
||||
@NotNull int[] appWidgetIds,
|
||||
@NotNull CalculatorEditorViewState editorState,
|
||||
@NotNull CalculatorDisplayViewState displayState) {
|
||||
for (int appWidgetId : appWidgetIds) {
|
||||
final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
|
||||
|
||||
for (WidgetButton button : WidgetButton.values()) {
|
||||
final Intent onButtonClickIntent = new Intent(context, getComponentClass());
|
||||
onButtonClickIntent.setAction(BUTTON_PRESSED_ACTION);
|
||||
onButtonClickIntent.putExtra(BUTTON_ID_EXTRA, button.getButtonId());
|
||||
final PendingIntent pendingIntent = PendingIntent.getBroadcast(context, button.getButtonId(), onButtonClickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
if (pendingIntent != null) {
|
||||
views.setOnClickPendingIntent(button.getButtonId(), pendingIntent);
|
||||
}
|
||||
}
|
||||
|
||||
updateEditorState(context, views, editorState);
|
||||
updateDisplayState(context, views, displayState);
|
||||
|
||||
CalculatorButtons.initMultiplicationButton(views);
|
||||
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
super.onReceive(context, intent);
|
||||
|
||||
this.intentHandler.onIntent(context, intent);
|
||||
}
|
||||
|
||||
private void updateDisplayState(@NotNull Context context, @NotNull RemoteViews views, @NotNull CalculatorDisplayViewState displayState) {
|
||||
if (displayState.isValid()) {
|
||||
views.setTextViewText(R.id.calculator_display, displayState.getText());
|
||||
views.setTextColor(R.id.calculator_display, context.getResources().getColor(R.color.cpp_default_text_color));
|
||||
} else {
|
||||
views.setTextColor(R.id.calculator_display, context.getResources().getColor(R.color.cpp_display_error_text_color));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateEditorState(@NotNull Context context, @NotNull RemoteViews views, @NotNull CalculatorEditorViewState editorState) {
|
||||
String text = editorState.getText();
|
||||
|
||||
CharSequence newText = text;
|
||||
int selection = editorState.getSelection();
|
||||
if (selection >= 0 && selection <= text.length()) {
|
||||
// inject cursor
|
||||
newText = Html.fromHtml(text.substring(0, selection) + "<font color=\"#" + getCursorColor(context) + "\">|</font>" + text.substring(selection));
|
||||
}
|
||||
Locator.getInstance().getNotifier().showDebugMessage(TAG, "New editor state: " + text);
|
||||
views.setTextViewText(R.id.calculator_editor, newText);
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
/**
|
||||
* User: Solovyev_S
|
||||
* Date: 19.10.12
|
||||
* Time: 16:20
|
||||
*/
|
||||
public class CalculatorWidgetConfigurationActivity extends Activity {
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
import org.solovyev.android.calculator.external.DefaultExternalCalculatorIntentHandler;
|
||||
import org.solovyev.android.calculator.external.ExternalCalculatorStateUpdater;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 11/20/12
|
||||
* Time: 10:39 PM
|
||||
*/
|
||||
public class CalculatorWidgetIntentHandler extends DefaultExternalCalculatorIntentHandler {
|
||||
|
||||
public CalculatorWidgetIntentHandler(@NotNull ExternalCalculatorStateUpdater stateUpdater) {
|
||||
super(stateUpdater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntent(@NotNull Context context, @NotNull Intent intent) {
|
||||
super.onIntent(context, intent);
|
||||
|
||||
if (AbstractCalculatorWidgetProvider.BUTTON_PRESSED_ACTION.equals(intent.getAction())) {
|
||||
final int buttonId = intent.getIntExtra(AbstractCalculatorWidgetProvider.BUTTON_ID_EXTRA, 0);
|
||||
|
||||
final WidgetButton button = WidgetButton.getById(buttonId);
|
||||
if (button != null) {
|
||||
button.onClick(context);
|
||||
}
|
||||
} else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(intent.getAction())) {
|
||||
updateState(context, Locator.getInstance().getEditor().getViewState(), Locator.getInstance().getDisplay().getViewState());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 11/18/12
|
||||
* Time: 1:00 PM
|
||||
*/
|
||||
public class CalculatorWidgetProvider extends AbstractCalculatorWidgetProvider {
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 11/18/12
|
||||
* Time: 1:01 PM
|
||||
*/
|
||||
public class CalculatorWidgetProvider3x4 extends AbstractCalculatorWidgetProvider {
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 11/18/12
|
||||
* Time: 1:01 PM
|
||||
*/
|
||||
public class CalculatorWidgetProvider4x4 extends AbstractCalculatorWidgetProvider {
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 11/18/12
|
||||
* Time: 7:43 PM
|
||||
*/
|
||||
public class CalculatorWidgetProvider4x5 extends AbstractCalculatorWidgetProvider {
|
||||
}
|
@@ -0,0 +1,130 @@
|
||||
package org.solovyev.android.calculator.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.solovyev.android.calculator.CalculatorSpecialButton;
|
||||
import org.solovyev.android.calculator.Locator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 10/20/12
|
||||
* Time: 12:05 AM
|
||||
*/
|
||||
public enum WidgetButton {
|
||||
|
||||
/*digits*/
|
||||
one(R.id.oneDigitButton, "1"),
|
||||
two(R.id.twoDigitButton, "2"),
|
||||
three(R.id.threeDigitButton, "3"),
|
||||
four(R.id.fourDigitButton, "4"),
|
||||
five(R.id.fiveDigitButton, "5"),
|
||||
six(R.id.sixDigitButton, "6"),
|
||||
seven(R.id.sevenDigitButton, "7"),
|
||||
eight(R.id.eightDigitButton, "8"),
|
||||
nine(R.id.nineDigitButton, "9"),
|
||||
zero(R.id.zeroDigitButton, "0"),
|
||||
|
||||
period(R.id.periodButton, "."),
|
||||
brackets(R.id.roundBracketsButton, "()"),
|
||||
|
||||
settings(R.id.settingsButton, CalculatorSpecialButton.settings_detached),
|
||||
like(R.id.likeButton, CalculatorSpecialButton.like),
|
||||
|
||||
/*last row*/
|
||||
left(R.id.leftButton, CalculatorSpecialButton.cursor_left),
|
||||
right(R.id.rightButton, CalculatorSpecialButton.cursor_right),
|
||||
vars(R.id.vars_button, CalculatorSpecialButton.vars_detached),
|
||||
functions(R.id.functions_button, CalculatorSpecialButton.functions_detached),
|
||||
app(R.id.appButton, CalculatorSpecialButton.open_app),
|
||||
history(R.id.historyButton, CalculatorSpecialButton.history_detached),
|
||||
|
||||
/*operations*/
|
||||
multiplication(R.id.multiplicationButton, "*"),
|
||||
division(R.id.divisionButton, "/"),
|
||||
plus(R.id.plusButton, "+"),
|
||||
subtraction(R.id.subtractionButton, "-"),
|
||||
percent(R.id.percentButton, "%"),
|
||||
power(R.id.powerButton, "^"),
|
||||
|
||||
/*last column*/
|
||||
clear(R.id.clearButton, CalculatorSpecialButton.clear),
|
||||
erase(R.id.eraseButton, CalculatorSpecialButton.erase, CalculatorSpecialButton.clear),
|
||||
copy(R.id.copyButton, CalculatorSpecialButton.copy),
|
||||
paste(R.id.pasteButton, CalculatorSpecialButton.paste),
|
||||
|
||||
/*equals*/
|
||||
equals(R.id.equalsButton, CalculatorSpecialButton.equals);
|
||||
|
||||
|
||||
private final int buttonId;
|
||||
|
||||
@NotNull
|
||||
private final String onClickText;
|
||||
|
||||
@Nullable
|
||||
private final String onLongClickText;
|
||||
|
||||
@NotNull
|
||||
private static Map<Integer, WidgetButton> buttonsByIds = new HashMap<Integer, WidgetButton>();
|
||||
|
||||
WidgetButton(int buttonId, @NotNull CalculatorSpecialButton onClickButton, @Nullable CalculatorSpecialButton onLongClickButton) {
|
||||
this(buttonId, onClickButton.getActionCode(), onLongClickButton == null ? null : onLongClickButton.getActionCode());
|
||||
}
|
||||
|
||||
WidgetButton(int buttonId, @NotNull CalculatorSpecialButton onClickButton) {
|
||||
this(buttonId, onClickButton, null);
|
||||
}
|
||||
|
||||
WidgetButton(int buttonId, @NotNull String onClickText, @Nullable String onLongClickText) {
|
||||
this.buttonId = buttonId;
|
||||
this.onClickText = onClickText;
|
||||
this.onLongClickText = onLongClickText;
|
||||
|
||||
}
|
||||
|
||||
WidgetButton(int buttonId, @NotNull String onClickText) {
|
||||
this(buttonId, onClickText, null);
|
||||
}
|
||||
|
||||
public void onLongClick(@NotNull Context context) {
|
||||
Locator.getInstance().getNotifier().showDebugMessage("Calculator++ Widget", "Button pressed: " + onLongClickText);
|
||||
if (onLongClickText != null) {
|
||||
Locator.getInstance().getKeyboard().buttonPressed(onLongClickText);
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick(@NotNull Context context) {
|
||||
Locator.getInstance().getNotifier().showDebugMessage("Calculator++ Widget", "Button pressed: " + onClickText);
|
||||
Locator.getInstance().getKeyboard().buttonPressed(onClickText);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static WidgetButton getById(int buttonId) {
|
||||
initButtonsByIdsMap();
|
||||
|
||||
return buttonsByIds.get(buttonId);
|
||||
}
|
||||
|
||||
private static void initButtonsByIdsMap() {
|
||||
if ( buttonsByIds.isEmpty() ) {
|
||||
// if not initialized
|
||||
|
||||
final WidgetButton[] widgetButtons = values();
|
||||
|
||||
final Map<Integer, WidgetButton> localButtonsByIds = new HashMap<Integer, WidgetButton>(widgetButtons.length);
|
||||
for (WidgetButton widgetButton : widgetButtons) {
|
||||
localButtonsByIds.put(widgetButton.getButtonId(), widgetButton);
|
||||
}
|
||||
|
||||
buttonsByIds = localButtonsByIds;
|
||||
}
|
||||
}
|
||||
|
||||
public int getButtonId() {
|
||||
return buttonId;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user