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: misc stubs and fixes for Spotify
This commit is contained in:
@@ -7,6 +7,7 @@ import android.util.Log;
|
||||
|
||||
public class BaseBundle {
|
||||
protected static final String TAG = "Bundle";
|
||||
static final boolean DEBUG = false;
|
||||
|
||||
// Invariant - exactly one of mMap / mParcelledData will be null
|
||||
// (except inside a call to unparcel)
|
||||
@@ -198,6 +199,57 @@ public class BaseBundle {
|
||||
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 a boolean value
|
||||
*/
|
||||
public boolean getBoolean(String key, boolean defaultValue) {
|
||||
Object o = mMap.get(key);
|
||||
System.out.println("bundle.getBoolean(" + key + ", " + defaultValue + ") called");
|
||||
/* the default for this is very scummy */
|
||||
if(key.equals("com.facebook.sdk.AutoLogAppEventsEnabled")) {
|
||||
return false;
|
||||
}
|
||||
if (o == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
return (Boolean)o;
|
||||
} catch (ClassCastException e) {
|
||||
typeWarning(key, o, "Boolean", defaultValue, e);
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or false if
|
||||
* no mapping of the desired type exists for the given key.
|
||||
*
|
||||
* @param key a String
|
||||
* @return a boolean value
|
||||
*/
|
||||
public boolean getBoolean(String key) {
|
||||
if (DEBUG)
|
||||
Log.d(TAG, "Getting boolean in " + Integer.toHexString(System.identityHashCode(this)));
|
||||
return getBoolean(key, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a Boolean 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 Boolean, or null
|
||||
*/
|
||||
public void putBoolean(String key, boolean value) {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or defaultValue if
|
||||
* no mapping of the desired type exists for the given key.
|
||||
|
||||
Reference in New Issue
Block a user