mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-04-28 12:17:57 +03:00
api-impl: misc APIs for WhatsApp media chooser Activities
This commit is contained in:
parent
69b742263a
commit
e011092025
19 changed files with 123 additions and 26 deletions
|
@ -258,7 +258,7 @@ public class Activity extends ContextThemeWrapper implements Window.Callback, La
|
|||
protected void onSaveInstanceState(Bundle outState) {
|
||||
}
|
||||
|
||||
void onConfigurationChanged(Configuration newConfig) {
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
}
|
||||
|
||||
public void onLowMemory() {
|
||||
|
|
|
@ -395,7 +395,15 @@ public class Intent implements Parcelable {
|
|||
|
||||
public void setSourceBounds(Rect sourceBounds) {}
|
||||
|
||||
public Rect getSourceBounds() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setSelector(Intent selector) {}
|
||||
|
||||
public void setClipData(ClipData clip) {}
|
||||
|
||||
public String resolveType(Context context) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package android.content.pm;
|
||||
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public class ResolveInfo {
|
||||
public ActivityInfo activityInfo = new ActivityInfo();
|
||||
|
@ -8,6 +9,22 @@ public class ResolveInfo {
|
|||
public IntentFilter filter = new IntentFilter();
|
||||
public int priority = -500;
|
||||
|
||||
public Drawable loadIcon(PackageManager pm) {
|
||||
Drawable icon = activityInfo.loadIcon(pm);
|
||||
if (icon == null) {
|
||||
icon = new Drawable();
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
public CharSequence loadLabel(PackageManager pm) {
|
||||
CharSequence label = activityInfo.loadLabel(pm);
|
||||
if (label == null) {
|
||||
label = "fixme ResolveInfo.loadLabel";
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
public static class DisplayNameComparator {
|
||||
|
||||
public DisplayNameComparator(PackageManager pm) {}
|
||||
|
|
|
@ -626,9 +626,9 @@ public class BitmapFactory {
|
|||
|
||||
Trace.traceBegin(Trace.TRACE_TAG_GRAPHICS, "decodeFileDescriptor");
|
||||
try {
|
||||
if (nativeIsSeekable(fd)) {
|
||||
bm = nativeDecodeFileDescriptor(fd, outPadding, opts);
|
||||
} else {
|
||||
//if (nativeIsSeekable(fd)) {
|
||||
// bm = nativeDecodeFileDescriptor(fd, outPadding, opts);
|
||||
//} else {
|
||||
FileInputStream fis = new FileInputStream(fd);
|
||||
try {
|
||||
bm = decodeStreamInternal(fis, outPadding, opts);
|
||||
|
@ -638,7 +638,7 @@ public class BitmapFactory {
|
|||
} catch (Throwable t) { /* ignore */
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
if (bm == null && opts != null && opts.inBitmap != null) {
|
||||
throw new IllegalArgumentException("Problem decoding into existing bitmap");
|
||||
|
|
|
@ -474,6 +474,10 @@ public class Canvas {
|
|||
return save();
|
||||
}
|
||||
|
||||
public int saveLayer(RectF bounds, Paint paint) {
|
||||
return save();
|
||||
}
|
||||
|
||||
public void drawOval(RectF oval, Paint paint) {
|
||||
Log.w("Canvas", "STUB: drawOval");
|
||||
}
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
package android.graphics.drawable;
|
||||
|
||||
public class TransitionDrawable extends Drawable {
|
||||
import android.graphics.Canvas;
|
||||
|
||||
public TransitionDrawable(Drawable[] layers) {}
|
||||
public class TransitionDrawable extends LayerDrawable {
|
||||
|
||||
public TransitionDrawable(Drawable[] layers) {
|
||||
super(layers);
|
||||
}
|
||||
|
||||
public void setCrossFadeEnabled(boolean enabled) {}
|
||||
|
||||
public void startTransition(int duration) {}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
// always draw the target drawable
|
||||
mLayerState.mChildren[1].mDrawable.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,4 +56,8 @@ public class AudioManager {
|
|||
public boolean isStreamMute(int streamType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMusicActive() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -601,19 +601,19 @@ public class ParcelFileDescriptor implements Closeable {
|
|||
*
|
||||
* @see #canDetectErrors()
|
||||
*/
|
||||
public int detachFd() { /*
|
||||
if (mWrapped != null) {
|
||||
return mWrapped.detachFd();
|
||||
} else {
|
||||
if (mClosed) {
|
||||
throw new IllegalStateException("Already closed");
|
||||
}
|
||||
final int fd = getFd();
|
||||
Parcel.clearFileDescriptor(mFd);
|
||||
writeCommStatusAndClose(Status.DETACHED, null);
|
||||
return fd;
|
||||
}*/
|
||||
return -1;
|
||||
public int detachFd() {
|
||||
if (mWrapped != null) {
|
||||
return mWrapped.detachFd();
|
||||
} else {
|
||||
if (mClosed) {
|
||||
throw new IllegalStateException("Already closed");
|
||||
}
|
||||
final int fd = getFd();
|
||||
// Parcel.clearFileDescriptor(mFd);
|
||||
mFd.setInt$(-1);
|
||||
writeCommStatusAndClose(Status.DETACHED, null);
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,6 +7,6 @@ public class PhoneNumberUtils {
|
|||
}
|
||||
|
||||
public static boolean isGlobalPhoneNumber(String phoneNumber) {
|
||||
return phoneNumber.startsWith("+") || phoneNumber.startsWith("00");
|
||||
return phoneNumber != null && (phoneNumber.startsWith("+") || phoneNumber.startsWith("00"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,4 +74,6 @@ public interface MenuItem {
|
|||
public MenuItem setNumericShortcut(char numericChar);
|
||||
|
||||
public boolean expandActionView();
|
||||
|
||||
public boolean isActionViewExpanded();
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
package android.view;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public interface SubMenu extends Menu {
|
||||
|
||||
public MenuItem getItem();
|
||||
|
||||
public void clearHeader();
|
||||
|
||||
public SubMenu setIcon(Drawable icon);
|
||||
|
||||
}
|
||||
|
|
|
@ -654,5 +654,9 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
|||
|
||||
public void requestChildFocus(View child, View focused) {}
|
||||
|
||||
public boolean getClipChildren() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public native boolean native_dispatchTouchEvent(long widget, MotionEvent event, double x, double y);
|
||||
}
|
||||
|
|
|
@ -88,4 +88,12 @@ public class ViewPropertyAnimator {
|
|||
}
|
||||
}, startDelay+duration);
|
||||
}
|
||||
|
||||
public ViewPropertyAnimator withEndAction(Runnable runnable) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewPropertyAnimator withStartAction(Runnable runnable) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package android.view.animation;
|
||||
|
||||
import android.animation.TimeInterpolator;
|
||||
|
||||
public class AccelerateDecelerateInterpolator implements TimeInterpolator {
|
||||
public class AccelerateDecelerateInterpolator implements Interpolator {
|
||||
|
||||
@Override
|
||||
public float getInterpolation(float input) {
|
||||
|
|
|
@ -163,7 +163,10 @@ public class ImageView extends View {
|
|||
public final void setColorFilter(int color, PorterDuff.Mode mode) {}
|
||||
|
||||
public void setImageTintList(ColorStateList tint) {
|
||||
colorFilter = new PorterDuffColorFilter(tint.getDefaultColor(), PorterDuff.Mode.SRC_IN);
|
||||
if (tint == null)
|
||||
colorFilter = null;
|
||||
else
|
||||
colorFilter = new PorterDuffColorFilter(tint.getDefaultColor(), PorterDuff.Mode.SRC_IN);
|
||||
setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
|
@ -191,6 +194,10 @@ public class ImageView extends View {
|
|||
|
||||
public void setColorFilter(ColorFilter cf) {}
|
||||
|
||||
public Matrix getImageMatrix() {
|
||||
return Matrix.IDENTITY_MATRIX;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected native long native_constructor(Context context, AttributeSet attrs);
|
||||
protected native void native_setDrawable(long widget, long paintable);
|
||||
|
|
|
@ -335,6 +335,12 @@ public class PopupMenu {
|
|||
throw new UnsupportedOperationException("Unimplemented method 'clearHeader'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubMenu setIcon(Drawable icon) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'setIcon'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class MenuItemImpl implements MenuItem {
|
||||
|
@ -549,6 +555,12 @@ public class PopupMenu {
|
|||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'expandActionView'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActionViewExpanded() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'isActionViewExpanded'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,11 +19,12 @@ public class ProgressBar extends View {
|
|||
super(context, attrs, defStyle);
|
||||
haveCustomMeasure = false;
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ProgressBar, defStyle, 0);
|
||||
setIndeterminateDrawable(a.getDrawable(com.android.internal.R.styleable.ProgressBar_indeterminateDrawable));
|
||||
setProgressDrawable(a.getDrawable(com.android.internal.R.styleable.ProgressBar_progressDrawable));
|
||||
setIndeterminate(a.getBoolean(com.android.internal.R.styleable.ProgressBar_indeterminate, false));
|
||||
if (a.getBoolean(com.android.internal.R.styleable.ProgressBar_indeterminateOnly, false)) {
|
||||
setIndeterminate(true);
|
||||
}
|
||||
setIndeterminateDrawable(a.getDrawable(com.android.internal.R.styleable.ProgressBar_indeterminateDrawable));
|
||||
/* FIXME hack: NewPipe expects this to not be null, but for some reason it is */
|
||||
if(indeterminateDrawable == null)
|
||||
indeterminateDrawable = new Drawable() {
|
||||
|
|
|
@ -1,4 +1,20 @@
|
|||
package android.widget;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
|
||||
public class RemoteViews {
|
||||
|
||||
public RemoteViews(String packageName, int layoutId) {}
|
||||
|
||||
public void setProgressBar(int viewId, int max, int progress, boolean indeterminate) {}
|
||||
|
||||
public void setTextViewText(int viewId, CharSequence text) {}
|
||||
|
||||
public void setImageViewResource(int viewId, int resId) {}
|
||||
|
||||
public void setContentDescription(int viewId, CharSequence text) {}
|
||||
|
||||
public void setOnClickPendingIntent(int viewId, PendingIntent pendingIntent) {}
|
||||
|
||||
public void setViewVisibility(int viewId, int visibility) {}
|
||||
}
|
||||
|
|
|
@ -403,4 +403,6 @@ public class TextView extends View {
|
|||
public void setShadowLayer(float radius, float dx, float dy, int color) {}
|
||||
|
||||
public void setBreakStrategy(int strategy) {}
|
||||
|
||||
public void clearComposingText() {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue