You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
add APIs needed for non legacy NewPipe version
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package android.view;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
public final class Display {
|
||||
@@ -54,4 +55,8 @@ public final class Display {
|
||||
public long getPresentationDeadlineNanos() {
|
||||
return 0; // what else...
|
||||
}
|
||||
|
||||
public void getSize(Point size) {
|
||||
size.set(getWidth(), getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package android.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
|
||||
public class GestureDetector {
|
||||
|
||||
public GestureDetector(Context context, OnGestureListener listener, Handler handler) {}
|
||||
|
||||
public interface OnGestureListener {
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,10 @@ public class InputDevice {
|
||||
return new ArrayList<InputDevice.MotionRange>();
|
||||
}
|
||||
|
||||
public boolean supportsSource(int source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public class MotionRange {
|
||||
int axis;
|
||||
|
||||
|
||||
@@ -13,4 +13,12 @@ public interface Menu {
|
||||
public void clear();
|
||||
|
||||
public void removeGroup(int groupId);
|
||||
|
||||
public SubMenu addSubMenu(int id);
|
||||
|
||||
public MenuItem add(int id);
|
||||
|
||||
public MenuItem add(CharSequence text);
|
||||
|
||||
public void setGroupCheckable(int group, boolean checkable, boolean exclusive);
|
||||
}
|
||||
|
||||
@@ -26,4 +26,6 @@ public interface MenuItem {
|
||||
|
||||
public int getGroupId();
|
||||
|
||||
public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener listener);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package android.view;
|
||||
|
||||
import android.animation.StateListAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
@@ -19,6 +20,7 @@ import android.view.animation.Animation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class View extends Object {
|
||||
|
||||
@@ -776,7 +778,7 @@ public class View extends Object {
|
||||
|
||||
// --- end of subclasses
|
||||
|
||||
public int id;
|
||||
public int id = NO_ID;
|
||||
private int system_ui_visibility = 0;
|
||||
public ViewGroup parent;
|
||||
public AttributeSet attrs;
|
||||
@@ -815,9 +817,11 @@ public class View extends Object {
|
||||
widget = native_constructor(context, attrs);
|
||||
|
||||
if (attrs != null) {
|
||||
id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0);
|
||||
if (id != 0)
|
||||
setId(id);
|
||||
int id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0);
|
||||
if (id != 0) {
|
||||
this.id = id;
|
||||
view_by_id.put(id, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -995,6 +999,14 @@ public class View extends Object {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getPaddingStart() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getPaddingEnd() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void postInvalidate() {
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
@Override
|
||||
@@ -1328,4 +1340,107 @@ public class View extends Object {
|
||||
public Display getDisplay() {
|
||||
return new Display();
|
||||
}
|
||||
|
||||
private int importantForAccessibility;
|
||||
public void setImportantForAccessibility(int importantForAccessibility) {
|
||||
this.importantForAccessibility = importantForAccessibility;
|
||||
}
|
||||
public int getImportantForAccessibility() {
|
||||
return importantForAccessibility;
|
||||
}
|
||||
|
||||
public boolean getFitsSystemWindows() {return true;}
|
||||
|
||||
public void setOnApplyWindowInsetsListener(View.OnApplyWindowInsetsListener l) {}
|
||||
|
||||
public final boolean isFocusable() {return true;}
|
||||
public boolean isClickable() {return true;}
|
||||
public boolean isLongClickable() {return true;}
|
||||
|
||||
public int getLayoutDirection() {return LAYOUT_DIRECTION_LTR;}
|
||||
|
||||
public void setBackground(Drawable background) {}
|
||||
|
||||
private float elevation;
|
||||
public void setElevation(float elevation) {
|
||||
this.elevation = elevation;
|
||||
}
|
||||
public float getElevation() {
|
||||
return elevation;
|
||||
}
|
||||
|
||||
public boolean isLaidOut() {return true;}
|
||||
|
||||
public void postOnAnimation(Runnable action) {
|
||||
post(action);
|
||||
}
|
||||
|
||||
public void setHorizontalScrollBarEnabled(boolean enabled) {}
|
||||
|
||||
public void postInvalidateOnAnimation() {
|
||||
postInvalidate();
|
||||
}
|
||||
|
||||
public void setPaddingRelative(int start, int top, int end, int bottom) {}
|
||||
|
||||
public boolean isAttachedToWindow() {return true;}
|
||||
|
||||
public void requestApplyInsets() {}
|
||||
|
||||
public View getRootView() {
|
||||
View view = this;
|
||||
while (view.parent != null) {
|
||||
view = view.parent;
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
public boolean isShown() {return true;}
|
||||
|
||||
public int getWindowVisibility() {return VISIBLE;}
|
||||
|
||||
public float getAlpha() {return 1.f;}
|
||||
|
||||
public View findFocus() {return this;}
|
||||
|
||||
public int getMinimumHeight() {return getSuggestedMinimumHeight();}
|
||||
public int getMinimumWidth() {return getSuggestedMinimumWidth();}
|
||||
|
||||
public boolean isNestedScrollingEnabled() {return true;}
|
||||
|
||||
public void setClipToOutline(boolean clipToOutline) {}
|
||||
|
||||
public boolean hasTransientState() {return false;}
|
||||
|
||||
public final void cancelPendingInputEvents() {}
|
||||
|
||||
public ViewOutlineProvider getOutlineProvider() {return new ViewOutlineProvider();}
|
||||
public void setOutlineProvider(ViewOutlineProvider provider) {}
|
||||
|
||||
public void setStateListAnimator(StateListAnimator stateListAnimator) {}
|
||||
|
||||
private static final AtomicInteger nextGeneratedId = new AtomicInteger(1);
|
||||
/**
|
||||
* Generate a value suitable for use in {@link #setId(int)}.
|
||||
* This value will not collide with ID values generated at build time by aapt for R.id.
|
||||
*
|
||||
* @return a generated ID value
|
||||
*/
|
||||
public static int generateViewId() {
|
||||
for (;;) {
|
||||
final int result = nextGeneratedId.get();
|
||||
// aapt-generated IDs have the high byte nonzero; clamp to the range under that.
|
||||
int newValue = result + 1;
|
||||
if (newValue > 0x00FFFFFF) newValue = 1; // Roll over to 1, not 0.
|
||||
if (nextGeneratedId.compareAndSet(result, newValue)) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLayoutDirectionResolved() {return true;}
|
||||
|
||||
public boolean isPaddingRelative() {return false;}
|
||||
|
||||
public void setForeground(Drawable foreground) {}
|
||||
}
|
||||
|
||||
@@ -287,6 +287,8 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
}
|
||||
}
|
||||
|
||||
protected void setChildrenDrawingOrderEnabled(boolean enabled) {}
|
||||
|
||||
public static class LayoutParams {
|
||||
public static final int FILL_PARENT = -1;
|
||||
public static final int MATCH_PARENT = -1;
|
||||
@@ -355,6 +357,17 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
public MarginLayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
public int getMarginStart() {
|
||||
return leftMargin;
|
||||
}
|
||||
|
||||
public int getMarginEnd() {
|
||||
return rightMargin;
|
||||
}
|
||||
|
||||
public void setMarginStart(int marginStart) {}
|
||||
public void setMarginEnd(int marginEnd) {}
|
||||
}
|
||||
|
||||
public interface OnHierarchyChangeListener {
|
||||
|
||||
6
src/api-impl/android/view/ViewOutlineProvider.java
Normal file
6
src/api-impl/android/view/ViewOutlineProvider.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package android.view;
|
||||
|
||||
public class ViewOutlineProvider {
|
||||
|
||||
public static final ViewOutlineProvider BACKGROUND = new ViewOutlineProvider();
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public class ViewPropertyAnimator {
|
||||
|
||||
public ViewPropertyAnimator setListener(Animator.AnimatorListener listener) {
|
||||
if (listener != null)
|
||||
listener.onAnimationEnd(null);
|
||||
listener.onAnimationEnd(new Animator());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
18
src/api-impl/android/view/WindowInsets.java
Normal file
18
src/api-impl/android/view/WindowInsets.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package android.view;
|
||||
|
||||
public class WindowInsets {
|
||||
|
||||
public static final WindowInsets CONSUMED = new WindowInsets();
|
||||
|
||||
public WindowInsets() {}
|
||||
|
||||
public WindowInsets(WindowInsets windowInsets) {}
|
||||
|
||||
public WindowInsets consumeStableInsets() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public WindowInsets consumeSystemWindowInsets() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package android.view.accessibility;
|
||||
|
||||
public class AccessibilityNodeInfo {
|
||||
|
||||
public static final class AccessibilityAction {
|
||||
|
||||
public AccessibilityAction(int actionId, CharSequence label) {}
|
||||
|
||||
public int getId() {return 0;}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package android.view.accessibility;
|
||||
|
||||
public class CaptioningManager {
|
||||
}
|
||||
Reference in New Issue
Block a user