本文整理汇总了Java中com.afollestad.materialdialogs.AlertDialogWrapper类的典型用法代码示例。如果您正苦于以下问题:Java AlertDialogWrapper类的具体用法?Java AlertDialogWrapper怎么用?Java AlertDialogWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AlertDialogWrapper类属于com.afollestad.materialdialogs包,在下文中一共展示了AlertDialogWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPostExecute
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
@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);
}
}
示例2: doAdapter
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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();
}
});
}
示例3: onCreateDialog
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
@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();
}
示例4: measurementTypeDialog
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
@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();
}
示例5: handleImportSms
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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();
}
示例6: show
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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();
}
示例7: onPreferenceClick
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
@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;
}
示例8: handleUnblock
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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();
}
示例9: handleDeleteThread
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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();
}
示例10: selectContactInfo
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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();
}
示例11: showFirstDialog
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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();
}
});
}
示例12: showErrorDialog
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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();
}
});
}
示例13: showFirstDialog
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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) {
}
}
示例14: showErrorDialog
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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();
}
示例15: showFirstDialog
import com.afollestad.materialdialogs.AlertDialogWrapper; //导入依赖的package包/类
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) {
}
}