|
|
@@ -0,0 +1,70 @@
|
|
|
+/*
|
|
|
+ * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
|
|
|
+ */
|
|
|
+package kr.co.zumo.app.lifeplus.view.command;
|
|
|
+
|
|
|
+import android.content.Context;
|
|
|
+import android.content.Intent;
|
|
|
+import android.net.Uri;
|
|
|
+import android.os.Build;
|
|
|
+import android.provider.Settings;
|
|
|
+
|
|
|
+import kr.co.zumo.app.lifeplus.model.Model;
|
|
|
+import kr.co.zumo.app.lifeplus.view.IView;
|
|
|
+import kr.co.zumo.app.lifeplus.view.presenter.Presenter;
|
|
|
+
|
|
|
+/**
|
|
|
+ * NotificationSettingCommand
|
|
|
+ * <pre>
|
|
|
+ * </pre>
|
|
|
+ *
|
|
|
+ * @author 민효동
|
|
|
+ * @version 1.0
|
|
|
+ * @history 민효동 [2018. 10. 29.] [최초 작성]
|
|
|
+ * @since 2018. 10. 29.
|
|
|
+ */
|
|
|
+public class NotificationSettingCommand extends Command {
|
|
|
+ private String packageName;
|
|
|
+ private int uid;
|
|
|
+
|
|
|
+ public NotificationSettingCommand(String packageName, int uid) {
|
|
|
+ this.packageName = packageName;
|
|
|
+ this.uid = uid;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void preExecute(Model model, IView view, Presenter presenter) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void execute(Model model, IView view, Presenter presenter) {
|
|
|
+ Intent intent = new Intent();
|
|
|
+ Context context = view.getActivity();
|
|
|
+ if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
|
|
|
+ intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
|
|
|
+ intent.putExtra("android.provider.extra.APP_PACKAGE", packageName);
|
|
|
+ }
|
|
|
+ else if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
|
+ intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
|
|
|
+ intent.putExtra("app_package", packageName);
|
|
|
+ intent.putExtra("app_uid", uid);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
|
+ intent.addCategory(Intent.CATEGORY_DEFAULT);
|
|
|
+ intent.setData(Uri.parse("package:" + packageName));
|
|
|
+ }
|
|
|
+ context.startActivity(intent);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void postExecute(Model model, IView view, Presenter presenter) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void dispose() {
|
|
|
+
|
|
|
+ }
|
|
|
+}
|