-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlin DSL #81
base: master
Are you sure you want to change the base?
Kotlin DSL #81
Conversation
2b86daa
to
f2199ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should pass the Travis build and modify the following.
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
@Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no reason to change indent.
Please revert it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad! Reverted it in last commit.
|
||
@SuppressWarnings("unchecked") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any lint error about this?
I don't know why this should be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now there is no lint error about it. I just don't like compile warnings. Removed it anyway.
The only thing lint complains about right now is an absence of a korean translation. I gave the one "powered" by Google Translate. Probably I will need your assist in translating text because I'm not sure that the current translation is correct.
@@ -64,30 +79,63 @@ protected void checkPermissions() { | |||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION); | |||
TedPermissionActivity.startActivity(context, intent, listener); | |||
TedPermissionBase.setFirstRequest(context,permissions); | |||
TedPermissionBase.setFirstRequest(context, permissionsAsStringArray()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about changing setFirstRequest(Context, String[])
to setFirstRequest(Context, List)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Also I decided to move stringListToStringArray
to ObjectUtils
class.
} | ||
|
||
protected void checkPermissions() { | ||
if (listener == null) { | ||
throw new IllegalArgumentException("You must setPermissionListener() on TedPermission"); | ||
} else if (ObjectUtils.isEmpty(permissions)) { | ||
} else if (permissions.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks changed to ObjectUtils.isEmpty(permissions)
.
It can be null.
return (T) this; | ||
} | ||
|
||
public T addSinglePermission(String permission) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about change naming to addPermission
?
(It's just a recommendation. This is also good.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your comment. I thought about it but I guess addPermissions
and addPermission
look too similar and it would be easy to mix them up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Thanks
SCREEN_ORIENTATION_SENSOR_PORTRAIT, | ||
SCREEN_ORIENTATION_REVERSE_LANDSCAPE, | ||
SCREEN_ORIENTATION_REVERSE_PORTRAIT, | ||
SCREEN_ORIENTATION_FULL_SENSOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks need to add followings.
- SCREEN_ORIENTATION_FULL_USER
- SCREEN_ORIENTATION_LOCKED
- SCREEN_ORIENTATION_USER_LANDSCAPE
- SCREEN_ORIENTATION_USER_PORTRAIT
ee4b8a1
to
445fb1f
Compare
Because of there is no test code in this project, I'll run code and reply. Thanks |
@lutsenko-yuriy |
@ParkSangGwon |
…method, so now you can add permissions in arguments of the method, not in body
a7f8e1e
to
84e17e7
Compare
|
||
public abstract class PermissionBuilder<T extends PermissionBuilder> { | ||
|
||
private static final String PREFS_NAME_PERMISSION = "PREFS_NAME_PERMISSION"; | ||
private static final String PREFS_IS_FIRST_REQUEST = "PREFS_IS_FIRST_REQUEST"; | ||
|
||
private PermissionListener listener; | ||
private String[] permissions; | ||
|
||
private final List<String> permissions = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should resolve crash reported on issue #114
String[] permissions
intofinal List<String> permissions
which should make code less error-proneObjectUtils
which also should make code less error-prone