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 for WhatsApp
This commit is contained in:
@@ -48,4 +48,8 @@ public class Animator {
|
||||
|
||||
public void end() {}
|
||||
|
||||
public TimeInterpolator getInterpolator() { return null; }
|
||||
|
||||
public boolean isRunning() { return false; }
|
||||
|
||||
}
|
||||
|
||||
@@ -5,4 +5,8 @@ public class LayoutTransition {
|
||||
public void enableTransitionType(int transitionType) {}
|
||||
|
||||
public void setStartDelay(int transitionType, long startDelay) {}
|
||||
|
||||
public void setAnimator(int transitionType, Animator animator) {}
|
||||
|
||||
public void setDuration(long duration) {}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,8 @@ public class ObjectAnimator extends ValueAnimator {
|
||||
|
||||
public void setPropertyName(String propertyName) {}
|
||||
|
||||
public static ObjectAnimator ofPropertyValuesHolder(Object target, PropertyValuesHolder... values) {
|
||||
return new ObjectAnimator();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -73,6 +73,8 @@ public class ValueAnimator extends Animator {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public void setObjectValues(Object[] values) {}
|
||||
|
||||
/**
|
||||
* Implementors of this interface can add themselves as update listeners
|
||||
* to an <code>ValueAnimator</code> instance to receive callbacks on every animation
|
||||
|
||||
@@ -587,4 +587,12 @@ public class Activity extends ContextThemeWrapper implements Window.Callback, La
|
||||
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean onSearchRequested() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public View getCurrentFocus() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,4 +84,6 @@ public class ActivityManager {
|
||||
public List<ApplicationExitInfo> getHistoricalProcessExitReasons(String pkgname, int pid, int maxNum) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public static boolean isUserAMonkey() {return false;}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
@@ -174,4 +175,8 @@ public class Dialog implements Window.Callback, DialogInterface {
|
||||
}
|
||||
|
||||
public void setCancelMessage(Message msg) {}
|
||||
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,12 @@ public final class SigningInfo {
|
||||
public Signature[] getApkContentsSigners() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasMultipleSigners() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Signature[] getSigningCertificateHistory() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,12 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
|
||||
* @return The value of the field as a string.
|
||||
*/
|
||||
public String getString(int row, int column) {
|
||||
return String.valueOf(rows.get(row - startPos)[column]);
|
||||
Object value = rows.get(row - startPos)[column];
|
||||
if (value == null) {
|
||||
return null;
|
||||
} else {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
332
src/api-impl/android/database/MatrixCursor.java
Normal file
332
src/api-impl/android/database/MatrixCursor.java
Normal file
@@ -0,0 +1,332 @@
|
||||
/*
|
||||
* Copyright (C) 2007 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.database;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* A mutable cursor implementation backed by an array of {@code Object}s. Use
|
||||
* {@link #newRow()} to add rows. Automatically expands internal capacity
|
||||
* as needed.
|
||||
*/
|
||||
public class MatrixCursor extends AbstractCursor {
|
||||
|
||||
private final String[] columnNames;
|
||||
private Object[] data;
|
||||
private int rowCount = 0;
|
||||
private final int columnCount;
|
||||
|
||||
/**
|
||||
* Constructs a new cursor with the given initial capacity.
|
||||
*
|
||||
* @param columnNames names of the columns, the ordering of which
|
||||
* determines column ordering elsewhere in this cursor
|
||||
* @param initialCapacity in rows
|
||||
*/
|
||||
public MatrixCursor(String[] columnNames, int initialCapacity) {
|
||||
this.columnNames = columnNames;
|
||||
this.columnCount = columnNames.length;
|
||||
|
||||
if (initialCapacity < 1) {
|
||||
initialCapacity = 1;
|
||||
}
|
||||
|
||||
this.data = new Object[columnCount * initialCapacity];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new cursor.
|
||||
*
|
||||
* @param columnNames names of the columns, the ordering of which
|
||||
* determines column ordering elsewhere in this cursor
|
||||
*/
|
||||
public MatrixCursor(String[] columnNames) {
|
||||
this(columnNames, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets value at the given column for the current row.
|
||||
*/
|
||||
private Object get(int column) {
|
||||
if (column < 0 || column >= columnCount) {
|
||||
throw new IndexOutOfBoundsException("Requested column: " + column + ", # of columns: " + columnCount);
|
||||
}
|
||||
if (mPos < 0) {
|
||||
throw new IndexOutOfBoundsException("Before first row.");
|
||||
}
|
||||
if (mPos >= rowCount) {
|
||||
throw new IndexOutOfBoundsException("After last row.");
|
||||
}
|
||||
return data[mPos * columnCount + column];
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new row to the end and returns a builder for that row. Not safe
|
||||
* for concurrent use.
|
||||
*
|
||||
* @return builder which can be used to set the column values for the new
|
||||
* row
|
||||
*/
|
||||
public RowBuilder newRow() {
|
||||
final int row = rowCount++;
|
||||
final int endIndex = rowCount * columnCount;
|
||||
ensureCapacity(endIndex);
|
||||
return new RowBuilder(row);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new row to the end with the given column values. Not safe
|
||||
* for concurrent use.
|
||||
*
|
||||
* @throws IllegalArgumentException if {@code columnValues.length !=
|
||||
* columnNames.length}
|
||||
* @param columnValues in the same order as the the column names specified
|
||||
* at cursor construction time
|
||||
*/
|
||||
public void addRow(Object[] columnValues) {
|
||||
if (columnValues.length != columnCount) {
|
||||
throw new IllegalArgumentException("columnNames.length = " + columnCount + ", columnValues.length = " + columnValues.length);
|
||||
}
|
||||
|
||||
int start = rowCount++ * columnCount;
|
||||
ensureCapacity(start + columnCount);
|
||||
System.arraycopy(columnValues, 0, data, start, columnCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new row to the end with the given column values. Not safe
|
||||
* for concurrent use.
|
||||
*
|
||||
* @throws IllegalArgumentException if {@code columnValues.size() !=
|
||||
* columnNames.length}
|
||||
* @param columnValues in the same order as the the column names specified
|
||||
* at cursor construction time
|
||||
*/
|
||||
public void addRow(Iterable<?> columnValues) {
|
||||
int start = rowCount * columnCount;
|
||||
int end = start + columnCount;
|
||||
ensureCapacity(end);
|
||||
|
||||
if (columnValues instanceof ArrayList<?>) {
|
||||
addRow((ArrayList<?>)columnValues, start);
|
||||
return;
|
||||
}
|
||||
|
||||
int current = start;
|
||||
Object[] localData = data;
|
||||
for (Object columnValue : columnValues) {
|
||||
if (current == end) {
|
||||
// TODO: null out row?
|
||||
throw new IllegalArgumentException(
|
||||
"columnValues.size() > columnNames.length");
|
||||
}
|
||||
localData[current++] = columnValue;
|
||||
}
|
||||
|
||||
if (current != end) {
|
||||
// TODO: null out row?
|
||||
throw new IllegalArgumentException(
|
||||
"columnValues.size() < columnNames.length");
|
||||
}
|
||||
|
||||
// Increase row count here in case we encounter an exception.
|
||||
rowCount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optimization for {@link ArrayList}.
|
||||
*/
|
||||
private void addRow(ArrayList<?> columnValues, int start) {
|
||||
int size = columnValues.size();
|
||||
if (size != columnCount) {
|
||||
throw new IllegalArgumentException("columnNames.length = " + columnCount + ", columnValues.size() = " + size);
|
||||
}
|
||||
|
||||
rowCount++;
|
||||
Object[] localData = data;
|
||||
for (int i = 0; i < size; i++) {
|
||||
localData[start + i] = columnValues.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that this cursor has enough capacity.
|
||||
*/
|
||||
private void ensureCapacity(int size) {
|
||||
if (size > data.length) {
|
||||
Object[] oldData = this.data;
|
||||
int newSize = data.length * 2;
|
||||
if (newSize < size) {
|
||||
newSize = size;
|
||||
}
|
||||
this.data = new Object[newSize];
|
||||
System.arraycopy(oldData, 0, this.data, 0, oldData.length);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a row of values using either of these approaches:
|
||||
* <ul>
|
||||
* <li>Values can be added with explicit column ordering using
|
||||
* {@link #add(Object)}, which starts from the left-most column and adds one
|
||||
* column value at a time. This follows the same ordering as the column
|
||||
* names specified at cursor construction time.
|
||||
* <li>Column and value pairs can be offered for possible inclusion using
|
||||
* {@link #add(String, Object)}. If the cursor includes the given column,
|
||||
* the value will be set for that column, otherwise the value is ignored.
|
||||
* This approach is useful when matching data to a custom projection.
|
||||
* </ul>
|
||||
* Undefined values are left as {@code null}.
|
||||
*/
|
||||
public class RowBuilder {
|
||||
private final int row;
|
||||
private final int endIndex;
|
||||
|
||||
private int index;
|
||||
|
||||
RowBuilder(int row) {
|
||||
this.row = row;
|
||||
this.index = row * columnCount;
|
||||
this.endIndex = index + columnCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the next column value in this row.
|
||||
*
|
||||
* @throws CursorIndexOutOfBoundsException if you try to add too many
|
||||
* values
|
||||
* @return this builder to support chaining
|
||||
*/
|
||||
public RowBuilder add(Object columnValue) {
|
||||
if (index == endIndex) {
|
||||
throw new IndexOutOfBoundsException(
|
||||
"No more columns left.");
|
||||
}
|
||||
|
||||
data[index++] = columnValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Offer value for possible inclusion if this cursor defines the given
|
||||
* column. Columns not defined by the cursor are silently ignored.
|
||||
*
|
||||
* @return this builder to support chaining
|
||||
*/
|
||||
public RowBuilder add(String columnName, Object value) {
|
||||
for (int i = 0; i < columnNames.length; i++) {
|
||||
if (columnName.equals(columnNames[i])) {
|
||||
data[(row * columnCount) + i] = value;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public final RowBuilder add(int columnIndex, Object value) {
|
||||
data[(row * columnCount) + columnIndex] = value;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
// AbstractCursor implementation.
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getColumnNames() {
|
||||
return columnNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(int column) {
|
||||
Object value = get(column);
|
||||
if (value == null)
|
||||
return null;
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getShort(int column) {
|
||||
Object value = get(column);
|
||||
if (value == null)
|
||||
return 0;
|
||||
if (value instanceof Number)
|
||||
return ((Number)value).shortValue();
|
||||
return Short.parseShort(value.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(int column) {
|
||||
Object value = get(column);
|
||||
if (value == null)
|
||||
return 0;
|
||||
if (value instanceof Number)
|
||||
return ((Number)value).intValue();
|
||||
return Integer.parseInt(value.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLong(int column) {
|
||||
Object value = get(column);
|
||||
if (value == null)
|
||||
return 0;
|
||||
if (value instanceof Number)
|
||||
return ((Number)value).longValue();
|
||||
return Long.parseLong(value.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloat(int column) {
|
||||
Object value = get(column);
|
||||
if (value == null)
|
||||
return 0.0f;
|
||||
if (value instanceof Number)
|
||||
return ((Number)value).floatValue();
|
||||
return Float.parseFloat(value.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDouble(int column) {
|
||||
Object value = get(column);
|
||||
if (value == null)
|
||||
return 0.0d;
|
||||
if (value instanceof Number)
|
||||
return ((Number)value).doubleValue();
|
||||
return Double.parseDouble(value.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBlob(int column) {
|
||||
Object value = get(column);
|
||||
return (byte[])value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType(int column) {
|
||||
return DatabaseUtils.getTypeOfObject(get(column));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull(int column) {
|
||||
return get(column) == null;
|
||||
}
|
||||
}
|
||||
@@ -180,6 +180,10 @@ public final class Bitmap {
|
||||
buffer.position(buffer.position() + getAllocationByteCount());
|
||||
}
|
||||
|
||||
public int getByteCount() {
|
||||
return getAllocationByteCount();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
|
||||
@@ -6,7 +6,11 @@ public class Canvas {
|
||||
private Bitmap bitmap;
|
||||
private GskCanvas gsk_canvas;
|
||||
|
||||
public Canvas() {}
|
||||
public Canvas() {
|
||||
if (!(this instanceof GskCanvas)) {
|
||||
gsk_canvas = new GskCanvas(0);
|
||||
}
|
||||
}
|
||||
|
||||
public Canvas(Bitmap bmp) {
|
||||
this.bitmap = bmp;
|
||||
@@ -462,4 +466,6 @@ public class Canvas {
|
||||
outRect.set(0, 0, 100, 100);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void drawPaint(Paint paint) {}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,10 @@ public class Path {
|
||||
|
||||
public void arcTo(RectF oval, float startAngle, float sweepAngle, boolean forceMoveTo) {}
|
||||
|
||||
public void arcTo(RectF oval, float startAngle, float sweepAngle) {}
|
||||
|
||||
public void arcTo(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean forceMoveTo) {}
|
||||
|
||||
public void rMoveTo(float x, float y) {
|
||||
native_rel_move_to(getBuilder(), x, y);
|
||||
}
|
||||
@@ -118,6 +122,10 @@ public class Path {
|
||||
addPath(path, matrix);
|
||||
}
|
||||
|
||||
public void addPath(Path path) {
|
||||
addPath(path, Matrix.IDENTITY_MATRIX);
|
||||
}
|
||||
|
||||
public void addRect(RectF rect, Direction direction) {
|
||||
native_add_rect(getBuilder(), rect.left, rect.top, rect.right, rect.bottom);
|
||||
}
|
||||
@@ -138,6 +146,8 @@ public class Path {
|
||||
|
||||
public void addOval(RectF rect, Direction direction) {}
|
||||
|
||||
public void addCircle(float x, float y, float radius, Direction direction) {}
|
||||
|
||||
public void transform(Matrix matrix) {
|
||||
builder = native_transform(getGskPath(), matrix.ni());
|
||||
path = 0;
|
||||
|
||||
@@ -338,4 +338,12 @@ public class TextUtils {
|
||||
public static String htmlEncode(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
public static CharSequence concat(CharSequence[] array) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (CharSequence cs : array) {
|
||||
sb.append(cs);
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
|
||||
14
src/api-impl/android/transition/Transition.java
Normal file
14
src/api-impl/android/transition/Transition.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package android.transition;
|
||||
|
||||
public class Transition {
|
||||
|
||||
public interface TransitionListener {}
|
||||
|
||||
public Transition clone() {
|
||||
return new Transition();
|
||||
}
|
||||
|
||||
public Transition addListener(TransitionListener listener) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import android.graphics.Rect;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
@@ -2112,4 +2113,10 @@ public class View implements Drawable.Callback {
|
||||
public float getTransitionAlpha() {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public void onWindowFocusChanged(boolean hasFocus) {}
|
||||
|
||||
public void setAnimation(Animation animation) {}
|
||||
|
||||
public boolean performAccessibilityAction(int action, Bundle arguments) { return false; }
|
||||
}
|
||||
|
||||
@@ -422,6 +422,8 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
||||
// FIXME
|
||||
}
|
||||
|
||||
public boolean getClipToPadding() { return false; }
|
||||
|
||||
public static class LayoutParams {
|
||||
public static final int FILL_PARENT = -1;
|
||||
public static final int MATCH_PARENT = -1;
|
||||
|
||||
@@ -2,6 +2,7 @@ package android.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.transition.Transition;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
@@ -135,4 +136,22 @@ public class Window {
|
||||
public void setTitle(CharSequence title) {
|
||||
set_title(native_window, title != null ? title.toString() : context.getPackageName());
|
||||
}
|
||||
|
||||
public Transition getSharedElementEnterTransition() {
|
||||
return new Transition();
|
||||
}
|
||||
|
||||
public void setSharedElementExitTransition(Transition transition) {}
|
||||
|
||||
public void setSharedElementReenterTransition(Transition transition) {}
|
||||
|
||||
public void setSharedElementReturnTransition(Transition transition) {}
|
||||
|
||||
public Transition getSharedElementExitTransition() {
|
||||
return new Transition();
|
||||
}
|
||||
|
||||
public Transition getSharedElementReenterTransition() {
|
||||
return new Transition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,6 @@ public class Animation {
|
||||
public void setRepeatCount(int count) {}
|
||||
|
||||
public void reset() {}
|
||||
|
||||
public void start() {}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,6 @@ public class EditText extends TextView {
|
||||
|
||||
@Override
|
||||
public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {}
|
||||
|
||||
public void selectAll() {}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user