Add some stubs needed by android material library

This commit is contained in:
Julian Winkler
2023-08-22 14:41:01 +02:00
parent ca975a0e7c
commit 960930a348
42 changed files with 428 additions and 19 deletions

View File

@@ -15,6 +15,7 @@ JNIEXPORT jlong JNICALL Java_android_widget_TextView_native_1constructor(JNIEnv
GtkWidget *wrapper = g_object_ref(wrapper_widget_new()); GtkWidget *wrapper = g_object_ref(wrapper_widget_new());
GtkWidget *label = gtk_label_new(text); GtkWidget *label = gtk_label_new(text);
gtk_label_set_wrap(GTK_LABEL(label), TRUE);
wrapper_widget_set_child(WRAPPER_WIDGET(wrapper), label); wrapper_widget_set_child(WRAPPER_WIDGET(wrapper), label);
return _INTPTR(label); return _INTPTR(label);
} }

View File

@@ -2,6 +2,9 @@ package android.animation;
public class Animator { public class Animator {
public interface AnimatorListener {
}
public void setTarget(Object target) {} public void setTarget(Object target) {}
public void start() {} public void start() {}

View File

@@ -5,7 +5,7 @@ import android.content.Context;
public class AnimatorInflater { public class AnimatorInflater {
public static Animator loadAnimator(Context context, int resId) { public static Animator loadAnimator(Context context, int resId) {
return new Animator(); return new ObjectAnimator();
} }
} }

View File

@@ -0,0 +1,5 @@
package android.animation;
public class AnimatorSet extends Animator {
}

View File

@@ -0,0 +1,9 @@
package android.animation;
public class ObjectAnimator extends ValueAnimator {
public String getPropertyName() {
return null;
}
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright (C) 2010 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.animation;
/**
* A time interpolator defines the rate of change of an animation. This allows animations
* to have non-linear motion, such as acceleration and deceleration.
*/
public interface TimeInterpolator {
/**
* Maps a value representing the elapsed fraction of an animation to a value that represents
* the interpolated fraction. This interpolated value is then multiplied by the change in
* value of an animation to derive the animated value at the current elapsed animation time.
*
* @param input A value between 0 and 1.0 indicating our current point
* in the animation where 0 represents the start and 1.0 represents
* the end
* @return The interpolation value. This value can be more than 1.0 for
* interpolators which overshoot their targets, or less than 0 for
* interpolators that undershoot their targets.
*/
float getInterpolation(float input);
}

View File

@@ -0,0 +1,5 @@
package android.animation;
public interface TypeEvaluator {
}

View File

@@ -1,6 +1,8 @@
package android.animation; package android.animation;
public class ValueAnimator { final class PropertyValuesHolder{}
public class ValueAnimator extends Animator {
public static ValueAnimator ofFloat(float... values) { public static ValueAnimator ofFloat(float... values) {
return new ValueAnimator(); return new ValueAnimator();
@@ -16,6 +18,19 @@ public class ValueAnimator {
return 20; // 20ms frame interval return 20; // 20ms frame interval
} }
public PropertyValuesHolder[] getValues() {
return null;
}
public long getStartDelay() {return 0;}
public long getDuration() {return 0;}
public TimeInterpolator getInterpolator() {return null;}
public int getRepeatCount() {return 0;}
public int getRepeatMode() {return 0;}
public void setInterpolator(TimeInterpolator interpolator) {}
public void addListener(Animator.AnimatorListener listener) {}
public void setFloatValues(float[] values) {}
/** /**
* Implementors of this interface can add themselves as update listeners * Implementors of this interface can add themselves as update listeners
* to an <code>ValueAnimator</code> instance to receive callbacks on every animation * to an <code>ValueAnimator</code> instance to receive callbacks on every animation

View File

@@ -329,6 +329,8 @@ public class Activity extends Context {
return "Title"; return "Title";
} }
public boolean isChangingConfigurations() {return false;}
private native void nativeFinish(long native_window); private native void nativeFinish(long native_window);
private static native void nativeStartActivity(Activity activity); private static native void nativeStartActivity(Activity activity);
} }

View File

@@ -0,0 +1,5 @@
package android.app;
public class SharedElementCallback {
}

View File

@@ -358,4 +358,6 @@ public class Context extends Object {
public final CharSequence getText(int resId) { public final CharSequence getText(int resId) {
return getResources().getText(resId); return getResources().getText(resId);
} }
public boolean isRestricted() {return false;}
} }

View File

@@ -329,6 +329,8 @@ public class TypedArray {
public ColorStateList getColorStateList(int index) { public ColorStateList getColorStateList(int index) {
final TypedValue value = mValue; final TypedValue value = mValue;
if (getValueAt(index * AssetManager.STYLE_NUM_ENTRIES, value)) { if (getValueAt(index * AssetManager.STYLE_NUM_ENTRIES, value)) {
if (value.type == -1)
return null;
return mResources.loadColorStateList(value, value.resourceId); return mResources.loadColorStateList(value, value.resourceId);
} }
return null; return null;

View File

@@ -45,6 +45,30 @@ public class Color {
return color >>> 24; return color >>> 24;
} }
/**
* Return the red component of a color int. This is the same as saying
* (color >> 16) & 0xFF
*/
public static int red(int color) {
return (color >> 16) & 0xFF;
}
/**
* Return the green component of a color int. This is the same as saying
* (color >> 8) & 0xFF
*/
public static int green(int color) {
return (color >> 8) & 0xFF;
}
/**
* Return the blue component of a color int. This is the same as saying
* color & 0xFF
*/
public static int blue(int color) {
return color & 0xFF;
}
/** /**
* Parse the color string, and return the corresponding color-int. * Parse the color string, and return the corresponding color-int.
* If the string cannot be parsed, throws an IllegalArgumentException * If the string cannot be parsed, throws an IllegalArgumentException

View File

@@ -0,0 +1,5 @@
package android.graphics;
public class ColorFilter {
}

View File

@@ -245,7 +245,7 @@ public class Matrix {
* Set the matrix to identity * Set the matrix to identity
*/ */
public void reset() { public void reset() {
native_reset(native_instance); // native_reset(native_instance);
} }
/** /**
* Set the matrix to translate by (dx, dy). * Set the matrix to translate by (dx, dy).
@@ -386,7 +386,8 @@ public class Matrix {
* M' = S(sx, sy, px, py) * M * M' = S(sx, sy, px, py) * M
*/ */
public boolean postScale(float sx, float sy, float px, float py) { public boolean postScale(float sx, float sy, float px, float py) {
return native_postScale(native_instance, sx, sy, px, py); // return native_postScale(native_instance, sx, sy, px, py);
return true;
} }
/** /**
* Postconcats the matrix with the specified scale. * Postconcats the matrix with the specified scale.
@@ -480,7 +481,8 @@ public class Matrix {
if (dst == null || src == null) { if (dst == null || src == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
return native_setRectToRect(native_instance, src, dst, stf.nativeInt); // return native_setRectToRect(native_instance, src, dst, stf.nativeInt);
return true;
} }
// private helper to perform range checks on arrays of "points" // private helper to perform range checks on arrays of "points"
private static void checkPointArrays(float[] src, int srcIndex, private static void checkPointArrays(float[] src, int srcIndex,

View File

@@ -20,7 +20,7 @@ package android.graphics;
* A color filter that can be used to tint the source pixels using a single * A color filter that can be used to tint the source pixels using a single
* color and a specific {@link PorterDuff Porter-Duff composite mode}. * color and a specific {@link PorterDuff Porter-Duff composite mode}.
*/ */
public class PorterDuffColorFilter { public class PorterDuffColorFilter extends ColorFilter {
private int mColor; private int mColor;
private PorterDuff.Mode mMode; private PorterDuff.Mode mMode;

View File

@@ -36,4 +36,12 @@ public class Typeface {
public static Typeface createFromAsset(AssetManager mgr, String path) { public static Typeface createFromAsset(AssetManager mgr, String path) {
return null; return null;
} }
public static Typeface create(String familyName, int style) {
return null;
}
public static Typeface create(Typeface typeface, int style) {
return null;
}
} }

View File

@@ -2,6 +2,7 @@ package android.graphics.drawable;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.Rect; import android.graphics.Rect;
@@ -65,8 +66,12 @@ public abstract class Drawable {
public void setBounds(Rect bounds) {} public void setBounds(Rect bounds) {}
public void setColorFilter(int color, PorterDuff.Mode mode) {} public void setColorFilter(int color, PorterDuff.Mode mode) {}
public void setColorFilter(ColorFilter filter) {}
public Drawable mutate() { public Drawable mutate() {
return this; return this;
} }
public int getIntrinsicWidth() {return 0;}
public int getIntrinsicHeight() {return 0;}
} }

View File

@@ -0,0 +1,17 @@
package android.graphics.drawable;
import android.graphics.Canvas;
public class InsetDrawable extends Drawable {
public InsetDrawable(Drawable drawable, int insetLeft, int insetTop, int insetRight, int insetBottom) {
super();
}
@Override
public void draw(Canvas canvas) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'draw'");
}
}

View File

@@ -0,0 +1,12 @@
package android.text;
public class Layout {
public enum Alignment {
ALIGN_NORMAL,
ALIGN_OPPOSITE,
ALIGN_CENTER,
ALIGN_LEFT,
ALIGN_RIGHT,
}
}

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