diff --git a/MissPermissionPro/jcenter.gradle b/MissPermissionPro/jcenter.gradle index 96c4b00..fbada70 100644 --- a/MissPermissionPro/jcenter.gradle +++ b/MissPermissionPro/jcenter.gradle @@ -12,7 +12,7 @@ publish { userOrg = 'bugyun' //bintray.com用户名 groupId = 'vip.ruoyun.permission' //jcenter group artifactId = 'miss-pro' //项目名称 name - publishVersion = '1.0.1'//版本号 version + publishVersion = '1.0.2'//版本号 version desc = 'Android 权限请求库 MissPermission pro版'//描述 website = 'https://github.com/bugyun/MissPermission' // github 网址 } diff --git a/MissPermissionPro/src/main/java/vip/ruoyun/permission/pro/MissPermission.java b/MissPermissionPro/src/main/java/vip/ruoyun/permission/pro/MissPermission.java index afb6fc2..7d432b8 100644 --- a/MissPermissionPro/src/main/java/vip/ruoyun/permission/pro/MissPermission.java +++ b/MissPermissionPro/src/main/java/vip/ruoyun/permission/pro/MissPermission.java @@ -14,15 +14,6 @@ public class MissPermission { - private static class SingletonHolder { - - private static final MissPermission INSTANCE = new MissPermission(); - } - - private static MissPermission getInstance() { - return SingletonHolder.INSTANCE; - } - private MissPermission() { } diff --git a/MissPermissionPro/src/main/java/vip/ruoyun/permission/pro/PermissionGroup.java b/MissPermissionPro/src/main/java/vip/ruoyun/permission/pro/PermissionGroup.java index c43b0f0..6a8f256 100644 --- a/MissPermissionPro/src/main/java/vip/ruoyun/permission/pro/PermissionGroup.java +++ b/MissPermissionPro/src/main/java/vip/ruoyun/permission/pro/PermissionGroup.java @@ -16,6 +16,7 @@ public class PermissionGroup { public final String permissionName; + public final int permissionIconRes; public PermissionGroup(String permissionName, int permissionIconRes) { @@ -30,12 +31,14 @@ public PermissionGroup(String permissionName, int permissionIconRes) { */ static { //CalendarChecker - PermissionGroup calendarGroup = new PermissionGroup(CalendarChecker.PERMISSION_NAME, CalendarChecker.PERMISSION_ICON_RES); + PermissionGroup calendarGroup = new PermissionGroup(CalendarChecker.PERMISSION_NAME, + CalendarChecker.PERMISSION_ICON_RES); permissionGroupHashMap.put(Manifest.permission.READ_CALENDAR, calendarGroup); permissionGroupHashMap.put(Manifest.permission.WRITE_CALENDAR, calendarGroup); //PhoneChecker - PermissionGroup phoneGroup = new PermissionGroup(PhoneChecker.PERMISSION_NAME, PhoneChecker.PERMISSION_ICON_RES); + PermissionGroup phoneGroup = new PermissionGroup(PhoneChecker.PERMISSION_NAME, + PhoneChecker.PERMISSION_ICON_RES); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { permissionGroupHashMap.put(Manifest.permission.READ_CALL_LOG, phoneGroup); permissionGroupHashMap.put(Manifest.permission.WRITE_CALL_LOG, phoneGroup); @@ -50,27 +53,32 @@ public PermissionGroup(String permissionName, int permissionIconRes) { permissionGroupHashMap.put(Manifest.permission.ADD_VOICEMAIL, phoneGroup); //CameraChecker - PermissionGroup cameraGroup = new PermissionGroup(CameraChecker.PERMISSION_NAME, CameraChecker.PERMISSION_ICON_RES); + PermissionGroup cameraGroup = new PermissionGroup(CameraChecker.PERMISSION_NAME, + CameraChecker.PERMISSION_ICON_RES); permissionGroupHashMap.put(Manifest.permission.CAMERA, cameraGroup); //ContactsChecker - PermissionGroup contactsGroup = new PermissionGroup(ContactsChecker.PERMISSION_NAME, ContactsChecker.PERMISSION_ICON_RES); + PermissionGroup contactsGroup = new PermissionGroup(ContactsChecker.PERMISSION_NAME, + ContactsChecker.PERMISSION_ICON_RES); permissionGroupHashMap.put(Manifest.permission.READ_CONTACTS, contactsGroup); permissionGroupHashMap.put(Manifest.permission.WRITE_CONTACTS, contactsGroup); permissionGroupHashMap.put(Manifest.permission.GET_ACCOUNTS, contactsGroup); //LocationChecker - PermissionGroup locationGroup = new PermissionGroup(LocationChecker.PERMISSION_NAME, LocationChecker.PERMISSION_ICON_RES); + PermissionGroup locationGroup = new PermissionGroup(LocationChecker.PERMISSION_NAME, + LocationChecker.PERMISSION_ICON_RES); permissionGroupHashMap.put(Manifest.permission.ACCESS_FINE_LOCATION, locationGroup); permissionGroupHashMap.put(Manifest.permission.ACCESS_COARSE_LOCATION, locationGroup); permissionGroupHashMap.put("android.permission.ACCESS_BACKGROUND_LOCATION", locationGroup); //MicrophoneChecker - PermissionGroup microphoneGroup = new PermissionGroup(MicrophoneChecker.PERMISSION_NAME, MicrophoneChecker.PERMISSION_ICON_RES); + PermissionGroup microphoneGroup = new PermissionGroup(MicrophoneChecker.PERMISSION_NAME, + MicrophoneChecker.PERMISSION_ICON_RES); permissionGroupHashMap.put(Manifest.permission.RECORD_AUDIO, microphoneGroup); //SensorsChecker - PermissionGroup sensorsGroup = new PermissionGroup(SensorsChecker.PERMISSION_NAME, SensorsChecker.PERMISSION_ICON_RES); + PermissionGroup sensorsGroup = new PermissionGroup(SensorsChecker.PERMISSION_NAME, + SensorsChecker.PERMISSION_ICON_RES); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { permissionGroupHashMap.put(Manifest.permission.BODY_SENSORS, sensorsGroup); } @@ -84,7 +92,8 @@ public PermissionGroup(String permissionName, int permissionIconRes) { permissionGroupHashMap.put(Manifest.permission.RECEIVE_MMS, smsGroup); //StorageChecker - PermissionGroup storageGroup = new PermissionGroup(StorageChecker.PERMISSION_NAME, StorageChecker.PERMISSION_ICON_RES); + PermissionGroup storageGroup = new PermissionGroup(StorageChecker.PERMISSION_NAME, + StorageChecker.PERMISSION_ICON_RES); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { permissionGroupHashMap.put(Manifest.permission.READ_EXTERNAL_STORAGE, storageGroup); } diff --git a/README.md b/README.md index 8a9ff83..b225c3f 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,15 @@ android 权限库,超级简单好用!! ![](https://github.com/bugyun/MissPermission/blob/master/art/down.png?raw=true) +## 版本变化 + +- 1.0.0 : 优化代码 +- 1.0.1 : 优化流程,增加真实检测权限方法,优化不必要的代码 +- 1.0.2 : 优化图片大小,体积减小50% + ### 配置 ```xml -implementation 'vip.ruoyun.permission:miss-pro:1.0.1' +implementation 'vip.ruoyun.permission:miss-pro:1.0.2' ``` ### 准备工作 @@ -194,11 +200,6 @@ public interface IAction extends AvoidOnResultHelper.ActivityCallback { } ``` - -## 版本变化 - -- 1.0.0 : 优化代码 - --- ## MissPermission diff --git a/app/build.gradle b/app/build.gradle index 335736e..3028246 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,7 +22,7 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:support-v4:28.0.0' - debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-3' + debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0' androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) @@ -31,6 +31,6 @@ dependencies { implementation 'vip.ruoyun.helper:screen-helper:1.0.2' testImplementation 'junit:junit:4.12' implementation project(':MissPermission') -// implementation project(':MissPermissionPro') - implementation 'vip.ruoyun.permission:miss-pro:1.0.1' + implementation project(':MissPermissionPro') +// implementation 'vip.ruoyun.permission:miss-pro:1.0.1' } diff --git a/app/src/main/java/com/ruoyun/permission/MainActivity.java b/app/src/main/java/com/ruoyun/permission/MainActivity.java index 60359da..7dded3c 100644 --- a/app/src/main/java/com/ruoyun/permission/MainActivity.java +++ b/app/src/main/java/com/ruoyun/permission/MainActivity.java @@ -42,19 +42,6 @@ protected void onCreate(Bundle savedInstanceState) { public void onClick(View v) { switch (v.getId()) { case R.id.buttonCamera: - if (MissPermission.check(this, SMSChecker.NEED_PERMISSION)) { - Log.e(TAG, "有权限"); - } else { - Log.e(TAG, "没有权限"); - } - - if (MissPermission.realCheck(this, Manifest.permission.READ_SMS)) { - Log.e(TAG, "有短信权限"); - - } else { - Log.e(TAG, "没有短信权限"); - } - MissPermission.with(this) // .permission(Manifest.permission.SEND_SMS)// // .permission(Manifest.permission.RECEIVE_SMS)// @@ -93,6 +80,18 @@ public void onFailure(PermissionRequest request) { break; case R.id.buttonAll: + if (MissPermission.check(this, SMSChecker.NEED_PERMISSION)) { + Log.e(TAG, "有权限"); + } else { + Log.e(TAG, "没有权限"); + } + + if (MissPermission.realCheck(this, Manifest.permission.READ_SMS)) { + Log.e(TAG, "有短信权限"); + + } else { + Log.e(TAG, "没有短信权限"); + } break; } }