Commit a2789f299a757a7fceb6de2d7a40228f42e7d709
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/VLionSimple
Showing
8 changed files
with
166 additions
and
156 deletions
app/libs/vlionSdk1.0.jar
No preview for this file type
app/src/main/AndroidManifest.xml
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | </intent-filter> |
| 27 | 27 | </activity> |
| 28 | 28 | |
| 29 | - <receiver android:name="cn.vlion.ad.utils.apkdownload.DownloadCompleteReceiver"> | |
| 29 | + <receiver android:name="cn.vlion.ad.core.VLionReceiver"> | |
| 30 | 30 | <intent-filter> |
| 31 | 31 | <action android:name="android.intent.action.DOWNLOAD_COMPLETE" /> |
| 32 | 32 | </intent-filter> |
| ... | ... | @@ -36,6 +36,16 @@ |
| 36 | 36 | </intent-filter> |
| 37 | 37 | </receiver> |
| 38 | 38 | |
| 39 | + <provider | |
| 40 | + android:name="android.support.v4.content.FileProvider" | |
| 41 | + android:authorities="cn.vlion.ad.fileprovider" | |
| 42 | + android:exported="false" | |
| 43 | + android:grantUriPermissions="true"> | |
| 44 | + <meta-data | |
| 45 | + android:name="android.support.FILE_PROVIDER_PATHS" | |
| 46 | + android:resource="@xml/file_provider" /> | |
| 47 | + </provider> | |
| 48 | + | |
| 39 | 49 | <activity |
| 40 | 50 | android:name="cn.vlion.simple.BannerActivity" |
| 41 | 51 | android:configChanges="keyboardHidden|screenSize|orientation" | ... | ... |
app/src/main/java/cn/vlion/simple/BannerActivity.java
| ... | ... | @@ -2,12 +2,15 @@ package cn.vlion.simple; |
| 2 | 2 | |
| 3 | 3 | import android.os.Bundle; |
| 4 | 4 | import android.support.v7.app.AppCompatActivity; |
| 5 | +import android.util.Log; | |
| 6 | +import android.view.ViewGroup; | |
| 5 | 7 | import android.widget.RelativeLayout; |
| 6 | 8 | |
| 7 | 9 | import cn.vlion.ad.core.Config; |
| 8 | 10 | import cn.vlion.ad.moudle.banner.BannerManager; |
| 9 | 11 | import cn.vlion.ad.moudle.banner.BannerView; |
| 10 | 12 | import cn.vlion.ad.moudle.banner.BannerViewListener; |
| 13 | +import cn.vlion.simple.util.ScreenUtil; | |
| 11 | 14 | |
| 12 | 15 | public class BannerActivity extends AppCompatActivity { |
| 13 | 16 | |
| ... | ... | @@ -23,44 +26,46 @@ public class BannerActivity extends AppCompatActivity { |
| 23 | 26 | bannerContainer = (RelativeLayout) findViewById(R.id.bannerContainer); |
| 24 | 27 | |
| 25 | 28 | BannerManager.getInstance().setAdScalingModel(Config.AD_SCALING_MODE_SCALE_TO_FIT); |
| 26 | - | |
| 27 | - bannerView = BannerManager.getInstance().getBannerView(this, "350", new BannerViewListener() { | |
| 28 | - | |
| 29 | + //430 h5 | |
| 30 | + //431 image | |
| 31 | + bannerView = BannerManager.getInstance().getBannerView(this, "430", new BannerViewListener() { | |
| 29 | 32 | @Override |
| 30 | - public void onRequestFailed(int i, String s) { | |
| 31 | - | |
| 33 | + public void onRequestSuccess(int viewWidth, int viewHeight) { | |
| 34 | + Log.e(TAG, "onRequestSuccess: " + viewWidth + "," + viewHeight); | |
| 35 | + bannerContainer.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; | |
| 36 | + bannerContainer.getLayoutParams().height = ScreenUtil.getScreenWidth(BannerActivity.this) * viewHeight / viewWidth; | |
| 32 | 37 | } |
| 33 | 38 | |
| 34 | 39 | @Override |
| 35 | - public void onRequestSuccess(int i, int i1) { | |
| 36 | - | |
| 40 | + public void onRequestFailed(int code, String errorMsg) { | |
| 41 | + Log.e(TAG, "onRequestFailed" + code + " : " + errorMsg); | |
| 37 | 42 | } |
| 38 | 43 | |
| 39 | 44 | @Override |
| 40 | 45 | public void onShowSuccess() { |
| 41 | - | |
| 46 | + Log.e(TAG, "onShowSuccess"); | |
| 42 | 47 | } |
| 43 | 48 | |
| 44 | 49 | @Override |
| 45 | 50 | public void onSwitchBanner() { |
| 46 | - | |
| 51 | + Log.e(TAG, "onSwitchBanner"); | |
| 47 | 52 | } |
| 48 | 53 | |
| 49 | 54 | @Override |
| 50 | - public void onShowFailed(int i, String s) { | |
| 51 | - | |
| 55 | + public void onShowFailed(int code, String msg) { | |
| 56 | + Log.e(TAG, "onShowFailed: " + code + "," + msg); | |
| 52 | 57 | } |
| 53 | 58 | |
| 54 | 59 | @Override |
| 55 | 60 | public void onBannerClicked() { |
| 56 | - | |
| 61 | + Log.e(TAG, "onBannerClicked"); | |
| 57 | 62 | } |
| 58 | 63 | }); |
| 59 | 64 | |
| 60 | -// bannerView.setLayoutParams(new RelativeLayout.LayoutParams(300, 300)); | |
| 61 | 65 | bannerContainer.addView(bannerView); |
| 62 | 66 | } |
| 63 | 67 | |
| 68 | + | |
| 64 | 69 | @Override |
| 65 | 70 | protected void onPause() { |
| 66 | 71 | super.onPause(); | ... | ... |
app/src/main/java/cn/vlion/simple/SplashActivity.java
| ... | ... | @@ -72,7 +72,9 @@ public class SplashActivity extends AppCompatActivity { |
| 72 | 72 | SplashManager.getInstance().setAutoJumpToTargetWhenShowFailed(true); |
| 73 | 73 | SplashManager.getInstance().setSplashViewContainer(splashAdContainer); |
| 74 | 74 | SplashManager.getInstance().setAdScalingModel(Config.AD_SCALING_MODE_SCALE_TO_FIT); |
| 75 | - SplashManager.getInstance().showSplash(this, "353", new SplashViewListener() { | |
| 75 | + //432 h5 | |
| 76 | + //433 image | |
| 77 | + SplashManager.getInstance().showSplash(this, "432", new SplashViewListener() { | |
| 76 | 78 | |
| 77 | 79 | @Override |
| 78 | 80 | public void onRequestSuccess(int viewWidth, int viewHeight) { | ... | ... |
app/src/main/java/cn/vlion/simple/SpotActivity.java
| ... | ... | @@ -36,15 +36,16 @@ public class SpotActivity extends AppCompatActivity { |
| 36 | 36 | adLayout = (RelativeLayout) findViewById(R.id.adLayout); |
| 37 | 37 | |
| 38 | 38 | SpotManager.getInstance().setSpotViewContainer(spotAdContainer); |
| 39 | -// SpotManager.getInstance().setSplashViewContainerAndLayoutParams(splashContainer, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 600)); | |
| 40 | 39 | SpotManager.getInstance().setAdScalingModel(Config.AD_SCALING_MODE_SCALE_TO_FIT); |
| 41 | - SpotManager.getInstance().showSpot(this, "355",new SpotViewListener() { | |
| 40 | + //434 h5 | |
| 41 | + //438 image | |
| 42 | + SpotManager.getInstance().showSpot(this, "438", new SpotViewListener() { | |
| 42 | 43 | |
| 43 | 44 | @Override |
| 44 | 45 | public void onRequestSuccess(int viewWidth, int viewHeight, int closeViewHeight) { |
| 45 | 46 | Log.e(TAG, "onRequestSuccess: " + viewWidth + "," + viewHeight); |
| 46 | - spotAdContainer.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; | |
| 47 | - spotAdContainer.getLayoutParams().height = ScreenUtil.getScreenWidth(SpotActivity.this) * viewHeight / viewWidth + closeViewHeight; | |
| 47 | + spotAdContainer.getLayoutParams().width = 300; | |
| 48 | + spotAdContainer.getLayoutParams().height = 300 * viewHeight / viewWidth + closeViewHeight; | |
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | @Override | ... | ... |
app/src/main/java/cn/vlion/simple/util/PermissionHelper.java
| ... | ... | @@ -13,46 +13,25 @@ import android.support.v4.content.ContextCompat; |
| 13 | 13 | import android.util.Log; |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * Android 6.0 上权限分为<b>正常</b>和<b>危险</b>级别 | |
| 17 | - * <ul> | |
| 18 | - * <li>正常级别权限:开发者仅仅需要在AndroidManifext.xml上声明,那么应用就会被允许拥有该权限,如:android.permission.INTERNET</li> | |
| 19 | - * <li>危险级别权限:开发者需要在AndroidManifext.xml上声明,并且在运行时进行申请,而且用户允许了,应用才会被允许拥有该权限,如:android.permission.WRITE_EXTERNAL_STORAGE</li> | |
| 20 | - * </ul> | |
| 21 | - * 有米的以下权限需要在Android6.0上被允许,有米广告sdk才能正常工作,开发者需要在调用有米的任何代码之前,提前让用户允许权限 | |
| 22 | - * <ul> | |
| 23 | - * <li>必须申请的权限 | |
| 24 | - * <ul> | |
| 25 | - * <li>android.permission.READ_PHONE_STATE</li> | |
| 26 | - * <li>android.permission.WRITE_EXTERNAL_STORAGE</li> | |
| 27 | - * </ul> | |
| 28 | - * </li> | |
| 29 | - * <li>可选申请的权限 | |
| 30 | - * <ul> | |
| 31 | - * <li>android.permission.ACCESS_FINE_LOCATION</li> | |
| 32 | - * </ul> | |
| 33 | - * </li> | |
| 34 | - * </ul> | |
| 35 | - * Android 6.0+ 权限申请助手 | |
| 36 | - * | |
| 37 | - * @since 2016-01-12 | |
| 16 | + * sdk所需权限工具类 | |
| 38 | 17 | */ |
| 39 | 18 | public class PermissionHelper { |
| 40 | - | |
| 19 | + | |
| 41 | 20 | private static final String TAG = "PermissionHelper"; |
| 42 | - | |
| 21 | + | |
| 43 | 22 | /** |
| 44 | 23 | * 小tips:这里的int数值不能太大,否则不会弹出请求权限提示,测试的时候,改到1000就不会弹出请求了 |
| 45 | 24 | */ |
| 46 | 25 | private final static int READ_PHONE_STATE_CODE = 101; |
| 47 | - | |
| 26 | + | |
| 48 | 27 | private final static int WRITE_EXTERNAL_STORAGE_CODE = 102; |
| 49 | - | |
| 28 | + | |
| 50 | 29 | private final static int REQUEST_OPEN_APPLICATION_SETTINGS_CODE = 12345; |
| 51 | - | |
| 30 | + | |
| 52 | 31 | /** |
| 53 | - * 有米 Android SDK 所需要向用户申请的权限列表 | |
| 32 | + * Android SDK 所需要向用户申请的权限列表 | |
| 54 | 33 | */ |
| 55 | - private PermissionModel[] mPermissionModels = new PermissionModel[] { | |
| 34 | + private PermissionModel[] mPermissionModels = new PermissionModel[]{ | |
| 56 | 35 | new PermissionModel("电话", Manifest.permission.READ_PHONE_STATE, "我们需要读取手机信息的权限来标识您的身份", READ_PHONE_STATE_CODE), |
| 57 | 36 | new PermissionModel( |
| 58 | 37 | "存储空间", |
| ... | ... | @@ -61,19 +40,19 @@ public class PermissionHelper { |
| 61 | 40 | WRITE_EXTERNAL_STORAGE_CODE |
| 62 | 41 | ) |
| 63 | 42 | }; |
| 64 | - | |
| 43 | + | |
| 65 | 44 | private Activity mActivity; |
| 66 | - | |
| 45 | + | |
| 67 | 46 | private OnApplyPermissionListener mOnApplyPermissionListener; |
| 68 | - | |
| 47 | + | |
| 69 | 48 | public PermissionHelper(Activity activity) { |
| 70 | 49 | mActivity = activity; |
| 71 | 50 | } |
| 72 | - | |
| 51 | + | |
| 73 | 52 | public void setOnApplyPermissionListener(OnApplyPermissionListener onApplyPermissionListener) { |
| 74 | 53 | mOnApplyPermissionListener = onApplyPermissionListener; |
| 75 | 54 | } |
| 76 | - | |
| 55 | + | |
| 77 | 56 | /** |
| 78 | 57 | * 这里我们演示如何在Android 6.0+上运行时申请权限 |
| 79 | 58 | */ |
| ... | ... | @@ -81,7 +60,7 @@ public class PermissionHelper { |
| 81 | 60 | try { |
| 82 | 61 | for (final PermissionModel model : mPermissionModels) { |
| 83 | 62 | if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(mActivity, model.permission)) { |
| 84 | - ActivityCompat.requestPermissions(mActivity, new String[] { model.permission }, model.requestCode); | |
| 63 | + ActivityCompat.requestPermissions(mActivity, new String[]{model.permission}, model.requestCode); | |
| 85 | 64 | return; |
| 86 | 65 | } |
| 87 | 66 | } |
| ... | ... | @@ -92,7 +71,7 @@ public class PermissionHelper { |
| 92 | 71 | Log.e(TAG, "", e); |
| 93 | 72 | } |
| 94 | 73 | } |
| 95 | - | |
| 74 | + | |
| 96 | 75 | /** |
| 97 | 76 | * 对应Activity的 {@code onRequestPermissionsResult(...)} 方法 |
| 98 | 77 | * |
| ... | ... | @@ -102,85 +81,85 @@ public class PermissionHelper { |
| 102 | 81 | */ |
| 103 | 82 | public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { |
| 104 | 83 | switch (requestCode) { |
| 105 | - case READ_PHONE_STATE_CODE: | |
| 106 | - case WRITE_EXTERNAL_STORAGE_CODE: | |
| 107 | - // 如果用户不允许,我们视情况发起二次请求或者引导用户到应用页面手动打开 | |
| 108 | - if (PackageManager.PERMISSION_GRANTED != grantResults[0]) { | |
| 109 | - | |
| 110 | - // 二次请求,表现为:以前请求过这个权限,但是用户拒接了 | |
| 111 | - // 在二次请求的时候,会有一个“不再提示的”checkbox | |
| 112 | - // 因此这里需要给用户解释一下我们为什么需要这个权限,否则用户可能会永久不在激活这个申请 | |
| 113 | - // 方便用户理解我们为什么需要这个权限 | |
| 114 | - if (ActivityCompat.shouldShowRequestPermissionRationale(mActivity, permissions[0])) { | |
| 115 | - AlertDialog.Builder builder = new AlertDialog.Builder(mActivity).setTitle("权限申请") | |
| 116 | - .setMessage(findPermissionExplain | |
| 117 | - (permissions[0])).setPositiveButton( | |
| 118 | - "确定", | |
| 119 | - new DialogInterface.OnClickListener | |
| 120 | - () { | |
| 121 | - | |
| 122 | - @Override | |
| 123 | - public void onClick( | |
| 124 | - DialogInterface dialog, | |
| 125 | - int which) { | |
| 126 | - applyPermissions(); | |
| 127 | - } | |
| 128 | - } | |
| 129 | - ); | |
| 130 | - builder.setCancelable(false); | |
| 131 | - builder.show(); | |
| 132 | - } | |
| 133 | - // 到这里就表示已经是第3+次请求,而且此时用户已经永久拒绝了,这个时候,我们引导用户到应用权限页面,让用户自己手动打开 | |
| 134 | - else { | |
| 135 | - AlertDialog.Builder builder = new AlertDialog.Builder(mActivity).setTitle("权限申请") | |
| 136 | - .setMessage("请在打开的窗口的权限中开启" + | |
| 137 | - findPermissionName | |
| 138 | - (permissions[0]) + | |
| 139 | - "权限,以正常使用本应用") | |
| 140 | - .setPositiveButton( | |
| 141 | - "去设置", | |
| 142 | - new DialogInterface.OnClickListener | |
| 143 | - () { | |
| 144 | - | |
| 145 | - @Override | |
| 146 | - public void onClick( | |
| 147 | - DialogInterface dialog, | |
| 148 | - int which) { | |
| 149 | - openApplicationSettings( | |
| 150 | - REQUEST_OPEN_APPLICATION_SETTINGS_CODE); | |
| 151 | - } | |
| 152 | - } | |
| 153 | - ) | |
| 154 | - .setNegativeButton( | |
| 155 | - "取消", | |
| 156 | - new DialogInterface.OnClickListener | |
| 157 | - () { | |
| 158 | - @Override | |
| 159 | - public void onClick( | |
| 160 | - DialogInterface dialog, | |
| 161 | - int which) { | |
| 162 | - mActivity.finish(); | |
| 163 | - } | |
| 164 | - } | |
| 165 | - ); | |
| 166 | - builder.setCancelable(false); | |
| 167 | - builder.show(); | |
| 84 | + case READ_PHONE_STATE_CODE: | |
| 85 | + case WRITE_EXTERNAL_STORAGE_CODE: | |
| 86 | + // 如果用户不允许,我们视情况发起二次请求或者引导用户到应用页面手动打开 | |
| 87 | + if (PackageManager.PERMISSION_GRANTED != grantResults[0]) { | |
| 88 | + | |
| 89 | + // 二次请求,表现为:以前请求过这个权限,但是用户拒接了 | |
| 90 | + // 在二次请求的时候,会有一个“不再提示的”checkbox | |
| 91 | + // 因此这里需要给用户解释一下我们为什么需要这个权限,否则用户可能会永久不在激活这个申请 | |
| 92 | + // 方便用户理解我们为什么需要这个权限 | |
| 93 | + if (ActivityCompat.shouldShowRequestPermissionRationale(mActivity, permissions[0])) { | |
| 94 | + AlertDialog.Builder builder = new AlertDialog.Builder(mActivity).setTitle("权限申请") | |
| 95 | + .setMessage(findPermissionExplain | |
| 96 | + (permissions[0])).setPositiveButton( | |
| 97 | + "确定", | |
| 98 | + new DialogInterface.OnClickListener | |
| 99 | + () { | |
| 100 | + | |
| 101 | + @Override | |
| 102 | + public void onClick( | |
| 103 | + DialogInterface dialog, | |
| 104 | + int which) { | |
| 105 | + applyPermissions(); | |
| 106 | + } | |
| 107 | + } | |
| 108 | + ); | |
| 109 | + builder.setCancelable(false); | |
| 110 | + builder.show(); | |
| 111 | + } | |
| 112 | + // 到这里就表示已经是第3+次请求,而且此时用户已经永久拒绝了,这个时候,我们引导用户到应用权限页面,让用户自己手动打开 | |
| 113 | + else { | |
| 114 | + AlertDialog.Builder builder = new AlertDialog.Builder(mActivity).setTitle("权限申请") | |
| 115 | + .setMessage("请在打开的窗口的权限中开启" + | |
| 116 | + findPermissionName | |
| 117 | + (permissions[0]) + | |
| 118 | + "权限,以正常使用本应用") | |
| 119 | + .setPositiveButton( | |
| 120 | + "去设置", | |
| 121 | + new DialogInterface.OnClickListener | |
| 122 | + () { | |
| 123 | + | |
| 124 | + @Override | |
| 125 | + public void onClick( | |
| 126 | + DialogInterface dialog, | |
| 127 | + int which) { | |
| 128 | + openApplicationSettings( | |
| 129 | + REQUEST_OPEN_APPLICATION_SETTINGS_CODE); | |
| 130 | + } | |
| 131 | + } | |
| 132 | + ) | |
| 133 | + .setNegativeButton( | |
| 134 | + "取消", | |
| 135 | + new DialogInterface.OnClickListener | |
| 136 | + () { | |
| 137 | + @Override | |
| 138 | + public void onClick( | |
| 139 | + DialogInterface dialog, | |
| 140 | + int which) { | |
| 141 | + mActivity.finish(); | |
| 142 | + } | |
| 143 | + } | |
| 144 | + ); | |
| 145 | + builder.setCancelable(false); | |
| 146 | + builder.show(); | |
| 147 | + } | |
| 148 | + return; | |
| 168 | 149 | } |
| 169 | - return; | |
| 170 | - } | |
| 171 | - | |
| 172 | - // 到这里就表示用户允许了本次请求,我们继续检查是否还有待申请的权限没有申请 | |
| 173 | - if (isAllRequestedPermissionGranted()) { | |
| 174 | - if (mOnApplyPermissionListener != null) { | |
| 175 | - mOnApplyPermissionListener.onAfterApplyAllPermission(); | |
| 150 | + | |
| 151 | + // 到这里就表示用户允许了本次请求,我们继续检查是否还有待申请的权限没有申请 | |
| 152 | + if (isAllRequestedPermissionGranted()) { | |
| 153 | + if (mOnApplyPermissionListener != null) { | |
| 154 | + mOnApplyPermissionListener.onAfterApplyAllPermission(); | |
| 155 | + } | |
| 156 | + } else { | |
| 157 | + applyPermissions(); | |
| 176 | 158 | } |
| 177 | - } else { | |
| 178 | - applyPermissions(); | |
| 179 | - } | |
| 180 | - break; | |
| 159 | + break; | |
| 181 | 160 | } |
| 182 | 161 | } |
| 183 | - | |
| 162 | + | |
| 184 | 163 | /** |
| 185 | 164 | * 对应Activity的 {@code onActivityResult(...)} 方法 |
| 186 | 165 | * |
| ... | ... | @@ -190,18 +169,18 @@ public class PermissionHelper { |
| 190 | 169 | */ |
| 191 | 170 | public void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 192 | 171 | switch (requestCode) { |
| 193 | - case REQUEST_OPEN_APPLICATION_SETTINGS_CODE: | |
| 194 | - if (isAllRequestedPermissionGranted()) { | |
| 195 | - if (mOnApplyPermissionListener != null) { | |
| 196 | - mOnApplyPermissionListener.onAfterApplyAllPermission(); | |
| 172 | + case REQUEST_OPEN_APPLICATION_SETTINGS_CODE: | |
| 173 | + if (isAllRequestedPermissionGranted()) { | |
| 174 | + if (mOnApplyPermissionListener != null) { | |
| 175 | + mOnApplyPermissionListener.onAfterApplyAllPermission(); | |
| 176 | + } | |
| 177 | + } else { | |
| 178 | + mActivity.finish(); | |
| 197 | 179 | } |
| 198 | - } else { | |
| 199 | - mActivity.finish(); | |
| 200 | - } | |
| 201 | - break; | |
| 180 | + break; | |
| 202 | 181 | } |
| 203 | 182 | } |
| 204 | - | |
| 183 | + | |
| 205 | 184 | /** |
| 206 | 185 | * 判断是否所有的权限都被授权了 |
| 207 | 186 | * |
| ... | ... | @@ -215,12 +194,11 @@ public class PermissionHelper { |
| 215 | 194 | } |
| 216 | 195 | return true; |
| 217 | 196 | } |
| 218 | - | |
| 197 | + | |
| 219 | 198 | /** |
| 220 | 199 | * 打开应用设置界面 |
| 221 | 200 | * |
| 222 | 201 | * @param requestCode 请求码 |
| 223 | - * | |
| 224 | 202 | * @return |
| 225 | 203 | */ |
| 226 | 204 | private boolean openApplicationSettings(int requestCode) { |
| ... | ... | @@ -228,7 +206,7 @@ public class PermissionHelper { |
| 228 | 206 | Intent intent = |
| 229 | 207 | new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + mActivity.getPackageName())); |
| 230 | 208 | intent.addCategory(Intent.CATEGORY_DEFAULT); |
| 231 | - | |
| 209 | + | |
| 232 | 210 | // Android L 之后Activity的启动模式发生了一些变化 |
| 233 | 211 | // 如果用了下面的 Intent.FLAG_ACTIVITY_NEW_TASK ,并且是 startActivityForResult |
| 234 | 212 | // 那么会在打开新的activity的时候就会立即回调 onActivityResult |
| ... | ... | @@ -240,12 +218,11 @@ public class PermissionHelper { |
| 240 | 218 | } |
| 241 | 219 | return false; |
| 242 | 220 | } |
| 243 | - | |
| 221 | + | |
| 244 | 222 | /** |
| 245 | 223 | * 查找申请权限的解释短语 |
| 246 | 224 | * |
| 247 | 225 | * @param permission 权限 |
| 248 | - * | |
| 249 | 226 | * @return |
| 250 | 227 | */ |
| 251 | 228 | private String findPermissionExplain(String permission) { |
| ... | ... | @@ -258,12 +235,11 @@ public class PermissionHelper { |
| 258 | 235 | } |
| 259 | 236 | return null; |
| 260 | 237 | } |
| 261 | - | |
| 238 | + | |
| 262 | 239 | /** |
| 263 | 240 | * 查找申请权限的名称 |
| 264 | 241 | * |
| 265 | 242 | * @param permission 权限 |
| 266 | - * | |
| 267 | 243 | * @return |
| 268 | 244 | */ |
| 269 | 245 | private String findPermissionName(String permission) { |
| ... | ... | @@ -276,29 +252,29 @@ public class PermissionHelper { |
| 276 | 252 | } |
| 277 | 253 | return null; |
| 278 | 254 | } |
| 279 | - | |
| 255 | + | |
| 280 | 256 | private static class PermissionModel { |
| 281 | - | |
| 257 | + | |
| 282 | 258 | /** |
| 283 | 259 | * 权限名称 |
| 284 | 260 | */ |
| 285 | 261 | public String name; |
| 286 | - | |
| 262 | + | |
| 287 | 263 | /** |
| 288 | 264 | * 请求的权限 |
| 289 | 265 | */ |
| 290 | 266 | public String permission; |
| 291 | - | |
| 267 | + | |
| 292 | 268 | /** |
| 293 | 269 | * 解析为什么请求这个权限 |
| 294 | 270 | */ |
| 295 | 271 | public String explain; |
| 296 | - | |
| 272 | + | |
| 297 | 273 | /** |
| 298 | 274 | * 请求代码 |
| 299 | 275 | */ |
| 300 | 276 | public int requestCode; |
| 301 | - | |
| 277 | + | |
| 302 | 278 | public PermissionModel(String name, String permission, String explain, int requestCode) { |
| 303 | 279 | this.name = name; |
| 304 | 280 | this.permission = permission; |
| ... | ... | @@ -306,16 +282,16 @@ public class PermissionHelper { |
| 306 | 282 | this.requestCode = requestCode; |
| 307 | 283 | } |
| 308 | 284 | } |
| 309 | - | |
| 285 | + | |
| 310 | 286 | /** |
| 311 | 287 | * 权限申请事件监听 |
| 312 | 288 | */ |
| 313 | 289 | public interface OnApplyPermissionListener { |
| 314 | - | |
| 290 | + | |
| 315 | 291 | /** |
| 316 | 292 | * 申请所有权限之后的逻辑 |
| 317 | 293 | */ |
| 318 | 294 | void onAfterApplyAllPermission(); |
| 319 | 295 | } |
| 320 | - | |
| 296 | + | |
| 321 | 297 | } | ... | ... |
app/src/main/res/drawable/vlion_bg_jump.xml
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | <shape xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | 3 | android:shape="rectangle" |
| 4 | 4 | android:useLevel="false"> |
| 5 | - <solid android:color="#66000000" /> | |
| 5 | + <solid android:color="#2f000000" /> | |
| 6 | 6 | <corners |
| 7 | 7 | android:bottomLeftRadius="10dp" |
| 8 | 8 | android:bottomRightRadius="10dp" | ... | ... |
app/src/main/res/xml/file_provider.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<paths> | |
| 3 | + | |
| 4 | + <!-- | |
| 5 | + ## 说明 | |
| 6 | + | |
| 7 | + 这个文件为开发者适配Android 7.0系统以上才需要配置瑞狮的相关内容,如果没有兼容到的话,可以不管 | |
| 8 | + --> | |
| 9 | + | |
| 10 | + <cache-path | |
| 11 | + name="apk1" | |
| 12 | + path="." /> | |
| 13 | + <external-path | |
| 14 | + name="apk2" | |
| 15 | + path="." /> | |
| 16 | +</paths> | |
| 0 | 17 | \ No newline at end of file | ... | ... |