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
add Java APIs needed for WhatsApp MainActivity and ConversationActivity
This commit is contained in:
@@ -62,6 +62,15 @@ public class BaseBundle {
|
||||
return mMap.containsKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes any entry with the given key from the mapping of this Bundle.
|
||||
*
|
||||
* @param key a String key
|
||||
*/
|
||||
public void remove(String key) {
|
||||
mMap.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the entry with the given key as an object.
|
||||
*
|
||||
@@ -169,6 +178,17 @@ public class BaseBundle {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a String array value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key. Either key or value may be null.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @param value a String array object, or null
|
||||
*/
|
||||
public void putStringArray(String key, String[] value) {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of mappings contained in this Bundle.
|
||||
*
|
||||
@@ -209,4 +229,25 @@ public class BaseBundle {
|
||||
public int getInt(String key) {
|
||||
return getInt(key, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or null if
|
||||
* no mapping of the desired type exists for the given key or a null
|
||||
* value is explicitly associated with the key.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @return a String[] value, or null
|
||||
*/
|
||||
public String[] getStringArray(String key) {
|
||||
Object o = mMap.get(key);
|
||||
if (o == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return (String[])o;
|
||||
} catch (ClassCastException e) {
|
||||
typeWarning(key, o, "String[]", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
* A mapping from String values to various Parcelable types.
|
||||
*
|
||||
*/
|
||||
public final class Bundle extends BaseBundle implements Cloneable {
|
||||
public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
|
||||
static final boolean DEBUG = false;
|
||||
public static final Bundle EMPTY;
|
||||
|
||||
@@ -188,15 +188,6 @@ public final class Bundle extends BaseBundle implements Cloneable {
|
||||
mFdsKnown = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes any entry with the given key from the mapping of this Bundle.
|
||||
*
|
||||
* @param key a String key
|
||||
*/
|
||||
public void remove(String key) {
|
||||
mMap.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts all mappings from the given Bundle into this Bundle.
|
||||
*
|
||||
@@ -541,17 +532,6 @@ public final class Bundle extends BaseBundle implements Cloneable {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a String array value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key. Either key or value may be null.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @param value a String array object, or null
|
||||
*/
|
||||
public void putStringArray(String key, String[] value) {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a CharSequence array value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key. Either key or value may be null.
|
||||
@@ -1196,27 +1176,6 @@ public final class Bundle extends BaseBundle implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or null if
|
||||
* no mapping of the desired type exists for the given key or a null
|
||||
* value is explicitly associated with the key.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @return a String[] value, or null
|
||||
*/
|
||||
public String[] getStringArray(String key) {
|
||||
Object o = mMap.get(key);
|
||||
if (o == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return (String[])o;
|
||||
} catch (ClassCastException e) {
|
||||
typeWarning(key, o, "String[]", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or null if
|
||||
* no mapping of the desired type exists for the given key or a null
|
||||
|
||||
@@ -15,4 +15,12 @@ public final class Debug {
|
||||
public static boolean isDebuggerConnected() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static long getNativeHeapFreeSize() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static long getNativeHeapAllocatedSize() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ public final class StrictMode {
|
||||
public Builder penaltyLog() {
|
||||
return this;
|
||||
}
|
||||
public Builder detectNetwork() {
|
||||
return this;
|
||||
}
|
||||
public ThreadPolicy build() {
|
||||
return new ThreadPolicy();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user