add more API stubs for NewPipe

This commit is contained in:
Julian Winkler
2023-09-19 23:22:21 +02:00
parent 2013024971
commit c830abc5f3
34 changed files with 310 additions and 23 deletions

View File

@@ -6,12 +6,17 @@ public class Animator {
public abstract void onAnimationEnd (Animator animation); public abstract void onAnimationEnd (Animator animation);
} }
private AnimatorListener listener;
public void setTarget(Object target) {} public void setTarget(Object target) {}
public void start() {} public void start() {
if (listener != null)
listener.onAnimationEnd(this);
}
public void addListener(AnimatorListener listener) { public void addListener(AnimatorListener listener) {
listener.onAnimationEnd(Animator.this); this.listener = listener;
} }
} }

View File

@@ -1,5 +1,7 @@
package android.animation; package android.animation;
import android.util.Property;
public class ObjectAnimator extends ValueAnimator { public class ObjectAnimator extends ValueAnimator {
public String getPropertyName() { public String getPropertyName() {
@@ -10,6 +12,12 @@ public class ObjectAnimator extends ValueAnimator {
return new ObjectAnimator(); return new ObjectAnimator();
} }
public static <T> ObjectAnimator ofFloat(T target, Property<T, Float> property, float... values) {
return new ObjectAnimator();
}
public ObjectAnimator setDuration(long duration) {return this;} public ObjectAnimator setDuration(long duration) {return this;}
public void setAutoCancel(boolean autoCancel) {}
} }

View File

@@ -10,6 +10,7 @@ public class Intent {
private Bundle extras = new Bundle(); private Bundle extras = new Bundle();
private String action; private String action;
private Uri data; private Uri data;
private int flags;
public Intent() {} public Intent() {}
public Intent(Intent o) { public Intent(Intent o) {
@@ -34,11 +35,13 @@ public class Intent {
} }
public Intent addFlags(int flags) { public Intent addFlags(int flags) {
return this; //?? this.flags |= flags;
return this;
} }
public Intent setFlags(int flags) { public Intent setFlags(int flags) {
return this; //?? this.flags = flags;
return this;
} }
public Intent setPackage(String packageName) { public Intent setPackage(String packageName) {
return this; //?? return this; //??
@@ -206,7 +209,7 @@ public class Intent {
} }
public String getAction() { public String getAction() {
return null; return action;
} }
public Bundle getBundleExtra(String name) { public Bundle getBundleExtra(String name) {
@@ -259,4 +262,8 @@ public class Intent {
return target; return target;
} }
public int getFlags() {
return flags;
}
} }

View File

@@ -714,6 +714,10 @@ public class Resources {
return res; return res;
} }
public Drawable getDrawable(int id, Theme theme) throws NotFoundException {
return getDrawable(id);
}
/** /**
* Return a drawable object associated with a particular resource ID for the * Return a drawable object associated with a particular resource ID for the
* given screen density in DPI. This will set the drawable's density to be * given screen density in DPI. This will set the drawable's density to be

View File

@@ -376,6 +376,9 @@ public class Canvas {
} }
public void setBitmap(Bitmap bitmap) {} public void setBitmap(Bitmap bitmap) {}
public void drawPath(Path path, Paint paint) {}
private static native void native_drawText(long skia_canvas, CharSequence text, int start, int end, float x, float y, long skia_font, long skia_paint); private static native void native_drawText(long skia_canvas, CharSequence text, int start, int end, float x, float y, long skia_font, long skia_paint);
private static native void native_drawRect(long skia_canvas, float left, float top, float right, float bottom, long skia_paint); private static native void native_drawRect(long skia_canvas, float left, float top, float right, float bottom, long skia_paint);
private static native void native_drawLine(long skia_canvas, long widget, float startX, float startY, float stopX, float stopY, long skia_paint); private static native void native_drawLine(long skia_canvas, long widget, float startX, float startY, float stopX, float stopY, long skia_paint);

View File

@@ -203,6 +203,10 @@ public class Paint {
public void setStrokeJoin(Join join) {} public void setStrokeJoin(Join join) {}
public Typeface getTypeface() {
return new Typeface();
}
private native long native_constructor(); private native long native_constructor();
private native void native_set_color(long skia_paint, int color); private native void native_set_color(long skia_paint, int color);
private native int native_get_color(long skia_paint); private native int native_get_color(long skia_paint);

View File

@@ -80,7 +80,7 @@ mDetectSimplePaths = HardwareRenderer.isAvailable();
// We promised not to change this, so preserve it around the native // We promised not to change this, so preserve it around the native
// call, which does now reset fill type. // call, which does now reset fill type.
final FillType fillType = getFillType(); final FillType fillType = getFillType();
native_reset(mNativePath); // native_reset(mNativePath);
setFillType(fillType); setFillType(fillType);
} }
/** /**
@@ -213,7 +213,8 @@ mDetectSimplePaths = HardwareRenderer.isAvailable();
* @return the path's fill type * @return the path's fill type
*/ */
public FillType getFillType() { public FillType getFillType() {
return sFillTypeArray[native_getFillType(mNativePath)]; return FillType.WINDING;
// return sFillTypeArray[native_getFillType(mNativePath)];
} }
/** /**
* Set the path's fill type. This defines how "inside" is computed. * Set the path's fill type. This defines how "inside" is computed.
@@ -221,7 +222,7 @@ mDetectSimplePaths = HardwareRenderer.isAvailable();
* @param ft The new fill type for this path * @param ft The new fill type for this path
*/ */
public void setFillType(FillType ft) { public void setFillType(FillType ft) {
native_setFillType(mNativePath, ft.nativeInt); // native_setFillType(mNativePath, ft.nativeInt);
} }
/** /**
@@ -292,7 +293,7 @@ mDetectSimplePaths = HardwareRenderer.isAvailable();
* @param y The y-coordinate of the start of a new contour * @param y The y-coordinate of the start of a new contour
*/ */
public void moveTo(float x, float y) { public void moveTo(float x, float y) {
native_moveTo(mNativePath, x, y); // native_moveTo(mNativePath, x, y);
} }
/** /**
* Set the beginning of the next contour relative to the last point on the * Set the beginning of the next contour relative to the last point on the
@@ -317,7 +318,7 @@ mDetectSimplePaths = HardwareRenderer.isAvailable();
*/ */
public void lineTo(float x, float y) { public void lineTo(float x, float y) {
isSimplePath = false; isSimplePath = false;
native_lineTo(mNativePath, x, y); // native_lineTo(mNativePath, x, y);
} }
/** /**
* Same as lineTo, but the coordinates are considered relative to the last * Same as lineTo, but the coordinates are considered relative to the last
@@ -345,7 +346,7 @@ mDetectSimplePaths = HardwareRenderer.isAvailable();
*/ */
public void quadTo(float x1, float y1, float x2, float y2) { public void quadTo(float x1, float y1, float x2, float y2) {
isSimplePath = false; isSimplePath = false;
native_quadTo(mNativePath, x1, y1, x2, y2); // native_quadTo(mNativePath, x1, y1, x2, y2);
} }
/** /**
* Same as quadTo, but the coordinates are considered relative to the last * Same as quadTo, but the coordinates are considered relative to the last
@@ -433,7 +434,7 @@ mDetectSimplePaths = HardwareRenderer.isAvailable();
*/ */
public void close() { public void close() {
isSimplePath = false; isSimplePath = false;
native_close(mNativePath); // native_close(mNativePath);
} }
/** /**
* Specifies how closed shapes (e.g. rects, ovals) are oriented when they * Specifies how closed shapes (e.g. rects, ovals) are oriented when they

View File

@@ -6,6 +6,9 @@ import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
public class Uri { public class Uri {
public static final Uri EMPTY = new Uri();
private URI uri; private URI uri;
public static Uri parse(String s) { public static Uri parse(String s) {

View File

@@ -0,0 +1,8 @@
package android.os;
public class ConditionVariable {
public void open() {}
public void block() {}
}

View File

@@ -54,6 +54,10 @@ public class Settings {
public static Uri getUriFor(String name) { public static Uri getUriFor(String name) {
return null; return null;
} }
public static float getFloat(ContentResolver cr, String key, float def) {
return 0.0f;
}
} }
public static final class Global { public static final class Global {

View File

@@ -8,4 +8,6 @@ public class TelephonyManager {
public int getPhoneType() { public int getPhoneType() {
return 0; // PHONE_TYPE_NONE return 0; // PHONE_TYPE_NONE
} }
public String getNetworkCountryIso() {return "";}
} }

View File

@@ -0,0 +1,4 @@
package android.text.method;
public class MovementMethod {
}

View File

@@ -19,6 +19,7 @@ package android.text.method;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Handler; import android.os.Handler;
import android.os.SystemClock; import android.os.SystemClock;
import android.text.Editable;
import android.text.GetChars; import android.text.GetChars;
import android.text.NoCopySpan; import android.text.NoCopySpan;
import android.text.Spannable; import android.text.Spannable;
@@ -173,4 +174,10 @@ public class PasswordTransformationMethod implements TransformationMethod, TextW
private static PasswordTransformationMethod sInstance; private static PasswordTransformationMethod sInstance;
private static char DOT = '\u2022'; private static char DOT = '\u2022';
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'afterTextChanged'");
}
} }

View File

@@ -0,0 +1,4 @@
package android.text.style;
public class ClickableSpan {
}

View File

@@ -0,0 +1,4 @@
package android.text.style;
public class URLSpan {
}

View File

@@ -0,0 +1,80 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.util;
/**
* A property is an abstraction that can be used to represent a <emb>mutable</em> value that is held
* in a <em>host</em> object. The Property's {@link #set(Object, Object)} or {@link #get(Object)}
* methods can be implemented in terms of the private fields of the host object, or via "setter" and
* "getter" methods or by some other mechanism, as appropriate.
*
* @param <T> The class on which the property is declared.
* @param <V> The type that this property represents.
*/
public abstract class Property<T, V> {
private final String mName;
private final Class<V> mType;
/**
* A constructor that takes an identifying name and {@link #getType() type} for the property.
*/
public Property(Class<V> type, String name) {
mName = name;
mType = type;
}
/**
* Returns true if the {@link #set(Object, Object)} method does not set the value on the target
* object (in which case the {@link #set(Object, Object) set()} method should throw a {@link
* NoSuchPropertyException} exception). This may happen if the Property wraps functionality that
* allows querying the underlying value but not setting it. For example, the {@link #of(Class,
* Class, String)} factory method may return a Property with name "foo" for an object that has
* only a <code>getFoo()</code> or <code>isFoo()</code> method, but no matching
* <code>setFoo()</code> method.
*/
public boolean isReadOnly() {
return false;
}
/**
* Sets the value on <code>object</code> which this property represents. If the method is unable
* to set the value on the target object it will throw an {@link UnsupportedOperationException}
* exception.
*/
public void set(T object, V value) {
throw new UnsupportedOperationException("Property " + getName() +" is read-only");
}
/**
* Returns the current value that this property represents on the given <code>object</code>.
*/
public abstract V get(T object);
/**
* Returns the name for this property.
*/
public String getName() {
return mName;
}
/**
* Returns the type for this property.
*/
public Class<V> getType() {
return mType;
}
}

View File

@@ -7,6 +7,8 @@ public class GestureDetector {
public GestureDetector(Context context, OnGestureListener listener, Handler handler) {} public GestureDetector(Context context, OnGestureListener listener, Handler handler) {}
public GestureDetector(Context context, OnGestureListener listener) {}
public interface OnGestureListener { public interface OnGestureListener {
} }

View File

@@ -21,4 +21,6 @@ public interface Menu {
public MenuItem add(CharSequence text); public MenuItem add(CharSequence text);
public void setGroupCheckable(int group, boolean checkable, boolean exclusive); public void setGroupCheckable(int group, boolean checkable, boolean exclusive);
public SubMenu addSubMenu(int groupId, int itemId, int order, CharSequence title);
} }

View File

@@ -28,4 +28,6 @@ public interface MenuItem {
public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener listener); public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener listener);
public MenuItem setTitle(int resId);
} }

View File

@@ -2,4 +2,6 @@ package android.view;
public interface SubMenu extends Menu { public interface SubMenu extends Menu {
public MenuItem getItem();
} }

Some files were not shown because too many files have changed in this diff Show More