MyFragmentInside of me MyActivity. MyFragmentcontains Dialog, which is used as an explanatory for permissions. I used Animatorfor animation AlertDialog.
No, where in the code do I call Toast or Snackbar or something else. So I'm sure there is no toast interacting with the Android resolution view.
public void showPermissionExplainer() {
final View dialogView = View.inflate(getActivity(), R.layout.dialog_permission_explainer_view, null);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(dialogView);
final AlertDialog permissionExplainer = builder.create();
permissionExplainer.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialog) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
revealShow(dialogView, true, null, false);
else
permissionExplainer.dismiss();
}
});
dialogView.findViewById(R.id.btnNo).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
revealShow(dialogView, false, permissionExplainer, false);
else
permissionExplainer.dismiss();
}
});
dialogView.findViewById(R.id.btnContinue).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
revealShow(dialogView, false, permissionExplainer, true);
else
permissionExplainer.dismiss();
}
});
if (permissionExplainer.getWindow() != null)
permissionExplainer.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
permissionExplainer.show();
}
revealShow()where I animate the dialog and contains the method onAnimationEnd.
Further, I thought that animation might be a problem, since later the dialog is rejected. So, I asked for permission after completing the animation and viewing hidden and
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
dialog.dismiss();
view.setVisibility(View.INVISIBLE);
if(askForPermission) {
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Log.d(TAG, "run: Running after 1 sec");
requestPermissions(new String[]{Manifest.permission.READ_SMS}, MY_PERMISSIONS_REQUEST_READ_SMS);
}
}, 1000);
}
}
Unfortunately, this also did not solve the problem. Then I tried to delay the request for permissions that solved the problem, but only if I delay at least 2-3 seconds. With a 1 second delay, I still run into a problem.
: , ?
, ?