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 stubs and trivial impls
This commit is contained in:
@@ -29,8 +29,12 @@ public class Notification implements Parcelable {
|
||||
|
||||
public int iconLevel;
|
||||
|
||||
public RemoteViews bigContentView;
|
||||
|
||||
public RemoteViews contentView;
|
||||
|
||||
public RemoteViews headsUpContentView;
|
||||
|
||||
public long[] vibrate;
|
||||
|
||||
public int ledARGB;
|
||||
|
||||
@@ -32,6 +32,9 @@ public final class Bitmap {
|
||||
public enum CompressFormat {
|
||||
JPEG,
|
||||
PNG,
|
||||
WEBP,
|
||||
WEBP_LOSSY,
|
||||
WEBP_LOSSLESS,
|
||||
}
|
||||
|
||||
private int width;
|
||||
|
||||
@@ -207,7 +207,6 @@ public class Canvas {
|
||||
* @param py The y-coord for the pivot point (unchanged by the scale)
|
||||
*/
|
||||
public final void scale(float sx, float sy, float px, float py) {
|
||||
System.out.println("XXXXXXX scale(sx, sy, px, py)");
|
||||
translate(px, py);
|
||||
scale(sx, sy);
|
||||
translate(-px, -py);
|
||||
@@ -466,6 +465,10 @@ public class Canvas {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean clipRect(RectF rect) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean clipRect(float left, float top, float right, float bottom, Region.Op op) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public class Paint {
|
||||
public long paint; // native paint
|
||||
private Xfermode xfermode;
|
||||
private Shader shader;
|
||||
private Align align = Align.CENTER;
|
||||
|
||||
public Paint() {
|
||||
paint = native_create();
|
||||
@@ -322,6 +323,10 @@ public class Paint {
|
||||
return Style.values[native_get_style(paint)];
|
||||
}
|
||||
|
||||
public Align getTextAlign() {
|
||||
return align;
|
||||
}
|
||||
|
||||
private static native long native_create();
|
||||
private static native long native_clone(long paint);
|
||||
private static native void native_recycle(long paint);
|
||||
|
||||
@@ -112,6 +112,10 @@ public class Path {
|
||||
native_rel_quad_to(getBuilder(), x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
public void addArc (RectF oval, float startAngle, float sweepAngle) {}
|
||||
|
||||
public void addArc (float left, float top, float right, float bottom, float startAngle, float sweepAngle) {}
|
||||
|
||||
public void addPath(Path path, Matrix matrix) {
|
||||
native_add_path(getBuilder(), path.getGskPath(), matrix.ni());
|
||||
}
|
||||
@@ -153,6 +157,13 @@ public class Path {
|
||||
path = 0;
|
||||
}
|
||||
|
||||
public void transform(Matrix matrix, Path out_path) {
|
||||
if(out_path == null)
|
||||
out_path = this;
|
||||
|
||||
out_path.transform(matrix);
|
||||
}
|
||||
|
||||
public void computeBounds(RectF bounds, boolean exact) {
|
||||
native_get_bounds(getGskPath(), bounds);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,9 @@ public final class PowerManager {
|
||||
|
||||
public void release() {}
|
||||
|
||||
public boolean isHeld() { return false; }
|
||||
public boolean isHeld() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void acquire(long timeout) {}
|
||||
}
|
||||
@@ -21,7 +23,15 @@ public final class PowerManager {
|
||||
|
||||
public static final int FULL_WAKE_LOCK = 0x1a;
|
||||
|
||||
public boolean isPowerSaveMode() { return false; }
|
||||
public boolean isPowerSaveMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isScreenOn() { return true; }
|
||||
public boolean isScreenOn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isIgnoringBatteryOptimizations(String packageName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
33
src/api-impl/android/speech/tts/TextToSpeech.java
Normal file
33
src/api-impl/android/speech/tts/TextToSpeech.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package android.speech.tts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
public class TextToSpeech {
|
||||
public static final int ERROR = -1;
|
||||
|
||||
public TextToSpeech(Context context, TextToSpeech.OnInitListener listener) {
|
||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
listener.onInit(ERROR);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int setOnUtteranceCompletedListener(TextToSpeech.OnUtteranceCompletedListener listener) {
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
}
|
||||
|
||||
public static interface OnInitListener {
|
||||
abstract void onInit(int status);
|
||||
}
|
||||
|
||||
public static interface OnUtteranceCompletedListener {
|
||||
public abstract void onUtteranceCompleted(String utteranceId);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* most of this file:
|
||||
*
|
||||
* Copyright (C) 2006 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.text;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -10,8 +28,6 @@ public class TextUtils {
|
||||
return 0 /*LTR*/; // FIXME
|
||||
}
|
||||
|
||||
// unchanged from android source
|
||||
|
||||
/* split */
|
||||
|
||||
private static String[] EMPTY_STRING_ARRAY = new String[] {};
|
||||
@@ -350,4 +366,15 @@ public class TextUtils {
|
||||
public static String substring(CharSequence s, int start, int end) {
|
||||
return s.subSequence(start, end).toString();
|
||||
}
|
||||
|
||||
public static boolean isDigitsOnly(CharSequence str) {
|
||||
final int len = str.length();
|
||||
for (int cp, i = 0; i < len; i += Character.charCount(cp)) {
|
||||
cp = Character.codePointAt(str, i);
|
||||
if (!Character.isDigit(cp)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
package android.text.style;
|
||||
|
||||
public class AbsoluteSizeSpan {
|
||||
public AbsoluteSizeSpan() {}
|
||||
public AbsoluteSizeSpan(int dummy) {}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,20 @@ public class VelocityTracker {
|
||||
public void computeCurrentVelocity(int units, float maxVelocity) {}
|
||||
public void computeCurrentVelocity(int units) {}
|
||||
|
||||
public float getXVelocity() {
|
||||
return getXVelocity(-1);
|
||||
}
|
||||
|
||||
public float getXVelocity(int id) {
|
||||
if (currentEventTime == startEventTime)
|
||||
return 0.f;
|
||||
return (currentX - startX) / (currentEventTime - startEventTime) * 1000;
|
||||
}
|
||||
|
||||
public float getYVelocity() {
|
||||
return getYVelocity();
|
||||
}
|
||||
|
||||
public float getYVelocity(int id) {
|
||||
if (currentEventTime == startEventTime)
|
||||
return 0.f;
|
||||
|
||||
@@ -5,4 +5,6 @@ import android.graphics.drawable.Drawable;
|
||||
public class ViewOverlay {
|
||||
|
||||
public void add(Drawable drawable) {}
|
||||
public void clear() {}
|
||||
public void remove(Drawable drawable) {}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,14 @@ public class ViewPropertyAnimator {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewPropertyAnimator x(float rotation) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewPropertyAnimator y(float rotation) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewPropertyAnimator rotation(float rotation) {
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user