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 additions for Oeffi
This commit is contained in:
@@ -233,3 +233,16 @@ JNIEXPORT jboolean JNICALL Java_android_graphics_Matrix_native_1preTranslate(JNI
|
|||||||
graphene_matrix_multiply(&translation, matrix, matrix);
|
graphene_matrix_multiply(&translation, matrix, matrix);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jboolean JNICALL Java_android_graphics_Matrix_native_1preRotate__JFFF(JNIEnv *env, jclass class, jlong matrix_ptr, jfloat degrees, jfloat px, jfloat py)
|
||||||
|
{
|
||||||
|
graphene_matrix_t *matrix = (graphene_matrix_t *)_PTR(matrix_ptr);
|
||||||
|
graphene_matrix_t rotation;
|
||||||
|
graphene_vec3_t rotation_axis;
|
||||||
|
graphene_vec3_init(&rotation_axis, 0, 0, 1);
|
||||||
|
graphene_matrix_init_rotate(&rotation, degrees, &rotation_axis);
|
||||||
|
graphene_matrix_translate(&rotation, &GRAPHENE_POINT3D_INIT(-px, -py, 0));
|
||||||
|
graphene_matrix_multiply(&rotation, matrix, matrix);
|
||||||
|
graphene_matrix_translate(matrix, &GRAPHENE_POINT3D_INIT(px, py, 0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 ObjectAnimator();
|
return new AnimatorSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StateListAnimator loadStateListAnimator(Context context, int resId) {
|
public static StateListAnimator loadStateListAnimator(Context context, int resId) {
|
||||||
|
|||||||
@@ -2,4 +2,7 @@ package android.animation;
|
|||||||
|
|
||||||
public class LayoutTransition {
|
public class LayoutTransition {
|
||||||
|
|
||||||
|
public void enableTransitionType(int transitionType) {}
|
||||||
|
|
||||||
|
public void setStartDelay(int transitionType, long startDelay) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -378,6 +378,10 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean showDialog(int id, Bundle args) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void removeDialog(int id) {
|
public void removeDialog(int id) {
|
||||||
Dialog dialog = dialogs.remove(id);
|
Dialog dialog = dialogs.remove(id);
|
||||||
if (dialog != null)
|
if (dialog != null)
|
||||||
@@ -388,9 +392,9 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (window != null) {
|
if (window != null && window.native_window != 0) {
|
||||||
nativeFinish(getWindow().native_window);
|
nativeFinish(getWindow().native_window);
|
||||||
window = null;
|
window.native_window = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -575,4 +579,5 @@ public class Activity extends ContextThemeWrapper implements Window.Callback {
|
|||||||
public Uri getReferrer() { return null; }
|
public Uri getReferrer() { return null; }
|
||||||
public void setDefaultKeyMode(int flag) {}
|
public void setDefaultKeyMode(int flag) {}
|
||||||
public void registerForContextMenu(View view) {}
|
public void registerForContextMenu(View view) {}
|
||||||
|
public boolean isInMultiWindowMode() { return true; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,4 +78,6 @@ public class ActivityManager {
|
|||||||
throws SecurityException {
|
throws SecurityException {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getLargeMemoryClass() {return getMemoryClass();}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ public class AlertDialog extends Dialog implements DialogInterface {
|
|||||||
dialog = new AlertDialog(context);
|
dialog = new AlertDialog(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder(Context context, int themeResId) {
|
||||||
|
dialog = new AlertDialog(context, themeResId);
|
||||||
|
}
|
||||||
|
|
||||||
public AlertDialog.Builder setPositiveButton(int textId, DialogInterface.OnClickListener listener) {
|
public AlertDialog.Builder setPositiveButton(int textId, DialogInterface.OnClickListener listener) {
|
||||||
return setPositiveButton(dialog.getContext().getText(textId), listener);
|
return setPositiveButton(dialog.getContext().getText(textId), listener);
|
||||||
}
|
}
|
||||||
@@ -92,6 +96,10 @@ public class AlertDialog extends Dialog implements DialogInterface {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AlertDialog.Builder setItems(int itemsId, final DialogInterface.OnClickListener listener) {
|
||||||
|
return setItems(dialog.getContext().getResources().getTextArray(itemsId), listener);
|
||||||
|
}
|
||||||
|
|
||||||
public Builder setOnCancelListener(OnCancelListener onCancelListener) {
|
public Builder setOnCancelListener(OnCancelListener onCancelListener) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,8 @@ public class ProgressDialog extends AlertDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setIndeterminate(boolean indeterminate) {}
|
public void setIndeterminate(boolean indeterminate) {}
|
||||||
|
|
||||||
|
public static ProgressDialog show(Context context, CharSequence title, CharSequence message, boolean indeterminate, boolean cancelable, OnCancelListener cancelListener) {
|
||||||
|
return new ProgressDialog(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,13 +31,15 @@ public abstract class ContentProvider {
|
|||||||
public boolean onCreate() {return false;}
|
public boolean onCreate() {return false;}
|
||||||
|
|
||||||
public Context getContext() {
|
public Context getContext() {
|
||||||
return new Context();
|
return Context.this_application;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder);
|
public abstract Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder);
|
||||||
|
|
||||||
public abstract Uri insert(Uri uri, ContentValues values);
|
public abstract Uri insert(Uri uri, ContentValues values);
|
||||||
|
|
||||||
|
public abstract int update(Uri uri, ContentValues values, String selection, String[] selectionArgs);
|
||||||
|
|
||||||
public abstract int delete(Uri uri, String selection, String[] selectionArgs);
|
public abstract int delete(Uri uri, String selection, String[] selectionArgs);
|
||||||
|
|
||||||
public abstract String getType(Uri uri);
|
public abstract String getType(Uri uri);
|
||||||
|
|||||||
@@ -69,4 +69,12 @@ public class ContentResolver {
|
|||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
||||||
|
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
||||||
|
if (provider != null)
|
||||||
|
return provider.update(uri, values, selection, selectionArgs);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ public class SearchRecentSuggestionsProvider extends ContentProvider {
|
|||||||
throw new UnsupportedOperationException("Unimplemented method 'insert'");
|
throw new UnsupportedOperationException("Unimplemented method 'insert'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'update'");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'delete'");
|
throw new UnsupportedOperationException("Unimplemented method 'delete'");
|
||||||
|
|||||||
@@ -402,11 +402,19 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
|
|||||||
* @return The value of the field as a <code>long</code>.
|
* @return The value of the field as a <code>long</code>.
|
||||||
*/
|
*/
|
||||||
public long getLong(int row, int column) {
|
public long getLong(int row, int column) {
|
||||||
Long field = (Long)rows.get(row - startPos)[column];
|
long result = 0L;
|
||||||
if (field == null) {
|
Object object = rows.get(row - startPos)[column];
|
||||||
return 0L;
|
if (object instanceof Long)
|
||||||
}
|
result = (Long)object;
|
||||||
return field.longValue();
|
else if (object instanceof String)
|
||||||
|
result = Long.parseLong((String) object);
|
||||||
|
else if (object instanceof Double)
|
||||||
|
result = ((Double) object).longValue();
|
||||||
|
else if (object == null)
|
||||||
|
result = 0L;
|
||||||
|
else
|
||||||
|
throw new SQLiteException("Unexpected object type for getLong: " + object.getClass().getName());
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -84,4 +84,8 @@ public class DrawableContainer extends Drawable {
|
|||||||
state.drawables[curIndex].setBounds(left, top, right, bottom);
|
state.drawables[curIndex].setBounds(left, top, right, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEnterFadeDuration(int duration) {}
|
||||||
|
|
||||||
|
public void setExitFadeDuration(int duration) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package android.location;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class LocationManager {
|
public class LocationManager {
|
||||||
@@ -36,4 +38,8 @@ public class LocationManager {
|
|||||||
|
|
||||||
public void removeUpdates(LocationListener listener) {
|
public void removeUpdates(LocationListener listener) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getAllProviders() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ public class NetworkInfo {
|
|||||||
UNKNOWN
|
UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum DetailedState {}
|
||||||
|
|
||||||
private State state = State.DISCONNECTED;
|
private State state = State.DISCONNECTED;
|
||||||
|
|
||||||
public NetworkInfo(boolean available) {
|
public NetworkInfo(boolean available) {
|
||||||
@@ -51,4 +53,16 @@ public class NetworkInfo {
|
|||||||
public boolean isAvailable () {
|
public boolean isAvailable () {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DetailedState getDetailedState() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExtraInfo() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReason() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,6 +147,8 @@ public class Build {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final int RESOURCES_SDK_INT = SDK_INT + ("REL".equals(CODENAME) ? 0 : 1);
|
public static final int RESOURCES_SDK_INT = SDK_INT + ("REL".equals(CODENAME) ? 0 : 1);
|
||||||
|
|
||||||
|
public static final String SECURITY_PATCH = getString("ro.build.version.security_patch");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
6
src/api-impl/android/preference/PreferenceActivity.java
Normal file
6
src/api-impl/android/preference/PreferenceActivity.java
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package android.preference;
|
||||||
|
|
||||||
|
import android.app.ListActivity;
|
||||||
|
|
||||||
|
public class PreferenceActivity extends ListActivity {
|
||||||
|
}
|
||||||
10
src/api-impl/android/provider/CalendarContract.java
Normal file
10
src/api-impl/android/provider/CalendarContract.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package android.provider;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
public class CalendarContract {
|
||||||
|
|
||||||
|
public static final class Events {
|
||||||
|
public static final Uri CONTENT_URI = Uri.parse("content://com.android.calendar/events");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,4 +9,11 @@ public class DateUtils {
|
|||||||
public static CharSequence getRelativeTimeSpanString(Context context, long millis, boolean withPreposition) {
|
public static CharSequence getRelativeTimeSpanString(Context context, long millis, boolean withPreposition) {
|
||||||
return new Date(millis).toString();
|
return new Date(millis).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isToday(long millis) {
|
||||||
|
Date d1 = new Date(millis);
|
||||||
|
Date d2 = new Date();
|
||||||
|
|
||||||
|
return d1.getYear() == d2.getYear() && d1.getMonth() == d2.getMonth() && d1.getDate() == d2.getDate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,4 +59,12 @@ public interface MenuItem {
|
|||||||
public MenuItem setAlphabeticShortcut(char alphaChar);
|
public MenuItem setAlphabeticShortcut(char alphaChar);
|
||||||
|
|
||||||
public MenuItem setShortcut(char numeric, char alpha);
|
public MenuItem setShortcut(char numeric, char alpha);
|
||||||
|
|
||||||
|
public int getOrder();
|
||||||
|
|
||||||
|
public boolean isEnabled();
|
||||||
|
|
||||||
|
public CharSequence getTitleCondensed();
|
||||||
|
|
||||||
|
public CharSequence getTitle();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -942,6 +942,11 @@ public class View implements Drawable.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
native_setPadding(widget, paddingLeft, paddingTop, paddingRight, paddingBottom);
|
native_setPadding(widget, paddingLeft, paddingTop, paddingRight, paddingBottom);
|
||||||
|
|
||||||
|
if (a.hasValue(com.android.internal.R.styleable.View_tag)) {
|
||||||
|
tag = a.getText(com.android.internal.R.styleable.View_tag);
|
||||||
|
}
|
||||||
|
a.recycle();
|
||||||
}
|
}
|
||||||
onCreateDrawableState(0);
|
onCreateDrawableState(0);
|
||||||
}
|
}
|
||||||
@@ -1436,7 +1441,7 @@ public class View implements Drawable.Callback {
|
|||||||
|
|
||||||
public void requestLayout() {
|
public void requestLayout() {
|
||||||
layoutRequested = true;
|
layoutRequested = true;
|
||||||
if (parent != null) {
|
if (parent != null && !parent.isLayoutRequested()) {
|
||||||
parent.requestLayout();
|
parent.requestLayout();
|
||||||
}
|
}
|
||||||
native_requestLayout(widget);
|
native_requestLayout(widget);
|
||||||
@@ -1949,4 +1954,6 @@ public class View implements Drawable.Callback {
|
|||||||
public void setImportantForAutofill(int flag) {}
|
public void setImportantForAutofill(int flag) {}
|
||||||
|
|
||||||
public void setDefaultFocusHighlightEnabled(boolean enabled) {}
|
public void setDefaultFocusHighlightEnabled(boolean enabled) {}
|
||||||
|
|
||||||
|
public void setHorizontalFadingEdgeEnabled(boolean horizontalFadingEdgeEnabled) {}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user