本文整理汇总了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();
}