Show important notice dialog

Bug: 10587358
Change-Id: I3b4282a1bb183aa901110a4a2fc1b6ed72818aae
This commit is contained in:
Tadashi G. Takaoka 2014-02-03 14:03:58 +09:00
parent 9221772ab7
commit 342e81e7a6

View File

@ -79,6 +79,7 @@ import com.android.inputmethod.latin.utils.ApplicationUtils;
import com.android.inputmethod.latin.utils.CapsModeUtils;
import com.android.inputmethod.latin.utils.CompletionInfoUtils;
import com.android.inputmethod.latin.utils.CoordinateUtils;
import com.android.inputmethod.latin.utils.ImportantNoticeUtils;
import com.android.inputmethod.latin.utils.IntentUtils;
import com.android.inputmethod.latin.utils.JniUtils;
import com.android.inputmethod.latin.utils.LatinImeLoggerUtils;
@ -1157,11 +1158,24 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mInputLogic.mSuggest.mDictionaryFacilitator.addWordToUserDictionary(wordToEdit);
}
// TODO: Move this method out of {@link LatinIME}.
// Callback for the {@link SuggestionStripView}, to call when the important notice strip is
// pressed.
@Override
public void showImportantNoticeContents() {
// TODO: Show dialog to display important notice contents.
final Context context = this;
final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface di, final int position) {
di.dismiss();
ImportantNoticeUtils.updateLastImportantNoticeVersion(context);
}
};
final AlertDialog.Builder builder =
new AlertDialog.Builder(context, AlertDialog.THEME_HOLO_DARK);
builder.setMessage(R.string.important_notice_contents)
.setPositiveButton(android.R.string.ok, listener);
showOptionDialog(builder.create(), false /* cancelable */);
}
public void displaySettingsDialog() {
@ -1692,17 +1706,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
};
final AlertDialog.Builder builder =
new AlertDialog.Builder(this).setItems(items, listener).setTitle(title);
showOptionDialog(builder.create());
showOptionDialog(builder.create(), true /*cancelable */);
}
public void showOptionDialog(final AlertDialog dialog) {
// TODO: Move this method out of {@link LatinIME}.
private void showOptionDialog(final AlertDialog dialog, final boolean cancelable) {
final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken();
if (windowToken == null) {
return;
}
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
dialog.setCancelable(cancelable);
dialog.setCanceledOnTouchOutside(cancelable);
final Window window = dialog.getWindow();
final WindowManager.LayoutParams lp = window.getAttributes();