Supporting EXTRA_APPWIDGET_OPTIONS correctly

This commit is contained in:
Michael Jurka
2012-11-05 18:56:14 -08:00
parent fd34f98960
commit ab3472f594

View File

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