add Java APIs needed for WhatsApp MainActivity and ConversationActivity

This commit is contained in:
Julian Winkler
2024-08-25 11:20:01 +02:00
parent 9d8e091799
commit c492e1f03f
74 changed files with 903 additions and 69 deletions

View File

@@ -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;
}
}
}