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 some stubs needed by android material library
This commit is contained in:
@@ -612,6 +612,14 @@ public class View extends Object {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public interface OnUnhandledKeyEventListener {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public interface OnFocusChangeListener {
|
||||
// TODO
|
||||
}
|
||||
|
||||
public interface OnCreateContextMenuListener {
|
||||
/**
|
||||
* Called when the context menu for this view is being built. It is not
|
||||
@@ -789,18 +797,18 @@ public class View extends Object {
|
||||
|
||||
public View(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
|
||||
if (attrs != null) {
|
||||
id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0);
|
||||
if (id != 0)
|
||||
setId(id);
|
||||
}
|
||||
}
|
||||
|
||||
public View(Context context, AttributeSet attrs, int defStyle) {
|
||||
this.context = context;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public View findViewById(int id) {
|
||||
@@ -926,11 +934,13 @@ public class View extends Object {
|
||||
public void getHitRect(Rect outRect) {}
|
||||
public final boolean getLocalVisibleRect(Rect r) { return false; }
|
||||
|
||||
public final int getTop() { return 0; }
|
||||
public final int getScrollX() { return 0; }
|
||||
public final int getScrollY() { return 0; }
|
||||
|
||||
public void scrollTo(int x, int y) {}
|
||||
|
||||
protected void onScrollChanged(int l, int t, int oldl, int oldt) {}
|
||||
|
||||
public void getLocationOnScreen(int[] location) { // FIXME: actually return the widget's location (and also have the onclick callback convert to window coordinates, because is seems that's what android deals in..)
|
||||
location[0] = 0;
|
||||
location[1] = 0;
|
||||
@@ -1159,4 +1169,30 @@ public class View extends Object {
|
||||
super.finalize();
|
||||
}
|
||||
}
|
||||
|
||||
public final int[] getDrawableState() {return new int[0];}
|
||||
|
||||
public float getRotation() {return 0.f;}
|
||||
|
||||
public void bringToFront() {}
|
||||
|
||||
public boolean isEnabled() {return true;}
|
||||
public boolean hasFocus() {return false;}
|
||||
public boolean isLayoutRequested() {return true;}
|
||||
public int getBaseline() {return -1;}
|
||||
public boolean hasFocusable() {return false;}
|
||||
public boolean isFocused() {return false;}
|
||||
|
||||
public void clearAnimation() {}
|
||||
|
||||
public ViewPropertyAnimator animate() {
|
||||
return new ViewPropertyAnimator();
|
||||
}
|
||||
|
||||
public float getTranslationX() {return 0.f;}
|
||||
public float getTranslationY() {return 0.f;}
|
||||
public void setTranslationX(float translationX) {}
|
||||
public void setTranslationY(float translationY) {}
|
||||
|
||||
public void setAlpha(float alpha) {}
|
||||
}
|
||||
|
||||
@@ -31,4 +31,8 @@ public class ViewConfiguration {
|
||||
public int getScaledPagingTouchSlop(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean hasPermanentMenuKey() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
}
|
||||
|
||||
public void addView(View child, int index, LayoutParams params) {
|
||||
if (child.parent == this)
|
||||
return;
|
||||
if (params != null) {
|
||||
child.setLayoutParams(params);
|
||||
}
|
||||
@@ -66,11 +68,17 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
}
|
||||
|
||||
public void removeView(View child) {
|
||||
if (child.parent != this)
|
||||
return;
|
||||
child.parent = null;
|
||||
children.remove(child);
|
||||
native_removeView(widget, child.widget);
|
||||
}
|
||||
|
||||
public void removeViewAt(int index) {
|
||||
removeView(children.get(index));
|
||||
}
|
||||
|
||||
public void removeAllViews() {
|
||||
for (Iterator<View> it = children.iterator(); it.hasNext();) {
|
||||
View child = it.next();
|
||||
@@ -80,6 +88,16 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void detachViewFromParent(int index) {
|
||||
}
|
||||
|
||||
public void attachViewToParent(View view, int index, LayoutParams params) {
|
||||
}
|
||||
|
||||
protected void removeDetachedView(View child, boolean animate) {
|
||||
removeView(child);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected native long native_constructor(Context context, AttributeSet attrs);
|
||||
protected native void native_addView(long widget, long child, int index, LayoutParams params);
|
||||
@@ -89,6 +107,10 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
return children.get(index);
|
||||
}
|
||||
|
||||
public int indexOfChild(View child) {
|
||||
return children.indexOf(child);
|
||||
}
|
||||
|
||||
public void updateViewLayout(View view, ViewGroup.LayoutParams params) {}
|
||||
|
||||
public LayoutParams generateLayoutParams(AttributeSet attrs) {
|
||||
@@ -196,6 +218,12 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
|
||||
}
|
||||
|
||||
public void setAddStatesFromChildren(boolean addsStates) {}
|
||||
|
||||
public View getFocusedChild() {return null;}
|
||||
|
||||
public int getDescendantFocusability() {return 0;}
|
||||
|
||||
public static class LayoutParams {
|
||||
public static final int FILL_PARENT = -1;
|
||||
public static final int MATCH_PARENT = -1;
|
||||
|
||||
12
src/api-impl/android/view/ViewPropertyAnimator.java
Normal file
12
src/api-impl/android/view/ViewPropertyAnimator.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package android.view;
|
||||
|
||||
import android.animation.TimeInterpolator;
|
||||
|
||||
public class ViewPropertyAnimator {
|
||||
|
||||
public void cancel() {}
|
||||
|
||||
public ViewPropertyAnimator setInterpolator(TimeInterpolator interpolator) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ public class Window {
|
||||
public void onContentChanged();
|
||||
|
||||
public abstract boolean onCreatePanelMenu(int featureId, Menu menu);
|
||||
|
||||
public View onCreatePanelView(int featureId);
|
||||
}
|
||||
public static class fixme_callback implements Callback {
|
||||
|
||||
@@ -16,6 +18,11 @@ public class Window {
|
||||
public boolean onCreatePanelMenu(int featureId, Menu menu) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreatePanelView(int featureId) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME private
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package android.view.animation;
|
||||
|
||||
public class AccelerateDecelerateInterpolator {
|
||||
|
||||
}
|
||||
@@ -2,4 +2,12 @@ package android.view.animation;
|
||||
|
||||
public class DecelerateInterpolator implements Interpolator{
|
||||
|
||||
public DecelerateInterpolator(float value) {}
|
||||
|
||||
@Override
|
||||
public float getInterpolation(float input) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getInterpolation'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package android.view.animation;
|
||||
|
||||
public interface Interpolator {
|
||||
import android.animation.TimeInterpolator;
|
||||
|
||||
public interface Interpolator extends TimeInterpolator {
|
||||
|
||||
}
|
||||
|
||||
12
src/api-impl/android/view/animation/LinearInterpolator.java
Normal file
12
src/api-impl/android/view/animation/LinearInterpolator.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package android.view.animation;
|
||||
|
||||
import android.animation.TimeInterpolator;
|
||||
|
||||
public class LinearInterpolator implements TimeInterpolator {
|
||||
|
||||
@Override
|
||||
public float getInterpolation(float input) {
|
||||
return input;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user