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 more APIs needed for NewPipe
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package android.view;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public interface MenuItem {
|
||||
|
||||
public interface OnMenuItemClickListener {}
|
||||
public interface OnMenuItemClickListener {
|
||||
public boolean onMenuItemClick(MenuItem item);
|
||||
}
|
||||
|
||||
public MenuItem setIcon(int iconRes);
|
||||
|
||||
@@ -30,4 +34,10 @@ public interface MenuItem {
|
||||
|
||||
public MenuItem setTitle(int resId);
|
||||
|
||||
public boolean isVisible();
|
||||
|
||||
public Drawable getIcon();
|
||||
|
||||
public SubMenu getSubMenu();
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import android.os.Looper;
|
||||
import android.os.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.LayoutDirection;
|
||||
import android.util.Property;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
import android.view.animation.Animation;
|
||||
@@ -823,6 +824,13 @@ public class View extends Object {
|
||||
private int minWidth = 0;
|
||||
private int minHeight = 0;
|
||||
|
||||
public static final Property<View, Float> TRANSLATION_Z = new Property<View, Float>(Float.class, "translationZ") {
|
||||
@Override
|
||||
public Float get(View object) {
|
||||
return 0.f;
|
||||
}
|
||||
};
|
||||
|
||||
public View(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
@@ -1641,4 +1649,8 @@ public class View extends Object {
|
||||
}
|
||||
|
||||
public boolean onCheckIsTextEditor() {return false;}
|
||||
|
||||
public boolean hasOnClickListeners() {return false;}
|
||||
|
||||
public void setTextAlignment(int textAlignment) {}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.Iterator;
|
||||
|
||||
public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
public ArrayList<View> children;
|
||||
private OnHierarchyChangeListener onHierarchyChangeListener;
|
||||
|
||||
public ViewGroup(Context context) {
|
||||
this(context, null);
|
||||
@@ -67,6 +68,9 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
if (isAttachedToWindow()) {
|
||||
child.onAttachedToWindow();
|
||||
}
|
||||
if (onHierarchyChangeListener != null) {
|
||||
onHierarchyChangeListener.onChildViewAdded(this, child);
|
||||
}
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
@@ -85,6 +89,9 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
child.parent = null;
|
||||
children.remove(child);
|
||||
native_removeView(widget, child.widget);
|
||||
if (onHierarchyChangeListener != null) {
|
||||
onHierarchyChangeListener.onChildViewRemoved(this, child);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeViewAt(int index) {
|
||||
@@ -97,6 +104,9 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
child.parent = null;
|
||||
it.remove();
|
||||
native_removeView(widget, child.widget);
|
||||
if (onHierarchyChangeListener != null) {
|
||||
onHierarchyChangeListener.onChildViewRemoved(this, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +164,9 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
|
||||
public void setMotionEventSplittingEnabled(boolean enabled) {}
|
||||
|
||||
public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {}
|
||||
public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {
|
||||
this.onHierarchyChangeListener = listener;
|
||||
}
|
||||
|
||||
protected boolean checkLayoutParams(LayoutParams params) {
|
||||
return true;
|
||||
@@ -422,5 +434,7 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
}
|
||||
|
||||
public interface OnHierarchyChangeListener {
|
||||
public void onChildViewAdded(View parent, View child);
|
||||
public void onChildViewRemoved(View parent, View child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,5 +7,14 @@ public interface WindowManager {
|
||||
public static final int FLAG_KEEP_SCREEN_ON = 0;
|
||||
|
||||
public float screenBrightness;
|
||||
public int softInputMode;
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
public LayoutParams(int w, int h, int type, int flags, int format) {
|
||||
super(w, h);
|
||||
}
|
||||
|
||||
public LayoutParams() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
package android.view;
|
||||
|
||||
public class WindowManagerImpl implements WindowManager {
|
||||
public class WindowManagerImpl implements WindowManager, ViewManager {
|
||||
public android.view.Display getDefaultDisplay() {
|
||||
return new android.view.Display();
|
||||
}
|
||||
|
||||
public class LayoutParams {
|
||||
@Override
|
||||
public void addView(View view, android.view.ViewGroup.LayoutParams params) {
|
||||
System.out.println("WindowManagerImpl.addView(" + view + ", " + params + ") called");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateViewLayout(View view, android.view.ViewGroup.LayoutParams params) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateViewLayout'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeView(View view) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'removeView'");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user