Permalink
Browse files

fix for display

  • Loading branch information...
Xlythe committed Feb 14, 2013
1 parent c46bb96 commit cd4aa3262e1063c491e773cf540339f88fd2919f
Showing with 15 additions and 9 deletions.
  1. +1 −1 AndroidManifest.xml
  2. +1 −1 res/values/strings.xml
  3. +13 −7 src/com/android2/calculator3/view/ScrollableDisplay.java
View
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android2.calculator3"
- android:versionCode="40"
+ android:versionCode="41"
android:versionName="@string/application_version"
android:installLocation="auto">
View
@@ -20,7 +20,7 @@
<!-- Application copyright -->
<string name="application_copyright">Copyright \u00A9 CyanogenMod 2013</string>
<!-- Application version -->
- <string name="application_version" translatable="false">3.1</string>
+ <string name="application_version" translatable="false">3.1.1</string>
<!-- If there is a syntax error in the user entered calculation, an error dialog will appear. This is the title. -->
<string name="error">Error</string>
<!-- Displayed numbers for the digit buttons -->
@@ -38,6 +38,7 @@ public boolean onLongClick(View v) {
@Override
public boolean onTouchEvent(MotionEvent ev) {
+ autoScrolling = false;
super.onTouchEvent(ev);
return false;
}
@@ -68,10 +69,12 @@ private int getScrollRange() {
}
private boolean gravityRight = false;
+ private boolean autoScrolling = false;
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
// HorizontalScrollView is broken for Gravity.RIGHT. So we're fixing it.
+ autoScrolling = false;
int childWidth = getView().getWidth();
super.onLayout(changed, left, top, right, bottom);
int delta = getView().getWidth() - childWidth;
@@ -84,9 +87,6 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
gravityRight = true;
p.gravity = Gravity.LEFT | verticalGravity;
view.setLayoutParams(p);
- removeViewAt(0);
- addView(view);
- if(view.getActiveEditText() != null) view.getActiveEditText().requestFocus();
super.onLayout(changed, left, top, right, bottom);
}
}
@@ -95,12 +95,18 @@ else if(gravityRight) {
gravityRight = false;
p.gravity = Gravity.RIGHT | verticalGravity;
view.setLayoutParams(p);
- removeViewAt(0);
- addView(view);
- if(view.getActiveEditText() != null) view.getActiveEditText().requestFocus();
super.onLayout(changed, left, top, right, bottom);
}
}
- if(gravityRight && delta > 0) scrollBy(delta, 0);
+ if(gravityRight && delta > 0) {
+ scrollBy(delta, 0);
+ autoScrolling = true;
+ }
+ }
+
+ @Override
+ public void computeScroll() {
+ if(autoScrolling) return;
+ super.computeScroll();
}
}

0 comments on commit cd4aa32

Please sign in to comment.