Commit ecd55d88 authored by Danny Lin's avatar Danny Lin Committed by Michael Bestas
Browse files

ExactCalculator: Use HapticButton for keypad buttons

Providing haptic feedback on key presses makes using the calculator feel
more interactive.

Change-Id: Ie8b3b0cc2674cac926323a5f6cd59e0743c5102f
parent 0d405e7c
......@@ -24,7 +24,7 @@
app:rowCount="5"
app:columnCount="3">
<Button
<com.android.calculator2.HapticButton
android:id="@+id/toggle_inv"
style="@style/PadButtonStyle.Advanced.Text"
android:background="@drawable/pad_button_inverse_background"
......@@ -33,7 +33,7 @@
app:layout_row="0"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/toggle_mode"
style="@style/PadButtonStyle.Advanced.Text"
android:contentDescription="@string/desc_switch_deg"
......@@ -41,7 +41,7 @@
app:layout_row="0"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_pct"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_pct"
......@@ -49,7 +49,7 @@
app:layout_row="0"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_sin"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_sin"
......@@ -57,7 +57,7 @@
app:layout_row="1"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_arcsin"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_arcsin"
......@@ -67,7 +67,7 @@
app:layout_row="1"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_cos"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_cos"
......@@ -75,7 +75,7 @@
app:layout_row="1"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_arccos"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_arccos"
......@@ -85,7 +85,7 @@
app:layout_row="1"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_tan"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_tan"
......@@ -93,7 +93,7 @@
app:layout_row="1"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_arctan"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_arctan"
......@@ -103,7 +103,7 @@
app:layout_row="1"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_ln"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_ln"
......@@ -111,7 +111,7 @@
app:layout_row="2"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_exp"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_exp"
......@@ -121,7 +121,7 @@
app:layout_row="2"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_log"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_log"
......@@ -129,7 +129,7 @@
app:layout_row="2"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_10pow"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_10pow"
......@@ -139,7 +139,7 @@
app:layout_row="2"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_fact"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_fact"
......@@ -147,7 +147,7 @@
app:layout_row="2"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/const_pi"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_const_pi"
......@@ -155,7 +155,7 @@
app:layout_row="3"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/const_e"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_const_e"
......@@ -163,7 +163,7 @@
app:layout_row="3"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_pow"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_pow"
......@@ -171,7 +171,7 @@
app:layout_row="3"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/lparen"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_lparen"
......@@ -179,7 +179,7 @@
app:layout_row="4"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/rparen"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_rparen"
......@@ -187,7 +187,7 @@
app:layout_row="4"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_sqrt"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_sqrt"
......@@ -195,7 +195,7 @@
app:layout_row="4"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_sqr"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_sqr"
......
......@@ -24,7 +24,7 @@
app:rowCount="4"
app:columnCount="4">
<Button
<com.android.calculator2.HapticButton
android:id="@+id/toggle_inv"
style="@style/PadButtonStyle.Advanced.Text"
android:background="@drawable/pad_button_inverse_background"
......@@ -33,7 +33,7 @@
app:layout_row="0"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/toggle_mode"
style="@style/PadButtonStyle.Advanced.Text"
android:contentDescription="@string/desc_switch_deg"
......@@ -41,7 +41,7 @@
app:layout_row="0"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_pct"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_pct"
......@@ -49,7 +49,7 @@
app:layout_row="0"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_sin"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_sin"
......@@ -57,7 +57,7 @@
app:layout_row="1"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_arcsin"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_arcsin"
......@@ -67,7 +67,7 @@
app:layout_row="1"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_cos"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_cos"
......@@ -75,7 +75,7 @@
app:layout_row="1"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_arccos"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_arccos"
......@@ -85,7 +85,7 @@
app:layout_row="1"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_tan"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_tan"
......@@ -93,7 +93,7 @@
app:layout_row="1"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_arctan"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_arctan"
......@@ -103,7 +103,7 @@
app:layout_row="1"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/const_pi"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_const_pi"
......@@ -111,7 +111,7 @@
app:layout_row="1"
app:layout_column="3" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_ln"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_ln"
......@@ -119,7 +119,7 @@
app:layout_row="2"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_exp"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_exp"
......@@ -129,7 +129,7 @@
app:layout_row="2"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_log"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_log"
......@@ -137,7 +137,7 @@
app:layout_row="2"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_10pow"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_10pow"
......@@ -147,7 +147,7 @@
app:layout_row="2"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_fact"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_fact"
......@@ -155,7 +155,7 @@
app:layout_row="2"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/const_e"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_const_e"
......@@ -163,7 +163,7 @@
app:layout_row="2"
app:layout_column="3" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/lparen"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_lparen"
......@@ -171,7 +171,7 @@
app:layout_row="3"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/rparen"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_rparen"
......@@ -179,7 +179,7 @@
app:layout_row="3"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_sqrt"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_sqrt"
......@@ -187,7 +187,7 @@
app:layout_row="3"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_sqr"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_sqr"
......@@ -197,7 +197,7 @@
app:layout_row="3"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_pow"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_pow"
......
......@@ -24,7 +24,7 @@
app:rowCount="3"
app:columnCount="5">
<Button
<com.android.calculator2.HapticButton
android:id="@+id/toggle_inv"
style="@style/PadButtonStyle.Advanced.Text"
android:background="@drawable/pad_button_inverse_background"
......@@ -33,7 +33,7 @@
app:layout_row="0"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/toggle_mode"
style="@style/PadButtonStyle.Advanced.Text"
android:contentDescription="@string/desc_switch_deg"
......@@ -41,7 +41,7 @@
app:layout_row="0"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_sin"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_sin"
......@@ -49,7 +49,7 @@
app:layout_row="0"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_arcsin"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_arcsin"
......@@ -59,7 +59,7 @@
app:layout_row="0"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_cos"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_cos"
......@@ -67,7 +67,7 @@
app:layout_row="0"
app:layout_column="3" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_arccos"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_arccos"
......@@ -77,7 +77,7 @@
app:layout_row="0"
app:layout_column="3" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_tan"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_tan"
......@@ -85,7 +85,7 @@
app:layout_row="0"
app:layout_column="4" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_arctan"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_arctan"
......@@ -95,7 +95,7 @@
app:layout_row="0"
app:layout_column="4" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_pct"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_pct"
......@@ -103,7 +103,7 @@
app:layout_row="1"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_ln"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_ln"
......@@ -111,7 +111,7 @@
app:layout_row="1"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_exp"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_exp"
......@@ -121,7 +121,7 @@
app:layout_row="1"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_log"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_log"
......@@ -129,7 +129,7 @@
app:layout_row="1"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/fun_10pow"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_fun_10pow"
......@@ -139,7 +139,7 @@
app:layout_row="1"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_fact"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_fact"
......@@ -147,7 +147,7 @@
app:layout_row="1"
app:layout_column="3" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_pow"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_pow"
......@@ -155,7 +155,7 @@
app:layout_row="1"
app:layout_column="4" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/const_pi"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_const_pi"
......@@ -163,7 +163,7 @@
app:layout_row="2"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/const_e"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_const_e"
......@@ -171,7 +171,7 @@
app:layout_row="2"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/lparen"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_lparen"
......@@ -179,7 +179,7 @@
app:layout_row="2"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/rparen"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_rparen"
......@@ -187,7 +187,7 @@
app:layout_row="2"
app:layout_column="3" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_sqrt"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_sqrt"
......@@ -195,7 +195,7 @@
app:layout_row="2"
app:layout_column="4" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_sqr"
style="@style/PadButtonStyle.Advanced"
android:contentDescription="@string/desc_op_sqr"
......
......@@ -24,84 +24,84 @@
app:rowCount="4"
app:columnCount="3">
<Button
<com.android.calculator2.HapticButton
android:id="@+id/digit_7"
style="@style/PadButtonStyle.Numeric"
android:text="@string/digit_7"
app:layout_row="0"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/digit_8"
style="@style/PadButtonStyle.Numeric"
android:text="@string/digit_8"
app:layout_row="0"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/digit_9"
style="@style/PadButtonStyle.Numeric"
android:text="@string/digit_9"
app:layout_row="0"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/digit_4"
style="@style/PadButtonStyle.Numeric"
android:text="@string/digit_4"
app:layout_row="1"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/digit_5"
style="@style/PadButtonStyle.Numeric"
android:text="@string/digit_5"
app:layout_row="1"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/digit_6"
style="@style/PadButtonStyle.Numeric"
android:text="@string/digit_6"
app:layout_row="1"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/digit_1"
style="@style/PadButtonStyle.Numeric"
android:text="@string/digit_1"
app:layout_row="2"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/digit_2"
style="@style/PadButtonStyle.Numeric"
android:text="@string/digit_2"
app:layout_row="2"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/digit_3"
style="@style/PadButtonStyle.Numeric"
android:text="@string/digit_3"
app:layout_row="2"
app:layout_column="2" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/dec_point"
style="@style/PadButtonStyle.Numeric"
android:contentDescription="@string/desc_dec_point"
app:layout_row="3"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/digit_0"
style="@style/PadButtonStyle.Numeric"
android:text="@string/digit_0"
app:layout_row="3"
app:layout_column="1" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/eq"
style="@style/PadButtonStyle.Numeric.Equals"
android:contentDescription="@string/desc_eq"
......
......@@ -32,7 +32,7 @@
app:layout_row="0"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/clr"
style="@style/PadButtonStyle.Operator.Text"
android:contentDescription="@string/desc_clr"
......@@ -42,7 +42,7 @@
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_div"
style="@style/PadButtonStyle.Operator"
android:contentDescription="@string/desc_op_div"
......@@ -50,7 +50,7 @@
app:layout_row="1"
app:layout_column="0" />
<Button
<com.android.calculator2.HapticButton
android:id="@+id/op_mul"
style="@style/PadButtonStyle.Operator"
android:contentDescription="@string/desc_op_mul"
......@@ -58,7 +58,7 @@
app:layout_row="2"