Search in sources :

Example 1 with PermissionRequest

use of permissions.dispatcher.PermissionRequest in project android-client by GenesisVision.

the class BaseFragment method showRationaleDialog.

protected void showRationaleDialog(String message, final PermissionRequest request) {
    AlertDialog rationaleDialog = new AlertDialog.Builder(getContext()).setPositiveButton(getString(R.string.allow), (dialog, which) -> request.proceed()).setNegativeButton(getString(R.string.deny), (dialog, which) -> request.cancel()).setCancelable(false).setMessage(message).show();
    rationaleDialog.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
    rationaleDialog.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) Color(android.graphics.Color) AlertDialog(android.support.v7.app.AlertDialog) TextView(android.widget.TextView) MvpAppCompatFragment(com.arellomobile.mvp.MvpAppCompatFragment) ContextCompat(android.support.v4.content.ContextCompat) R(vision.genesis.clientapp.R) View(android.view.View) PermissionRequest(permissions.dispatcher.PermissionRequest) Dialog(android.app.Dialog) BackButtonListener(vision.genesis.clientapp.ui.common.BackButtonListener) Snackbar(android.support.design.widget.Snackbar) DialogInterface(android.content.DialogInterface)

Example 2 with PermissionRequest

use of permissions.dispatcher.PermissionRequest in project android-client by GenesisVision.

the class BaseSwipeBackActivity method showRationaleDialog.

protected void showRationaleDialog(String message, final PermissionRequest request) {
    AlertDialog rationaleDialog = new AlertDialog.Builder(this).setPositiveButton(getString(R.string.allow), (dialog, which) -> request.proceed()).setNegativeButton(getString(R.string.deny), (dialog, which) -> request.cancel()).setCancelable(false).setMessage(message).show();
    rationaleDialog.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(ContextCompat.getColor(GenesisVisionApplication.INSTANCE, R.color.colorAccent));
    rationaleDialog.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(ContextCompat.getColor(GenesisVisionApplication.INSTANCE, R.color.colorAccent));
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) Bundle(android.os.Bundle) AlertDialog(androidx.appcompat.app.AlertDialog) SwipeBackActivityHelper(me.imid.swipebacklayout.lib.app.SwipeBackActivityHelper) SwipeBackLayout(me.imid.swipebacklayout.lib.SwipeBackLayout) R(vision.genesis.clientapp.R) PermissionRequest(permissions.dispatcher.PermissionRequest) Dialog(android.app.Dialog) ThemeUtil(vision.genesis.clientapp.utils.ThemeUtil) Utils(me.imid.swipebacklayout.lib.Utils) MvpAppCompatActivity(com.arellomobile.mvp.MvpAppCompatActivity) TextView(android.widget.TextView) View(android.view.View) GenesisVisionApplication(vision.genesis.clientapp.GenesisVisionApplication) SwipeBackActivityBase(me.imid.swipebacklayout.lib.app.SwipeBackActivityBase) ContextCompat(androidx.core.content.ContextCompat) Snackbar(com.google.android.material.snackbar.Snackbar) DialogInterface(android.content.DialogInterface)

Example 3 with PermissionRequest

use of permissions.dispatcher.PermissionRequest in project android-client by GenesisVision.

the class BaseFragment method showRationaleDialog.

protected void showRationaleDialog(String message, final PermissionRequest request, RationaleDialogCallback callback) {
    AlertDialog rationaleDialog = new AlertDialog.Builder(getContext()).setPositiveButton(getString(R.string.allow), (dialog, which) -> {
        request.proceed();
        if (callback != null) {
            callback.onPermissionAllowed();
        }
    }).setNegativeButton(getString(R.string.deny), (dialog, which) -> request.cancel()).setCancelable(false).setMessage(message).show();
    rationaleDialog.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
    rationaleDialog.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) TextView(android.widget.TextView) AlertDialog(androidx.appcompat.app.AlertDialog) MvpAppCompatFragment(com.arellomobile.mvp.MvpAppCompatFragment) R(vision.genesis.clientapp.R) View(android.view.View) PermissionRequest(permissions.dispatcher.PermissionRequest) Dialog(android.app.Dialog) BackButtonListener(vision.genesis.clientapp.ui.common.BackButtonListener) ThemeUtil(vision.genesis.clientapp.utils.ThemeUtil) ContextCompat(androidx.core.content.ContextCompat) Snackbar(com.google.android.material.snackbar.Snackbar) DialogInterface(android.content.DialogInterface)

Example 4 with PermissionRequest

use of permissions.dispatcher.PermissionRequest in project android-client by GenesisVision.

the class CreatePostActivity method showRationaleDialog.

