Ejemplo n.º 1
0
 @Override
 protected void onDestroy() {
   // 判断对话框是否显示状态,显示中则销毁,避免 activity 的销毁导致错误
   if (createConversationDialog != null && createConversationDialog.isShowing()) {
     createConversationDialog.dismiss();
   }
   super.onDestroy();
 }
Ejemplo n.º 2
0
 private void stopProgress() {
   if (reqProgress != null && reqProgress.isShowing()) {
     reqProgress.dismiss();
   }
   if (reDialog != null && reDialog.isShowing()) {
     reDialog.dismiss();
   }
 }
Ejemplo n.º 3
0
 public void showScanDialog() {
   CharSequence[] items = getResources().getStringArray(R.array.URI_labels);
   AlertDialog.Builder choiceBuilder = new AlertDialog.Builder(getActivity());
   AlertDialog choiceDialog =
       choiceBuilder
           .setTitle(R.string.content_providers_title)
           .setSingleChoiceItems(
               items,
               -1,
               new DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface choiceDialog, int i) {
                   String[] values = getResources().getStringArray(R.array.URI_values);
                   final Uri contentProvider = Uri.parse(values[i]);
                   String[] projection = new String[] {"artist", "title"};
                   String selection = "artist IS NOT NULL AND artist <> '<unknown>'";
                   Cursor countCursor =
                       getActivity()
                           .getContentResolver()
                           .query(contentProvider, projection, selection, null, null);
                   if (countCursor == null || countCursor.getCount() == 0) {
                     choiceDialog.cancel();
                     Toast.makeText(
                             getActivity(),
                             getString(R.string.scan_error_no_content),
                             Toast.LENGTH_LONG)
                         .show();
                     return;
                   }
                   final int count = countCursor.getCount();
                   final int time = (int) Math.ceil(count / 500f);
                   countCursor.close();
                   choiceDialog.dismiss();
                   String prompt =
                       getResources().getQuantityString(R.plurals.scan_dialog, count > 1 ? 2 : 1);
                   AlertDialog.Builder confirmDialog = new AlertDialog.Builder(getActivity());
                   confirmDialog
                       .setTitle(R.string.warning)
                       .setMessage(String.format(prompt, count, time))
                       .setPositiveButton(
                           android.R.string.ok,
                           new DialogInterface.OnClickListener() {
                             @Override
                             public void onClick(DialogInterface dialogInterface, int i) {
                               Intent scanInfo =
                                   new Intent(getActivity(), BatchDownloaderService.class);
                               scanInfo.putExtra("uri", contentProvider);
                               getActivity().startService(scanInfo);
                             }
                           })
                       .setNegativeButton(android.R.string.cancel, null)
                       .create()
                       .show();
                 }
               })
           .create();
   choiceDialog.show();
   if (!PermissionsChecker.requestPermission(
       getActivity(),
       "android.permission.READ_EXTERNAL_STORAGE",
       0,
       LocalLyricsFragment.REQUEST_CODE)) choiceDialog.dismiss();
 }
Ejemplo n.º 4
0
 @Override
 public void showMsg(String s) {
   showToast(s);
   alertDialog.dismiss();
 }
Ejemplo n.º 5
0
 @Override
 public void ToMain() {
   alertDialog.dismiss();
   Intent intent = new Intent(this, MainActivity.class);
   startActivity(intent);
 }
 public void onNegativeButtonClicked() {
   cancel(mSuppressCheckBox.isChecked());
   mDialog.dismiss();
 }
 public void onPositiveButtonClicked() {
   confirm(mPromptTextView.getText().toString(), mSuppressCheckBox.isChecked());
   mDialog.dismiss();
 }
 @CalledByNative
 void dismiss() {
   mDialog.dismiss();
   mNativeDialogPointer = 0;
 }