Fix the lock issue on Home. This was caused by onPrepareDialog().
onPrepareDialog() is called after a dialog was created/shown at least once. But onPrepareDialog() does not mean the dialog will be shown. Thus Home would sometimes lock itself without showing the dialog the user would normally use to unlock the workspace.
This commit is contained in:
parent
c5df5b61b8
commit
7b4ef330d9
|
@ -2014,14 +2014,14 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
|||
protected void onPrepareDialog(int id, Dialog dialog) {
|
||||
switch (id) {
|
||||
case DIALOG_CREATE_SHORTCUT:
|
||||
mWorkspace.lock();
|
||||
break;
|
||||
case DIALOG_RENAME_FOLDER:
|
||||
mWorkspace.lock();
|
||||
EditText input = (EditText) dialog.findViewById(R.id.folder_name);
|
||||
final CharSequence text = mFolderInfo.title;
|
||||
input.setText(text);
|
||||
input.setSelection(0, text.length());
|
||||
if (mFolderInfo != null) {
|
||||
EditText input = (EditText) dialog.findViewById(R.id.folder_name);
|
||||
final CharSequence text = mFolderInfo.title;
|
||||
input.setText(text);
|
||||
input.setSelection(0, text.length());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2090,7 +2090,15 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
|||
}
|
||||
);
|
||||
builder.setView(layout);
|
||||
return builder.create();
|
||||
|
||||
final AlertDialog dialog = builder.create();
|
||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
public void onShow(DialogInterface dialog) {
|
||||
mWorkspace.lock();
|
||||
}
|
||||
});
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
private void changeFolderName() {
|
||||
|
@ -2133,7 +2141,9 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
|||
* appropriate activity.
|
||||
*/
|
||||
private class CreateShortcut implements DialogInterface.OnClickListener,
|
||||
DialogInterface.OnCancelListener, DialogInterface.OnDismissListener {
|
||||
DialogInterface.OnCancelListener, DialogInterface.OnDismissListener,
|
||||
DialogInterface.OnShowListener {
|
||||
|
||||
private AddAdapter mAdapter;
|
||||
|
||||
Dialog createDialog() {
|
||||
|
@ -2150,6 +2160,7 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
|||
AlertDialog dialog = builder.create();
|
||||
dialog.setOnCancelListener(this);
|
||||
dialog.setOnDismissListener(this);
|
||||
dialog.setOnShowListener(this);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
@ -2239,6 +2250,10 @@ public final class Launcher extends Activity implements View.OnClickListener, On
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onShow(DialogInterface dialog) {
|
||||
mWorkspace.lock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue