ParkSangGwon / TedPermission

Easy check permission library for Android Marshmallow
1.74k stars 239 forks source link

Same key and also wrong key stored in bundle #73

Closed jayesh28589 closed 6 years ago

jayesh28589 commented 6 years ago

Hi,

In TedPermissionActivity on line number 240, 241

outState.putBoolean(EXTRA_SETTING_BUTTON, hasSettingButton); outState.putString(EXTRA_SETTING_BUTTON, deniedCloseButtonText);

You are adding boolean and string for the same key "EXTRA_SETTING_BUTTON", It should be EXTRA_DENIED_DIALOG_CLOSE_TEXT for deniedCloseButtonText in put extra on second line (line 241)

So I have one scenario in my app, even may be happen in everyapp.

suppose I am use this code for camera and read/write_external_storage Now when I request for permission, popup will be display for camera and read/write permission. Let's I allow only camera permission, at the same time I press home key and go to settings --> app --> permission and turn off the camera permission and allow read/write permission and open my app from recent apps menu in device.

In library version 2.0.3 it was crashed and I changed it to 2.1.0 and Now I get this issue.

Key setting_button expected Boolean but value was a java.lang.String. The default value true was returned. Attempt to cast generated internal exception:

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean at android.os.BaseBundle.getBoolean(BaseBundle.java:737) at com.gun0912.tedpermission.TedPermissionActivity.setupFromSavedInstanceState(TedPermissionActivity.java:90) at com.gun0912.tedpermission.TedPermissionActivity.onCreate(TedPermissionActivity.java:71) at android.app.Activity.performCreate(Activity.java:6662) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

ParkSangGwon commented 6 years ago

@jayesh28589 Thank you for your reporting. I fixed this code.