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 missing APIs.
android.widget.Filter and android.webkit.MimeTypeMap are copied from AOSP. Other new classes are only stub implementations.
This commit is contained in:
@@ -307,7 +307,7 @@ public class KeyCharacterMap {
|
||||
}
|
||||
}
|
||||
return inputDevice.getKeyCharacterMap();*/
|
||||
return null;
|
||||
return new KeyCharacterMap(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -609,7 +609,8 @@ public class KeyCharacterMap {
|
||||
* @return The keyboard type.
|
||||
*/
|
||||
public int getKeyboardType() {
|
||||
return nativeGetKeyboardType(mPtr);
|
||||
return FULL;
|
||||
// return nativeGetKeyboardType(mPtr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,8 +9,11 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.LayoutDirection;
|
||||
import android.util.SparseArray;
|
||||
import android.view.animation.Animation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -779,6 +782,7 @@ public class View extends Object {
|
||||
protected ViewGroup.LayoutParams layout_params;
|
||||
private Context context;
|
||||
private Map<Integer,Object> tags = new HashMap<>();
|
||||
private Object tag;
|
||||
|
||||
int measuredWidth = 0;
|
||||
int measuredHeight = 0;
|
||||
@@ -1019,7 +1023,10 @@ public class View extends Object {
|
||||
public static class AccessibilityDelegate {}
|
||||
|
||||
public Drawable getBackground() {
|
||||
return null;
|
||||
return new Drawable() {
|
||||
@Override
|
||||
public void draw(Canvas canvas) {}
|
||||
};
|
||||
}
|
||||
|
||||
public void setClickable(boolean clickable) {}
|
||||
@@ -1090,6 +1097,10 @@ public class View extends Object {
|
||||
return result | (childMeasuredState&MEASURED_STATE_MASK);
|
||||
}
|
||||
|
||||
public static int resolveSize(int size, int measureSpec) {
|
||||
return resolveSizeAndState(size, measureSpec, 0) & MEASURED_SIZE_MASK;
|
||||
}
|
||||
|
||||
public final int getMeasuredWidth() {
|
||||
return this.measuredWidth & MEASURED_SIZE_MASK;
|
||||
}
|
||||
@@ -1168,6 +1179,13 @@ public class View extends Object {
|
||||
return tags.get(key);
|
||||
}
|
||||
|
||||
public void setTag(Object tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
public Object getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void addOnLayoutChangeListener(OnLayoutChangeListener listener) {}
|
||||
|
||||
public boolean isSelected() {return false;}
|
||||
@@ -1250,5 +1268,44 @@ public class View extends Object {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static class BaseSavedState extends AbsSavedState {
|
||||
}
|
||||
|
||||
public void clearFocus() {}
|
||||
|
||||
public void setRotation(float rotation) {}
|
||||
|
||||
public void setScaleX(float scaleX) {}
|
||||
public void setScaleY(float scaleY) {}
|
||||
|
||||
public static View inflate(Context context, int resource, ViewGroup root) {
|
||||
LayoutInflater factory = LayoutInflater.from(context);
|
||||
return factory.inflate(resource, root);
|
||||
}
|
||||
|
||||
public void saveHierarchyState(SparseArray<Parcelable> array) {}
|
||||
|
||||
public void setDuplicateParentStateEnabled(boolean enabled) {}
|
||||
|
||||
public boolean performClick() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void playSoundEffect(int soundConstant) {}
|
||||
|
||||
public void computeScroll() {}
|
||||
|
||||
public void jumpDrawablesToCurrentState() {}
|
||||
|
||||
public void setOnFocusChangeListener (View.OnFocusChangeListener l) {}
|
||||
|
||||
public boolean hasWindowFocus() {return true;}
|
||||
|
||||
public void setSaveEnabled (boolean enabled) {}
|
||||
|
||||
public boolean willNotDraw() {return false;}
|
||||
|
||||
public void setOnCreateContextMenuListener (View.OnCreateContextMenuListener l) {}
|
||||
|
||||
public void startAnimation(Animation animation) {}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
}
|
||||
|
||||
public void attachViewToParent(View view, int index, LayoutParams params) {
|
||||
addViewInternal(view, index, params);
|
||||
}
|
||||
|
||||
protected void removeDetachedView(View child, boolean animate) {
|
||||
@@ -131,6 +132,9 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
public LayoutParams generateLayoutParams(AttributeSet attrs) {
|
||||
return new LayoutParams(getContext(), attrs);
|
||||
}
|
||||
protected LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
|
||||
return p;
|
||||
}
|
||||
|
||||
public void bringChildToFront(View child) {
|
||||
// TODO: actually implement this (might make sense to implement it in the subclasses instead), when applicable
|
||||
@@ -150,7 +154,7 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
|
||||
public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {}
|
||||
|
||||
public boolean checkLayoutParams(LayoutParams params) {
|
||||
protected boolean checkLayoutParams(LayoutParams params) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -233,12 +237,30 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
|
||||
}
|
||||
|
||||
protected void measureChild(View child, int parentWidthMeasureSpec,
|
||||
int parentHeightMeasureSpec) {
|
||||
final LayoutParams lp = child.getLayoutParams();
|
||||
final int childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec,
|
||||
/*mPaddingLeft + mPaddingRight*/0, lp.width);
|
||||
final int childHeightMeasureSpec = getChildMeasureSpec(parentHeightMeasureSpec,
|
||||
/*mPaddingTop + mPaddingBottom*/0, lp.height);
|
||||
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
|
||||
}
|
||||
|
||||
public void setAddStatesFromChildren(boolean addsStates) {}
|
||||
|
||||
public View getFocusedChild() {return null;}
|
||||
|
||||
public int getDescendantFocusability() {return 0;}
|
||||
|
||||
public void startViewTransition(View view) {}
|
||||
public void endViewTransition(View view) {}
|
||||
|
||||
protected LayoutParams generateDefaultLayoutParams() {
|
||||
return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
public void focusableViewAvailable(View v) {}
|
||||
public static class LayoutParams {
|
||||
public static final int FILL_PARENT = -1;
|
||||
public static final int MATCH_PARENT = -1;
|
||||
|
||||
@@ -2,4 +2,6 @@ package android.view;
|
||||
|
||||
public interface ViewParent {
|
||||
public abstract ViewParent getParent();
|
||||
|
||||
public boolean isLayoutRequested();
|
||||
}
|
||||
|
||||
16
src/api-impl/android/view/ViewStub.java
Normal file
16
src/api-impl/android/view/ViewStub.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package android.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public class ViewStub extends View {
|
||||
|
||||
public ViewStub(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public ViewStub(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,16 @@
|
||||
package android.view.accessibility;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AccessibilityManager {
|
||||
|
||||
public boolean isTouchExplorationEnabled() {return false;}
|
||||
|
||||
public boolean isEnabled() {return false;}
|
||||
|
||||
public List getEnabledAccessibilityServiceList(int feedbackTypeFlags) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package android.view.inputmethod;
|
||||
|
||||
import android.os.IBinder;
|
||||
|
||||
public class InputMethodManager {
|
||||
|
||||
public boolean hideSoftInputFromWindow(IBinder windowToken, int flags) {return false;}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user