diff options
-rw-r--r-- | res/drawable/blue_button.xml | 21 | ||||
-rw-r--r-- | res/drawable/button.png | bin | 3020 -> 0 bytes | |||
-rw-r--r-- | res/drawable/button.xml | 21 | ||||
-rw-r--r-- | res/drawable/button_bg.png | bin | 1412 -> 0 bytes | |||
-rw-r--r-- | res/drawable/lcd.9.png | bin | 2209 -> 0 bytes | |||
-rw-r--r-- | res/drawable/small_button.9.png | bin | 570 -> 0 bytes | |||
-rw-r--r-- | res/drawable/small_button_pressed.9.png | bin | 873 -> 0 bytes | |||
-rw-r--r-- | res/drawable/small_button_stateful.xml | 4 | ||||
-rw-r--r-- | res/layout-land/main.xml | 71 | ||||
-rw-r--r-- | res/layout-port/main.xml | 95 | ||||
-rw-r--r-- | res/values/colors.xml | 2 | ||||
-rw-r--r-- | res/values/styles.xml | 18 | ||||
-rw-r--r-- | src/com/android/calculator2/Calculator.java | 23 | ||||
-rw-r--r-- | src/com/android/calculator2/CalculatorDisplay.java | 12 | ||||
-rw-r--r-- | src/com/android/calculator2/ColorButton.java | 64 |
15 files changed, 179 insertions, 152 deletions
diff --git a/res/drawable/blue_button.xml b/res/drawable/blue_button.xml new file mode 100644 index 0000000..f4d6059 --- /dev/null +++ b/res/drawable/blue_button.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient android:startColor="#071622" android:endColor="#253541" + android:angle="90"/> + <corners android:radius="0dp" /> +</shape> diff --git a/res/drawable/button.png b/res/drawable/button.png Binary files differdeleted file mode 100644 index f28073c..0000000 --- a/res/drawable/button.png +++ /dev/null diff --git a/res/drawable/button.xml b/res/drawable/button.xml new file mode 100644 index 0000000..e5112ee --- /dev/null +++ b/res/drawable/button.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2007 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient android:startColor="#000000" android:endColor="#333333" + android:angle="90"/> + <corners android:radius="0dp" /> +</shape> diff --git a/res/drawable/button_bg.png b/res/drawable/button_bg.png Binary files differdeleted file mode 100644 index 83eeb0f..0000000 --- a/res/drawable/button_bg.png +++ /dev/null diff --git a/res/drawable/lcd.9.png b/res/drawable/lcd.9.png Binary files differdeleted file mode 100644 index 942ede9..0000000 --- a/res/drawable/lcd.9.png +++ /dev/null diff --git a/res/drawable/small_button.9.png b/res/drawable/small_button.9.png Binary files differdeleted file mode 100644 index c6b60a8..0000000 --- a/res/drawable/small_button.9.png +++ /dev/null diff --git a/res/drawable/small_button_pressed.9.png b/res/drawable/small_button_pressed.9.png Binary files differdeleted file mode 100644 index 5b5c866..0000000 --- a/res/drawable/small_button_pressed.9.png +++ /dev/null diff --git a/res/drawable/small_button_stateful.xml b/res/drawable/small_button_stateful.xml deleted file mode 100644 index a3326dd..0000000 --- a/res/drawable/small_button_stateful.xml +++ /dev/null @@ -1,4 +0,0 @@ -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_pressed="true" android:drawable="@drawable/small_button_pressed" /> - <item android:drawable="@drawable/small_button" /> -</selector> diff --git a/res/layout-land/main.xml b/res/layout-land/main.xml index 2559ebd..a684d2e 100644 --- a/res/layout-land/main.xml +++ b/res/layout-land/main.xml @@ -25,47 +25,40 @@ android:background="#ff000000"> <LinearLayout android:layout_width="fill_parent" - android:layout_height="wrap_content" + android:layout_height="0dp" + android:layout_weight="2" > - <LinearLayout - android:layout_width="0px" - android:layout_weight="1" - android:layout_height="wrap_content" - android:background="@drawable/lcd" - android:layout_marginRight="0px" - > - <com.android.calculator2.CalculatorDisplay android:id="@+id/display" - android:layout_width="fill_parent" - android:layout_height="wrap_content" + android:layout_width="0dp" + android:layout_weight="5" + android:layout_height="fill_parent" > <EditText style="@style/display_style" /> <EditText style="@style/display_style" /> </com.android.calculator2.CalculatorDisplay> - </LinearLayout> - <Button - android:background="@drawable/small_button_stateful" + <com.android.calculator2.ColorButton android:id="@+id/del" android:text="@string/clear" - android:layout_width="90px" - android:layout_height="60px" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="fill_parent" android:textColor="#ffffffff" - android:layout_marginRight="0px" - android:layout_marginTop="4px" - android:layout_marginLeft="5px" - android:layout_weight="0" + android:layout_marginRight="0dp" + android:textSize="15dp" + style="@style/button_style" /> </LinearLayout> <com.android.calculator2.PanelSwitcher android:id="@+id/panelswitch" android:layout_width="fill_parent" - android:layout_height="fill_parent" + android:layout_height="0dp" + android:layout_weight="5" > <LinearLayout @@ -78,22 +71,22 @@ <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/digit7" android:text="@string/digit7" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit8" android:text="@string/digit8" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit9" android:text="@string/digit9" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/leftParen" @@ -115,27 +108,27 @@ <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/digit4" android:text="@string/digit4" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit5" android:text="@string/digit5" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit6" android:text="@string/digit6" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/dot" android:text="@string/dot" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/div" @@ -152,27 +145,27 @@ <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/digit1" android:text="@string/digit1" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit2" android:text="@string/digit2" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit3" android:text="@string/digit3" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit0" android:text="@string/digit0" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/equal" @@ -194,14 +187,14 @@ android:layout_weight="1" android:orientation="vertical" android:layout_gravity="center" - android:layout_marginTop="5px" - android:layout_marginBottom="0px" + android:layout_marginTop="5dp" + android:layout_marginBottom="0dp" > <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/sin" @@ -233,7 +226,7 @@ <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/ln" diff --git a/res/layout-port/main.xml b/res/layout-port/main.xml index b115e53..aa3566c 100644 --- a/res/layout-port/main.xml +++ b/res/layout-port/main.xml @@ -24,35 +24,23 @@ android:layout_height="fill_parent" android:background="#ff000000"> - <RelativeLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_marginTop="5px" - > - - <LinearLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:background="@drawable/lcd" - android:layout_marginRight="0px"> - <com.android.calculator2.CalculatorDisplay android:id="@+id/display" android:layout_width="fill_parent" - android:layout_height="wrap_content" + android:layout_height="0dp" + android:layout_weight="1" > <EditText style="@style/display_style" /> <EditText style="@style/display_style" /> </com.android.calculator2.CalculatorDisplay> - </LinearLayout> - </RelativeLayout> <com.android.calculator2.PanelSwitcher android:id="@+id/panelswitch" android:layout_width="fill_parent" - android:layout_height="fill_parent" + android:layout_height="0dp" + android:layout_weight="4" > <LinearLayout @@ -65,51 +53,48 @@ <LinearLayout android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="8px" - android:layout_marginTop="5px" + android:layout_height="0dp" + android:layout_weight="2" > <View - android:layout_width="0px" - android:layout_height="0px" - android:layout_weight="1" + android:background="@drawable/button" + android:layout_width="0dp" + android:layout_height="fill_parent" + android:layout_weight="3" /> <!-- marginRight has to be 0 to catch border-touch --> - <Button - android:background="@drawable/small_button_stateful" + <com.android.calculator2.ColorButton android:id="@+id/del" android:text="@string/clear" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:width="90px" - android:height="50px" - android:textColor="#ffffffff" - android:layout_marginRight="0px" - android:layout_marginBottom="3px" - android:layout_weight="0" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="fill_parent" + android:layout_marginRight="0dp" + android:textSize="15dp" + style="@style/button_style" /> </LinearLayout> <LinearLayout - android:layout_weight="1" + android:layout_weight="3" android:layout_width="fill_parent" - android:layout_height="0px"> + android:layout_height="0dp"> <com.android.calculator2.ColorButton android:id="@+id/digit7" android:text="@string/digit7" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit8" android:text="@string/digit8" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit9" android:text="@string/digit9" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/div" @@ -119,24 +104,24 @@ </LinearLayout> <LinearLayout - android:layout_weight="1" + android:layout_weight="3" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/digit4" android:text="@string/digit4" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit5" android:text="@string/digit5" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit6" android:text="@string/digit6" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/mul" @@ -146,24 +131,24 @@ </LinearLayout> <LinearLayout - android:layout_weight="1" + android:layout_weight="3" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/digit1" android:text="@string/digit1" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit2" android:text="@string/digit2" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit3" android:text="@string/digit3" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/minus" @@ -173,19 +158,19 @@ </LinearLayout> <LinearLayout - android:layout_weight="1" + android:layout_weight="3" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/dot" android:text="@string/dot" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/digit0" android:text="@string/digit0" - style="@style/button_style" + style="@style/digit_button_style" /> <com.android.calculator2.ColorButton android:id="@+id/equal" @@ -210,7 +195,7 @@ <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/sin" @@ -232,7 +217,7 @@ <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/ln" @@ -254,7 +239,7 @@ <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/pi" @@ -276,7 +261,7 @@ <LinearLayout android:layout_weight="1" android:layout_width="fill_parent" - android:layout_height="0px" + android:layout_height="0dp" > <com.android.calculator2.ColorButton android:id="@+id/leftParen" diff --git a/res/values/colors.xml b/res/values/colors.xml index 76f3f13..54171e9 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -15,6 +15,6 @@ --> <resources> - <color name="magic_flame">#00ff2222</color> + <color name="magic_flame">#00ffffff</color> <color name="button_text">#ffffffff</color> </resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index 1fc670b..8aaa6fe 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -6,25 +6,27 @@ <item name="android:layout_height">fill_parent</item> <item name="android:layout_weight">1</item> <item name="android:focusable">true</item> + <item name="android:background">@drawable/button</item> + <item name="android:layout_marginLeft">1dp</item> </style> - <style name="button_small_style"> + <style name="digit_button_style" parent="button_style"> + <item name="android:background">@drawable/blue_button</item> + </style> + + <style name="button_small_style" parent="button_style"> <item name="android:textSize">30dp</item> - <item name="android:layout_width">fill_parent</item> - <item name="android:layout_height">fill_parent</item> - <item name="android:layout_weight">1</item> - <item name="android:focusable">true</item> </style> <style name="display_style"> <item name="android:textSize">40dp</item> - <item name="android:gravity">right</item> - <item name="android:textColor">#f000</item> + <item name="android:gravity">right|center_vertical</item> + <item name="android:textColor">#ffffff</item> <item name="android:maxLines">1</item> <item name="android:scrollbars">none</item> <item name="android:scrollHorizontally">true</item> <item name="android:layout_width">fill_parent</item> - <item name="android:layout_height">wrap_content</item> + <item name="android:layout_height">fill_parent</item> <item name="android:padding">8dp</item> </style> </resources> diff --git a/src/com/android/calculator2/Calculator.java b/src/com/android/calculator2/Calculator.java index f4d430e..d329a15 100644 --- a/src/com/android/calculator2/Calculator.java +++ b/src/com/android/calculator2/Calculator.java @@ -20,14 +20,14 @@ import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.util.Config; +import android.util.TypedValue; +import android.view.Display; import android.view.Menu; import android.view.MenuItem; -import android.view.Window; import android.view.View; import android.view.KeyEvent; import android.widget.Button; -import android.widget.ListView; -import android.content.res.Configuration; +import android.widget.TextView; public class Calculator extends Activity { EventListener mListener = new EventListener(); @@ -41,6 +41,8 @@ public class Calculator extends Activity { private static final int CMD_BASIC_PANEL = 2; private static final int CMD_ADVANCED_PANEL = 3; + private static final int HVGA_HEIGHT_PIXELS = 480; + static final int BASIC_PANEL = 0; static final int ADVANCED_PANEL = 1; @@ -71,7 +73,7 @@ public class Calculator extends Activity { if ((view = findViewById(R.id.del)) != null) { - view.setOnClickListener(mListener); +// view.setOnClickListener(mListener); view.setOnLongClickListener(mListener); } /* @@ -170,4 +172,17 @@ public class Calculator extends Activity { Log.v(LOG_TAG, message); } } + + /** + * The font sizes in the layout files are specified for a HVGA display. + * Adjust the font sizes accordingly if we are running on a different + * display. + */ + public void adjustFontSize(TextView view) { + float fontPixelSize = view.getTextSize(); + Display display = getWindowManager().getDefaultDisplay(); + int h = Math.max(display.getWidth(), display.getHeight()); + float ratio = (float)h/HVGA_HEIGHT_PIXELS; + view.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontPixelSize*ratio); + } } diff --git a/src/com/android/calculator2/CalculatorDisplay.java b/src/com/android/calculator2/CalculatorDisplay.java index 5e0d76f..f468ad2 100644 --- a/src/com/android/calculator2/CalculatorDisplay.java +++ b/src/com/android/calculator2/CalculatorDisplay.java @@ -21,15 +21,13 @@ import android.text.Editable; import android.text.Spanned; import android.text.method.NumberKeyListener; import android.util.AttributeSet; -import android.view.KeyEvent; import android.view.animation.TranslateAnimation; import android.text.InputType; import android.widget.EditText; +import android.widget.TextView; import android.widget.ViewSwitcher; import android.graphics.Rect; -import java.util.Map; - /** * Provides vertical scrolling for the input/result EditText. */ @@ -50,6 +48,14 @@ class CalculatorDisplay extends ViewSwitcher { super(context, attrs); } + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + Calculator calc = (Calculator) getContext(); + calc.adjustFontSize((TextView)getChildAt(0)); + calc.adjustFontSize((TextView)getChildAt(1)); + } + protected void setLogic(Logic logic) { NumberKeyListener calculatorKeyListener = new NumberKeyListener() { diff --git a/src/com/android/calculator2/ColorButton.java b/src/com/android/calculator2/ColorButton.java index 5d78446..c95ea8b 100644 --- a/src/com/android/calculator2/ColorButton.java +++ b/src/com/android/calculator2/ColorButton.java @@ -18,10 +18,8 @@ package com.android.calculator2; import android.content.Context; import android.graphics.Canvas; -import android.graphics.Color; import android.graphics.Paint; -import android.graphics.PorterDuff; -import android.graphics.drawable.Drawable; +import android.graphics.Paint.Style; import android.util.AttributeSet; import android.widget.Button; import android.view.View.OnClickListener; @@ -29,8 +27,6 @@ import android.view.View; import android.view.MotionEvent; import android.content.res.Resources; -import java.util.Map; - /** * Button with click-animation effect. */ @@ -39,47 +35,41 @@ class ColorButton extends Button implements OnClickListener { static final int CLICK_FEEDBACK_INTERVAL = 10; static final int CLICK_FEEDBACK_DURATION = 350; - Drawable mButtonBackground; - Drawable mButton; float mTextX; float mTextY; long mAnimStart; OnClickListener mListener; + Paint mFeedbackPaint; public ColorButton(Context context, AttributeSet attrs) { super(context, attrs); - init(); - mListener = ((Calculator) context).mListener; + Calculator calc = (Calculator) context; + init(calc); + mListener = calc.mListener; setOnClickListener(this); } public void onClick(View view) { - animateClickFeedback(); mListener.onClick(this); } - private void init() { - setBackgroundDrawable(null); - + private void init(Calculator calc) { Resources res = getResources(); - mButtonBackground = res.getDrawable(R.drawable.button_bg); - mButton = res.getDrawable(R.drawable.button); CLICK_FEEDBACK_COLOR = res.getColor(R.color.magic_flame); + mFeedbackPaint = new Paint(); + mFeedbackPaint.setStyle(Style.STROKE); + mFeedbackPaint.setStrokeWidth(2); getPaint().setColor(res.getColor(R.color.button_text)); mAnimStart = -1; + + calc.adjustFontSize(this); } @Override public void onSizeChanged(int w, int h, int oldW, int oldH) { - int selfW = mButton.getIntrinsicWidth(); - int selfH = mButton.getIntrinsicHeight(); - int marginX = (w - selfW) / 2; - int marginY = (h - selfH) / 2; - mButtonBackground.setBounds(marginX, marginY, marginX + selfW, marginY + selfH); - mButton.setBounds(marginX, marginY, marginX + selfW, marginY + selfH); measureText(); } @@ -97,14 +87,9 @@ class ColorButton extends Button implements OnClickListener { private void drawMagicFlame(int duration, Canvas canvas) { int alpha = 255 - 255 * duration / CLICK_FEEDBACK_DURATION; int color = CLICK_FEEDBACK_COLOR | (alpha << 24); - mButtonBackground.setColorFilter(color, PorterDuff.Mode.SRC_IN); - - int cx = getWidth() / 2; - int cy = getHeight() / 2; - float angle = 250.0f * duration / CLICK_FEEDBACK_DURATION; - canvas.rotate(angle, cx, cy); - mButtonBackground.draw(canvas); - canvas.rotate(-angle, cx, cy); + + mFeedbackPaint.setColor(color); + canvas.drawRect(1, 1, getWidth() - 1, getHeight() - 1, mFeedbackPaint); } @Override @@ -113,7 +98,6 @@ class ColorButton extends Button implements OnClickListener { int animDuration = (int) (System.currentTimeMillis() - mAnimStart); if (animDuration >= CLICK_FEEDBACK_DURATION) { - mButtonBackground.clearColorFilter(); mAnimStart = -1; } else { drawMagicFlame(animDuration, canvas); @@ -123,8 +107,6 @@ class ColorButton extends Button implements OnClickListener { drawMagicFlame(0, canvas); } - mButton.draw(canvas); - CharSequence text = getText(); canvas.drawText(text, 0, text.length(), mTextX, mTextY, getPaint()); } @@ -136,12 +118,18 @@ class ColorButton extends Button implements OnClickListener { @Override public boolean onTouchEvent(MotionEvent event) { - int a = event.getAction(); - if (a == MotionEvent.ACTION_DOWN - || a == MotionEvent.ACTION_CANCEL - || a == MotionEvent.ACTION_UP) { - invalidate(); + boolean result = super.onTouchEvent(event); + + switch (event.getAction()) { + case MotionEvent.ACTION_UP: + animateClickFeedback(); + break; + case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_CANCEL: + invalidate(); + break; } - return super.onTouchEvent(event); + + return result; } } |