Browse Source

修改权限弹出框消失的问题

xieshengqi 5 years ago
parent
commit
ab64f00c66

+ 1 - 0
app/src/main/AndroidManifest.xml

6
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
6
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
7
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
8
     <uses-permission android:name="android.permission.CALL_PHONE" />
8
     <uses-permission android:name="android.permission.CALL_PHONE" />
9
+    <uses-permission android:name="android.permission.CAMERA" />
9
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
10
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
10
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
11
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
11
     <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
12
     <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

+ 2 - 2
app/src/main/java/com/kuxuan/moneynote/SplashActivity.java

143
             boolean isOpenSplashAd = (boolean) SPUtil.get(this, Constant.System.SWITCH_SPLASH_AD, true);
143
             boolean isOpenSplashAd = (boolean) SPUtil.get(this, Constant.System.SWITCH_SPLASH_AD, true);
144
             if (isOpenSplashAd) {
144
             if (isOpenSplashAd) {
145
                 boolean isAD = (boolean) SPUtil.get(this, Constant.System.SWITCH_AD, true);
145
                 boolean isAD = (boolean) SPUtil.get(this, Constant.System.SWITCH_AD, true);
146
-                isAD = false;
147
                 if (isAD) {
146
                 if (isAD) {
148
                     //加载穿山甲开屏广告
147
                     //加载穿山甲开屏广告
149
                     //step2:创建TTAdNative对象
148
                     //step2:创建TTAdNative对象
170
         //获取保存的url
169
         //获取保存的url
171
         final String imageUrl = (String) SPUtil.get(this, Constant.System.IMAGE_URL, "");
170
         final String imageUrl = (String) SPUtil.get(this, Constant.System.IMAGE_URL, "");
172
         final String linkUrl = (String) SPUtil.get(this, Constant.System.LINK_URL, "");
171
         final String linkUrl = (String) SPUtil.get(this, Constant.System.LINK_URL, "");
172
+        final String title = (String) SPUtil.get(this, Constant.System.TITLE_URL, "标题");
173
         if(TextUtils.isEmpty(imageUrl)){
173
         if(TextUtils.isEmpty(imageUrl)){
174
             return;
174
             return;
175
         }
175
         }
195
                         //跳转链接
195
                         //跳转链接
196
                         isClickAd = true;
196
                         isClickAd = true;
197
                         Intent intent = new Intent(SplashActivity.this, WebviewActivity.class);
197
                         Intent intent = new Intent(SplashActivity.this, WebviewActivity.class);
198
-                        intent.putExtra(WebviewActivity.TITLE, "广告");
198
+                        intent.putExtra(WebviewActivity.TITLE, title);
199
                         intent.putExtra(WebviewActivity.URL, linkUrl);
199
                         intent.putExtra(WebviewActivity.URL, linkUrl);
200
                         startActivity(intent);
200
                         startActivity(intent);
201
 
201
 

+ 3 - 0
app/src/main/java/com/kuxuan/moneynote/common/Constant.java

60
         public static final String IMAGE_URL = "image_url_ad";
60
         public static final String IMAGE_URL = "image_url_ad";
61
         //自己广告的跳转链接
61
         //自己广告的跳转链接
62
         public static final String LINK_URL = "link_url_ad";
62
         public static final String LINK_URL = "link_url_ad";
63
+        //开屏自己广告位的标题
64
+        public static final String TITLE_URL = "title_url";
63
         //开屏广告位开关
65
         //开屏广告位开关
64
         public static final String SWITCH_SPLASH_AD = "switch_splash_ad";
66
         public static final String SWITCH_SPLASH_AD = "switch_splash_ad";
65
         //默认预算
67
         //默认预算
76
         public static final String CURRENT_GOLD = "current_gold";
78
         public static final String CURRENT_GOLD = "current_gold";
77
         //首页打开设置
79
         //首页打开设置
78
         public static final String SWITCH_SETTING = "switch_setting";
80
         public static final String SWITCH_SETTING = "switch_setting";
81
+
79
     }
82
     }
80
 
83
 
81
     /**
84
     /**

+ 6 - 0
app/src/main/java/com/kuxuan/moneynote/ui/activitys/MainActivity.java

200
         }
200
         }
201
         GoldManager.getInstance().getUserCoin();
201
         GoldManager.getInstance().getUserCoin();
202
         getSplashAd();
202
         getSplashAd();
203
+
203
     }
204
     }
204
 
205
 
205
     /**
206
     /**
243
                                     SPUtil.putAndApply(MyApplication.getInstance(), Constant.System.SWITCH_AD, false);
244
                                     SPUtil.putAndApply(MyApplication.getInstance(), Constant.System.SWITCH_AD, false);
244
                                     SPUtil.putAndApply(MyApplication.getInstance(), Constant.System.IMAGE_URL, adJson.getImg_url());
245
                                     SPUtil.putAndApply(MyApplication.getInstance(), Constant.System.IMAGE_URL, adJson.getImg_url());
245
                                     SPUtil.putAndApply(MyApplication.getInstance(), Constant.System.LINK_URL, adJson.getAdvert_url());
246
                                     SPUtil.putAndApply(MyApplication.getInstance(), Constant.System.LINK_URL, adJson.getAdvert_url());
247
+                                    SPUtil.putAndApply(MyApplication.getInstance(), Constant.System.TITLE_URL, adJson.getName());
246
                                 }
248
                                 }
247
                             }
249
                             }
248
 
250
 
893
                         Manifest.permission.WRITE_EXTERNAL_STORAGE,
895
                         Manifest.permission.WRITE_EXTERNAL_STORAGE,
894
                         Manifest.permission.READ_EXTERNAL_STORAGE,
896
                         Manifest.permission.READ_EXTERNAL_STORAGE,
895
                         Manifest.permission.CAMERA
897
                         Manifest.permission.CAMERA
898
+
896
                 )
899
                 )
897
                 .subscribe(new io.reactivex.functions.Consumer<Permission>() {
900
                 .subscribe(new io.reactivex.functions.Consumer<Permission>() {
898
                     @Override
901
                     @Override
899
                     public void accept(Permission permission) throws Exception {
902
                     public void accept(Permission permission) throws Exception {
900
                         if (permission.granted) {
903
                         if (permission.granted) {
901
                             // 用户已经同意该权限
904
                             // 用户已经同意该权限
905
+                            if (permission.name.equals("android.permission.READ_PHONE_STATE")) {
906
+                                getIMEI(MainActivity.this);
907
+                            }
902
 
908
 
903
 
909
 
904
                         } else if (permission.shouldShowRequestPermissionRationale) {
910
                         } else if (permission.shouldShowRequestPermissionRationale) {

+ 0 - 2
app/src/main/java/com/kuxuan/moneynote/ui/fragments/details/DetialFragment.java

1021
         }catch (Exception e){
1021
         }catch (Exception e){
1022
 
1022
 
1023
         }
1023
         }
1024
-
1025
-
1026
     }
1024
     }
1027
 
1025
 
1028
     @Override
1026
     @Override