@Immutable public final class Plugin extends Object implements Parcelable
ACTION_EDIT_CONDITION
or ACTION_EDIT_SETTING
, along with a
BroadcastReceiver for
ACTION_QUERY_CONDITION
or
ACTION_FIRE_SETTING
.
Note: This class does not validate the plug-in it represents. It is the caller's responsibility to provide valid names during construction, and the caller's responsibility to handle plug-ins that become invalid. This lack of validation is an intentional design decision because packages on Android can be installed, uninstalled, or changed at any time.
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<Plugin> |
CREATOR
Implements the
Parcelable interface |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
Plugin(PluginType type,
String packageName,
String activityClassName,
String receiverClassName,
int versionCode,
PluginConfiguration configuration)
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
describeContents() |
boolean |
equals(Object o) |
static String |
generateRegistryName(String packageName,
String activityName)
Generates the registry name using the plug-in's Android package and
Activity class. |
String |
getActivityClassName() |
Drawable |
getActivityIcon(Context context)
Retrieves a human-viewable version of the plug-in's icon that would be
appropriate to display to a user in a UI.
|
String |
getActivityLabel(Context context)
Retrieves a human-readable version of the Plugin's name that would be
appropriate to display to a user in a UI.
|
PluginConfiguration |
getConfiguration() |
String |
getPackageName() |
String |
getReceiverClassName() |
String |
getRegistryName() |
PluginType |
getType() |
int |
getVersionCode() |
int |
hashCode() |
String |
toString() |
void |
writeToParcel(Parcel dest,
int flags) |
public static final Parcelable.Creator<Plugin> CREATOR
Parcelable
interfacepublic Plugin(PluginType type, String packageName, String activityClassName, String receiverClassName, int versionCode, PluginConfiguration configuration)
type
- the type of the plug-in.packageName
- the package name of the plug-in.activityClassName
- the class name of the plug-in's edit
Activity
.receiverClassName
- The class name of the plug-in's
BroadcastReceiver
.versionCode
- The versionCode of the plug-in's package.configuration
- Configuration for the plug-in.public final PluginType getType()
public final String getRegistryName()
generateRegistryName(String, String)
.public final String getPackageName()
public final String getActivityClassName()
public final String getReceiverClassName()
public final int getVersionCode()
public final PluginConfiguration getConfiguration()
@Slow(value=MILLISECONDS) public final String getActivityLabel(Context context)
The results of this method may change after a configuration change (e.g. the system's locale is changed).
context
- Application context.public final Drawable getActivityIcon(Context context)
The results of this method may change after a configuration change (e.g. the system's locale is changed).
This method will scale the size of the icon if the dimension resource com_twofortyfouram_locale_sdk_host_plugin_icon_size exists.
context
- Application context.public static String generateRegistryName(String packageName, String activityName)
Activity
class.
By definition, all instances of a specific plug-in have the same registry
name. This requires that the Android package name and Activity
class name of a plug-in be consistent across updates.
packageName
- String
representing the component's Android
package name.activityName
- String
representing the component's
Activity
name.String
representing the registry name.public int describeContents()
describeContents
in interface Parcelable
public void writeToParcel(Parcel dest, int flags)
writeToParcel
in interface Parcelable