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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user