API stubs and fixes for composeUI

This commit is contained in:
Julian Winkler
2024-11-27 14:59:37 +01:00
committed by Mis012
parent 447784b6d6
commit e9cf5e7002
35 changed files with 559 additions and 24 deletions

View File

@@ -2213,7 +2213,8 @@ public final class MotionEvent extends InputEvent {
* @see KeyEvent#getMetaState()
*/
public final int getMetaState() {
return nativeGetMetaState(mNativePtr);
// return nativeGetMetaState(mNativePtr);
return 0;
}
/**
@@ -2228,7 +2229,8 @@ public final class MotionEvent extends InputEvent {
* @see #BUTTON_BACK
*/
public final int getButtonState() {
return nativeGetButtonState(mNativePtr);
// return nativeGetButtonState(mNativePtr);
return BUTTON_PRIMARY;
}
/**

View File

@@ -14,6 +14,7 @@ import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -624,7 +625,8 @@ public class View implements Drawable.Callback {
}
public interface OnAttachStateChangeListener {
// TODO
public void onViewAttachedToWindow(View v);
public void onViewDetachedFromWindow(View v);
}
public interface OnGenericMotionListener {
@@ -1061,10 +1063,12 @@ public class View implements Drawable.Callback {
private OnTouchListener on_touch_listener = null;
public boolean onTouchEvent(MotionEvent event) {
boolean handled = false;
if (on_touch_listener != null)
return on_touch_listener.onTouch(this, event);
else
return false;
handled = on_touch_listener.onTouch(this, event);
if (!handled)
handled = dispatchTouchEvent(event);
return handled;
}
public void setOnTouchListener(OnTouchListener l) {
@@ -1173,6 +1177,8 @@ public class View implements Drawable.Callback {
/* TODO */
}
public void unscheduleDrawable(Drawable drawable) {}
public void invalidate(Rect dirty) {
nativeInvalidate(widget);
}
@@ -1290,14 +1296,16 @@ public class View implements Drawable.Callback {
public void setOnGenericMotionListener(View.OnGenericMotionListener l) {}
public IBinder getWindowToken() {
return new IBinder();
return new Binder();
}
public void getLocationInWindow(int[] location) {
getLocationOnScreen(location);
}
public void addOnAttachStateChangeListener(OnAttachStateChangeListener l) {}
public void addOnAttachStateChangeListener(OnAttachStateChangeListener l) {
onAttachStateChangeListener = l;
}
public Context getContext() {
return this.context;
@@ -1843,9 +1851,15 @@ public class View implements Drawable.Callback {
protected void onAttachedToWindow () {
attachedToWindow = true;
if (onAttachStateChangeListener != null) {
onAttachStateChangeListener.onViewAttachedToWindow(this);
}
}
protected void onDetachedFromWindow() {
attachedToWindow = false;
if (onAttachStateChangeListener != null) {
onAttachStateChangeListener.onViewDetachedFromWindow(this);
}
}
public void attachToWindowInternal() {
onAttachedToWindow();
@@ -1892,7 +1906,12 @@ public class View implements Drawable.Callback {
});
}
public void removeOnAttachStateChangeListener(OnAttachStateChangeListener listener) {}
private OnAttachStateChangeListener onAttachStateChangeListener;
public void removeOnAttachStateChangeListener(OnAttachStateChangeListener listener) {
if (onAttachStateChangeListener == listener) {
onAttachStateChangeListener = null;
}
}
public boolean onInterceptTouchEvent(MotionEvent event) {return false;}
@@ -2028,4 +2047,38 @@ public class View implements Drawable.Callback {
public void setDefaultFocusHighlightEnabled(boolean enabled) {}
public void setHorizontalFadingEdgeEnabled(boolean horizontalFadingEdgeEnabled) {}
public Handler getHandler() {
return new Handler(Looper.getMainLooper());
}
public boolean isHardwareAccelerated() {
return false;
}
public void setClipBounds(Rect clipBounds) {}
public boolean getClipToOutline() {return false;}
public void setLeft(int left) {
layout(left, top, right, bottom);
}
public void setTop(int top) {
layout(left, top, right, bottom);
}
public void setRight(int right) {
layout(left, top, right, bottom);
}
public void setBottom(int bottom) {
layout(left, top, right, bottom);
}
public void setCameraDistance(float distance) {}
public boolean requestRectangleOnScreen(Rect rectangle, boolean immediate) {return false;}
public boolean requestRectangleOnScreen(Rect rectangle) {return false;}
}

View File

@@ -4,6 +4,7 @@ import android.R;
import android.animation.LayoutTransition;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.util.AttributeSet;
import java.util.ArrayList;
import java.util.Iterator;
@@ -84,6 +85,11 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
return true;
}
protected boolean addViewInLayout(View child, int index, LayoutParams params, boolean preventRequestLayout) {
addViewInternal(child, index, params);
return true;
}
// This internal method is used to share code between removeView and removeViewInLayout.
// Reusing removeView in removeViewInLayout is not possible, because e.g.
// ViewPager overrides removeView to call removeViewInLayout
@@ -385,6 +391,14 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
this.transition = transition;
}
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
return false;
}
protected void cleanupLayoutState(View child) {}
public boolean shouldDelayChildPressedState() { return false; }
public static class LayoutParams {
public static final int FILL_PARENT = -1;
public static final int MATCH_PARENT = -1;

View File

@@ -7,6 +7,8 @@ public class AccessibilityManager {
public interface AccessibilityStateChangeListener {}
public interface TouchExplorationStateChangeListener {}
public boolean isTouchExplorationEnabled() {return false;}
public boolean isEnabled() {return false;}
@@ -19,4 +21,8 @@ public class AccessibilityManager {
return false;
}
public boolean addTouchExplorationStateChangeListener(TouchExplorationStateChangeListener listener) {
return false;
}
}

View File

@@ -0,0 +1,4 @@
package android.view.accessibility;
public class AccessibilityNodeProvider {
}

View File

@@ -0,0 +1,7 @@
package android.view.inputmethod;
public class CursorAnchorInfo {
public static class Builder {}
}