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: add misc stuff needed by Teeter
note that Teeter still needs more stuff before it will work
This commit is contained in:
@@ -233,4 +233,8 @@ public class Activity extends Context {
|
||||
System.out.println("startActivityForResult(" + intent + ", " + requestCode + ") called, but we don't currently support multiple activities");
|
||||
onActivityResult(requestCode, 0 /*RESULT_CANCELED*/, new Intent()); // RESULT_CANCELED is the only pre-defined return value, so hopefully it works out for us
|
||||
}
|
||||
|
||||
public final void showDialog(int id) {
|
||||
System.out.println("Activity.showDialog(" + id + ") called");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,12 @@ public class AlertDialog extends Dialog {
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setPositiveButton(int textId, DialogInterface.OnClickListener listener) {
|
||||
System.out.println("AlertDialog.Builder setPositiveButton called with textId: '" + textId + "'");
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setPositiveButton(CharSequence text, DialogInterface.OnClickListener listener) {
|
||||
System.out.println("AlertDialog.Builder setPositiveButton called with text: '" + text + "'");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import android.content.res.AssetManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.hardware.input.InputManager;
|
||||
import android.hardware.SensorManager;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.hardware.usb.UsbManager;
|
||||
@@ -128,6 +129,8 @@ public class Context extends Object {
|
||||
return new NotificationManager();
|
||||
case "alarm":
|
||||
return new AlarmManager();
|
||||
case "input":
|
||||
return new InputManager();
|
||||
default:
|
||||
System.out.println("!!!!!!! getSystemService: case >" + name + "< is not implemented yet");
|
||||
return null;
|
||||
|
||||
@@ -79,6 +79,7 @@ public class PackageItemInfo {
|
||||
public Bundle metaData;
|
||||
|
||||
public PackageItemInfo() {
|
||||
metaData = new Bundle();
|
||||
}
|
||||
|
||||
public PackageItemInfo(PackageItemInfo orig) {
|
||||
|
||||
@@ -1328,7 +1328,9 @@ public final class Bitmap {
|
||||
public void eraseColor(int c) {
|
||||
checkRecycled("Can't erase a recycled bitmap");
|
||||
if (!isMutable()) {
|
||||
throw new IllegalStateException("cannot erase immutable bitmaps");
|
||||
// throw new IllegalStateException("cannot erase immutable bitmaps");
|
||||
System.out.println("cannot erase immutable bitmaps");
|
||||
return;
|
||||
}
|
||||
nativeErase(mNativeBitmap, c);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ public class Canvas {
|
||||
|
||||
public Canvas() {}
|
||||
|
||||
public Canvas(Bitmap bmp) {}
|
||||
|
||||
public Canvas(long cairo_context, long widget) {
|
||||
this.cairo_context = cairo_context;
|
||||
this.widget = widget;
|
||||
|
||||
96
src/api-impl/android/graphics/Point.java
Normal file
96
src/api-impl/android/graphics/Point.java
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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.graphics;
|
||||
|
||||
import android.os.Parcelable;
|
||||
|
||||
|
||||
/**
|
||||
* Point holds two integer coordinates
|
||||
*/
|
||||
public class Point implements Parcelable {
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
public Point() {}
|
||||
|
||||
public Point(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Point(Point src) {
|
||||
this.x = src.x;
|
||||
this.y = src.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the point's x and y coordinates
|
||||
*/
|
||||
public void set(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Negate the point's coordinates
|
||||
*/
|
||||
public final void negate() {
|
||||
x = -x;
|
||||
y = -y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset the point's coordinates by dx, dy
|
||||
*/
|
||||
public final void offset(int dx, int dy) {
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the point's coordinates equal (x,y)
|
||||
*/
|
||||
public final boolean equals(int x, int y) {
|
||||
return this.x == x && this.y == y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Point point = (Point) o;
|
||||
|
||||
if (x != point.x) return false;
|
||||
if (y != point.y) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = x;
|
||||
result = 31 * result + y;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Point(" + x + ", " + y + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
public class AnimationDrawable {
|
||||
public void addFrame(Drawable drawable, int dummy) {}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
public class BitmapDrawable extends Drawable {
|
||||
public BitmapDrawable(Resources res, Bitmap bitmap) {}
|
||||
}
|
||||
5
src/api-impl/android/graphics/drawable/Drawable.java
Normal file
5
src/api-impl/android/graphics/drawable/Drawable.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
public class Drawable {
|
||||
|
||||
}
|
||||
14
src/api-impl/android/hardware/input/InputManager.java
Normal file
14
src/api-impl/android/hardware/input/InputManager.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package android.hardware.input;
|
||||
|
||||
import android.os.Handler;
|
||||
|
||||
public class InputManager {
|
||||
public static interface InputDeviceListener {
|
||||
abstract void onInputDeviceAdded(int deviceId);
|
||||
abstract void onInputDeviceChanged(int deviceId);
|
||||
abstract void onInputDeviceRemoved(int deviceId);
|
||||
}
|
||||
|
||||
public void registerInputDeviceListener(InputManager.InputDeviceListener listener, Handler handler) {
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package android.media;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class MediaPlayer {
|
||||
public interface OnCompletionListener {
|
||||
}
|
||||
@@ -17,4 +19,6 @@ public class MediaPlayer {
|
||||
}
|
||||
public interface MediaPlayerControl {
|
||||
}
|
||||
|
||||
public static MediaPlayer create(Context context, int dummy) { return new MediaPlayer(); }
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.util;
|
||||
|
||||
import android.view.Display;
|
||||
|
||||
/**
|
||||
* A structure describing general information about a display, such as its
|
||||
* size, density, and font scaling.
|
||||
@@ -219,8 +221,8 @@ public class DisplayMetrics {
|
||||
}
|
||||
|
||||
public void setToDefaults() {
|
||||
widthPixels = 0;
|
||||
heightPixels = 0;
|
||||
widthPixels = Display.window_width;
|
||||
heightPixels = Display.window_height;
|
||||
density = DENSITY_DEVICE / (float)DENSITY_DEFAULT;
|
||||
densityDpi = DENSITY_DEVICE;
|
||||
scaledDensity = density;
|
||||
|
||||
5
src/api-impl/android/view/animation/Animation.java
Normal file
5
src/api-impl/android/view/animation/Animation.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package android.view.animation;
|
||||
|
||||
public class Animation {
|
||||
|
||||
}
|
||||
7
src/api-impl/android/view/animation/AnimationUtils.java
Normal file
7
src/api-impl/android/view/animation/AnimationUtils.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package android.view.animation;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class AnimationUtils {
|
||||
public static Animation loadAnimation(Context context, int dummy) { return new Animation(); }
|
||||
}
|
||||
10
src/api-impl/com/htc/util/htcresutil/resutil.java
Normal file
10
src/api-impl/com/htc/util/htcresutil/resutil.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.htc.util.htcresutil;
|
||||
|
||||
/*
|
||||
* This file only exists so that HTC-exclusive apps think they are running on an HTC device.
|
||||
* At least teeter checks for this class in order to determine if it should refuse to launch.
|
||||
*/
|
||||
|
||||
public class resutil {
|
||||
|
||||
}
|
||||
@@ -85,6 +85,7 @@ hax_jar = jar('hax', [
|
||||
'android/graphics/Matrix.java',
|
||||
'android/graphics/Paint.java',
|
||||
'android/graphics/Path.java',
|
||||
'android/graphics/Point.java',
|
||||
'android/graphics/PorterDuff.java',
|
||||
'android/graphics/PorterDuffXfermode.java',
|
||||
'android/graphics/RectF.java',
|
||||
@@ -92,7 +93,11 @@ hax_jar = jar('hax', [
|
||||
'android/graphics/Region.java',
|
||||
'android/graphics/Typeface.java',
|
||||
'android/graphics/Xfermode.java',
|
||||
'android/graphics/drawable/AnimationDrawable.java',
|
||||
'android/graphics/drawable/BitmapDrawable.java',
|
||||
'android/graphics/drawable/Drawable.java',
|
||||
'android/hardware/display/DisplayManager.java',
|
||||
'android/hardware/input/InputManager.java',
|
||||
'android/hardware/SensorEventListener.java',
|
||||
'android/hardware/Sensor.java',
|
||||
'android/hardware/SensorManager.java',
|
||||
@@ -208,6 +213,8 @@ hax_jar = jar('hax', [
|
||||
'android/view/Window.java',
|
||||
'android/view/WindowManagerImpl.java',
|
||||
'android/view/WindowManager.java',
|
||||
'android/view/animation/Animation.java',
|
||||
'android/view/animation/AnimationUtils.java',
|
||||
'android/webkit/DownloadListener.java',
|
||||
'android/webkit/WebSettings.java',
|
||||
'android/webkit/WebView.java',
|
||||
@@ -231,6 +238,7 @@ hax_jar = jar('hax', [
|
||||
'com/google/android/vending/licensing/LicenseCheckerCallback.java',
|
||||
'com/google/android/vending/licensing/LicenseChecker.java',
|
||||
'com/google/android/vending/licensing/Policy.java',
|
||||
'com/htc/util/htcresutil/resutil.java',
|
||||
'javax/microedition/khronos/egl/EGL10.java',
|
||||
'javax/microedition/khronos/egl/EGL11.java',
|
||||
'javax/microedition/khronos/egl/EGLConfig.java',
|
||||
|
||||
Reference in New Issue
Block a user