protected void showRationaleDialog(String message, final PermissionRequest request) {
    AlertDialog rationaleDialog = new AlertDialog.Builder(this).setPositiveButton(getString(R.string.allow), (dialog, which) -> request.proceed()).setNegativeButton(getString(R.string.deny), (dialog, which) -> request.cancel()).setCancelable(false).setMessage(message).show();
    rationaleDialog.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(ContextCompat.getColor(GenesisVisionApplication.INSTANCE, R.color.colorAccent));
    rationaleDialog.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(ContextCompat.getColor(GenesisVisionApplication.INSTANCE, R.color.colorAccent));
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) PrimaryButton(vision.genesis.clientapp.ui.PrimaryButton) LinearLayout(android.widget.LinearLayout) Bundle(android.os.Bundle) ProgressBar(android.widget.ProgressBar) NonNull(androidx.annotation.NonNull) ImageView(android.widget.ImageView) R(vision.genesis.clientapp.R) PermissionRequest(permissions.dispatcher.PermissionRequest) OnClick(butterknife.OnClick) BindView(butterknife.BindView) Manifest(android.Manifest) OnPermissionDenied(permissions.dispatcher.OnPermissionDenied) StfalconImageViewer(com.stfalcon.imageviewer.StfalconImageViewer) OnNeverAskAgain(permissions.dispatcher.OnNeverAskAgain) View(android.view.View) ImageCropActivity(vision.genesis.clientapp.feature.common.image_crop.ImageCropActivity) ContextCompat(androidx.core.content.ContextCompat) SocialPostView(vision.genesis.clientapp.ui.SocialPostView) InjectPresenter(com.arellomobile.mvp.presenter.InjectPresenter) UUID(java.util.UUID) RuntimePermissions(permissions.dispatcher.RuntimePermissions) ViewGroup(android.view.ViewGroup) Timber(timber.log.Timber) List(java.util.List) TextView(android.widget.TextView) AutoCompleteGvAssetsView(vision.genesis.clientapp.ui.AutoCompleteGvAssetsView) Snackbar(com.google.android.material.snackbar.Snackbar) RxTextView(com.jakewharton.rxbinding.widget.RxTextView) Context(android.content.Context) AlertDialog(androidx.appcompat.app.AlertDialog) ButterKnife(butterknife.ButterKnife) OnShowRationale(permissions.dispatcher.OnShowRationale) Dialog(android.app.Dialog) Intent(android.content.Intent) ImageViewerOverlayView(vision.genesis.clientapp.ui.ImageViewerOverlayView) ThemeUtil(vision.genesis.clientapp.utils.ThemeUtil) InputMethodManager(android.view.inputmethod.InputMethodManager) MvpAppCompatActivity(com.arellomobile.mvp.MvpAppCompatActivity) ArrayList(java.util.ArrayList) GenesisVisionApplication(vision.genesis.clientapp.GenesisVisionApplication) DialogInterface(android.content.DialogInterface) Constants(vision.genesis.clientapp.utils.Constants) TypedValueFormatter(vision.genesis.clientapp.utils.TypedValueFormatter) File(java.io.File) NeedsPermission(permissions.dispatcher.NeedsPermission) Glide(com.bumptech.glide.Glide) NewPostImageView(vision.genesis.clientapp.ui.NewPostImageView) ScrollView(android.widget.ScrollView) PictureChooserBottomSheetFragment(vision.genesis.clientapp.feature.common.picture_chooser.PictureChooserBottomSheetFragment) ImageUtils(vision.genesis.clientapp.utils.ImageUtils) Activity(android.app.Activity) EditText(android.widget.EditText) NewPostImage(io.swagger.client.model.NewPostImage) Post(io.swagger.client.model.Post)

Aggregations

Dialog (android.app.Dialog)4 DialogInterface (android.content.DialogInterface)4 View (android.view.View)4 TextView (android.widget.TextView)4 PermissionRequest (permissions.dispatcher.PermissionRequest)4 AlertDialog (androidx.appcompat.app.AlertDialog)3 ContextCompat (androidx.core.content.ContextCompat)3 Snackbar (com.google.android.material.snackbar.Snackbar)3 R (vision.genesis.clientapp.R)3 Bundle (android.os.Bundle)2 MvpAppCompatActivity (com.arellomobile.mvp.MvpAppCompatActivity)2 MvpAppCompatFragment (com.arellomobile.mvp.MvpAppCompatFragment)2 BackButtonListener (vision.genesis.clientapp.ui.common.BackButtonListener)2 ThemeUtil (vision.genesis.clientapp.utils.ThemeUtil)2 Manifest (android.Manifest)1 Activity (android.app.Activity)1 Context (android.content.Context)1 Intent (android.content.Intent)1 Color (android.graphics.Color)1 Snackbar (android.support.design.widget.Snackbar)1