ViewGroup: handle scroll events

This commit is contained in:
Julian Winkler
2023-08-22 18:08:16 +02:00
parent 960930a348
commit c4b7bdc63d
13 changed files with 53 additions and 11 deletions

View File

@@ -301,9 +301,8 @@ public final class AssetManager {
return map;
}
/*package*/ final boolean getThemeValue(int theme, int ident,
/*package*/ final boolean getThemeValue(Map<Integer,ValueItem> style, int ident,
TypedValue outValue, boolean resolveRefs) {
Map<Integer,ValueItem> style = loadStyle(theme);
EntryGroup entryGroup = tableBlockSearch(ident);
if (entryGroup == null)
return false;

View File

@@ -1422,7 +1422,7 @@ public class Resources {
*/
public boolean resolveAttribute(int resid, TypedValue outValue,
boolean resolveRefs) {
boolean got = mAssets.getThemeValue(mTheme, resid, outValue, resolveRefs);
boolean got = mAssets.getThemeValue(themeMap, resid, outValue, resolveRefs);
if (false) {
System.out.println(
"resolveAttribute #" + Integer.toHexString(resid) + " got=" + got + ", type=0x" + Integer.toHexString(outValue.type) + ", data=0x" + Integer.toHexString(outValue.data));

View File

@@ -202,7 +202,8 @@ public class Matrix {
* This maybe faster than testing if (getType() == 0)
*/
public boolean isIdentity() {
return native_isIdentity(native_instance);
return true;
// return native_isIdentity(native_instance);
}
/**
* Returns true if will map a rectangle to another rectangle. This can be

View File

@@ -1363,6 +1363,7 @@ public final class MotionEvent extends InputEvent {
private static native void nativeScale(int nativePtr, float scale);
private static native void nativeTransform(int nativePtr, Matrix matrix);
int source;
int action;
float coord_x;
float coord_y;
@@ -1370,7 +1371,8 @@ public final class MotionEvent extends InputEvent {
private MotionEvent() {
}
public MotionEvent(int action, float coord_x, float coord_y) {
public MotionEvent(int source, int action, float coord_x, float coord_y) {
this.source = source;
this.action = action;
this.coord_x = coord_x;
this.coord_y = coord_y;
@@ -1694,7 +1696,7 @@ public final class MotionEvent extends InputEvent {
*/
@Override
public final int getSource() {
return 4098 /*SOURCE_TOUCHSCREEN*/; // TODO: reflect reality
return source;
// return nativeGetSource(mNativePtr);
}
@@ -1931,6 +1933,10 @@ public final class MotionEvent extends InputEvent {
* @see #AXIS_Y
*/
public final float getAxisValue(int axis) {
if (axis == AXIS_HSCROLL)
return coord_x;
else if (axis == AXIS_VSCROLL)
return coord_y;
return nativeGetAxisValue(mNativePtr, axis, 0, HISTORY_CURRENT);
}

View File

@@ -3,6 +3,7 @@ package android.view;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Handler;
@@ -1195,4 +1196,9 @@ public class View extends Object {
public void setTranslationY(float translationY) {}
public void setAlpha(float alpha) {}
public boolean onGenericMotionEvent(MotionEvent event) {return false;}
protected boolean awakenScrollBars() {return false;}
public Matrix getMatrix() {return new Matrix();}
}

View File

@@ -1,6 +1,5 @@
package android.view;
import android.graphics.Rect;
public interface ViewParent {
public abstract ViewParent getParent();
}

View File

@@ -14,4 +14,8 @@ public class EdgeEffect extends View {
super(context, attributeSet);
}
public void setSize(int width, int height) {}
public void onPull(float deltaDistance) {}
public boolean isFinished() {return true;}
}