Java Code Examples for org.telegram.ui.ActionBar.AlertDialog#setOnDismissListener()

The following examples show how to use org.telegram.ui.ActionBar.AlertDialog#setOnDismissListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VoIPHelper.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.M)
public static void permissionDenied(final Activity activity, final Runnable onFinish) {
	if (!activity.shouldShowRequestPermissionRationale(Manifest.permission.RECORD_AUDIO)) {
		AlertDialog dlg = new AlertDialog.Builder(activity)
				.setTitle(LocaleController.getString("AppName", R.string.AppName))
				.setMessage(LocaleController.getString("VoipNeedMicPermission", R.string.VoipNeedMicPermission))
				.setPositiveButton(LocaleController.getString("OK", R.string.OK), null)
				.setNegativeButton(LocaleController.getString("Settings", R.string.Settings), (dialog, which) -> {
					Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
					Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
					intent.setData(uri);
					activity.startActivity(intent);
				})
				.show();
		dlg.setOnDismissListener(dialog -> {
			if (onFinish != null)
				onFinish.run();
		});
	}
}
 
Example 2
Source File: VoIPHelper.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.M)
public static void permissionDenied(final Activity activity, final Runnable onFinish) {
	if (!activity.shouldShowRequestPermissionRationale(Manifest.permission.RECORD_AUDIO)) {
		AlertDialog dlg = new AlertDialog.Builder(activity)
				.setTitle(LocaleController.getString("AppName", R.string.AppName))
				.setMessage(LocaleController.getString("VoipNeedMicPermission", R.string.VoipNeedMicPermission))
				.setPositiveButton(LocaleController.getString("OK", R.string.OK), null)
				.setNegativeButton(LocaleController.getString("Settings", R.string.Settings), (dialog, which) -> {
					Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
					Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
					intent.setData(uri);
					activity.startActivity(intent);
				})
				.show();
		dlg.setOnDismissListener(dialog -> {
			if (onFinish != null)
				onFinish.run();
		});
	}
}
 
Example 3
Source File: VoIPActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void showErrorDialog(CharSequence message){
       AlertDialog dlg = new DarkAlertDialog.Builder(VoIPActivity.this)
               .setTitle(LocaleController.getString("VoipFailed", R.string.VoipFailed))
               .setMessage(message)
               .setPositiveButton(LocaleController.getString("OK", R.string.OK), null)
               .show();
       dlg.setCanceledOnTouchOutside(true);
       dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
           @Override
           public void onDismiss(DialogInterface dialog) {
               finish();
           }
       });
}
 
Example 4
Source File: VoIPActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void showErrorDialog(CharSequence message){
       AlertDialog dlg = new DarkAlertDialog.Builder(VoIPActivity.this)
               .setTitle(LocaleController.getString("VoipFailed", R.string.VoipFailed))
               .setMessage(message)
               .setPositiveButton(LocaleController.getString("OK", R.string.OK), null)
               .show();
       dlg.setCanceledOnTouchOutside(true);
       dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
           @Override
           public void onDismiss(DialogInterface dialog) {
               finish();
           }
       });
}
 
Example 5
Source File: VoIPActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void showErrorDialog(CharSequence message) {
    AlertDialog dlg = new DarkAlertDialog.Builder(VoIPActivity.this)
            .setTitle(LocaleController.getString("VoipFailed", R.string.VoipFailed))
            .setMessage(message)
            .setPositiveButton(LocaleController.getString("OK", R.string.OK), null)
            .show();
    dlg.setCanceledOnTouchOutside(true);
    dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            finish();
        }
    });
}
 
Example 6
Source File: VoIPActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void showErrorDialog(CharSequence message) {
    AlertDialog dlg = new DarkAlertDialog.Builder(VoIPActivity.this)
            .setTitle(LocaleController.getString("VoipFailed", R.string.VoipFailed))
            .setMessage(message)
            .setPositiveButton(LocaleController.getString("OK", R.string.OK), null)
            .show();
    dlg.setCanceledOnTouchOutside(true);
    dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            finish();
        }
    });
}