Supporting EXTRA_APPWIDGET_OPTIONS correctly
This commit is contained in:
@@ -84,6 +84,7 @@ public class KeyguardAppWidgetPickActivity extends Activity
|
|||||||
private Intent mResultData;
|
private Intent mResultData;
|
||||||
private LockPatternUtils mLockPatternUtils;
|
private LockPatternUtils mLockPatternUtils;
|
||||||
private boolean mSuccess;
|
private boolean mSuccess;
|
||||||
|
private Bundle mExtraConfigureOptions;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -101,6 +102,7 @@ public class KeyguardAppWidgetPickActivity extends Activity
|
|||||||
} else {
|
} else {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
mExtraConfigureOptions = intent.getBundleExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS);
|
||||||
|
|
||||||
mGridView = (GridView) findViewById(R.id.widget_list);
|
mGridView = (GridView) findViewById(R.id.widget_list);
|
||||||
mAppWidgetManager = AppWidgetManager.getInstance(this);
|
mAppWidgetManager = AppWidgetManager.getInstance(this);
|
||||||
@@ -466,12 +468,8 @@ public class KeyguardAppWidgetPickActivity extends Activity
|
|||||||
setResultData(result, intent);
|
setResultData(result, intent);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
Bundle options = null;
|
mAppWidgetManager.bindAppWidgetId(
|
||||||
if (intent.getExtras() != null) {
|
mAppWidgetId, intent.getComponent(), mExtraConfigureOptions);
|
||||||
options = intent.getExtras().getBundle(
|
|
||||||
AppWidgetManager.EXTRA_APPWIDGET_OPTIONS);
|
|
||||||
}
|
|
||||||
mAppWidgetManager.bindAppWidgetId(mAppWidgetId, intent.getComponent(), options);
|
|
||||||
result = RESULT_OK;
|
result = RESULT_OK;
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// This is thrown if they're already bound, or otherwise somehow
|
// This is thrown if they're already bound, or otherwise somehow
|
||||||
|
Reference in New Issue
Block a user