Java 类com.afollestad.materialdialogs.AlertDialogWrapper 实例源码

项目:Slide-RSS    文件:ReorderFeeds.java   
@Override
protected void onPostExecute(final Feed feed) {
    if (feed != null) {
        new AlertDialogWrapper.Builder(ReorderFeeds.this).setTitle("Feed added successfully!").setPositiveButton("Ok!", null).show();
        Realm.getDefaultInstance().executeTransactionAsync(new Realm.Transaction() {
            @Override
            public void execute(Realm realm) {
                realm.copyToRealmOrUpdate(feed);
            }
        }, new Realm.Transaction.OnSuccess() {
            @Override
            public void onSuccess() {
                doAddSub(feed);
            }
        });
    } else {
        new SearchSiteTask().execute(url);
    }
}
项目:Slide-RSS    文件:SearchFragment.java   
public void doAdapter() {
    dataSet = new SearchLoader(search);
    adapter = new FeedAdapter(getActivity(), dataSet, rv, mSwipeRefreshLayout);
    adapter.setHasStableIds(true);

    rv.setAdapter(adapter);
    if (dataSet.getData().isEmpty()) {
        new AlertDialogWrapper.Builder(getActivity()).setTitle("No results").setPositiveButton("OK", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                getActivity().finish();
            }
        }).show();
    }
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            refresh();
        }
    });
}
项目:berlin-vegan-guide    文件:UiUtils.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    WebView webView = new WebView(getActivity());
    webView.loadUrl("file:///android_asset/licenses.html");
    return new AlertDialogWrapper.Builder(getActivity())
            .setTitle(R.string.about_licenses)
            .setView(webView)
            .setPositiveButton(android.R.string.ok,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            dialog.dismiss();
                        }
                    }
            )
            .create();
}
项目:berlin-vegan-guide    文件:UiUtils.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    WebView webView = new WebView(getActivity());
    webView.loadUrl("file:///android_asset/credits.html");
    return new AlertDialogWrapper.Builder(getActivity())
            .setTitle(R.string.about_credits)
            .setView(webView)
            .setPositiveButton(android.R.string.ok,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int whichButton) {
                            dialog.dismiss();
                        }
                    }
            )
            .create();
}
项目:Fridge    文件:SettingsFragment.java   
@OnClick(R.id.text_measurement_type)
public void measurementTypeDialog(View view) {

    AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
    builder.setTitle(R.string.pick_measurement_type)
            .setItems(R.array.measurement_type_array, new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    // The 'which' argument contains the index position
                    // of the selected item
                    application.prefStore
                            .setInt(SharedPrefStore.Pref.SETTINGS_MEASUREMENT_TYPE, which);
                    textMeasurementTypeValue.setText(application.getResources()
                            .getStringArray(R.array.measurement_type_array)[which]);
                }
            });
    builder.create().show();
}
项目:TextSecureSMP    文件:ImportFragment.java   
private void handleImportSms() {
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
  builder.setIconAttribute(R.attr.dialog_info_icon);
  builder.setTitle(getActivity().getString(R.string.ImportFragment_import_system_sms_database));
  builder.setMessage(getActivity().getString(R.string.ImportFragment_this_will_import_messages_from_the_system));
  builder.setPositiveButton(getActivity().getString(R.string.ImportFragment_import), new AlertDialog.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      Intent intent = new Intent(getActivity(), ApplicationMigrationService.class);
      intent.setAction(ApplicationMigrationService.MIGRATE_DATABASE);
      intent.putExtra("master_secret", masterSecret);
      getActivity().startService(intent);

      Intent nextIntent = new Intent(getActivity(), ConversationListActivity.class);

      Intent activityIntent = new Intent(getActivity(), DatabaseMigrationActivity.class);
      activityIntent.putExtra("next_intent", nextIntent);
      getActivity().startActivity(activityIntent);
    }
  });
  builder.setNegativeButton(getActivity().getString(R.string.ImportFragment_cancel), null);
  builder.show();
}
项目:TextSecureSMP    文件:MuteDialog.java   
public static void show(final Context context, final @NonNull MuteSelectionListener listener) {
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
  builder.setTitle(R.string.MuteDialog_mute_notifications);
  builder.setItems(R.array.mute_durations, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, final int which) {
      final long muteUntil;

      switch (which) {
        case 0:  muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break;
        case 1:  muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(2); break;
        case 2:  muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1);  break;
        case 3:  muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(7);  break;
        default: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break;
      }

      listener.onMuted(muteUntil);
    }
  });

  builder.show();

}
项目:TextSecureSMP    文件:StoragePreferenceFragment.java   
@Override
public boolean onPreferenceClick(Preference preference) {
  final int threadLengthLimit = TextSecurePreferences.getThreadTrimLength(getActivity());
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
  builder.setTitle(R.string.ApplicationPreferencesActivity_delete_all_old_messages_now);
  builder.setMessage(getString(R.string.ApplicationPreferencesActivity_are_you_sure_you_would_like_to_immediately_trim_all_conversation_threads_to_the_s_most_recent_messages,
                               threadLengthLimit));
  builder.setPositiveButton(R.string.ApplicationPreferencesActivity_delete,
    new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int which) {
        Trimmer.trimAllThreads(getActivity(), threadLengthLimit);
      }
    });

  builder.setNegativeButton(android.R.string.cancel, null);
  builder.show();

  return true;
}
项目:TextSecureSMP    文件:ConversationActivity.java   
private void handleUnblock() {
  new AlertDialogWrapper.Builder(this)
      .setTitle(R.string.ConversationActivity_unblock_question)
      .setMessage(R.string.ConversationActivity_are_you_sure_you_want_to_unblock_this_contact)
      .setNegativeButton(android.R.string.cancel, null)
      .setPositiveButton(R.string.ConversationActivity_unblock, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
          recipients.setBlocked(false);

          new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... params) {
              DatabaseFactory.getRecipientPreferenceDatabase(ConversationActivity.this)
                             .setBlocked(recipients, false);
              return null;
            }
          }.execute();
        }
      }).show();
}
项目:TextSecureSMP    文件:ConversationActivity.java   
private void handleDeleteThread() {
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
  builder.setTitle(R.string.ConversationActivity_delete_thread_confirmation);
  builder.setIconAttribute(R.attr.dialog_alert_icon);
  builder.setCancelable(true);
  builder.setMessage(R.string.ConversationActivity_are_you_sure_that_you_want_to_permanently_delete_this_conversation_question);
  builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      if (threadId > 0) {
        DatabaseFactory.getThreadDatabase(ConversationActivity.this).deleteConversation(threadId);
      }
      composeText.getText().clear();
      threadId = -1;
      finish();
    }
  });

  builder.setNegativeButton(R.string.no, null);
  builder.show();
}
项目:TextSecureSMP    文件:ConversationActivity.java   
private void selectContactInfo(ContactData contactData) {
  final CharSequence[] numbers     = new CharSequence[contactData.numbers.size()];
  final CharSequence[] numberItems = new CharSequence[contactData.numbers.size()];

  for (int i = 0; i < contactData.numbers.size(); i++) {
    numbers[i]     = contactData.numbers.get(i).number;
    numberItems[i] = contactData.numbers.get(i).type + ": " + contactData.numbers.get(i).number;
  }

  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
  builder.setIconAttribute(R.attr.conversation_attach_contact_info);
  builder.setTitle(R.string.ConversationActivity_select_contact_info);

  builder.setItems(numberItems, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      composeText.append(numbers[which]);
    }
  });
  builder.show();
}
项目:Slide    文件:TumblrPager.java   
public void showFirstDialog() {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            new AlertDialogWrapper.Builder(TumblrPager.this).setTitle(R.string.set_save_location)
                    .setMessage(R.string.set_save_location_msg)
                    .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            new FolderChooserDialogCreate.Builder(TumblrPager.this).chooseButton(
                                    R.string.btn_select)  // changes label of the choose button
                                    .initialPath(Environment.getExternalStorageDirectory()
                                            .getPath())  // changes initial path, defaults to external storage directory
                                    .show();
                        }
                    })
                    .setNegativeButton(R.string.btn_no, null)
                    .show();
        }
    });

}
项目:Slide    文件:TumblrPager.java   
public void showErrorDialog() {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            new AlertDialogWrapper.Builder(TumblrPager.this).setTitle(
                    R.string.err_something_wrong)
                    .setMessage(R.string.err_couldnt_save_choose_new)
                    .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            new FolderChooserDialogCreate.Builder(TumblrPager.this).chooseButton(
                                    R.string.btn_select)  // changes label of the choose button
                                    .initialPath(Environment.getExternalStorageDirectory()
                                            .getPath())  // changes initial path, defaults to external storage directory
                                    .show();
                        }
                    })
                    .setNegativeButton(R.string.btn_no, null)
                    .show();
        }
    });

}
项目:Slide    文件:Album.java   
public void showFirstDialog() {
    try {
        new AlertDialogWrapper.Builder(this).setTitle(R.string.set_save_location)
                .setMessage(R.string.set_save_location_msg)
                .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        new FolderChooserDialogCreate.Builder(Album.this).chooseButton(
                                R.string.btn_select)  // changes label of the choose button
                                .initialPath(Environment.getExternalStorageDirectory()
                                        .getPath())  // changes initial path, defaults to external storage directory
                                .show();
                    }
                })
                .setNegativeButton(R.string.btn_no, null)
                .show();
    } catch (Exception ignored) {

    }
}
项目:Slide    文件:Album.java   
public void showErrorDialog() {
    new AlertDialogWrapper.Builder(Album.this).setTitle(R.string.err_something_wrong)
            .setMessage(R.string.err_couldnt_save_choose_new)
            .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    new FolderChooserDialogCreate.Builder(Album.this).chooseButton(
                            R.string.btn_select)  // changes label of the choose button
                            .initialPath(Environment.getExternalStorageDirectory()
                                    .getPath())  // changes initial path, defaults to external storage directory
                            .show();
                }
            })
            .setNegativeButton(R.string.btn_no, null)
            .show();
}
项目:Slide    文件:Tumblr.java   
public void showFirstDialog() {
    try {
        new AlertDialogWrapper.Builder(this).setTitle(R.string.set_save_location)
                .setMessage(R.string.set_save_location_msg)
                .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        new FolderChooserDialogCreate.Builder(Tumblr.this).chooseButton(
                                R.string.btn_select)  // changes label of the choose button
                                .initialPath(Environment.getExternalStorageDirectory()
                                        .getPath())  // changes initial path, defaults to external storage directory
                                .show();
                    }
                })
                .setNegativeButton(R.string.btn_no, null)
                .show();
    } catch (Exception ignored) {

    }
}
项目:Slide    文件:Tumblr.java   
public void showErrorDialog() {
    new AlertDialogWrapper.Builder(Tumblr.this).setTitle(R.string.err_something_wrong)
            .setMessage(R.string.err_couldnt_save_choose_new)
            .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    new FolderChooserDialogCreate.Builder(Tumblr.this).chooseButton(
                            R.string.btn_select)  // changes label of the choose button
                            .initialPath(Environment.getExternalStorageDirectory()
                                    .getPath())  // changes initial path, defaults to external storage directory
                            .show();
                }
            })
            .setNegativeButton(R.string.btn_no, null)
            .show();
}
项目:Slide    文件:MediaView.java   
public void showErrorDialog() {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            new AlertDialogWrapper.Builder(MediaView.this).setTitle(
                    R.string.err_something_wrong)
                    .setMessage(R.string.err_couldnt_save_choose_new)
                    .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            new FolderChooserDialogCreate.Builder(MediaView.this).chooseButton(
                                    R.string.btn_select)  // changes label of the choose button
                                    .initialPath(Environment.getExternalStorageDirectory()
                                            .getPath())  // changes initial path, defaults to external storage directory
                                    .show();
                        }
                    })
                    .setNegativeButton(R.string.btn_no, null)
                    .show();
        }
    });
}
项目:Slide    文件:AlbumPager.java   
public void showFirstDialog() {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            new AlertDialogWrapper.Builder(AlbumPager.this).setTitle(R.string.set_save_location)
                    .setMessage(R.string.set_save_location_msg)
                    .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            new FolderChooserDialogCreate.Builder(AlbumPager.this).chooseButton(
                                    R.string.btn_select)  // changes label of the choose button
                                    .initialPath(Environment.getExternalStorageDirectory()
                                            .getPath())  // changes initial path, defaults to external storage directory
                                    .show();
                        }
                    })
                    .setNegativeButton(R.string.btn_no, null)
                    .show();
        }
    });

}
项目:Slide    文件:AlbumPager.java   
public void showErrorDialog() {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            new AlertDialogWrapper.Builder(AlbumPager.this).setTitle(
                    R.string.err_something_wrong)
                    .setMessage(R.string.err_couldnt_save_choose_new)
                    .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            new FolderChooserDialogCreate.Builder(AlbumPager.this).chooseButton(
                                    R.string.btn_select)  // changes label of the choose button
                                    .initialPath(Environment.getExternalStorageDirectory()
                                            .getPath())  // changes initial path, defaults to external storage directory
                                    .show();
                        }
                    })
                    .setNegativeButton(R.string.btn_no, null)
                    .show();
        }
    });

}
项目:Slide    文件:CommentAdapterHelper.java   
private static void viewCommentParent(CommentAdapter adapter, CommentViewHolder holder,
        Context mContext, CommentNode baseNode) {
    int old = holder.getAdapterPosition();
    int pos = (old < 2) ? 0 : old - 1;
    for (int i = pos - 1; i >= 0; i--) {
        CommentObject o = adapter.currentComments.get(adapter.getRealPosition(i));
        if (o instanceof CommentItem
                && pos - 1 != i
                && o.comment.getDepth() < baseNode.getDepth()) {
            LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
            final View dialoglayout = inflater.inflate(R.layout.parent_comment_dialog, null);
            final AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(mContext);
            Comment parent = o.comment.getComment();
            adapter.setViews(parent.getDataNode().get("body_html").asText(),
                    adapter.submission.getSubredditName(),
                    (SpoilerRobotoTextView) dialoglayout.findViewById(R.id.firstTextView),
                    (CommentOverflow) dialoglayout.findViewById(R.id.commentOverflow));
            builder.setView(dialoglayout);
            builder.show();
            break;
        }
    }
}
项目:Slide    文件:GifUtils.java   
@Override
public void run() {
    new AlertDialogWrapper.Builder(c).setTitle(
            R.string.error_video_not_found)
            .setMessage(R.string.error_video_message)
            .setCancelable(false)
            .setPositiveButton(R.string.btn_ok,
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(
                                DialogInterface dialog,
                                int which) {
                            c.finish();
                        }
                    })
            .create()
            .show();
}
项目:Slide    文件:GifUtils.java   
@Override
public void run() {
    try {
        new AlertDialogWrapper.Builder(c).setTitle(
                R.string.error_video_not_found)
                .setMessage(R.string.error_video_message)
                .setCancelable(false)
                .setPositiveButton(R.string.btn_ok,
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(
                                    DialogInterface dialog,
                                    int which) {
                                c.finish();
                            }
                        })
                .create()
                .show();
    } catch (Exception e) {

    }
}
项目:Slide    文件:GifUtils.java   
public static void showErrorDialog(final Activity a) {
    new AlertDialogWrapper.Builder(a).setTitle(R.string.err_something_wrong)
            .setMessage(R.string.err_couldnt_save_choose_new)
            .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    new FolderChooserDialogCreate.Builder((MediaView) a).chooseButton(
                            R.string.btn_select)  // changes label of the choose button
                            .initialPath(Environment.getExternalStorageDirectory()
                                    .getPath())  // changes initial path, defaults to external storage directory
                            .show();
                }
            })
            .setNegativeButton(R.string.btn_no, null)
            .show();
}
项目:Slide    文件:GifUtils.java   
public static void showFirstDialog(final Activity a) {
    new AlertDialogWrapper.Builder(a).setTitle(R.string.set_gif_save_loc)
            .setMessage(R.string.set_gif_save_loc_msg)
            .setPositiveButton(R.string.btn_yes, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    new FolderChooserDialogCreate.Builder((MediaView) a).chooseButton(
                            R.string.btn_select)  // changes label of the choose button
                            .initialPath(Environment.getExternalStorageDirectory()
                                    .getPath())  // changes initial path, defaults to external storage directory
                            .show();
                }
            })
            .setNegativeButton(R.string.btn_no, null)
            .show();
}
项目:Slide    文件:SettingsBackup.java   
@Override
public void onResult(DriveFolder.DriveFileResult result) {
    progress.setProgress(progress.getCurrentProgress() + 1);
    if (!result.getStatus().isSuccess()) {
        errors += 1;
        return;
    }

    if (progress.getCurrentProgress() == progress.getMaxProgress()) {

        new AlertDialogWrapper.Builder(SettingsBackup.this)
                .setTitle(R.string.backup_success)
                .setPositiveButton(R.string.btn_close, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        finish();
                    }
                }).show();
    }
}
项目:Cam2PDF    文件:MainActivity.java   
@Override
public void onBackPressed() {
    if (mPhotoPaths.size() > 0) {
        AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
        builder.setTitle(R.string.confirm_exit);
        builder.setMessage(R.string.exit_message);
        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                MainActivity.super.onBackPressed();
            }
        });
        builder.setNegativeButton(android.R.string.cancel, null);
        builder.show();
    } else {
        super.onBackPressed();
    }
}
项目:Blurify    文件:BlurifyActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            closeAbout();
            return true;
        case R.id.menu_about:
            about();
            return true;
        case R.id.menu_contribute:
            new AlertDialogWrapper.Builder(this)
                    .setTitle(R.string.contribute)
                    .setMessage(R.string.contribute_text)
                    .setPositiveButton(R.string.contribute_go, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/chteuchteu/Blurify"));
                            startActivity(browserIntent);
                        }
                    })
                    .show();
            return true;
    }
    return true;
}
项目:Blurify    文件:Activity_Main.java   
public void displayI18nMessage() {
    // Only display the alertDialog if the device language is not handled
    String deviceLanguage = Locale.getDefault().getLanguage();

    if (!I18nHelper.isLanguageSupported(deviceLanguage)
            && !Util.Pref.getBool(this, Util.Pref.PrefKeys.I18NDialogShown, false)) {
        if (this.isFinishing())
            return;

        new AlertDialogWrapper.Builder(this)
                .setMessage(R.string.i18n_message)
                .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/chteuchteu/Blurify#how-to-help-translate-blurify")));
                    }
                })
                .setNegativeButton(R.string.no, null)
                .show();

        Util.Pref.setBool(this, Util.Pref.PrefKeys.I18NDialogShown, true);
    }
}
项目:smartcard-reader    文件:EmvReadActivity.java   
@SuppressWarnings("deprecation")
@Override
protected Dialog onCreateDialog(int id) {
    //AlertDialog.Builder builder = new AlertDialog.Builder(
    //        EmvReadActivity.this, R.style.dialog);
    AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(this);
    final LayoutInflater li = getLayoutInflater();
    Dialog dialog = null;
    switch (id) {
        case DIALOG_ENABLE_NFC: {
            dialog = mNfcManager.onCreateDialog(id, builder, li);
            break;
        }
    }
    return dialog;
}
项目:good-thing-map-android    文件:AlertDialogFragment.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Bundle args = getArguments();
    String title = args.getString(KEY_TITLE);
    String message = args.getString(KEY_MESSAGE);
    String positiveButtonTitle = args.getString(KEY_POSITIVE_BUTTON_TITLE);

    Builder builder = new AlertDialogWrapper.Builder(getActivity())
            .setPositiveButton(positiveButtonTitle, mPositiveListener)
            .setCancelable(false);

    String negativeButtonTitle = args.getString(KEY_NEGATIVE_BUTTON_TITLE);
    if (!TextUtils.isEmpty(negativeButtonTitle)) {
        builder.setNegativeButton(negativeButtonTitle, mNegativeListener);
    }
    if (!TextUtils.isEmpty(title)) {
        builder.setTitle(title);
    }
    if (!TextUtils.isEmpty(message)) {
        builder.setMessage(message);
    }
    return builder.create();
}
项目:Slide-RSS    文件:AddFeedFromURL.java   
@Override
protected void onPostExecute(final Feed feed) {
    if (feed != null) {
        new AlertDialogWrapper.Builder(AddFeedFromURL.this).setTitle("Feed added successfully!").setPositiveButton("Ok!", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                AddFeedFromURL.this.finish();
            }
        }).show();
        Realm.getDefaultInstance().executeTransactionAsync(new Realm.Transaction() {
            @Override
            public void execute(Realm realm) {
                realm.copyToRealmOrUpdate(feed);
                ArrayList<Feed> subs = new ArrayList<>(realm.where(Feed.class).findAllSorted("order"));
                subs.add(feed);
                for (int i = 0; i < subs.size(); i++) {
                    subs.get(i).setOrder(i);
                }
                for (Feed f : subs) {
                    realm.insertOrUpdate(f);
                }
            }
        }, new Realm.Transaction.OnSuccess() {
            @Override
            public void onSuccess() {

            }
        });
    } else {
        new SearchSiteTask().execute(url);
    }
}
项目:Slide-RSS    文件:AddFeedFromURL.java   
@Override
protected void onPostExecute(String feed) {
    if (feed == null) {
        new AlertDialogWrapper.Builder(AddFeedFromURL.this).setTitle("Error adding feed! This site may not have an RSS feed available.").setPositiveButton("Ok!", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        }).show();
    } else {
        new ParseFeedTask().execute(feed);
    }
}
项目:Slide-RSS    文件:ReorderFeeds.java   
@Override
protected void onPostExecute(String feed) {
    if (feed == null) {
        new AlertDialogWrapper.Builder(ReorderFeeds.this).setTitle("Error adding feed! Make sure you have entered the URL correctly").setPositiveButton("Ok!", null).show();
    } else {
        new ParseFeedTask().execute(feed);
    }
}
项目:Fridge    文件:AddItemFragment.java   
public void getPicture() {

        if (isPhotoSelected) {
            isPhotoSelected = false;
            circularView.setEnabled(true);
            FileUtils.deleteFile(new File(filePath));
            filePath = null;
            menu.findItem(R.id.action_add).setIcon(R.drawable.ic_photo_camera);
            // ((FloatingActionButton) view).setImageResource(R.drawable.ic_photo_camera);

            circularView.setHighlightedDegree(CircularView.RIGHT);
            Marker marker = circularView.getHighlightedMarker();
            circularView.getCenterCircle().setSrc(marker.getDrawable());
            textType.setText(adapter.getMarkerName(marker.getId()));
        } else {
            // Show image chooser dialog
            String[] options = {application.getString(R.string.take_photo),
                    application.getString(R.string.choose_image)};
            AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
            builder.setTitle(R.string.get_picture)
                    .setItems(options, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            // The 'which' argument contains the index position
                            // of the selected item
                            switch (which) {
                                case 0:
                                    takePhoto();
                                    break;
                                case 1:
                                    chooseImage();
                                    break;
                            }
                        }
                    });
            builder.create().show();
        }
    }
