cmsdk: Change how parts are launched
* Encode the part into the action and use an explicit intent instead of relying on extras. Change-Id: I4f035d6b839e9701e20a9b78dbe2a39757aad13e
This commit is contained in:
@@ -23,7 +23,6 @@ import android.util.AttributeSet;
|
||||
|
||||
import cyanogenmod.preference.SelfRemovingPreference;
|
||||
|
||||
import static org.cyanogenmod.internal.cmparts.PartsList.ACTION_PART;
|
||||
import static org.cyanogenmod.internal.cmparts.PartsList.ACTION_PART_CHANGED;
|
||||
import static org.cyanogenmod.internal.cmparts.PartsList.EXTRA_PART;
|
||||
import static org.cyanogenmod.internal.cmparts.PartsList.EXTRA_PART_KEY;
|
||||
@@ -46,9 +45,7 @@ public class CMPartsPreference extends SelfRemovingPreference {
|
||||
setAvailable(false);
|
||||
}
|
||||
|
||||
Intent i = new Intent(ACTION_PART);
|
||||
i.putExtra(EXTRA_PART_KEY, mPart.getName());
|
||||
setIntent(i);
|
||||
setIntent(mPart.getIntentForActivity());
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.cyanogenmod.internal.cmparts;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
@@ -127,6 +129,18 @@ public class PartInfo implements Parcelable {
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return PartsList.PARTS_ACTION_PREFIX + "." + mName;
|
||||
}
|
||||
|
||||
public Intent getIntentForActivity() {
|
||||
Intent i = new Intent(getAction());
|
||||
ComponentName cn = new ComponentName(PartsList.CMPARTS_PACKAGE,
|
||||
PartsList.CMPARTS_PACKAGE + ".PartsActivity");
|
||||
i.setComponent(cn);
|
||||
return i;
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<PartInfo> CREATOR =
|
||||
new Parcelable.Creator<PartInfo>() {
|
||||
@Override
|
||||
|
||||
@@ -44,13 +44,13 @@ import static com.android.internal.R.styleable.Preference_title;
|
||||
|
||||
public class PartsList {
|
||||
|
||||
public static final String ACTION_PART = "org.cyanogenmod.cmparts.PART";
|
||||
public static final String ACTION_PART_CHANGED = "org.cyanogenmod.cmparts.PART_CHANGED";
|
||||
|
||||
public static final String EXTRA_PART = "part";
|
||||
public static final String EXTRA_PART_KEY = "key";
|
||||
|
||||
public static final String CMPARTS_PACKAGE = "org.cyanogenmod.cmparts";
|
||||
public static final String PARTS_ACTION_PREFIX = CMPARTS_PACKAGE + ".parts";
|
||||
|
||||
private static final Map<String, PartInfo> sParts = new ArrayMap<String, PartInfo>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user