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
implement more APIs
This commit is contained in:
@@ -3,7 +3,9 @@ package android.content;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import android.database.AbstractCursor;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
|
||||
@@ -23,4 +25,18 @@ public class ContentResolver {
|
||||
public ParcelFileDescriptor openFileDescriptor(Uri uri, String mode) throws FileNotFoundException {
|
||||
return ParcelFileDescriptor.open(new File(uri.uri), ParcelFileDescriptor.parseMode(mode));
|
||||
}
|
||||
|
||||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
||||
return new AbstractCursor() {
|
||||
public int getCount() { return 0; }
|
||||
public String[] getColumnNames() { return new String[0]; }
|
||||
public String getString(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public short getShort(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public int getInt(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public long getLong(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public float getFloat(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public double getDouble(int column) { throw new IndexOutOfBoundsException(); }
|
||||
public boolean isNull(int column) { throw new IndexOutOfBoundsException(); }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,7 +419,11 @@ public class Context extends Object {
|
||||
if (intent.getComponent() == null) {
|
||||
if(intent.getAction() != null && intent.getAction().equals("android.intent.action.SEND")) {
|
||||
Slog.i(TAG, "starting extern activity with intent: " + intent);
|
||||
ClipboardManager.native_set_clipboard(intent.getStringExtra("android.intent.extra.TEXT"));
|
||||
String text = intent.getStringExtra("android.intent.extra.TEXT");
|
||||
if (text == null)
|
||||
text = String.valueOf(intent.getExtras().get("android.intent.extra.STREAM"));
|
||||
if (text != null)
|
||||
ClipboardManager.native_set_clipboard(text);
|
||||
} else if (intent.getData() != null) {
|
||||
Slog.i(TAG, "starting extern activity with intent: " + intent);
|
||||
Activity.nativeOpenURI(String.valueOf(intent.getData()));
|
||||
|
||||
@@ -294,4 +294,9 @@ public class Intent {
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Intent setData(Uri uri) {
|
||||
this.data = uri;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,4 +156,36 @@ public class BaseBundle {
|
||||
public int size() {
|
||||
return mMap.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or defaultValue if
|
||||
* no mapping of the desired type exists for the given key.
|
||||
*
|
||||
* @param key a String
|
||||
* @param defaultValue Value to return if key does not exist
|
||||
* @return an int value
|
||||
*/
|
||||
public int getInt(String key, int defaultValue) {
|
||||
Object o = mMap.get(key);
|
||||
if (o == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
return (Integer)o;
|
||||
} catch (ClassCastException e) {
|
||||
typeWarning(key, o, "Integer", defaultValue, e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or 0 if
|
||||
* no mapping of the desired type exists for the given key.
|
||||
*
|
||||
* @param key a String
|
||||
* @return an int value
|
||||
*/
|
||||
public int getInt(String key) {
|
||||
return getInt(key, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,6 @@ package android.os;
|
||||
public class Binder extends IBinder {
|
||||
|
||||
public void attachInterface(IInterface owner, String descriptor) {}
|
||||
|
||||
public static void flushPendingCommands() {}
|
||||
}
|
||||
|
||||
@@ -752,38 +752,6 @@ public final class Bundle extends BaseBundle implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or 0 if
|
||||
* no mapping of the desired type exists for the given key.
|
||||
*
|
||||
* @param key a String
|
||||
* @return an int value
|
||||
*/
|
||||
public int getInt(String key) {
|
||||
return getInt(key, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or defaultValue if
|
||||
* no mapping of the desired type exists for the given key.
|
||||
*
|
||||
* @param key a String
|
||||
* @param defaultValue Value to return if key does not exist
|
||||
* @return an int value
|
||||
*/
|
||||
public int getInt(String key, int defaultValue) {
|
||||
Object o = mMap.get(key);
|
||||
if (o == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
return (Integer)o;
|
||||
} catch (ClassCastException e) {
|
||||
typeWarning(key, o, "Integer", defaultValue, e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or 0L if
|
||||
* no mapping of the desired type exists for the given key.
|
||||
|
||||
11
src/api-impl/android/os/FileObserver.java
Normal file
11
src/api-impl/android/os/FileObserver.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package android.os;
|
||||
|
||||
public class FileObserver {
|
||||
|
||||
public FileObserver(String path, int mask) {}
|
||||
|
||||
public void startWatching() {}
|
||||
|
||||
public void stopWatching() {}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package android.text.method;
|
||||
|
||||
public class LinkMovementMethod extends MovementMethod {
|
||||
|
||||
public static MovementMethod getInstance() {
|
||||
return new LinkMovementMethod();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
7
src/api-impl/android/text/style/StyleSpan.java
Normal file
7
src/api-impl/android/text/style/StyleSpan.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package android.text.style;
|
||||
|
||||
public class StyleSpan {
|
||||
|
||||
public StyleSpan(int style) {}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
package android.text.style;
|
||||
|
||||
public class URLSpan {
|
||||
|
||||
public URLSpan(String url) {}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,11 @@ import android.text.Spannable;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class Linkify {
|
||||
|
||||
public static MatchFilter sUrlMatchFilter = null;
|
||||
|
||||
public static final boolean addLinks(Spannable text, int mask) { return true; }
|
||||
public static final boolean addLinks(TextView text, int mask) { return true; }
|
||||
|
||||
public class MatchFilter {}
|
||||
}
|
||||
|
||||
@@ -1661,4 +1661,8 @@ public class View extends Object {
|
||||
public boolean hasOnClickListeners() {return false;}
|
||||
|
||||
public void setTextAlignment(int textAlignment) {}
|
||||
|
||||
public void setHapticFeedbackEnabled(boolean hapticFeedbackEnabled) {}
|
||||
|
||||
public StateListAnimator getStateListAnimator() {return null;}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public class EditText extends TextView {
|
||||
protected native String native_getText(long widget);
|
||||
protected native void native_addTextChangedListener(long widget, TextWatcher watcher);
|
||||
protected native void native_setOnEditorActionListener(long widget, OnEditorActionListener l);
|
||||
protected native void native_setText(long widget, String text);
|
||||
|
||||
public Editable getText() {
|
||||
return new SpannableStringBuilder(native_getText(widget));
|
||||
@@ -30,7 +31,9 @@ public class EditText extends TextView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(CharSequence text) {}
|
||||
public void setText(CharSequence text) {
|
||||
native_setText(widget, String.valueOf(text));
|
||||
}
|
||||
@Override
|
||||
public void setTextSize(float size) {}
|
||||
|
||||
|
||||
@@ -231,4 +231,6 @@ public class TextView extends View {
|
||||
public float getLetterSpacing() {return 0.f;}
|
||||
|
||||
public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, int end, int bottom) {}
|
||||
|
||||
public boolean getLinksClickable() {return true;}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user