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
api-impl: misc fixes and additions to make Telegram launch
This commit is contained in:
@@ -275,3 +275,13 @@ JNIEXPORT void JNICALL Java_android_graphics_Matrix_native_1setRotate__JFFF(JNIE
|
|||||||
graphene_matrix_rotate_z(matrix, degrees);
|
graphene_matrix_rotate_z(matrix, degrees);
|
||||||
graphene_matrix_translate(matrix, &GRAPHENE_POINT3D_INIT(px, py, 0));
|
graphene_matrix_translate(matrix, &GRAPHENE_POINT3D_INIT(px, py, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jboolean JNICALL Java_android_graphics_Matrix_native_1rectStaysRect(JNIEnv *env, jclass class, jlong matrix_ptr)
|
||||||
|
{
|
||||||
|
graphene_matrix_t *matrix = (graphene_matrix_t *)_PTR(matrix_ptr);
|
||||||
|
float scale_x = graphene_matrix_get_value(matrix, 0, 0);
|
||||||
|
float skew_x = graphene_matrix_get_value(matrix, 1, 0);
|
||||||
|
float skew_y = graphene_matrix_get_value(matrix, 0, 1);
|
||||||
|
float scale_y = graphene_matrix_get_value(matrix, 1, 1);
|
||||||
|
return (!skew_x && !skew_y) || (!scale_x && !scale_y);
|
||||||
|
}
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ public class PropertyValuesHolder {
|
|||||||
public void setEvaluator(TypeEvaluator value) {}
|
public void setEvaluator(TypeEvaluator value) {}
|
||||||
|
|
||||||
public void calculateValue(float fraction) {
|
public void calculateValue(float fraction) {
|
||||||
|
if (fraction < 0f)
|
||||||
|
fraction = 0f;
|
||||||
|
if (fraction > 1f)
|
||||||
|
fraction = 1f;
|
||||||
if (values_object != null) {
|
if (values_object != null) {
|
||||||
value = values_object[(int) (fraction * (values_object.length - 1) + 0.5f)];
|
value = values_object[(int) (fraction * (values_object.length - 1) + 0.5f)];
|
||||||
} else if (values_float != null) {
|
} else if (values_float != null) {
|
||||||
|
|||||||
@@ -5,4 +5,6 @@ import android.content.Context;
|
|||||||
public class BackupManager {
|
public class BackupManager {
|
||||||
public BackupManager(Context context) {
|
public BackupManager(Context context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dataChanged() {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,4 +179,8 @@ public class Color {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int HSVToColor(int alpha, float[] hsv) {
|
||||||
|
return (alpha << 24) | (HSVToColor(hsv) & 0xffffff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,6 +224,10 @@ public class Path {
|
|||||||
transform(matrix);
|
transform(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLastPoint(float x, float y) {
|
||||||
|
Log.w("Path", "STUB: setLastPoint");
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import android.content.res.Resources.Theme;
|
|||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Shader;
|
import android.graphics.Shader;
|
||||||
@@ -61,4 +62,8 @@ public class BitmapDrawable extends Drawable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setTileModeX(Shader.TileMode mode) {}
|
public void setTileModeX(Shader.TileMode mode) {}
|
||||||
|
|
||||||
|
public Paint getPaint() {
|
||||||
|
return new Paint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,4 +7,6 @@ public class Shape {
|
|||||||
protected RectF rect() {
|
protected RectF rect() {
|
||||||
return new RectF();
|
return new RectF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resize(float width, float height) {}
|
||||||
}
|
}
|
||||||
|
|||||||
8
src/api-impl/android/media/AudioRecord.java
Normal file
8
src/api-impl/android/media/AudioRecord.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package android.media;
|
||||||
|
|
||||||
|
public class AudioRecord {
|
||||||
|
|
||||||
|
public static int getMinBufferSize(int sampleRateInHz, int channelConfig, int audioFormat) {
|
||||||
|
return 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
4
src/api-impl/android/os/WorkSource.java
Normal file
4
src/api-impl/android/os/WorkSource.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package android.os;
|
||||||
|
|
||||||
|
public class WorkSource {
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package android.text.style;
|
package android.text.style;
|
||||||
|
|
||||||
public class ClickableSpan {
|
public class ClickableSpan extends CharacterStyle {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ public class ImageSpan extends DynamicDrawableSpan {
|
|||||||
drawable = d;
|
drawable = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ImageSpan(Drawable d, int verticalAlignment) {
|
||||||
|
drawable = d;
|
||||||
|
}
|
||||||
|
|
||||||
public Drawable getDrawable() {
|
public Drawable getDrawable() {
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package android.text.style;
|
|||||||
|
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
|
|
||||||
public class MetricAffectingSpan {
|
public class MetricAffectingSpan extends CharacterStyle {
|
||||||
|
|
||||||
public void updateMeasureState(TextPaint paint) {}
|
public void updateMeasureState(TextPaint paint) {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package android.text.style;
|
package android.text.style;
|
||||||
|
|
||||||
public class URLSpan {
|
public class URLSpan extends CharacterStyle {
|
||||||
|
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ public class Linkify {
|
|||||||
public static final boolean addLinks(Spannable text, int mask) { return true; }
|
public static final boolean addLinks(Spannable text, int mask) { return true; }
|
||||||
public static final boolean addLinks(TextView text, int mask) { return true; }
|
public static final boolean addLinks(TextView text, int mask) { return true; }
|
||||||
|
|
||||||
public class MatchFilter {}
|
public interface MatchFilter {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,4 +15,8 @@ public class TextureView extends View {
|
|||||||
|
|
||||||
public interface SurfaceTextureListener {}
|
public interface SurfaceTextureListener {}
|
||||||
|
|
||||||
|
public void setSurfaceTextureListener(SurfaceTextureListener surfaceTextureListener) {}
|
||||||
|
|
||||||
|
public void setOpaque(boolean opaque) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,17 @@
|
|||||||
package android.view.animation;
|
package android.view.animation;
|
||||||
|
|
||||||
public class OvershootInterpolator {
|
import android.animation.TimeInterpolator;
|
||||||
|
|
||||||
public OvershootInterpolator(float overshoot) {}
|
public class OvershootInterpolator implements TimeInterpolator {
|
||||||
|
|
||||||
|
private float overshoot;
|
||||||
|
|
||||||
|
public OvershootInterpolator(float overshoot) {
|
||||||
|
this.overshoot = overshoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getInterpolation(float input) {
|
||||||
|
return (input-1) * (input-1) * ((overshoot + 1) * (input-1) + overshoot) + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class TextView extends View {
|
|||||||
public void setTextColor(ColorStateList colors) {
|
public void setTextColor(ColorStateList colors) {
|
||||||
if (colors != null) {
|
if (colors != null) {
|
||||||
this.colors = colors;
|
this.colors = colors;
|
||||||
setTextColor(colors.getDefaultColor()); // TODO: do this properly
|
native_setTextColor(colors.getDefaultColor()); // TODO: do this properly
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void setTypeface(Typeface tf, int style) {
|
public void setTypeface(Typeface tf, int style) {
|
||||||
|
|||||||
45
src/api-impl/android/widget/ViewSwitcher.java
Normal file
45
src/api-impl/android/widget/ViewSwitcher.java
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
package android.widget;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
public class ViewSwitcher extends ViewAnimator {
|
||||||
|
|
||||||
|
public interface ViewFactory {
|
||||||
|
public View makeView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ViewFactory factory;
|
||||||
|
|
||||||
|
public ViewSwitcher(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ViewSwitcher(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFactory(ViewFactory factory) {
|
||||||
|
this.factory = factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getCurrentView() {
|
||||||
|
View view = super.getCurrentView();
|
||||||
|
if (view == null) {
|
||||||
|
view = factory.makeView();
|
||||||
|
addView(view);
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getNextView() {
|
||||||
|
View view = getChildAt(mWhichChild+1);
|
||||||
|
if (view == null) {
|
||||||
|
view = factory.makeView();
|
||||||
|
addView(view);
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -274,6 +274,7 @@ srcs = [
|
|||||||
'android/location/LocationManager.java',
|
'android/location/LocationManager.java',
|
||||||
'android/media/AudioAttributes.java',
|
'android/media/AudioAttributes.java',
|
||||||
'android/media/AudioManager.java',
|
'android/media/AudioManager.java',
|
||||||
|
'android/media/AudioRecord.java',
|
||||||
'android/media/AudioTrack.java',
|
'android/media/AudioTrack.java',
|
||||||
'android/media/MediaCodec.java',
|
'android/media/MediaCodec.java',
|
||||||
'android/media/MediaCodecInfo.java',
|
'android/media/MediaCodecInfo.java',
|
||||||
@@ -363,6 +364,7 @@ srcs = [
|
|||||||
'android/os/UserManager.java',
|
'android/os/UserManager.java',
|
||||||
'android/os/VibrationEffect.java',
|
'android/os/VibrationEffect.java',
|
||||||
'android/os/Vibrator.java',
|
'android/os/Vibrator.java',
|
||||||
|
'android/os/WorkSource.java',
|
||||||
'android/os/ext/SdkExtensions.java',
|
'android/os/ext/SdkExtensions.java',
|
||||||
'android/os/storage/StorageManager.java',
|
'android/os/storage/StorageManager.java',
|
||||||
'android/preference/PreferenceActivity.java',
|
'android/preference/PreferenceActivity.java',
|
||||||
@@ -644,6 +646,7 @@ srcs = [
|
|||||||
'android/widget/Toolbar.java',
|
'android/widget/Toolbar.java',
|
||||||
'android/widget/ViewAnimator.java',
|
'android/widget/ViewAnimator.java',
|
||||||
'android/widget/ViewFlipper.java',
|
'android/widget/ViewFlipper.java',
|
||||||
|
'android/widget/ViewSwitcher.java',
|
||||||
'android/widget/ZoomButton.java',
|
'android/widget/ZoomButton.java',
|
||||||
'android/widget/ZoomButtonsController.java',
|
'android/widget/ZoomButtonsController.java',
|
||||||
'com/android/internal/Manifest.java',
|
'com/android/internal/Manifest.java',
|
||||||
|
|||||||
Reference in New Issue
Block a user