diff --git a/README.md b/README.md index df3cd9a..ca42de8 100755 --- a/README.md +++ b/README.md @@ -62,24 +62,24 @@ private void requestRuntime() { mRuntimeRequester = AnyPermission.with(this).runtime(1) .permissions(Manifest.permission.CAMERA, Manifest.permission.CALL_PHONE) - .onBeforeRequest(new OnPermissionProcess() { + .onBeforeRequest(new RequestInterceptor() { @Override - public void process(@NonNull final String permission, @NonNull final Processor processor) { + public void interceptor(@NonNull final String permission, @NonNull final Executor executor) { // TODO 在每个权限申请之前调用,多次回调。可弹窗向用户说明下面将进行某个权限的申请。 // processor有两个方法,必须调用其一,否则申请流程终止。 } }) - .onBeenDenied(new OnPermissionProcess() { + .onBeenDenied(new RequestInterceptor() { @Override - public void process(@NonNull final String permission, @NonNull final Processor processor) { + public void interceptor(@NonNull final String permission, @NonNull final Executor executor) { // TODO 在每个权限被拒后调用,多次回调。可弹窗向用户说明为什么需要该权限,否则用户可能在下次申请勾选不再提示。 // processor有两个方法,必须调用其一,否则申请流程终止。 } }) - .onGoSetting(new OnPermissionProcess() { + .onGoSetting(new RequestInterceptor() { @Override - public void process(@NonNull final String permission, @NonNull final Processor processor) { - // TODO 在每个权限永久被拒后调用(即用户勾选不再提示),多次回调。可弹窗引导用户前往设置打开权限,调用processor.next()会自动跳转设置。 + public void interceptor(@NonNull final String permission, @NonNull final Executor executor) { + // TODO 在每个权限永久被拒后调用(即用户勾选不再提示),多次回调。可弹窗引导用户前往设置打开权限,调用executor.execute()会自动跳转设置。 // processor有两个方法,必须调用其一,否则申请流程将终止。 } }) @@ -109,9 +109,9 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten ```java AnyPermission.with(this).install(apkFile) - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final File data, @NonNull final Processor processor) { + public void interceptor(@NonNull final File data, @NonNull final Executor executor) { // TODO 在安装应用之前如果没有授予未知应用安装权限,则会回调该方法,可在此项用户弹窗提示。 // processor有两个方法,必须调用其一,否则申请流程将终止。 } @@ -133,9 +133,9 @@ AnyPermission.with(this).install(apkFile) ```java AnyPermission.with(this).overlay() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void interceptor(@NonNull final Void data, @NonNull final Executor executor) { // TODO 在申请悬浮窗权限之前调用,可在此项用户弹窗提示。 // processor有两个方法,必须调用其一,否则申请流程将终止。 } @@ -157,9 +157,9 @@ AnyPermission.with(this).overlay() ```java AnyPermission.with(this).notificationShow() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void interceptor(@NonNull final Void data, @NonNull final Executor executor) { // TODO 在申请显示通知权限之前调用,可在此项用户弹窗提示。 // processor有两个方法,必须调用其一,否则申请流程将终止。 } @@ -181,9 +181,9 @@ AnyPermission.with(this).notificationShow() ```java AnyPermission.with(this).notificationAccess() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void interceptor(@NonNull final Void data, @NonNull final Executor executor) { // TODO 在申请访问通知权限之前调用,可在此项用户弹窗提示。 // processor有两个方法,必须调用其一,否则申请流程将终止。 } @@ -205,15 +205,15 @@ AnyPermission.with(this).notificationAccess() # API -## OnPermissionProcess +## RequestInterceptor 权限申请流程中回调,用于弹窗提醒用户。 ```java -void process(@NonNull final T data, @NonNull final Processor processor) +void interceptor(@NonNull final T data, @NonNull final Executor executor) ``` -## Processor +## Executor 控制流程的执行或取消。 @@ -221,7 +221,7 @@ void process(@NonNull final T data, @NonNull final Processor processor) /** * 继续流程 **/ -void next() +void execute() /** * 取消流程,即回调到申请失败 @@ -291,17 +291,17 @@ public RuntimeRequester permissions(String... permissions) /** * 每个权限申请之前的回调 **/ -public RuntimeRequester onBeforeRequest(OnPermissionProcess onBeforeRequest) +public RuntimeRequester onBeforeRequest(RequestInterceptor onBeforeRequest) /** * 每个权限被拒后的回调 **/ -public RuntimeRequester onBeenDenied(OnPermissionProcess onBeenDenied) +public RuntimeRequester onBeenDenied(RequestInterceptor onBeenDenied) /** * 每个权限被永久拒绝后的回调 **/ -public RuntimeRequester onGoSetting(OnPermissionProcess onGoSetting) +public RuntimeRequester onGoSetting(RequestInterceptor onGoSetting) /** * 开始申请 @@ -322,7 +322,7 @@ public void onActivityResult(int requestCode) /** * 未授予权限时,在跳转设置页面之前调用 **/ -public InstallRequester onWithoutPermission(OnPermissionProcess onWithoutPermission) +public InstallRequester onWithoutPermission(RequestInterceptor onWithoutPermission) /** * 开始申请 @@ -338,7 +338,7 @@ public Void start(final RequestListener listener) /** * 未授予权限时,在跳转设置页面之前调用 **/ -public OverlayRequester onWithoutPermission(OnPermissionProcess onWithoutPermission) +public OverlayRequester onWithoutPermission(RequestInterceptor onWithoutPermission) /** * 开始申请 @@ -354,7 +354,7 @@ public Void start(final RequestListener listener) /** * 未授予权限时,在跳转设置页面之前调用 **/ -public NotificationShowRequester onWithoutPermission(OnPermissionProcess onWithoutPermission) +public NotificationShowRequester onWithoutPermission(RequestInterceptor onWithoutPermission) /** * 开始申请 @@ -370,7 +370,7 @@ public Void start(final RequestListener listener) /** * 未授予权限时,在跳转设置页面之前调用 **/ -public NotificationAccessRequester onWithoutPermission(OnPermissionProcess onWithoutPermission) +public NotificationAccessRequester onWithoutPermission(RequestInterceptor onWithoutPermission) /** * 开始申请 diff --git a/anypermission/src/main/java/per/goweii/anypermission/AnyPermission.java b/anypermission/src/main/java/per/goweii/anypermission/AnyPermission.java index eb9bbcb..3ebef7e 100644 --- a/anypermission/src/main/java/per/goweii/anypermission/AnyPermission.java +++ b/anypermission/src/main/java/per/goweii/anypermission/AnyPermission.java @@ -10,6 +10,7 @@ import com.yanzhenjie.permission.runtime.Permission; import java.io.File; +import java.util.List; /** * 描述: diff --git a/anypermission/src/main/java/per/goweii/anypermission/InstallRequester.java b/anypermission/src/main/java/per/goweii/anypermission/InstallRequester.java index 7498c41..6a05715 100644 --- a/anypermission/src/main/java/per/goweii/anypermission/InstallRequester.java +++ b/anypermission/src/main/java/per/goweii/anypermission/InstallRequester.java @@ -20,14 +20,14 @@ public class InstallRequester implements Requester { private final Option mOption; private final File mApkFile; - private OnPermissionProcess mOnWithoutPermission = null; + private RequestInterceptor mOnWithoutPermission = null; InstallRequester(Option option, File apkFile) { this.mOption = option; this.mApkFile = apkFile; } - public InstallRequester onWithoutPermission(OnPermissionProcess onWithoutPermission) { + public InstallRequester onWithoutPermission(RequestInterceptor onWithoutPermission) { mOnWithoutPermission = onWithoutPermission; return this; } @@ -42,9 +42,9 @@ public void showRationale(Context c, File f, final RequestExecutor e) { if (mOnWithoutPermission == null) { e.execute(); } else { - mOnWithoutPermission.process(f, new OnPermissionProcess.Processor() { + mOnWithoutPermission.intercept(f, new RequestInterceptor.Executor() { @Override - public void next() { + public void execute() { e.execute(); } diff --git a/anypermission/src/main/java/per/goweii/anypermission/NotificationAccessRequester.java b/anypermission/src/main/java/per/goweii/anypermission/NotificationAccessRequester.java index 9918851..6621fc8 100644 --- a/anypermission/src/main/java/per/goweii/anypermission/NotificationAccessRequester.java +++ b/anypermission/src/main/java/per/goweii/anypermission/NotificationAccessRequester.java @@ -17,13 +17,13 @@ public class NotificationAccessRequester implements Requester { private final Option mOption; - private OnPermissionProcess mOnWithoutPermission = null; + private RequestInterceptor mOnWithoutPermission = null; NotificationAccessRequester(Option option) { this.mOption = option; } - public NotificationAccessRequester onWithoutPermission(OnPermissionProcess onWithoutPermission) { + public NotificationAccessRequester onWithoutPermission(RequestInterceptor onWithoutPermission) { mOnWithoutPermission = onWithoutPermission; return this; } @@ -37,9 +37,9 @@ public void showRationale(Context c, Void d, final RequestExecutor e) { if (mOnWithoutPermission == null) { e.execute(); } else { - mOnWithoutPermission.process(d, new OnPermissionProcess.Processor() { + mOnWithoutPermission.intercept(d, new RequestInterceptor.Executor() { @Override - public void next() { + public void execute() { e.execute(); } diff --git a/anypermission/src/main/java/per/goweii/anypermission/NotificationShowRequester.java b/anypermission/src/main/java/per/goweii/anypermission/NotificationShowRequester.java index 732e788..ff12610 100644 --- a/anypermission/src/main/java/per/goweii/anypermission/NotificationShowRequester.java +++ b/anypermission/src/main/java/per/goweii/anypermission/NotificationShowRequester.java @@ -17,13 +17,13 @@ public class NotificationShowRequester implements Requester { private final Option mOption; - private OnPermissionProcess mOnWithoutPermission = null; + private RequestInterceptor mOnWithoutPermission = null; NotificationShowRequester(Option option) { this.mOption = option; } - public NotificationShowRequester onWithoutPermission(OnPermissionProcess onWithoutPermission) { + public NotificationShowRequester onWithoutPermission(RequestInterceptor onWithoutPermission) { mOnWithoutPermission = onWithoutPermission; return this; } @@ -37,9 +37,9 @@ public void showRationale(Context c, Void d, final RequestExecutor e) { if (mOnWithoutPermission == null) { e.execute(); } else { - mOnWithoutPermission.process(d, new OnPermissionProcess.Processor() { + mOnWithoutPermission.intercept(d, new RequestInterceptor.Executor() { @Override - public void next() { + public void execute() { e.execute(); } diff --git a/anypermission/src/main/java/per/goweii/anypermission/OverlayRequester.java b/anypermission/src/main/java/per/goweii/anypermission/OverlayRequester.java index ddb8ec8..84e7c53 100644 --- a/anypermission/src/main/java/per/goweii/anypermission/OverlayRequester.java +++ b/anypermission/src/main/java/per/goweii/anypermission/OverlayRequester.java @@ -17,13 +17,13 @@ public class OverlayRequester implements Requester { private final Option mOption; - private OnPermissionProcess mOnWithoutPermission = null; + private RequestInterceptor mOnWithoutPermission = null; OverlayRequester(Option option) { this.mOption = option; } - public OverlayRequester onWithoutPermission(OnPermissionProcess onWithoutPermission) { + public OverlayRequester onWithoutPermission(RequestInterceptor onWithoutPermission) { mOnWithoutPermission = onWithoutPermission; return this; } @@ -37,9 +37,9 @@ public void showRationale(Context c, Void d, final RequestExecutor e) { if (mOnWithoutPermission == null) { e.execute(); } else { - mOnWithoutPermission.process(d, new OnPermissionProcess.Processor() { + mOnWithoutPermission.intercept(d, new RequestInterceptor.Executor() { @Override - public void next() { + public void execute() { e.execute(); } diff --git a/anypermission/src/main/java/per/goweii/anypermission/OnPermissionProcess.java b/anypermission/src/main/java/per/goweii/anypermission/RequestInterceptor.java similarity index 50% rename from anypermission/src/main/java/per/goweii/anypermission/OnPermissionProcess.java rename to anypermission/src/main/java/per/goweii/anypermission/RequestInterceptor.java index aaf1c73..f25452e 100644 --- a/anypermission/src/main/java/per/goweii/anypermission/OnPermissionProcess.java +++ b/anypermission/src/main/java/per/goweii/anypermission/RequestInterceptor.java @@ -8,12 +8,11 @@ * @author Cuizhen * @date 2019/3/16 */ -public interface OnPermissionProcess { - void process(@NonNull final T data, @NonNull final Processor processor); +public interface RequestInterceptor { + void intercept(@NonNull final T data, @NonNull final Executor executor); - interface Processor { - void next(); + interface Executor { + void execute(); void cancel(); } - } diff --git a/anypermission/src/main/java/per/goweii/anypermission/RuntimeRequester.java b/anypermission/src/main/java/per/goweii/anypermission/RuntimeRequester.java index 8d42d51..a3a20d7 100644 --- a/anypermission/src/main/java/per/goweii/anypermission/RuntimeRequester.java +++ b/anypermission/src/main/java/per/goweii/anypermission/RuntimeRequester.java @@ -28,9 +28,9 @@ public class RuntimeRequester implements Requester { private RequestListener mListener = null; - private OnPermissionProcess mOnBeforeRequest = null; - private OnPermissionProcess mOnBeenDenied = null; - private OnPermissionProcess mOnGoSetting = null; + private RequestInterceptor mOnBeforeRequest = null; + private RequestInterceptor mOnBeenDenied = null; + private RequestInterceptor mOnGoSetting = null; RuntimeRequester(Option option, Context context, int requestCodeWhenGoSetting) { this.mOption = option; @@ -43,17 +43,17 @@ public RuntimeRequester permissions(String... permissions) { return this; } - public RuntimeRequester onBeforeRequest(OnPermissionProcess onBeforeRequest) { + public RuntimeRequester onBeforeRequest(RequestInterceptor onBeforeRequest) { mOnBeforeRequest = onBeforeRequest; return this; } - public RuntimeRequester onBeenDenied(OnPermissionProcess onBeenDenied) { + public RuntimeRequester onBeenDenied(RequestInterceptor onBeenDenied) { mOnBeenDenied = onBeenDenied; return this; } - public RuntimeRequester onGoSetting(OnPermissionProcess onGoSetting) { + public RuntimeRequester onGoSetting(RequestInterceptor onGoSetting) { mOnGoSetting = onGoSetting; return this; } @@ -129,9 +129,9 @@ private void onBeforeRequest() { request(); return; } - mOnBeforeRequest.process(mUnGrantedPermissions.peek(), new OnPermissionProcess.Processor() { + mOnBeforeRequest.intercept(mUnGrantedPermissions.peek(), new RequestInterceptor.Executor() { @Override - public void next() { + public void execute() { request(); } @@ -147,9 +147,9 @@ private void onBeenDenied() { request(); return; } - mOnBeenDenied.process(mUnGrantedPermissions.peek(), new OnPermissionProcess.Processor() { + mOnBeenDenied.intercept(mUnGrantedPermissions.peek(), new RequestInterceptor.Executor() { @Override - public void next() { + public void execute() { request(); } @@ -165,9 +165,9 @@ private void onGoSetting() { setting(); return; } - mOnGoSetting.process(mUnGrantedPermissions.peek(), new OnPermissionProcess.Processor() { + mOnGoSetting.intercept(mUnGrantedPermissions.peek(), new RequestInterceptor.Executor() { @Override - public void next() { + public void execute() { setting(); } diff --git a/anypermission/src/main/java/per/goweii/anypermission/SettingRequester.java b/anypermission/src/main/java/per/goweii/anypermission/SettingRequester.java index 9b97df9..bc0d746 100644 --- a/anypermission/src/main/java/per/goweii/anypermission/SettingRequester.java +++ b/anypermission/src/main/java/per/goweii/anypermission/SettingRequester.java @@ -17,13 +17,13 @@ public class SettingRequester implements Requester { private final Option mOption; - private OnPermissionProcess mOnWithoutPermission = null; + private RequestInterceptor mOnWithoutPermission = null; SettingRequester(Option option) { this.mOption = option; } - public SettingRequester onWithoutPermission(OnPermissionProcess onWithoutPermission) { + public SettingRequester onWithoutPermission(RequestInterceptor onWithoutPermission) { mOnWithoutPermission = onWithoutPermission; return this; } @@ -38,9 +38,9 @@ public void showRationale(Context c, Void d, final RequestExecutor e) { if (mOnWithoutPermission == null) { e.execute(); } else { - mOnWithoutPermission.process(d, new OnPermissionProcess.Processor() { + mOnWithoutPermission.intercept(d, new RequestInterceptor.Executor() { @Override - public void next() { + public void execute() { e.execute(); } diff --git a/app/src/main/java/per/goweii/android/anypermission/TestActivity.java b/app/src/main/java/per/goweii/android/anypermission/TestActivity.java index af0ad1b..5550792 100644 --- a/app/src/main/java/per/goweii/android/anypermission/TestActivity.java +++ b/app/src/main/java/per/goweii/android/anypermission/TestActivity.java @@ -14,7 +14,7 @@ import per.goweii.anylayer.AnyLayer; import per.goweii.anypermission.AnyPermission; -import per.goweii.anypermission.OnPermissionProcess; +import per.goweii.anypermission.RequestInterceptor; import per.goweii.anypermission.RequestListener; import per.goweii.anypermission.RuntimeRequester; @@ -79,9 +79,9 @@ private void requestRuntime() { Manifest.permission.RECORD_AUDIO, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.SEND_SMS) - .onBeforeRequest(new OnPermissionProcess() { + .onBeforeRequest(new RequestInterceptor() { @Override - public void process(@NonNull final String permission, @NonNull final Processor processor) { + public void intercept(@NonNull final String permission, @NonNull final Executor executor) { AnyLayer.with(TestActivity.this) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -102,21 +102,21 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); } }) - .onBeenDenied(new OnPermissionProcess() { + .onBeenDenied(new RequestInterceptor() { @Override - public void process(@NonNull final String permission, @NonNull final Processor processor) { + public void intercept(@NonNull final String permission, @NonNull final Executor executor) { AnyLayer.with(TestActivity.this) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -137,21 +137,21 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); } }) - .onGoSetting(new OnPermissionProcess() { + .onGoSetting(new RequestInterceptor() { @Override - public void process(@NonNull final String permission, @NonNull final Processor processor) { + public void intercept(@NonNull final String permission, @NonNull final Executor executor) { AnyLayer.with(TestActivity.this) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -172,13 +172,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); @@ -199,9 +199,9 @@ public void onFailed() { private void requestInstall() { AnyPermission.with(this).install(new File(TestActivity.this.getCacheDir(), "1.apk")) - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final File data, @NonNull final Processor processor) { + public void intercept(@NonNull final File data, @NonNull final Executor executor) { AnyLayer.with(TestActivity.this) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -222,13 +222,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); @@ -249,9 +249,9 @@ public void onFailed() { private void requestOverlay() { AnyPermission.with(this).overlay() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void intercept(@NonNull final Void data, @NonNull final Executor executor) { AnyLayer.with(TestActivity.this) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -272,13 +272,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); @@ -299,9 +299,9 @@ public void onFailed() { private void requestSetting() { AnyPermission.with(this).setting() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void intercept(@NonNull final Void data, @NonNull final Executor executor) { AnyLayer.with(TestActivity.this) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -322,13 +322,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); @@ -349,9 +349,9 @@ public void onFailed() { private void requestNotificationShow() { AnyPermission.with(this).notificationShow() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void intercept(@NonNull final Void data, @NonNull final Executor executor) { AnyLayer.with(TestActivity.this) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -372,13 +372,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); @@ -399,9 +399,9 @@ public void onFailed() { private void requestNotificationAccess() { AnyPermission.with(this).notificationAccess() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void intercept(@NonNull final Void data, @NonNull final Executor executor) { AnyLayer.with(TestActivity.this) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -422,13 +422,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); diff --git a/app/src/main/java/per/goweii/android/anypermission/TestFragment.java b/app/src/main/java/per/goweii/android/anypermission/TestFragment.java index daa0a8c..2f32218 100644 --- a/app/src/main/java/per/goweii/android/anypermission/TestFragment.java +++ b/app/src/main/java/per/goweii/android/anypermission/TestFragment.java @@ -16,7 +16,7 @@ import per.goweii.anylayer.AnyLayer; import per.goweii.anypermission.AnyPermission; -import per.goweii.anypermission.OnPermissionProcess; +import per.goweii.anypermission.RequestInterceptor; import per.goweii.anypermission.RequestListener; import per.goweii.anypermission.RuntimeRequester; @@ -86,9 +86,9 @@ private void requestRuntime() { Manifest.permission.RECORD_AUDIO, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.SEND_SMS) - .onBeforeRequest(new OnPermissionProcess() { + .onBeforeRequest(new RequestInterceptor() { @Override - public void process(@NonNull final String permission, @NonNull final Processor processor) { + public void intercept(@NonNull final String permission, @NonNull final Executor executor) { AnyLayer.with(TestFragment.this.getContext()) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -109,21 +109,21 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); } }) - .onBeenDenied(new OnPermissionProcess() { + .onBeenDenied(new RequestInterceptor() { @Override - public void process(@NonNull final String permission, @NonNull final Processor processor) { + public void intercept(@NonNull final String permission, @NonNull final Executor executor) { AnyLayer.with(TestFragment.this.getContext()) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -144,21 +144,21 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); } }) - .onGoSetting(new OnPermissionProcess() { + .onGoSetting(new RequestInterceptor() { @Override - public void process(@NonNull final String permission, @NonNull final Processor processor) { + public void intercept(@NonNull final String permission, @NonNull final Executor executor) { AnyLayer.with(TestFragment.this.getContext()) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -179,13 +179,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); @@ -206,9 +206,9 @@ public void onFailed() { private void requestInstall() { AnyPermission.with(this).install(new File(TestFragment.this.getContext().getCacheDir(), "1.apk")) - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final File data, @NonNull final Processor processor) { + public void intercept(@NonNull final File data, @NonNull final Executor executor) { AnyLayer.with(TestFragment.this.getContext()) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -229,13 +229,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); @@ -256,9 +256,9 @@ public void onFailed() { private void requestOverlay() { AnyPermission.with(this).overlay() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void intercept(@NonNull final Void data, @NonNull final Executor executor) { AnyLayer.with(TestFragment.this.getContext()) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -279,13 +279,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); @@ -306,9 +306,9 @@ public void onFailed() { private void requestSetting() { AnyPermission.with(this).setting() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void intercept(@NonNull final Void data, @NonNull final Executor executor) { AnyLayer.with(TestFragment.this.getContext()) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -329,13 +329,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); @@ -356,9 +356,9 @@ public void onFailed() { private void requestNotificationShow() { AnyPermission.with(this).notificationShow() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void intercept(@NonNull final Void data, @NonNull final Executor executor) { AnyLayer.with(TestFragment.this.getContext()) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -379,13 +379,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show(); @@ -406,9 +406,9 @@ public void onFailed() { private void requestNotificationAccess() { AnyPermission.with(this).notificationAccess() - .onWithoutPermission(new OnPermissionProcess() { + .onWithoutPermission(new RequestInterceptor() { @Override - public void process(@NonNull final Void data, @NonNull final Processor processor) { + public void intercept(@NonNull final Void data, @NonNull final Executor executor) { AnyLayer.with(TestFragment.this.getContext()) .contentView(R.layout.dialog_runtime_before_request) .backgroundColorRes(R.color.dialog_bg) @@ -429,13 +429,13 @@ public void bind(AnyLayer anyLayer) { .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.next(); + executor.execute(); } }, R.id.tv_dialog_permission_next) .onClickToDismiss(new AnyLayer.OnLayerClickListener() { @Override public void onClick(AnyLayer anyLayer, View v) { - processor.cancel(); + executor.cancel(); } }, R.id.tv_dialog_permission_close) .show();