项目:TextSecureSMP    文件:ConversationItem.java   
public void onClick(final View v, final Slide slide) {
  if (!batchSelected.isEmpty()) {
    selectionClickListener.onItemClick(null, ConversationItem.this, -1, -1);
  } else if (MediaPreviewActivity.isContentTypeSupported(slide.getContentType()) &&
             slide.getThumbnailUri() != null)
  {
    Intent intent = new Intent(context, MediaPreviewActivity.class);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    intent.setDataAndType(slide.getUri(), slide.getContentType());
    if (!messageRecord.isOutgoing()) intent.putExtra(MediaPreviewActivity.RECIPIENT_EXTRA, messageRecord.getIndividualRecipient().getRecipientId());
    intent.putExtra(MediaPreviewActivity.DATE_EXTRA, messageRecord.getDateReceived());

    context.startActivity(intent);
  } else if (slide.getThumbnailUri() != null) {
    AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
    builder.setTitle(R.string.ConversationItem_view_secure_media_question);
    builder.setIconAttribute(R.attr.dialog_alert_icon);
    builder.setCancelable(true);
    builder.setMessage(R.string.ConversationItem_this_media_has_been_stored_in_an_encrypted_database_external_viewer_warning);
    builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
        fireIntent(slide);
      }
    });
    builder.setNegativeButton(R.string.no, null);
    builder.show();
  }
}
项目:TextSecureSMP    文件:GroupMembersDialog.java   
@Override
public void onPostExecute(Recipients members) {
  GroupMembers groupMembers = new GroupMembers(members);
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
  builder.setTitle(R.string.ConversationActivity_group_members);
  builder.setIconAttribute(R.attr.group_members_dialog_icon);
  builder.setCancelable(true);
  builder.setItems(groupMembers.getRecipientStrings(), new GroupMembersOnClickListener(context, groupMembers));
  builder.setPositiveButton(android.R.string.ok, null);
  builder.show();
}
项目:TextSecureSMP    文件:ImportFragment.java   
private void handleImportEncryptedBackup() {
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
  builder.setIconAttribute(R.attr.dialog_alert_icon);
  builder.setTitle(getActivity().getString(R.string.ImportFragment_restore_encrypted_backup));
  builder.setMessage(getActivity().getString(R.string.ImportFragment_restoring_an_encrypted_backup_will_completely_replace_your_existing_keys));
  builder.setPositiveButton(getActivity().getString(R.string.ImportFragment_restore), new AlertDialog.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      new ImportEncryptedBackupTask().execute();
    }
  });
  builder.setNegativeButton(getActivity().getString(R.string.ImportFragment_cancel), null);
  builder.show();
}
项目:TextSecureSMP    文件:ImportFragment.java   
private void handleImportPlaintextBackup() {
  AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(getActivity());
  builder.setIconAttribute(R.attr.dialog_alert_icon);
  builder.setTitle(getActivity().getString(R.string.ImportFragment_import_plaintext_backup));
  builder.setMessage(getActivity().getString(R.string.ImportFragment_this_will_import_messages_from_a_plaintext_backup));
  builder.setPositiveButton(getActivity().getString(R.string.ImportFragment_import), new AlertDialog.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
      new ImportPlaintextBackupTask().execute();
    }
  });
  builder.setNegativeButton(getActivity().getString(R.string.ImportFragment_cancel), null);
  builder.show();
}
项目:TextSecureSMP    文件:SMPSyncContentObserver.java   
public void handleSMPSessionStart(final Context context) {
    new AlertDialogWrapper.Builder(context)
        .setTitle(R.string.ConversationActivity_smp_session_start_verification)
        .setMessage(R.string.ConversationActivity_smp_session_start_question)
        .setNegativeButton(android.R.string.cancel, null)
        .setPositiveButton(R.string.ConversationActivity_smp_session_accept, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Intent verifyIdentityIntent = new Intent(context, VerifyIdentityActivity.class);
                verifyIdentityIntent.putExtra("recipient", recipients.getPrimaryRecipient().getRecipientId());
                verifyIdentityIntent.putExtra("initiator", false);
                context.startActivity(verifyIdentityIntent);
            }
        }).show();
}