Commit 4fc59ba7850932a325827fd5f301df97cbc588ac

Authored by YangShuai
1 parent fbff357d

1 重构大众体育

Showing 31 changed files with 1275 additions and 48 deletions
app/strike/build.gradle
... ... @@ -160,7 +160,10 @@ dependencies {
160 160 implementation project(path: ':cloud:user')
161 161  
162 162 implementation project(path: ':core:imageload')
163   - compile project(path: ':module:xiaojiasoundbox')
  163 + implementation project(path: ':module:xiaojiasoundbox')
  164 + implementation project(path: ':module:pedometer')
  165 + implementation project(path: ':library_baidumap')
  166 +
164 167 // implementation project(path: ':core:util')
165 168 // implementation project(path: ':core:encipher')
166 169 // implementation project(path: ':cloud:user')
... ...
app/strike/src/main/java/com/cnlive/strike/MainActivity.java
... ... @@ -9,6 +9,8 @@ import android.util.AttributeSet;
9 9 import android.util.Log;
10 10 import android.view.View;
11 11  
  12 +import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity;
  13 +import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity;
12 14 import com.cnlive.strike.demo.activity.DemoActivity;
13 15 import com.cnlive.strike.imgutil.ImgActivity;
14 16 import com.cnlive.strike.user.ui.activity.LoginActivity;
... ... @@ -28,7 +30,7 @@ public class MainActivity extends AppCompatActivity {
28 30 findViewById(R.id.go_to).setOnClickListener(new View.OnClickListener() {
29 31 @Override
30 32 public void onClick(View v) {
31   - startActivity(new Intent(MainActivity.this, DemoActivity.class));
  33 + startActivity(new Intent(MainActivity.this, RunLineActivity.class));
32 34 // finish();
33 35 }
34 36 });
... ...
app/strike/src/main/java/com/cnlive/strike/MyActivity.java
... ... @@ -5,6 +5,8 @@ import android.content.Intent;
5 5 import android.text.TextUtils;
6 6  
7 7 import com.cnlive.core.libs.base.frame.activity.BaseActivity;
  8 +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo;
  9 +import com.cnlive.moudle.pedometer.ui.activity.RunLineActivity;
8 10 import com.cnlive.strike.user.auth.UserService;
9 11 import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo;
10 12 import com.cnlive.strike.xiaojiaspeaker.ui.activity.AllDeviceActivity;
... ... @@ -21,7 +23,7 @@ public class MyActivity extends BaseActivity {
21 23 protected void initView() {
22 24 // getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new MyFragment()).commitAllowingStateLoss();
23 25 initXiaoJiaSoundBoxData();
24   - startActivity(new Intent(MyActivity.this,AllDeviceActivity.class));
  26 + startActivity(new Intent(MyActivity.this, RunLineActivity.class));
25 27 }
26 28  
27 29 @Override
... ... @@ -49,5 +51,8 @@ public class MyActivity extends BaseActivity {
49 51 if (!TextUtils.isEmpty(UserService.getInstance(this).getAppAccount().getNickName())) {
50 52 XiaoJIaCommInfo.setUserNickName(this, UserService.getInstance(this).getAppAccount().getNickName());
51 53 }
  54 + if (null != UserService.getInstance(this).getAppAccount().getMobile() && !TextUtils.isEmpty(UserService.getInstance(this).getAppAccount().getMobile())) {
  55 + CommonInfo.setUserInfo(this, UserService.getUid(this), UserService.getInstance(this).getAppAccount().getNickName(), UserService.getInstance(this).getAppAccount().getFaceUrl(), UserService.getInstance(this).getAppAccount().getMobile());
  56 + }
52 57 }
53 58 }
... ...
app/strike/src/main/java/com/cnlive/strike/MyApp.java
... ... @@ -3,8 +3,11 @@ package com.cnlive.strike;
3 3 import android.app.Application;
4 4  
5 5 import com.alibaba.android.arouter.launcher.ARouter;
  6 +import com.baidu.mapapi.CoordType;
  7 +import com.baidu.mapapi.SDKInitializer;
6 8 import com.cnlive.core.libs.base.application.AppConfig;
7 9 import com.cnlive.core.libs.base.application.BaseApplication;
  10 +import com.cnlive.moudle.pedometer.model.Constant;
8 11  
9 12 public class MyApp extends BaseApplication {
10 13 @Override
... ... @@ -12,12 +15,22 @@ public class MyApp extends BaseApplication {
12 15 super.onCreate();
13 16 AppConfig.init(this, BuildConfig.APP_ID, BuildConfig.APP_KEY,
14 17 BuildConfig.APP_SCERET, BuildConfig.SPECIAL_GROUP_MEMBER_LIMIT,
15   - BuildConfig.VERSION_AS_DEBUG, "", "",
  18 + BuildConfig.VERSION_AS_DEBUG, BuildConfig.BAIDU_MAP_APP_KEY, "",
16 19 "10514333", "",
17 20 "", "", "",
18 21 "", "", "",
19 22 BuildConfig.BAIDU_MAP_APP_KEY, "");
20 23 initARouter();
  24 + if (AppConfig.isDebug()) {
  25 + Constant.SERVICE_ID = 213511;
  26 + } else {
  27 + Constant.SERVICE_ID = 214690;
  28 + }
  29 + //在使用SDK各组件之前初始化context信息,传入ApplicationContext
  30 + SDKInitializer.initialize(getApplicationContext());
  31 + //自4.3.0起,百度地图SDK所有接口均支持百度坐标和国测局坐标,用此方法设置您使用的坐标类型.
  32 + //包括BD09LL和GCJ02两种坐标,默认是BD09LL坐标。
  33 + SDKInitializer.setCoordType(CoordType.GCJ02);
21 34 }
22 35  
23 36  
... ...
app/strike/src/main/res/values/styles.xml
... ... @@ -2,7 +2,7 @@
2 2  
3 3 <!-- Base application theme. -->
4 4 <style name="AppTheme" parent="QMUI.Compat.NoActionBar">
5   - <item name="android:windowIsTranslucent">true</item>
  5 +
6 6 <!-- Customize your theme here. -->
7 7 <item name="colorPrimary">@color/colorPrimary</item>
8 8 <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
... ...
build.gradle
... ... @@ -146,6 +146,7 @@ task clean(type: Delete) {
146 146  
147 147 //配置全局变量
148 148 ext {
  149 + compileSdkVersion=29
149 150 libEmoj = '2.0.9'
150 151 libMediaPicker = '1.5.8'
151 152 // loading动画
... ... @@ -155,4 +156,13 @@ ext {
155 156 //动画大全
156 157 viewAnimationsEasing='2.0@aar'
157 158 viewAnimationsAndroid='2.3@aar'
  159 + libLargeImage = '1.0.1'
  160 + //SmartRefresh
  161 + SmartRefreshLayout = '1.1.0-alpha-1'
  162 + SmartRefreshHeader = '1.1.0-alpha-1'
  163 + TimePickerDialog = '1.0.1'
  164 +// libVideoQiniu = '1.0.6'
  165 + //七牛
  166 + qiniuAndroidSdk = '7.3.11'
  167 + libUpload = '2.0.6'
158 168 }
... ...
cloud/user/src/main/java/com/cnlive/strike/user/frame/presenter/QuickLoginPresenter.java
... ... @@ -164,9 +164,9 @@ public class QuickLoginPresenter extends BasePresenter&lt;QuickLoginView&gt; {
164 164 } else {
165 165 //友盟账号登录统计,暂时只有平台登录,后续对接三方登录
166 166 // MobclickAgent.onProfileSignIn("CNLive", user.getUid());
167   -// ifViewAttached(view -> view.showMainView(false, false));
  167 + ifViewAttached(view -> view.showMainView(false, false));
168 168 //todo 测试首次用户
169   - ifViewAttached(view -> view.showEditView(false));
  169 +// ifViewAttached(view -> view.showEditView(false));
170 170 }
171 171 AppConfig.setCountryCode("");
172 172 AppConfig.setVerificationCode("");
... ...
cloud/user/src/main/java/com/cnlive/strike/user/frame/view/QuickLoginView.java
... ... @@ -208,7 +208,6 @@ public class QuickLoginView extends BaseView {
208 208 successInfo.setClickAd(fragment.clickAd);
209 209 successInfo.setTagShare(fragment.tagShare);
210 210 successInfo.setTagMsg(fragment.tagMsg);
211   -
212 211 if (isNewUser) {
213 212 // HelperUtil.isNewUser(fragment.getActivity(), successInfo, isHasOtherUserInfo);
214 213 } else {
... ...
config.gradle
... ... @@ -18,7 +18,7 @@ ext {
18 18  
19 19 moudle = [
20 20 //用户
21   -// cloud_user: project(':cloud:user'),
  21 + core_network: project(':core:network'),
22 22 //基础库
23 23 core_base: project(':core:base')
24 24  
... ...
core/base/src/main/java/com/cnlive/core/libs/base/frame/activity/BaseActivity.java
... ... @@ -88,7 +88,7 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
88 88 private OnPermissionResponseListener onPermissionResponseListener; //权限申请回调
89 89 private int DEFAULT_REQUEST_CODE_PERMISSION = 0x00099;//默认权限请求码
90 90 private int USER_SET_REQUEST_CODE_PERMISSION = -0x00099;//用户设置的权限请求码
91   - private String defaultDefinePermissionTip = "需要必要的权限才可以正常使用该功能,您已拒绝获得该权限。\n如果需要重新授权,您可以点击“允许”按钮进入系统设置进行授权";//默认拒绝的权限提示语
  91 + private String defaultDefinePermissionTip = "需要必要的权限才可以正常使用该功能,您已拒绝获得该权限。\n如果需要重新授权,您可以点击“设置”按钮进入系统设置进行授权";//默认拒绝的权限提示语
92 92 private String userSetDefinePermissionTip = "";//用户设置的权限提示语
93 93 // private SwipeBackActivityHelper mHelper;//侧滑返回
94 94 private boolean isOpenSwipBack = false;
... ... @@ -96,6 +96,9 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
96 96 private final SupportActivityDelegate mDelegate = new SupportActivityDelegate(this);
97 97 //fragment侧滑
98 98 private final SwipeBackActivityDelegate mSwipeDelegate = new SwipeBackActivityDelegate(this);
  99 + private boolean isDefinePermissionCloseActivity = false;
  100 + private boolean isUserClickAllowBtn = false;//用户是否点击允许按钮
  101 + private String[] userSetPermission;
99 102  
100 103 @Override
101 104 protected void onCreate(@Nullable Bundle savedInstanceState) {
... ... @@ -264,6 +267,25 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
264 267 imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
265 268 }
266 269  
  270 + @Override
  271 + protected void onResume() {
  272 + super.onResume();
  273 + if (isUserClickAllowBtn) {
  274 + isUserClickAllowBtn = false;
  275 + int requestCode = DEFAULT_REQUEST_CODE_PERMISSION;
  276 + String tip = defaultDefinePermissionTip;
  277 + if (null != onPermissionResponseListener && null != userSetPermission) {
  278 + if (null != userSetDefinePermissionTip) {
  279 + tip = userSetDefinePermissionTip;
  280 + }
  281 + if (-0x00099 != USER_SET_REQUEST_CODE_PERMISSION) {
  282 + requestCode = USER_SET_REQUEST_CODE_PERMISSION;
  283 + }
  284 + //开始请求
  285 + requestPermission(requestCode, tip, isDefinePermissionCloseActivity, userSetPermission, onPermissionResponseListener);
  286 + }
  287 + }
  288 + }
267 289  
268 290 @Override
269 291 protected void onDestroy() {
... ... @@ -272,6 +294,9 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
272 294 if (null != baseBinding) {
273 295 baseBinding.unbind();
274 296 }
  297 + onPermissionResponseListener = null;
  298 + userSetPermission = null;
  299 + userSetDefinePermissionTip = null;
275 300 //activity管理
276 301 AppManager.getInstance().deleteActivity(me);
277 302 //清除当前订阅
... ... @@ -407,7 +432,12 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
407 432  
408 433 @Override
409 434 public void finish() {
410   - AppManager.getInstance().killActivity(me);
  435 + //先判断当前activity是否有多个fragment
  436 + if (getSupportFragmentManager().getBackStackEntryCount() > 1) {
  437 + pop();
  438 + } else {
  439 + AppManager.getInstance().killActivity(me);
  440 + }
411 441 }
412 442  
413 443 public void finishActivity() {
... ... @@ -450,10 +480,35 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
450 480 * @param permissions 请求的权限
451 481 * @param onPermissionResponseListener 回调监听器
452 482 */
453   - public void requestPermission(String[] permissions, String defineTip, OnPermissionResponseListener
  483 + public void requestPermission(boolean isDefineActivity, String[] permissions, OnPermissionResponseListener
  484 + onPermissionResponseListener) {
  485 + this.onPermissionResponseListener = onPermissionResponseListener;
  486 + isDefinePermissionCloseActivity = isDefineActivity;
  487 + if (checkPermissions(permissions)) {
  488 + if (onPermissionResponseListener != null) {
  489 + onPermissionResponseListener.onSuccess(permissions);
  490 + }
  491 + } else {
  492 + List<String> needPermissions = getDeniedPermissions(permissions);
  493 + ActivityCompat.requestPermissions(this, needPermissions.toArray(new String[needPermissions.size()]), DEFAULT_REQUEST_CODE_PERMISSION);
  494 + }
  495 + }
  496 +
  497 + /**
  498 + * 请求权限
  499 + * <p>
  500 + * 警告:此处除了用户拒绝外,唯一可能出现无法获取权限或失败的情况是在AndroidManifest.xml中未声明权限信息
  501 + * Android6.0+即便需要动态请求权限(重点)但不代表着不需要在AndroidManifest.xml中进行声明。
  502 + *
  503 + * @param permissions 请求的权限
  504 + * @param onPermissionResponseListener 回调监听器
  505 + */
  506 + public void requestPermission(String defineTip, boolean isDefineActivity, String[] permissions, OnPermissionResponseListener
454 507 onPermissionResponseListener) {
  508 + this.isDefinePermissionCloseActivity = isDefineActivity;
455 509 this.userSetDefinePermissionTip = defineTip;
456 510 this.onPermissionResponseListener = onPermissionResponseListener;
  511 + this.userSetPermission = permissions;
457 512 if (checkPermissions(permissions)) {
458 513 if (onPermissionResponseListener != null) {
459 514 onPermissionResponseListener.onSuccess(permissions);
... ... @@ -465,6 +520,51 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
465 520 }
466 521  
467 522 /**
  523 + * 请求权限
  524 + * <p>
  525 + * 警告:此处除了用户拒绝外,唯一可能出现无法获取权限或失败的情况是在AndroidManifest.xml中未声明权限信息
  526 + * Android6.0+即便需要动态请求权限(重点)但不代表着不需要在AndroidManifest.xml中进行声明。
  527 + *
  528 + * @param permissions 请求的权限
  529 + * @param onPermissionResponseListener 回调监听器
  530 + */
  531 + public void requestPermission(String defineTip, String[] permissions, OnPermissionResponseListener
  532 + onPermissionResponseListener) {
  533 + this.userSetDefinePermissionTip = defineTip;
  534 + this.onPermissionResponseListener = onPermissionResponseListener;
  535 + if (checkPermissions(permissions)) {
  536 + if (onPermissionResponseListener != null) {
  537 + onPermissionResponseListener.onSuccess(permissions);
  538 + }
  539 + } else {
  540 + List<String> needPermissions = getDeniedPermissions(permissions);
  541 + ActivityCompat.requestPermissions(this, needPermissions.toArray(new String[needPermissions.size()]), DEFAULT_REQUEST_CODE_PERMISSION);
  542 + }
  543 + }
  544 +
  545 + /**
  546 + * 自定义权限申请码
  547 + *
  548 + * @param requestCode
  549 + * @param permissions
  550 + * @param onPermissionResponseListener
  551 + */
  552 + public void requestPermission(int requestCode, boolean isDefineActivity, String[]
  553 + permissions, OnPermissionResponseListener onPermissionResponseListener) {
  554 + this.onPermissionResponseListener = onPermissionResponseListener;
  555 + this.USER_SET_REQUEST_CODE_PERMISSION = requestCode;
  556 + this.isDefinePermissionCloseActivity = isDefineActivity;
  557 + if (checkPermissions(permissions)) {
  558 + if (onPermissionResponseListener != null) {
  559 + onPermissionResponseListener.onSuccess(permissions);
  560 + }
  561 + } else {
  562 + List<String> needPermissions = getDeniedPermissions(permissions);
  563 + ActivityCompat.requestPermissions(this, needPermissions.toArray(new String[needPermissions.size()]), USER_SET_REQUEST_CODE_PERMISSION);
  564 + }
  565 + }
  566 +
  567 + /**
468 568 * 自定义权限申请码
469 569 *
470 570 * @param requestCode
... ... @@ -492,6 +592,29 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
492 592 * @param permissions
493 593 * @param onPermissionResponseListener
494 594 */
  595 + public void requestPermission(int requestCode, String defineTip, boolean isDefineActivity, String[]
  596 + permissions, OnPermissionResponseListener onPermissionResponseListener) {
  597 + this.onPermissionResponseListener = onPermissionResponseListener;
  598 + this.USER_SET_REQUEST_CODE_PERMISSION = requestCode;
  599 + this.isDefinePermissionCloseActivity = isDefineActivity;
  600 + this.userSetDefinePermissionTip = defineTip;
  601 + if (checkPermissions(permissions)) {
  602 + if (onPermissionResponseListener != null) {
  603 + onPermissionResponseListener.onSuccess(permissions);
  604 + }
  605 + } else {
  606 + List<String> needPermissions = getDeniedPermissions(permissions);
  607 + ActivityCompat.requestPermissions(this, needPermissions.toArray(new String[needPermissions.size()]), USER_SET_REQUEST_CODE_PERMISSION);
  608 + }
  609 + }
  610 +
  611 + /**
  612 + * 自定义权限申请码和提示信息
  613 + *
  614 + * @param requestCode
  615 + * @param permissions
  616 + * @param onPermissionResponseListener
  617 + */
495 618 public void requestPermission(int requestCode, String defineTip, String[]
496 619 permissions, OnPermissionResponseListener onPermissionResponseListener) {
497 620 this.onPermissionResponseListener = onPermissionResponseListener;
... ... @@ -515,6 +638,30 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
515 638 * @param permissions
516 639 * @param onPermissionResponseListener
517 640 */
  641 + public void requestPermission(int requestCode, @StringRes int defineTip, boolean isDefineActivity, String[]
  642 + permissions, OnPermissionResponseListener onPermissionResponseListener) {
  643 + this.onPermissionResponseListener = onPermissionResponseListener;
  644 + this.USER_SET_REQUEST_CODE_PERMISSION = requestCode;
  645 + this.userSetDefinePermissionTip = getResources().getString(defineTip);
  646 + this.isDefinePermissionCloseActivity = isDefineActivity;
  647 + if (checkPermissions(permissions)) {
  648 + if (onPermissionResponseListener != null) {
  649 + onPermissionResponseListener.onSuccess(permissions);
  650 + }
  651 + } else {
  652 + List<String> needPermissions = getDeniedPermissions(permissions);
  653 + ActivityCompat.requestPermissions(this, needPermissions.toArray(new String[needPermissions.size()]), USER_SET_REQUEST_CODE_PERMISSION);
  654 + }
  655 + }
  656 +
  657 + /**
  658 + * 自定义权限申请码和提示信息
  659 + * 可传入string字符串
  660 + *
  661 + * @param requestCode
  662 + * @param permissions
  663 + * @param onPermissionResponseListener
  664 + */
518 665 public void requestPermission(int requestCode, @StringRes int defineTip, String[]
519 666 permissions, OnPermissionResponseListener onPermissionResponseListener) {
520 667 this.onPermissionResponseListener = onPermissionResponseListener;
... ... @@ -569,7 +716,7 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
569 716 if (onPermissionResponseListener != null) {
570 717 onPermissionResponseListener.onFail();
571 718 }
572   - showTipsDialog("");
  719 + showTipsDialog();
573 720 }
574 721 }
575 722 //用户自定义权限申请码
... ... @@ -582,7 +729,7 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
582 729 if (onPermissionResponseListener != null) {
583 730 onPermissionResponseListener.onFail();
584 731 }
585   - showTipsDialog(userSetDefinePermissionTip);
  732 + showTipsDialog();
586 733 }
587 734 //重置用户提示语
588 735 userSetDefinePermissionTip = "";
... ... @@ -640,29 +787,45 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
640 787 /**
641 788 * 显示提示对话框
642 789 */
643   - private void showTipsDialog(String msg) {
  790 + private void showTipsDialog() {
644 791 String tip = "";
645   - if (TextUtils.isEmpty(msg)) {
  792 + if (TextUtils.isEmpty(userSetDefinePermissionTip)) {
646 793 tip = defaultDefinePermissionTip;
647 794 } else {
648   - tip = msg;
  795 + tip = userSetDefinePermissionTip;
649 796 }
650 797 new AlertDialog.Builder(this)
651 798 .setTitle("温馨提示")
652 799 .setMessage(tip)
  800 + .setCancelable(false)
653 801 .setNegativeButton("取消", new DialogInterface.OnClickListener() {
654 802 @Override
655 803 public void onClick(DialogInterface dialog, int which) {
  804 + if (isDefinePermissionCloseActivity) {
  805 + isDefinePermissionCloseActivity = false;
  806 + //先判断当前是否是多个activity
  807 +// if (null != getSupportFragmentManager().getFragments() && getSupportFragmentManager().getFragments().size() > 1) {
  808 +// //移除最上层的
  809 +// pop();
  810 +// } else {
  811 + finish();
  812 +// }
  813 +
  814 + }
  815 +
656 816 }
657 817 })
658   - .setPositiveButton("确定", new DialogInterface.OnClickListener() {
  818 + .setPositiveButton("去设置", new DialogInterface.OnClickListener() {
659 819 @Override
660 820 public void onClick(DialogInterface dialog, int which) {
  821 + dialog.dismiss();
661 822 startAppSettings();
  823 + isUserClickAllowBtn = true;
662 824 }
663 825 }).show();
664 826 }
665 827  
  828 +
666 829 //启动当前应用设置页面
667 830 public void startAppSettings() {
668 831 Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
... ...
core/base/src/main/java/com/cnlive/core/libs/base/frame/fragment/BaseFragment.java
... ... @@ -184,8 +184,8 @@ public abstract class BaseFragment&lt;V extends BaseView, P extends BasePresenter&lt;V
184 184 * @param color
185 185 * @param statusBarAlpha
186 186 */
187   - protected void setStatusBarColor(@ColorRes int color,
188   - @IntRange(from = 0, to = 255) int statusBarAlpha) {
  187 + public void setStatusBarColor(@ColorRes int color,
  188 + @IntRange(from = 0, to = 255) int statusBarAlpha) {
189 189 me.setStatusBarColor(color, statusBarAlpha);
190 190 }
191 191  
... ... @@ -212,7 +212,7 @@ public abstract class BaseFragment&lt;V extends BaseView, P extends BasePresenter&lt;V
212 212 /**
213 213 * 设置状态栏字体颜色
214 214 */
215   - protected void setStatusBarTextColor(int type) {
  215 + public void setStatusBarTextColor(int type) {
216 216 me.setStatusBarTextColor(type);
217 217 }
218 218  
... ... @@ -249,18 +249,38 @@ public abstract class BaseFragment&lt;V extends BaseView, P extends BasePresenter&lt;V
249 249 }
250 250  
251 251 //权限申请
  252 + public void requestPermission(boolean isDefineActivity, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) {
  253 + me.requestPermission(isDefineActivity, permissions, onPermissionResponseListener);
  254 + }
  255 +
  256 + //权限申请
252 257 public void requestPermission(int requestCode, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) {
253 258 me.requestPermission(requestCode, permissions, onPermissionResponseListener);
254 259 }
255 260  
256 261 //权限申请
  262 + public void requestPermission(int requestCode, boolean isDefineActivity, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) {
  263 + me.requestPermission(requestCode, isDefineActivity, permissions, onPermissionResponseListener);
  264 + }
  265 +
  266 + //权限申请
257 267 public void requestPermission(int requestCode, String defineTip, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) {
258 268 me.requestPermission(requestCode, defineTip, permissions, onPermissionResponseListener);
259 269 }
260 270  
261   - public void requestPermission(String[] permissions, String defineTip, OnPermissionResponseListener
  271 + //权限申请
  272 + public void requestPermission(int requestCode, String defineTip, boolean isDefineActivity, String[] permissions, OnPermissionResponseListener onPermissionResponseListener) {
  273 + me.requestPermission(requestCode, defineTip, isDefineActivity, permissions, onPermissionResponseListener);
  274 + }
  275 +
  276 + public void requestPermission(String defineTip, String[] permissions, OnPermissionResponseListener
  277 + onPermissionResponseListener) {
  278 + me.requestPermission(defineTip, permissions, onPermissionResponseListener);
  279 + }
  280 +
  281 + public void requestPermission(String defineTip, boolean isDefineActivity, String[] permissions, OnPermissionResponseListener
262 282 onPermissionResponseListener) {
263   - me.requestPermission(permissions, defineTip, onPermissionResponseListener);
  283 + me.requestPermission(defineTip, isDefineActivity, permissions, onPermissionResponseListener);
264 284 }
265 285  
266 286 public void requestPermission(int requestCode, @StringRes int defineTip, String[]
... ... @@ -268,6 +288,11 @@ public abstract class BaseFragment&lt;V extends BaseView, P extends BasePresenter&lt;V
268 288 me.requestPermission(requestCode, defineTip, permissions, onPermissionResponseListener);
269 289 }
270 290  
  291 + public void requestPermission(int requestCode, @StringRes int defineTip, boolean isDefineActivity, String[]
  292 + permissions, OnPermissionResponseListener onPermissionResponseListener) {
  293 + me.requestPermission(requestCode, defineTip, isDefineActivity, permissions, onPermissionResponseListener);
  294 + }
  295 +
271 296 //多权限检查
272 297 public boolean checkPermissions(String[] permissions) {
273 298 return me.checkPermissions(permissions);
... ... @@ -374,7 +399,7 @@ public abstract class BaseFragment&lt;V extends BaseView, P extends BasePresenter&lt;V
374 399 }
375 400  
376 401 public void logVerbose(String info) {
377   - Logger.v( info);
  402 + Logger.v(info);
378 403 }
379 404  
380 405 public void logJson(String json) {
... ...
core/base/src/main/java/com/cnlive/core/libs/base/ui/widget/BottomMenuDialog.java 0 → 100644
  1 +package com.cnlive.core.libs.base.ui.widget;
  2 +
  3 +import android.app.Dialog;
  4 +import android.content.Context;
  5 +import android.text.TextUtils;
  6 +import android.view.Gravity;
  7 +import android.view.LayoutInflater;
  8 +import android.view.View;
  9 +import android.view.ViewGroup;
  10 +import android.view.ViewGroup.LayoutParams;
  11 +import android.view.Window;
  12 +import android.view.WindowManager;
  13 +import android.widget.TextView;
  14 +
  15 +
  16 +import com.cnlive.strike.base.R;
  17 +
  18 +import java.util.ArrayList;
  19 +import java.util.List;
  20 +
  21 +/**
  22 + * 创建:wukuiqing
  23 + * <p>
  24 + * 时间:2018/1/8
  25 + * <p>
  26 + * 描述:底部弹出的 Dialog
  27 + */
  28 +
  29 +public class BottomMenuDialog extends Dialog {
  30 +
  31 + public BottomMenuDialog(Context context, int themeResId) {
  32 + super(context, themeResId);
  33 + }
  34 +
  35 + public static class Params {
  36 + private final List<BottomMenu> menuList = new ArrayList<>();
  37 + private String menuTitle;
  38 + private String cancelText;
  39 + private int titleColor;
  40 + }
  41 +
  42 + public static class Builder {
  43 + private boolean canCancel = true;
  44 + private boolean shadow = true;
  45 + private final Params p;
  46 +
  47 + public Builder(Context context) {
  48 + p = new Params();
  49 + }
  50 +
  51 + public Builder setCanCancel(boolean canCancel) {
  52 + this.canCancel = canCancel;
  53 + return this;
  54 + }
  55 +
  56 + public Builder setShadow(boolean shadow) {
  57 + this.shadow = shadow;
  58 + return this;
  59 + }
  60 +
  61 + public Builder setTitle(String title) {
  62 + this.p.menuTitle = title;
  63 + return this;
  64 + }
  65 +
  66 + public Builder setTitle(String title, int titleColor) {
  67 + this.p.menuTitle = title;
  68 + this.p.titleColor = titleColor;
  69 + return this;
  70 + }
  71 +
  72 + public Builder addMenu(String text, View.OnClickListener listener) {
  73 + BottomMenu bm = new BottomMenu(text, listener);
  74 + this.p.menuList.add(bm);
  75 + return this;
  76 + }
  77 +
  78 + public Builder setCancelText(String text) {
  79 + p.cancelText = text;
  80 + return this;
  81 + }
  82 +
  83 + public BottomMenuDialog create(Context context) {
  84 + return create(context, null);
  85 + }
  86 +
  87 + public BottomMenuDialog create(Context context, View.OnClickListener cancelListener) {
  88 + BottomMenuDialog dialog = new BottomMenuDialog(context, shadow ? R.style.Theme_Light_NoTitle_Dialog : R.style.Theme_Light_NoTitle_NoShadow_Dialog);
  89 + Window window = dialog.getWindow();
  90 + if (window != null) {
  91 + window.setWindowAnimations(R.style.Animation_Bottom_Rising);
  92 + window.getDecorView().setPadding(0, 0, 0, 0);
  93 + WindowManager.LayoutParams lp = window.getAttributes();
  94 + lp.width = WindowManager.LayoutParams.MATCH_PARENT;
  95 + lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
  96 + window.setAttributes(lp);
  97 + window.setGravity(Gravity.BOTTOM);
  98 + }
  99 +
  100 + View view = LayoutInflater.from(context).inflate(R.layout.dialog_bottom_menu, null);
  101 +
  102 + TextView btnCancel = view.findViewById(R.id.btn_cancel);
  103 + ViewGroup layContainer = view.findViewById(R.id.lay_container);
  104 + LayoutParams lpItem = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
  105 + LayoutParams lpDivider = new LayoutParams(LayoutParams.MATCH_PARENT, 1);
  106 + int dip1 = (int) (1 * context.getResources().getDisplayMetrics().density + 0.5f);
  107 + int spacing = dip1 * 13;
  108 +
  109 + boolean hasTitle = !TextUtils.isEmpty(p.menuTitle);
  110 + if (hasTitle) {
  111 + TextView tTitle = new TextView(context);
  112 + tTitle.setLayoutParams(lpItem);
  113 + tTitle.setGravity(Gravity.CENTER);
  114 + if (p.titleColor != 0 && p.titleColor != 1) {
  115 + tTitle.setTextColor(context.getResources().getColor(p.titleColor));
  116 +
  117 + } else {
  118 + tTitle.setTextColor(context.getResources().getColor(R.color.blacktext));
  119 + }
  120 +
  121 + tTitle.setText(p.menuTitle);
  122 + tTitle.setTextSize(15);
  123 + tTitle.setPadding(0, spacing, 0, spacing);
  124 + tTitle.setBackgroundResource(R.drawable.common_dialog_selection_selector_top);
  125 + layContainer.addView(tTitle);
  126 +
  127 + View viewDivider = new View(context);
  128 + viewDivider.setLayoutParams(lpDivider);
  129 + viewDivider.setBackgroundColor(0xFFCED2D6);
  130 + layContainer.addView(viewDivider);
  131 + }
  132 +
  133 + for (int i = 0; i < p.menuList.size(); i++) {
  134 + BottomMenu bottomMenu = p.menuList.get(i);
  135 + TextView bbm = new TextView(context);
  136 + bbm.setLayoutParams(lpItem);
  137 + int backgroundResId = R.drawable.common_dialog_selection_selector_center;
  138 + if (p.menuList.size() > 1) {
  139 + if (i == 0) {
  140 + if (hasTitle) {
  141 + backgroundResId = R.drawable.common_dialog_selection_selector_center;
  142 + } else {
  143 + backgroundResId = R.drawable.common_dialog_selection_selector_top;
  144 + }
  145 + } else if (i == p.menuList.size() - 1) {
  146 + backgroundResId = R.drawable.common_dialog_selection_selector_bottom;
  147 + }
  148 + } else if (p.menuList.size() == 1) {
  149 + backgroundResId = R.drawable.common_dialog_selection_selector_singleton;
  150 + }
  151 + bbm.setBackgroundResource(backgroundResId);
  152 + bbm.setPadding(0, spacing, 0, spacing);
  153 + bbm.setGravity(Gravity.CENTER);
  154 + bbm.setText(bottomMenu.funName);
  155 + bbm.setTextColor(context.getResources().getColor(R.color.blacktext));
  156 + bbm.setTextSize(15);
  157 + bbm.setOnClickListener(bottomMenu.listener);
  158 + layContainer.addView(bbm);
  159 +
  160 + if (i != p.menuList.size() - 1) {
  161 + View viewDivider = new View(context);
  162 + viewDivider.setLayoutParams(lpDivider);
  163 + viewDivider.setBackgroundColor(0xFFCED2D6);
  164 + layContainer.addView(viewDivider);
  165 + }
  166 + }
  167 +
  168 + if (!TextUtils.isEmpty(p.cancelText)) {
  169 + btnCancel.setText(p.cancelText);
  170 + }
  171 +
  172 + if (cancelListener != null) {
  173 + btnCancel.setOnClickListener(cancelListener);
  174 + } else {
  175 + btnCancel.setOnClickListener(new View.OnClickListener() {
  176 + @Override
  177 + public void onClick(View v) {
  178 + dialog.dismiss();
  179 + }
  180 + });
  181 + }
  182 + dialog.setContentView(view);
  183 + dialog.setCanceledOnTouchOutside(canCancel);
  184 + dialog.setCancelable(canCancel);
  185 + return dialog;
  186 + }
  187 + }
  188 +
  189 +
  190 + private static class BottomMenu {
  191 + public String funName;
  192 + public View.OnClickListener listener;
  193 +
  194 + public BottomMenu(String funName, View.OnClickListener listener) {
  195 + this.funName = funName;
  196 + this.listener = listener;
  197 + }
  198 + }
  199 +}
... ...
core/base/src/main/java/com/cnlive/core/libs/base/util/QMUITipDialogUtil.java
... ... @@ -3,8 +3,12 @@ package com.cnlive.core.libs.base.util;
3 3 import android.content.Context;
4 4 import android.os.Handler;
5 5  
  6 +import androidx.appcompat.app.AppCompatActivity;
  7 +
6 8 import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
7 9  
  10 +import java.lang.ref.WeakReference;
  11 +
8 12 /**
9 13 * 文 件 名: QMUITipDialogUtil
10 14 * 创 建 人: 杨帅
... ... @@ -16,7 +20,7 @@ import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;
16 20 */
17 21 public class QMUITipDialogUtil {
18 22 private static QMUITipDialog tipDialog;
19   -
  23 + private static WeakReference<Context> currentContext;
20 24  
21 25 /**
22 26 * Loading 类型提示框
... ... @@ -26,13 +30,14 @@ public class QMUITipDialogUtil {
26 30 */
27 31 public static void loadingDialog(Context context, String tipStr, boolean isCancel) {
28 32 try {
29   - if (context == null) {
  33 + currentContext = new WeakReference<>(context);
  34 + if (currentContext == null) {
30 35 return;
31 36 }
32 37 if (tipDialog != null && tipDialog.isShowing()) {
33 38 tipDialog.dismiss();
34 39 }
35   - tipDialog = new QMUITipDialog.Builder(context)
  40 + tipDialog = new QMUITipDialog.Builder(currentContext.get())
36 41 .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
37 42 .setTipWord(tipStr)
38 43 .create();
... ... @@ -54,14 +59,14 @@ public class QMUITipDialogUtil {
54 59 */
55 60 public static void successDialog(Context context, String tipStr, int second) {
56 61 try {
57   - if (context == null) {
  62 + currentContext = new WeakReference<>(context);
  63 + if (currentContext == null) {
58 64 return;
59 65 }
60   -
61 66 if (tipDialog != null && tipDialog.isShowing()) {
62 67 tipDialog.dismiss();
63 68 }
64   - tipDialog = new QMUITipDialog.Builder(context)
  69 + tipDialog = new QMUITipDialog.Builder(currentContext.get())
65 70 .setIconType(QMUITipDialog.Builder.ICON_TYPE_SUCCESS)
66 71 .setTipWord(tipStr)
67 72 .create();
... ... @@ -71,7 +76,7 @@ public class QMUITipDialogUtil {
71 76 new Handler().postDelayed(new Runnable() {
72 77 @Override
73 78 public void run() {
74   - if (context == null) {
  79 + if (currentContext == null) {
75 80 return;
76 81 }
77 82 /**
... ... @@ -96,10 +101,14 @@ public class QMUITipDialogUtil {
96 101 */
97 102 public static void failedDialog(Context context, String tipStr, int second) {
98 103 try {
  104 + currentContext = new WeakReference<>(context);
  105 + if (currentContext == null) {
  106 + return;
  107 + }
99 108 if (tipDialog != null && tipDialog.isShowing()) {
100 109 tipDialog.dismiss();
101 110 }
102   - tipDialog = new QMUITipDialog.Builder(context)
  111 + tipDialog = new QMUITipDialog.Builder(currentContext.get())
103 112 .setIconType(QMUITipDialog.Builder.ICON_TYPE_FAIL)
104 113 .setTipWord(tipStr)
105 114 .create();
... ... @@ -109,7 +118,7 @@ public class QMUITipDialogUtil {
109 118 new Handler().postDelayed(new Runnable() {
110 119 @Override
111 120 public void run() {
112   - if (context == null) {
  121 + if (currentContext == null) {
113 122 return;
114 123 }
115 124 /**
... ... @@ -124,7 +133,7 @@ public class QMUITipDialogUtil {
124 133 } catch (Exception e) {
125 134  
126 135 }
127   - if (context == null) {
  136 + if (currentContext == null) {
128 137 return;
129 138 }
130 139  
... ... @@ -138,10 +147,14 @@ public class QMUITipDialogUtil {
138 147 */
139 148 public static void messageDialog(Context context, String tipStr, int second) {
140 149 try {
  150 + currentContext = new WeakReference<>(context);
  151 + if (currentContext == null) {
  152 + return;
  153 + }
141 154 if (tipDialog != null && tipDialog.isShowing()) {
142 155 tipDialog.dismiss();
143 156 }
144   - tipDialog = new QMUITipDialog.Builder(context)
  157 + tipDialog = new QMUITipDialog.Builder(currentContext.get())
145 158 .setIconType(QMUITipDialog.Builder.ICON_TYPE_INFO)
146 159 .setTipWord(tipStr)
147 160 .create();
... ... @@ -151,7 +164,7 @@ public class QMUITipDialogUtil {
151 164 new Handler().postDelayed(new Runnable() {
152 165 @Override
153 166 public void run() {
154   - if (context == null) {
  167 + if (currentContext == null) {
155 168 return;
156 169 }
157 170 /**
... ... @@ -164,7 +177,7 @@ public class QMUITipDialogUtil {
164 177 } catch (Exception e) {
165 178  
166 179 }
167   - if (context == null) {
  180 + if (currentContext == null) {
168 181 return;
169 182 }
170 183  
... ... @@ -178,13 +191,14 @@ public class QMUITipDialogUtil {
178 191 */
179 192 public static void textDialog(Context context, String tipStr, int second) {
180 193 try {
181   - if (context == null) {
  194 + currentContext = new WeakReference<>(context);
  195 + if (currentContext == null) {
182 196 return;
183 197 }
184 198 if (tipDialog != null && tipDialog.isShowing()) {
185 199 tipDialog.dismiss();
186 200 }
187   - tipDialog = new QMUITipDialog.Builder(context)
  201 + tipDialog = new QMUITipDialog.Builder(currentContext.get())
188 202 .setTipWord(tipStr)
189 203 .create();
190 204 tipDialog.setCanceledOnTouchOutside(false);//屏蔽返回键
... ... @@ -193,7 +207,7 @@ public class QMUITipDialogUtil {
193 207 new Handler().postDelayed(new Runnable() {
194 208 @Override
195 209 public void run() {
196   - if (context == null) {
  210 + if (currentContext == null) {
197 211 return;
198 212 }
199 213 /**
... ... @@ -211,6 +225,9 @@ public class QMUITipDialogUtil {
211 225  
212 226 public static void dismessDialog() {
213 227 try {
  228 + if (currentContext == null) {
  229 + return;
  230 + }
214 231 if (tipDialog != null && tipDialog.isShowing()) {
215 232 tipDialog.dismiss();
216 233 }
... ...
core/base/src/main/java/com/top/zibin/luban/Checker.java 0 → 100644
  1 +package com.top.zibin.luban;
  2 +
  3 +import android.graphics.BitmapFactory;
  4 +import android.util.Log;
  5 +
  6 +import java.io.ByteArrayOutputStream;
  7 +import java.io.File;
  8 +import java.io.IOException;
  9 +import java.io.InputStream;
  10 +import java.util.ArrayList;
  11 +import java.util.Arrays;
  12 +import java.util.List;
  13 +
  14 +enum Checker {
  15 + SINGLE;
  16 +
  17 + private static final String TAG = "Luban";
  18 +
  19 + private static List<String> format = new ArrayList<>();
  20 + private static final String JPG = ".jpg";
  21 + private static final String JPEG = ".jpeg";
  22 + private static final String PNG = ".png";
  23 + private static final String WEBP = ".webp";
  24 + private static final String GIF = ".gif";
  25 +
  26 + private final byte[] JPEG_SIGNATURE = new byte[]{(byte) 0xFF, (byte) 0xD8, (byte) 0xFF};
  27 +
  28 + static {
  29 + format.add(JPG);
  30 + format.add(JPEG);
  31 + format.add(PNG);
  32 + format.add(WEBP);
  33 + format.add(GIF);
  34 + }
  35 +
  36 + /**
  37 + * Determine if it is JPG.
  38 + *
  39 + * @param is image file input stream
  40 + */
  41 + boolean isJPG(InputStream is) {
  42 + return isJPG(toByteArray(is));
  43 + }
  44 +
  45 + /**
  46 + * Returns the degrees in clockwise. Values are 0, 90, 180, or 270.
  47 + */
  48 + int getOrientation(InputStream is) {
  49 + return getOrientation(toByteArray(is));
  50 + }
  51 +
  52 + private boolean isJPG(byte[] data) {
  53 + if (data == null || data.length < 3) {
  54 + return false;
  55 + }
  56 + byte[] signatureB = new byte[]{data[0], data[1], data[2]};
  57 + return Arrays.equals(JPEG_SIGNATURE, signatureB);
  58 + }
  59 +
  60 + private int getOrientation(byte[] jpeg) {
  61 + if (jpeg == null) {
  62 + return 0;
  63 + }
  64 +
  65 + int offset = 0;
  66 + int length = 0;
  67 +
  68 + // ISO/IEC 10918-1:1993(E)
  69 + while (offset + 3 < jpeg.length && (jpeg[offset++] & 0xFF) == 0xFF) {
  70 + int marker = jpeg[offset] & 0xFF;
  71 +
  72 + // Check if the marker is a padding.
  73 + if (marker == 0xFF) {
  74 + continue;
  75 + }
  76 + offset++;
  77 +
  78 + // Check if the marker is SOI or TEM.
  79 + if (marker == 0xD8 || marker == 0x01) {
  80 + continue;
  81 + }
  82 + // Check if the marker is EOI or SOS.
  83 + if (marker == 0xD9 || marker == 0xDA) {
  84 + break;
  85 + }
  86 +
  87 + // Get the length and check if it is reasonable.
  88 + length = pack(jpeg, offset, 2, false);
  89 + if (length < 2 || offset + length > jpeg.length) {
  90 + Log.e(TAG, "Invalid length");
  91 + return 0;
  92 + }
  93 +
  94 + // Break if the marker is EXIF in APP1.
  95 + if (marker == 0xE1 && length >= 8
  96 + && pack(jpeg, offset + 2, 4, false) == 0x45786966
  97 + && pack(jpeg, offset + 6, 2, false) == 0) {
  98 + offset += 8;
  99 + length -= 8;
  100 + break;
  101 + }
  102 +
  103 + // Skip other markers.
  104 + offset += length;
  105 + length = 0;
  106 + }
  107 +
  108 + // JEITA CP-3451 Exif Version 2.2
  109 + if (length > 8) {
  110 + // Identify the byte order.
  111 + int tag = pack(jpeg, offset, 4, false);
  112 + if (tag != 0x49492A00 && tag != 0x4D4D002A) {
  113 + Log.e(TAG, "Invalid byte order");
  114 + return 0;
  115 + }
  116 + boolean littleEndian = (tag == 0x49492A00);
  117 +
  118 + // Get the offset and check if it is reasonable.
  119 + int count = pack(jpeg, offset + 4, 4, littleEndian) + 2;
  120 + if (count < 10 || count > length) {
  121 + Log.e(TAG, "Invalid offset");
  122 + return 0;
  123 + }
  124 + offset += count;
  125 + length -= count;
  126 +
  127 + // Get the count and go through all the elements.
  128 + count = pack(jpeg, offset - 2, 2, littleEndian);
  129 + while (count-- > 0 && length >= 12) {
  130 + // Get the tag and check if it is orientation.
  131 + tag = pack(jpeg, offset, 2, littleEndian);
  132 + if (tag == 0x0112) {
  133 + int orientation = pack(jpeg, offset + 8, 2, littleEndian);
  134 + switch (orientation) {
  135 + case 1:
  136 + return 0;
  137 + case 3:
  138 + return 180;
  139 + case 6:
  140 + return 90;
  141 + case 8:
  142 + return 270;
  143 + }
  144 + Log.e(TAG, "Unsupported orientation");
  145 + return 0;
  146 + }
  147 + offset += 12;
  148 + length -= 12;
  149 + }
  150 + }
  151 +
  152 + Log.e(TAG, "Orientation not found");
  153 + return 0;
  154 + }
  155 +
  156 + String extSuffix(InputStreamProvider input) {
  157 + try {
  158 + BitmapFactory.Options options = new BitmapFactory.Options();
  159 + options.inJustDecodeBounds = true;
  160 + BitmapFactory.decodeStream(input.open(), null, options);
  161 + return options.outMimeType.replace("image/", ".");
  162 + } catch (Exception e) {
  163 + return JPG;
  164 + }
  165 + }
  166 +
  167 + boolean needCompress(int leastCompressSize, String path) {
  168 + if (leastCompressSize > 0) {
  169 + File source = new File(path);
  170 + return source.exists() && source.length() > (leastCompressSize << 10);
  171 + }
  172 + return true;
  173 + }
  174 +
  175 + private int pack(byte[] bytes, int offset, int length, boolean littleEndian) {
  176 + int step = 1;
  177 + if (littleEndian) {
  178 + offset += length - 1;
  179 + step = -1;
  180 + }
  181 +
  182 + int value = 0;
  183 + while (length-- > 0) {
  184 + value = (value << 8) | (bytes[offset] & 0xFF);
  185 + offset += step;
  186 + }
  187 + return value;
  188 + }
  189 +
  190 + private byte[] toByteArray(InputStream is) {
  191 + if (is == null) {
  192 + return new byte[0];
  193 + }
  194 +
  195 + ByteArrayOutputStream buffer = new ByteArrayOutputStream();
  196 +
  197 + int read;
  198 + byte[] data = new byte[4096];
  199 +
  200 + try {
  201 + while ((read = is.read(data, 0, data.length)) != -1) {
  202 + buffer.write(data, 0, read);
  203 + }
  204 + } catch (Exception ignored) {
  205 + return new byte[0];
  206 + } finally {
  207 + try {
  208 + buffer.close();
  209 + } catch (IOException ignored) {
  210 + }
  211 + }
  212 +
  213 + return buffer.toByteArray();
  214 + }
  215 +}
... ...
core/base/src/main/java/com/top/zibin/luban/CompressionPredicate.java 0 → 100644
  1 +package com.top.zibin.luban;
  2 +
  3 +/**
  4 + * Created on 2018/1/3 19:43
  5 + *
  6 + * @author andy
  7 + *
  8 + * A functional interface (callback) that returns true or false for the given input path should be compressed.
  9 + */
  10 +
  11 +public interface CompressionPredicate {
  12 +
  13 + /**
  14 + * Determine the given input path should be compressed and return a boolean.
  15 + * @param path input path
  16 + * @return the boolean result
  17 + */
  18 + boolean apply(String path);
  19 +}
... ...
core/base/src/main/java/com/top/zibin/luban/Engine.java 0 → 100644
  1 +package com.top.zibin.luban;
  2 +
  3 +import android.graphics.Bitmap;
  4 +import android.graphics.BitmapFactory;
  5 +import android.graphics.Matrix;
  6 +
  7 +import java.io.ByteArrayOutputStream;
  8 +import java.io.File;
  9 +import java.io.FileOutputStream;
  10 +import java.io.IOException;
  11 +
  12 +/**
  13 + * Responsible for starting compress and managing active and cached resources.
  14 + */
  15 +class Engine {
  16 + private InputStreamProvider srcImg;
  17 + private File tagImg;
  18 + private int srcWidth;
  19 + private int srcHeight;
  20 + private boolean focusAlpha;
  21 +
  22 + Engine(InputStreamProvider srcImg, File tagImg, boolean focusAlpha) throws IOException {
  23 + this.tagImg = tagImg;
  24 + this.srcImg = srcImg;
  25 + this.focusAlpha = focusAlpha;
  26 +
  27 + BitmapFactory.Options options = new BitmapFactory.Options();
  28 + options.inJustDecodeBounds = true;
  29 + options.inSampleSize = 1;
  30 +
  31 + BitmapFactory.decodeStream(srcImg.open(), null, options);
  32 + this.srcWidth = options.outWidth;
  33 + this.srcHeight = options.outHeight;
  34 + }
  35 +
  36 + private int computeSize() {
  37 + srcWidth = srcWidth % 2 == 1 ? srcWidth + 1 : srcWidth;
  38 + srcHeight = srcHeight % 2 == 1 ? srcHeight + 1 : srcHeight;
  39 +
  40 + int longSide = Math.max(srcWidth, srcHeight);
  41 + int shortSide = Math.min(srcWidth, srcHeight);
  42 +
  43 + float scale = ((float) shortSide / longSide);
  44 + if (scale <= 1 && scale > 0.5625) {
  45 + if (longSide < 1664) {
  46 + return 1;
  47 + } else if (longSide < 4990) {
  48 + return 2;
  49 + } else if (longSide > 4990 && longSide < 10240) {
  50 + return 4;
  51 + } else {
  52 + return longSide / 1280 == 0 ? 1 : longSide / 1280;
  53 + }
  54 + } else if (scale <= 0.5625 && scale > 0.5) {
  55 + return longSide / 1280 == 0 ? 1 : longSide / 1280;
  56 + } else {
  57 + //TODO 增加最大像素限制
  58 + return Math.max((int) Math.ceil(longSide / (1280.0 / scale)), 1 + (longSide / 20480));
  59 + }
  60 + }
  61 +
  62 + private Bitmap rotatingImage(Bitmap bitmap, int angle) {
  63 + Matrix matrix = new Matrix();
  64 +
  65 + matrix.postRotate(angle);
  66 +
  67 + return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
  68 + }
  69 +
  70 + File compress() throws IOException {
  71 + BitmapFactory.Options options = new BitmapFactory.Options();
  72 + options.inSampleSize = computeSize();
  73 +
  74 + Bitmap tagBitmap = BitmapFactory.decodeStream(srcImg.open(), null, options);
  75 + ByteArrayOutputStream stream = new ByteArrayOutputStream();
  76 +
  77 + if (Checker.SINGLE.isJPG(srcImg.open())) {
  78 + tagBitmap = rotatingImage(tagBitmap, Checker.SINGLE.getOrientation(srcImg.open()));
  79 + }
  80 + tagBitmap.compress(focusAlpha ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, 60, stream);
  81 + tagBitmap.recycle();
  82 +
  83 + FileOutputStream fos = new FileOutputStream(tagImg);
  84 + fos.write(stream.toByteArray());
  85 + fos.flush();
  86 + fos.close();
  87 + stream.close();
  88 +
  89 + return tagImg;
  90 + }
  91 +}
0 92 \ No newline at end of file
... ...
core/base/src/main/java/com/top/zibin/luban/InputStreamProvider.java 0 → 100644
  1 +package com.top.zibin.luban;
  2 +
  3 +import java.io.IOException;
  4 +import java.io.InputStream;
  5 +
  6 +/**
  7 + * 通过此接口获取输入流,以兼容文件、FileProvider方式获取到的图片
  8 + * <p>
  9 + * Get the input stream through this interface, and obtain the picture using compatible files and FileProvider
  10 + */
  11 +public interface InputStreamProvider {
  12 +
  13 + InputStream open() throws IOException;
  14 +
  15 + String getPath();
  16 +}
... ...
core/base/src/main/java/com/top/zibin/luban/Luban.java 0 → 100644
  1 +package com.top.zibin.luban;
  2 +
  3 +import android.content.Context;
  4 +import android.net.Uri;
  5 +import android.os.AsyncTask;
  6 +import android.os.Handler;
  7 +import android.os.Looper;
  8 +import android.os.Message;
  9 +import android.text.TextUtils;
  10 +import android.util.Log;
  11 +
  12 +import java.io.File;
  13 +import java.io.FileInputStream;
  14 +import java.io.IOException;
  15 +import java.io.InputStream;
  16 +import java.util.ArrayList;
  17 +import java.util.Iterator;
  18 +import java.util.List;
  19 +
  20 +@SuppressWarnings("unused")
  21 +public class Luban implements Handler.Callback {
  22 + private static final String TAG = "Luban";
  23 + private static final String DEFAULT_DISK_CACHE_DIR = "luban_disk_cache";
  24 +
  25 + private static final int MSG_COMPRESS_SUCCESS = 0;
  26 + private static final int MSG_COMPRESS_START = 1;
  27 + private static final int MSG_COMPRESS_ERROR = 2;
  28 +
  29 + private String mTargetDir;
  30 + private boolean focusAlpha;
  31 + private int mLeastCompressSize;
  32 + private OnRenameListener mRenameListener;
  33 + private OnCompressListener mCompressListener;
  34 + private CompressionPredicate mCompressionPredicate;
  35 + private List<InputStreamProvider> mStreamProviders;
  36 +
  37 + private Handler mHandler;
  38 +
  39 + private Luban(Builder builder) {
  40 + this.mTargetDir = builder.mTargetDir;
  41 + this.mRenameListener = builder.mRenameListener;
  42 + this.mStreamProviders = builder.mStreamProviders;
  43 + this.mCompressListener = builder.mCompressListener;
  44 + this.mLeastCompressSize = builder.mLeastCompressSize;
  45 + this.mCompressionPredicate = builder.mCompressionPredicate;
  46 + mHandler = new Handler(Looper.getMainLooper(), this);
  47 + }
  48 +
  49 + public static Builder with(Context context) {
  50 + return new Builder(context);
  51 + }
  52 +
  53 + /**
  54 + * Returns a file with a cache image name in the private cache directory.
  55 + *
  56 + * @param context A context.
  57 + */
  58 + private File getImageCacheFile(Context context, String suffix) {
  59 + if (TextUtils.isEmpty(mTargetDir)) {
  60 + mTargetDir = getImageCacheDir(context).getAbsolutePath();
  61 + }
  62 +
  63 + String cacheBuilder = mTargetDir + "/" +
  64 + System.currentTimeMillis() +
  65 + (int) (Math.random() * 1000) +
  66 + (TextUtils.isEmpty(suffix) ? ".jpg" : suffix);
  67 +
  68 + return new File(cacheBuilder);
  69 + }
  70 +
  71 + private File getImageCustomFile(Context context, String filename) {
  72 + if (TextUtils.isEmpty(mTargetDir)) {
  73 + mTargetDir = getImageCacheDir(context).getAbsolutePath();
  74 + }
  75 +
  76 + String cacheBuilder = mTargetDir + "/" + filename;
  77 +
  78 + return new File(cacheBuilder);
  79 + }
  80 +
  81 + /**
  82 + * Returns a directory with a default name in the private cache directory of the application to
  83 + * use to store retrieved audio.
  84 + *
  85 + * @param context A context.
  86 + * @see #getImageCacheDir(Context, String)
  87 + */
  88 + private File getImageCacheDir(Context context) {
  89 + return getImageCacheDir(context, DEFAULT_DISK_CACHE_DIR);
  90 + }
  91 +
  92 + /**
  93 + * Returns a directory with the given name in the private cache directory of the application to
  94 + * use to store retrieved media and thumbnails.
  95 + *
  96 + * @param context A context.
  97 + * @param cacheName The name of the subdirectory in which to store the cache.
  98 + * @see #getImageCacheDir(Context)
  99 + */
  100 + private static File getImageCacheDir(Context context, String cacheName) {
  101 + File cacheDir = context.getExternalCacheDir();
  102 + if (cacheDir != null) {
  103 + File result = new File(cacheDir, cacheName);
  104 + if (!result.mkdirs() && (!result.exists() || !result.isDirectory())) {
  105 + // File wasn't able to create a directory, or the result exists but not a directory
  106 + return null;
  107 + }
  108 + return result;
  109 + }
  110 + if (Log.isLoggable(TAG, Log.ERROR)) {
  111 + Log.e(TAG, "default disk cache dir is null");
  112 + }
  113 + return null;
  114 + }
  115 +
  116 + /**
  117 + * start asynchronous compress thread
  118 + */
  119 + private void launch(final Context context) {
  120 + if (mStreamProviders == null || mStreamProviders.size() == 0 && mCompressListener != null) {
  121 + mCompressListener.onError(new NullPointerException("image file cannot be null"));
  122 + }
  123 +
  124 + Iterator<InputStreamProvider> iterator = mStreamProviders.iterator();
  125 +
  126 + while (iterator.hasNext()) {
  127 + final InputStreamProvider path = iterator.next();
  128 +
  129 + AsyncTask.SERIAL_EXECUTOR.execute(new Runnable() {
  130 + @Override
  131 + public void run() {
  132 + try {
  133 + mHandler.sendMessage(mHandler.obtainMessage(MSG_COMPRESS_START));
  134 +
  135 + File result = compress(context, path);
  136 +
  137 + mHandler.sendMessage(mHandler.obtainMessage(MSG_COMPRESS_SUCCESS, result));
  138 + } catch (IOException e) {
  139 + mHandler.sendMessage(mHandler.obtainMessage(MSG_COMPRESS_ERROR, e));
  140 + }
  141 + }
  142 + });
  143 +
  144 + iterator.remove();
  145 + }
  146 + }
  147 +
  148 + /**
  149 + * start compress and return the file
  150 + */
  151 + private File get(InputStreamProvider input, Context context) throws IOException {
  152 + return new Engine(input, getImageCacheFile(context, Checker.SINGLE.extSuffix(input)), focusAlpha).compress();
  153 + }
  154 +
  155 + private List<File> get(Context context) throws IOException {
  156 + List<File> results = new ArrayList<>();
  157 + Iterator<InputStreamProvider> iterator = mStreamProviders.iterator();
  158 +
  159 + while (iterator.hasNext()) {
  160 + results.add(compress(context, iterator.next()));
  161 + iterator.remove();
  162 + }
  163 +
  164 + return results;
  165 + }
  166 +
  167 + private File compress(Context context, InputStreamProvider path) throws IOException {
  168 + File result;
  169 +
  170 + File outFile = getImageCacheFile(context, Checker.SINGLE.extSuffix(path));
  171 +
  172 + if (mRenameListener != null) {
  173 + String filename = mRenameListener.rename(path.getPath());
  174 + outFile = getImageCustomFile(context, filename);
  175 + }
  176 +
  177 + if (mCompressionPredicate != null) {
  178 + if (mCompressionPredicate.apply(path.getPath())
  179 + && Checker.SINGLE.needCompress(mLeastCompressSize, path.getPath())) {
  180 + result = new Engine(path, outFile, focusAlpha).compress();
  181 + } else {
  182 + result = new File(path.getPath());
  183 + }
  184 + } else {
  185 + result = Checker.SINGLE.needCompress(mLeastCompressSize, path.getPath()) ?
  186 + new Engine(path, outFile, focusAlpha).compress() :
  187 + new File(path.getPath());
  188 + }
  189 +
  190 + return result;
  191 + }
  192 +
  193 + @Override
  194 + public boolean handleMessage(Message msg) {
  195 + if (mCompressListener == null) return false;
  196 +
  197 + switch (msg.what) {
  198 + case MSG_COMPRESS_START:
  199 + mCompressListener.onStart();
  200 + break;
  201 + case MSG_COMPRESS_SUCCESS:
  202 + mCompressListener.onSuccess((File) msg.obj);
  203 + break;
  204 + case MSG_COMPRESS_ERROR:
  205 + mCompressListener.onError((Throwable) msg.obj);
  206 + break;
  207 + }
  208 + return false;
  209 + }
  210 +
  211 + public static class Builder {
  212 + private Context context;
  213 + private String mTargetDir;
  214 + private boolean focusAlpha;
  215 + private int mLeastCompressSize = 100;
  216 + private OnRenameListener mRenameListener;
  217 + private OnCompressListener mCompressListener;
  218 + private CompressionPredicate mCompressionPredicate;
  219 + private List<InputStreamProvider> mStreamProviders;
  220 +
  221 + Builder(Context context) {
  222 + this.context = context;
  223 + this.mStreamProviders = new ArrayList<>();
  224 + }
  225 +
  226 + private Luban build() {
  227 + return new Luban(this);
  228 + }
  229 +
  230 + public Builder load(InputStreamProvider inputStreamProvider) {
  231 + mStreamProviders.add(inputStreamProvider);
  232 + return this;
  233 + }
  234 +
  235 + public Builder load(final File file) {
  236 + mStreamProviders.add(new InputStreamProvider() {
  237 + @Override
  238 + public InputStream open() throws IOException {
  239 + return new FileInputStream(file);
  240 + }
  241 +
  242 + @Override
  243 + public String getPath() {
  244 + return file.getAbsolutePath();
  245 + }
  246 + });
  247 + return this;
  248 + }
  249 +
  250 + public Builder load(final String string) {
  251 + mStreamProviders.add(new InputStreamProvider() {
  252 + @Override
  253 + public InputStream open() throws IOException {
  254 + return new FileInputStream(string);
  255 + }
  256 +
  257 + @Override
  258 + public String getPath() {
  259 + return string;
  260 + }
  261 + });
  262 + return this;
  263 + }
  264 +
  265 + public <T> Builder load(List<T> list) {
  266 + for (T src : list) {
  267 + if (src instanceof String) {
  268 + load((String) src);
  269 + } else if (src instanceof File) {
  270 + load((File) src);
  271 + } else if (src instanceof Uri) {
  272 + load((Uri) src);
  273 + } else {
  274 + throw new IllegalArgumentException("Incoming data type exception, it must be String, File, Uri or Bitmap");
  275 + }
  276 + }
  277 + return this;
  278 + }
  279 +
  280 + public Builder load(final Uri uri) {
  281 + mStreamProviders.add(new InputStreamProvider() {
  282 + @Override
  283 + public InputStream open() throws IOException {
  284 + return context.getContentResolver().openInputStream(uri);
  285 + }
  286 +
  287 + @Override
  288 + public String getPath() {
  289 + return uri.getPath();
  290 + }
  291 + });
  292 + return this;
  293 + }
  294 +
  295 + public Builder putGear(int gear) {
  296 + return this;
  297 + }
  298 +
  299 + public Builder setRenameListener(OnRenameListener listener) {
  300 + this.mRenameListener = listener;
  301 + return this;
  302 + }
  303 +
  304 + public Builder setCompressListener(OnCompressListener listener) {
  305 + this.mCompressListener = listener;
  306 + return this;
  307 + }
  308 +
  309 + public Builder setTargetDir(String targetDir) {
  310 + this.mTargetDir = targetDir;
  311 + return this;
  312 + }
  313 +
  314 + /**
  315 + * Do I need to keep the image's alpha channel
  316 + *
  317 + * @param focusAlpha <p> true - to keep alpha channel, the compress speed will be slow. </p>
  318 + * <p> false - don't keep alpha channel, it might have a black background.</p>
  319 + */
  320 + public Builder setFocusAlpha(boolean focusAlpha) {
  321 + this.focusAlpha = focusAlpha;
  322 + return this;
  323 + }
  324 +
  325 + /**
  326 + * do not compress when the origin image file size less than one value
  327 + *
  328 + * @param size the value of file size, unit KB, default 100K
  329 + */
  330 + public Builder ignoreBy(int size) {
  331 + this.mLeastCompressSize = size;
  332 + return this;
  333 + }
  334 +
  335 + /**
  336 + * do compress image when return value was true, otherwise, do not compress the image file
  337 + *
  338 + * @param compressionPredicate A predicate callback that returns true or false for the given input path should be compressed.
  339 + */
  340 + public Builder filter(CompressionPredicate compressionPredicate) {
  341 + this.mCompressionPredicate = compressionPredicate;
  342 + return this;
  343 + }
  344 +
  345 +
  346 + /**
  347 + * begin compress image with asynchronous
  348 + */
  349 + public void launch() {
  350 + build().launch(context);
  351 + }
  352 +
  353 + public File get(final String path) throws IOException {
  354 + return build().get(new InputStreamProvider() {
  355 + @Override
  356 + public InputStream open() throws IOException {
  357 + return new FileInputStream(path);
  358 + }
  359 +
  360 + @Override
  361 + public String getPath() {
  362 + return path;
  363 + }
  364 + }, context);
  365 + }
  366 +
  367 + /**
  368 + * begin compress image with synchronize
  369 + *
  370 + * @return the thumb image file list
  371 + */
  372 + public List<File> get() throws IOException {
  373 + return build().get(context);
  374 + }
  375 + }
  376 +}
0 377 \ No newline at end of file
... ...
core/base/src/main/java/com/top/zibin/luban/OnCompressListener.java 0 → 100644
  1 +package com.top.zibin.luban;
  2 +
  3 +import java.io.File;
  4 +
  5 +public interface OnCompressListener {
  6 +
  7 + /**
  8 + * Fired when the compression is started, override to handle in your own code
  9 + */
  10 + void onStart();
  11 +
  12 + /**
  13 + * Fired when a compression returns successfully, override to handle in your own code
  14 + */
  15 + void onSuccess(File file);
  16 +
  17 + /**
  18 + * Fired when a compression fails to complete, override to handle in your own code
  19 + */
  20 + void onError(Throwable e);
  21 +}
... ...
core/base/src/main/java/com/top/zibin/luban/OnRenameListener.java 0 → 100644
  1 +package com.top.zibin.luban;
  2 +
  3 +/**
  4 + * Author: zibin
  5 + * Datetime: 2018/5/18
  6 + * <p>
  7 + * 提供修改压缩图片命名接口
  8 + * <p>
  9 + * A functional interface (callback) that used to rename the file after compress.
  10 + */
  11 +public interface OnRenameListener {
  12 +
  13 + /**
  14 + * 压缩前调用该方法用于修改压缩后文件名
  15 + * <p>
  16 + * Call before compression begins.
  17 + *
  18 + * @param filePath 传入文件路径/ file path
  19 + * @return 返回重命名后的字符串/ file name
  20 + */
  21 + String rename(String filePath);
  22 +}
... ...
core/base/src/main/res/drawable-hdpi/zhuangtai_kong.png 0 → 100644

7.47 KB

core/base/src/main/res/drawable-xhdpi/back.png 0 → 100644

1.07 KB

core/base/src/main/res/drawable-xhdpi/zhuangtai_kong.png 0 → 100644

10.3 KB

core/base/src/main/res/drawable-xxhdpi/zhuangtai_kong.png 0 → 100644

19.7 KB

core/base/src/main/res/values/style.xml
... ... @@ -167,4 +167,8 @@
167 167 <item name="android:background">@android:color/transparent</item>
168 168 </style>
169 169 <!-- -->
  170 + <style name="SwipeBackActivityTheme" parent="QMUI.Compat.NoActionBar">
  171 + <!-- Customize your theme here. -->
  172 + <item name="android:windowIsTranslucent">true</item>
  173 + </style>
170 174 </resources>
171 175 \ No newline at end of file
... ...
core/network/build.gradle
1 1 apply plugin: 'com.android.library'
2 2  
3 3 android {
4   - compileSdkVersion 29
5   - buildToolsVersion "29.0.2"
  4 +// compileSdkVersion 29
  5 +// buildToolsVersion "29.0.2"
6 6  
7 7  
8 8 // defaultConfig {
... ...
core/network/src/main/java/com/cnlive/core/network/api/ApiBaseServiceOpen.java
1 1 package com.cnlive.core.network.api;
2 2  
3 3  
4   -
5   -
6 4 import com.cnlive.core.network.BaseResult;
7 5 import com.cnlive.core.network.FaceData;
8 6 import com.cnlive.core.network.TokenData;
9 7 import com.cnlive.core.network.UserData;
  8 +import com.cnlive.core.network.model.StorageInfoData;
  9 +import com.cnlive.core.network.model.UploadAuthData;
10 10  
11 11 import java.util.List;
12 12 import java.util.Map;
... ... @@ -14,6 +14,7 @@ import java.util.Map;
14 14 import io.reactivex.Observable;
15 15 import okhttp3.MultipartBody;
16 16 import okhttp3.RequestBody;
  17 +import retrofit2.adapter.rxjava2.Result;
17 18 import retrofit2.http.Multipart;
18 19 import retrofit2.http.POST;
19 20 import retrofit2.http.Part;
... ... @@ -26,6 +27,23 @@ import retrofit2.http.QueryMap;
26 27  
27 28 public interface ApiBaseServiceOpen {
28 29  
  30 + /**
  31 + * 上传鉴权
  32 + *
  33 + * @param maps
  34 + * @return
  35 + */
  36 + @POST("open/api2/vod_epg/getUploadAuthForApp")
  37 + Observable<BaseResult<UploadAuthData>> getUploadAuthForApp(@QueryMap Map<String, String> maps);
  38 +
  39 + /**
  40 + * 获取存储信息
  41 + *
  42 + * @param map
  43 + * @return
  44 + */
  45 + @POST("open/api2/storage/getStorageInfo")
  46 + Observable<BaseResult<List<StorageInfoData>>> getStorageInfo(@QueryMap Map<String, String> map);
29 47  
30 48 /**
31 49 * 顶踩一条节目 0:踩 1:顶
... ... @@ -142,16 +160,18 @@ public interface ApiBaseServiceOpen {
142 160 @Part List<MultipartBody.Part> params);
143 161  
144 162  
145   -
146 163 /**
147 164 * 音频播放鉴权接口
  165 + *
148 166 * @param map
149 167 * @return
150 168 */
151 169 @POST("open/api2/user/loginIn3rdForWJJ")
152 170 Observable<BaseResult<UserData>> loginIn3rdForWJJ(@QueryMap Map<String, String> map);
  171 +
153 172 /**
154 173 * 登陆
  174 + *
155 175 * @param map
156 176 * @return
157 177 */
... ...
module/pedometer/src/main/java/com/cnlive/moudle/pedometer/upload/interfaces/ProgressCallback.java 0 → 100644
  1 +package com.cnlive.moudle.pedometer.upload.interfaces;
  2 +
  3 +public interface ProgressCallback {
  4 + void onProgress(double var1);
  5 +}
... ...
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/BlueToothStep2Activity.java
... ... @@ -11,6 +11,7 @@ import android.net.Uri;
11 11 import android.provider.Settings;
12 12 import android.util.Log;
13 13 import android.view.View;
  14 +
14 15 import com.clj.fastble.BleManager;
15 16 import com.cnlive.core.libs.base.frame.activity.BaseActivity;
16 17 import com.cnlive.core.libs.base.interfaces.OnPermissionResponseListener;
... ... @@ -114,7 +115,7 @@ public class BlueToothStep2Activity extends BaseActivity {
114 115 String[] permissions = new String[]{Manifest.permission.INTERNET
115 116 , Manifest.permission.ACCESS_FINE_LOCATION
116 117 , Manifest.permission.ACCESS_COARSE_LOCATION};
117   - requestPermission(permissions, "您尚未授予程序运行所需权限\n是否设置?", new OnPermissionResponseListener() {
  118 + requestPermission("您尚未授予程序运行所需权限\n是否设置?", permissions, new OnPermissionResponseListener() {
118 119 @Override
119 120 public void onSuccess(String[] permissions) {
120 121 //判断蓝牙是否打开
... ...
module/xiaojiasoundbox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/ChangeWifiActivity.java
... ... @@ -82,7 +82,7 @@ public class ChangeWifiActivity extends BaseActivity {
82 82 String[] permissions = new String[]{Manifest.permission.INTERNET
83 83 , Manifest.permission.ACCESS_FINE_LOCATION
84 84 , Manifest.permission.ACCESS_COARSE_LOCATION};
85   - requestPermission(permissions, "您尚未授予程序运行所需权限\n是否设置?", new OnPermissionResponseListener() {
  85 + requestPermission("您尚未授予程序运行所需权限\n是否设置?",permissions, new OnPermissionResponseListener() {
86 86 @Override
87 87 public void onSuccess(String[] permissions) {
88 88 //判断蓝牙是否打开
... ...
settings.gradle
... ... @@ -2,5 +2,6 @@ include &#39;:app:strike&#39;, &#39;:network&#39;, &#39;:xiaojiasoundbox&#39;
2 2 //基础库
3 3 include ':core:base',':core:network',':core:imageload'
4 4 include ':cloud:user'
5   -include ':module:xiaojiasoundbox'
  5 +include ':module:xiaojiasoundbox',':module:pedometer'
  6 +include ':library_baidumap'
6 7 rootProject.name='ModuleStrike'
... ...