本文整理匯總了Java中com.afollestad.materialdialogs.MaterialDialog類的典型用法代碼示例。如果您正苦於以下問題:Java MaterialDialog類的具體用法?Java MaterialDialog怎麽用?Java MaterialDialog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MaterialDialog類屬於com.afollestad.materialdialogs包,在下文中一共展示了MaterialDialog類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: exit
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
private void exit() {
if(!QHBService.isRun()){
AppManager.getInstance().exitApp(true);
return;
}
new MaterialDialog.Builder(getActivity())
.title("退出服務")
.content("找到[快手搶紅包],然後關閉服務再退出即可")
.negativeText("取消")
.positiveText("確認")
.onAny(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
switch (which) {
case POSITIVE:
getActivity().startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
break;
}
}
})
.show();
}
示例2: showSelectionDialog
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
/**
* Shows the selection dialog for a given renderer.
*
* @param rendererIndex The index of the renderer.
* @param callback The callback interface when the dialog is dismissed
*/
public void showSelectionDialog(int rendererIndex, @NonNull TrackSelectionHelperInterface callback) {
this.mCallbackInterface = callback;
qualityDialogView = new TubiQualityDialogView(mActivity);
qualityDialogView.setAdaptiveTrackSelectionFactory(adaptiveTrackSelectionFactory);
MaterialDialog.Builder materialBuilder = new MaterialDialog.Builder(mActivity);
materialBuilder.customView(qualityDialogView.buildQualityDialog(selector, rendererIndex), false)
.title(mActivity.getResources().getString(R.string.track_selector_alert_quality_title))
.backgroundColor(mActivity.getResources().getColor(R.color.tubi_tv_steel_grey))
.positiveText(android.R.string.ok)
.positiveColor(mActivity.getResources().getColor(R.color.tubi_tv_golden_gate))
.onPositive(qualityDialogView)
.dismissListener(this)
.show();
}
示例3: deleteScriptFile
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
@Optional
@OnClick(R.id.delete)
void deleteScriptFile() {
dismissDialogs();
new MaterialDialog.Builder(getActivity())
.title(R.string.delete_confirm)
.positiveText(R.string.cancel)
.negativeText(R.string.ok)
.onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
doDeletingScriptFile();
}
})
.show();
}
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:17,代碼來源:MyScriptListFragment.java
示例4: onInput
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
@Override
public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
if (mIsFirstTextChanged) {
mIsFirstTextChanged = false;
return;
}
EditText editText = dialog.getInputEditText();
if (editText == null)
return;
int errorResId = 0;
if (input == null || input.length() == 0) {
errorResId = R.string.text_name_should_not_be_empty;
} else if (!input.equals(mExcluded)) {
if (new File(getCurrentDirectory(), mIsDirectory ? input.toString() : input.toString() + ".js").exists()) {
errorResId = R.string.text_file_exists;
}
}
if (errorResId == 0) {
editText.setError(null);
dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
} else {
editText.setError(getString(errorResId));
dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
}
}
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:27,代碼來源:MyScriptListFragment.java
示例5: onCreateDialog
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final List<Playlist> playlists = PlaylistLoader.getPlaylists(getActivity(), false);
CharSequence[] chars = new CharSequence[playlists.size() + 1];
chars[0] = "Create new playlist";
for (int i = 0; i < playlists.size(); i++) {
chars[i + 1] = playlists.get(i).name;
}
return new MaterialDialog.Builder(getActivity()).title("Add to playlist").items(chars).itemsCallback(new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
long[] songs = getArguments().getLongArray("songs");
if (which == 0) {
CreatePlaylistDialog.newInstance(songs).show(getActivity().getSupportFragmentManager(), "CREATE_PLAYLIST");
return;
}
MusicPlayer.addToPlaylist(getActivity(), songs, playlists.get(which - 1).id);
dialog.dismiss();
}
}).build();
}
示例6: showFirstRunDialog
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
public void showFirstRunDialog() {
MaterialDialog frDialog = new MaterialDialog.Builder(this)
.title(getString(R.string.welcome_app_dialog_title))
.content(getString(R.string.welcome_app_text))
.positiveText(getString(R.string.welcome_app_dialog_positive_text))
.cancelable(false)
.autoDismiss(false)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
dialog.dismiss();
Prefs.putBoolean("firstRun", false);
}
})
.build();
frDialog.show();
}
示例7: showScriptList
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
@Optional
@OnClick(R.id.script_list)
void showScriptList() {
mWindow.collapse();
ScriptListView listView = new ScriptListView(mContext);
listView.setStorageFileProvider(StorageFileProvider.getDefault());
listView.setDirectorySpanSize(2);
final MaterialDialog dialog = new ThemeColorMaterialDialogBuilder(mContext)
.title(R.string.text_run_script)
.customView(listView, false)
.positiveText(R.string.cancel)
.build();
listView.setOnItemOperatedListener(file -> dialog.dismiss());
listView.setOnScriptFileClickListener((view, file) -> Scripts.run(file));
DialogUtils.showDialog(dialog);
}
示例8: show500ServerError
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
@Override
public void show500ServerError() {
builder = new MaterialDialog.Builder(mContext)
.title(R.string.all_dialog_server_error)
.content(R.string.all_dialog_try_again)
.positiveText(R.string.all_dialog_positive).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
dialog.dismiss();
}
});
dialog = builder.build();
dialog.show();
dialog.setCanceledOnTouchOutside(false);
}
示例9: onCreateDialog
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View rootView = LayoutInflater.from(getContext()).inflate(R.layout.playlist_picker, new LinearLayout(getContext()), false);
rv = (RecyclerView) rootView.findViewById(R.id.rv);
MaterialDialog.Builder pickDialog = new MaterialDialog.Builder(getContext());
pickDialog.title(R.string.choose_playlist);
playlistListAdapter = new PlaylistListAdapter(getContext());
playlistListAdapter.setOnItemClickListener(onClick);
CustomLayoutManager customLayoutManager = new CustomLayoutManager(getContext());
customLayoutManager.setSmoothScrollbarEnabled(true);
rv.addItemDecoration(new DividerItemDecoration(getContext(), 75, false));
rv.setLayoutManager(customLayoutManager);
rv.setAdapter(playlistListAdapter);
ateKey = Helper.getATEKey(getContext());
colorAccent = Config.accentColor(getContext(), ateKey);
CreatePlaylist = (Button) rootView.findViewById(R.id.create_playlist);
CreatePlaylist.setOnClickListener(mOnClickListener);
CreatePlaylist.setBackgroundColor(colorAccent);
pickDialog.customView(rootView, false);
loadPlaylist();
return pickDialog.show();
}
示例10: onBackPressed
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
@Override
public void onBackPressed() {
new MaterialDialog.Builder(this)
.title(R.string.ok)
.content(R.string.are_you_finish_app)
.positiveText(R.string.finish)
.negativeText(R.string.cancel)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Intent intent = new Intent(getApplicationContext(), StartActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("EXIT", true);
startActivity(intent);
finish();
}
})
.show();
}
示例11: handleMessage
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case GET_ERROR:
case GET_SUCCESS:
dismissLoading();
/*發送廣播獲取待審核數量*/
Intent intent = new Intent("REFRESH_COUNT");
sendBroadcast(intent);
new MaterialDialog.Builder(InsideCheckActivity.this)
.content((String) msg.obj)
.title("係統提示")
.canceledOnTouchOutside(false)
.positiveText("確定")
.onPositive((dialog, which) -> {
finish();
})
.show();
break;
default:
break;
}
}
示例12: showHintDialog
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
private void showHintDialog() {
PackageInfo weChat = PackageUtils.getPackageInfo(Config.PACKAGE_NAME_WX);
PackageInfo qq = PackageUtils.getPackageInfo(Config.PACKAGE_NAME_QQ);
PackageInfo tim = PackageUtils.getPackageInfo(Config.PACKAGE_NAME_TIM);
String msg = "";
if(weChat != null && weChat.versionCode < WeChatConfig.V_1080){
msg += "微信、";
}
if(qq != null && qq.versionCode < QQConfig.V_718){
msg += "QQ、";
}
if(tim != null && tim.versionCode < TIMConfig.V_938){
msg += "TIM、";
}
if (!TextUtils.isEmpty(msg)) {
msg = msg.substring(0, msg.length() - 1);
new MaterialDialog.Builder(this)
.title("提示")
.content("當前" + msg + "版本過低,可能導致搶紅包失敗!請及時更新到" + msg + "最新版")
.positiveText("我知道了")
.show();
}
}
示例13: requestAppReset
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
public void requestAppReset() {
new DialogManager(mContext).createDialogMessage("Authentication Error", Html.fromHtml(mContext.getString(R.string.app_splash_authenticating_message)),
mContext.getString(R.string.Yes), mContext.getString(R.string.No), new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
switch (which) {
case POSITIVE:
makeAlerterInfo("Application has been reset!");
ServiceGenerator.authStateChange(mContext);
new ApplicationPrefs(mContext).setUserDeactivated();
mContext.onRefresh();
break;
case NEGATIVE:
dialog.dismiss();
break;
}
}
});
}
示例14: checkPlayServices
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
/**
* Check the device to make sure it has the Google Play Services APK. If
* it doesn't, display a dialog that allows users to download the APK from
* the Google Play Store or enable it in the device's system settings.
*/
public static boolean checkPlayServices(AppCompatActivity activity, int PLAY_SERVICES_RESOLUTION_REQUEST) {
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity);
if (resultCode != ConnectionResult.SUCCESS) {
if (apiAvailability.isUserResolvableError(resultCode)) {
apiAvailability.getErrorDialog(activity, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST)
.show();
} else {
MaterialDialog dialog = new MaterialDialog.Builder(activity)
.content("This device is not supported.")
.show();
}
return false;
}
return true;
}
示例15: deletePlaylistDailog
import com.afollestad.materialdialogs.MaterialDialog; //導入依賴的package包/類
/**
* Delete playlist Dialog
*
* @param context
* @param Playlistname
*/
public static void deletePlaylistDailog(@NonNull Context context, String Playlistname, RefreshPlaylist refreshPlaylist) {
MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
builder.title(Playlistname);
builder.content(R.string.deleteplaylist);
builder.positiveText(R.string.delete);
builder.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
deletePlaylist(context, Playlistname);
Toast.makeText(context, Playlistname + " Deleted", Toast.LENGTH_SHORT).show();
refreshPlaylist.refresh();
}
});
builder.typeface(Helper.getFont(context), Helper.getFont(context));
builder.negativeText(R.string.cancel);
builder.show();
}