Skip to content

Commit 7bcbfe1

Browse files
authored
Merge pull request #60 from xuexiangjys/dev/1.1.3
Dev/1.1.3
2 parents cadeb65 + 8fce103 commit 7bcbfe1

File tree

29 files changed

+961
-44
lines changed

29 files changed

+961
-44
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# These are supported funding model platforms
22

3-
custom: https://github.com/xuexiangjys/Resource/blob/master/doc/sponsor.md
3+
custom: https://gitee.com/xuexiangjys/Resource/blob/master/doc/sponsor.md

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626

2727
## X系列库快速集成
2828

29-
为了方便大家快速集成X系列框架库,我提供了一个空壳模版供大家参考使用: https://github.com/xuexiangjys/TemplateAppProject
29+
为了方便大家快速集成X系列框架库,我提供了一个空壳模版供大家参考使用: [https://github.com/xuexiangjys/TemplateAppProject](https://github.com/xuexiangjys/TemplateAppProject)
30+
31+
除此之外,我还特别制作了几期[视频教程](https://space.bilibili.com/483850585/channel/detail?cid=104998)供大家学习参考.
3032

3133
----
3234

@@ -63,12 +65,12 @@ allprojects {
6365
dependencies {
6466
...
6567
//androidx项目
66-
implementation 'com.github.xuexiangjys:XUI:1.1.2'
68+
implementation 'com.github.xuexiangjys:XUI:1.1.3'
6769
6870
implementation 'androidx.appcompat:appcompat:1.1.0'
6971
implementation 'androidx.recyclerview:recyclerview:1.1.0'
7072
implementation 'com.google.android.material:material:1.1.0-beta01'
71-
implementation 'com.github.bumptech.glide:glide:4.8.0'
73+
implementation 'com.github.bumptech.glide:glide:4.11.0'
7274
}
7375
```
7476

@@ -223,6 +225,10 @@ C*y | 1¥ | 微信
223225
*清红 | 1¥ | 支付宝
224226
*口 | 5¥ | 微信
225227
\* | 10.24¥ | 微信
228+
*俊耀 | 100¥ | 支付宝
229+
*俊杰 | 1¥ | 支付宝
230+
*鸥 | 10.24¥ | 微信
231+
*云 | 20.21¥ | 支付宝
226232

227233

228234
## 联系方式

app/build.gradle

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414
applicationId "com.xuexiang.xuidemo"
1515
minSdkVersion 17
1616
targetSdkVersion build_versions.target_sdk
17-
versionCode 13
18-
versionName "1.1.2"
17+
versionCode 14
18+
versionName "1.1.3"
1919

2020
multiDexEnabled true
2121
vectorDrawables.useSupportLibrary = true
@@ -99,16 +99,16 @@ dependencies {
9999
implementation 'androidx.appcompat:appcompat:1.1.0'
100100
implementation 'androidx.recyclerview:recyclerview:1.1.0'
101101
implementation 'com.google.android.material:material:1.1.0-beta01'
102-
implementation 'com.github.bumptech.glide:glide:4.8.0'
102+
implementation 'com.github.bumptech.glide:glide:4.11.0'
103103

104104
//XUI框架
105-
// implementation project(':xui_lib')
106-
implementation 'com.github.xuexiangjys:XUI:1.1.2'
105+
implementation project(':xui_lib')
106+
// implementation 'com.github.xuexiangjys:XUI:1.1.2'
107107
// implementation 'com.qmuiteam:qmui:1.2.0'
108108

109109
//工具类
110-
implementation 'com.github.xuexiangjys.XUtil:xutil-core:1.1.6'
111-
implementation 'com.github.xuexiangjys.XUtil:xutil-sub:1.1.6'
110+
implementation 'com.github.xuexiangjys.XUtil:xutil-core:1.1.7'
111+
implementation 'com.github.xuexiangjys.XUtil:xutil-sub:1.1.7'
112112
//切片
113113
implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.0.5x'
114114
//页面路由
@@ -191,8 +191,11 @@ dependencies {
191191
//相机拍摄
192192
implementation 'com.github.xuexiangjys:CameraView:1.0.3'
193193

194+
//另一款相机拍摄库,使用更简单
195+
implementation 'com.wonderkiln:camerakit:0.13.1'
196+
194197
//版本更新
195-
implementation 'com.github.xuexiangjys:XUpdate:1.1.1'
198+
implementation 'com.github.xuexiangjys:XUpdate:1.1.4'
196199
implementation 'com.zhy:okhttputils:2.6.2'
197200
//腾讯的键值对存储mmkv
198201
implementation 'com.tencent:mmkv:1.0.22'
@@ -204,6 +207,9 @@ dependencies {
204207
implementation 'com.umeng.umsdk:analytics:8.0.2'
205208
implementation 'com.umeng.umsdk:common:2.0.2'
206209

210+
//ANR异常捕获
211+
implementation 'com.github.anrwatchdog:anrwatchdog:1.4.0'
212+
207213
//bugly统计
208214
implementation 'com.tencent.bugly:crashreport:3.0.0'
209215
//其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如2.1.9

app/proguard-rules.pro

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@
180180
-keep class com.google.gson.stream.** { *; }
181181
-keep class com.google.gson.examples.android.model.** { *; }
182182

183+
# Glide
184+
-keep public class * implements com.bumptech.glide.module.GlideModule
185+
-keep public class * extends com.bumptech.glide.module.AppGlideModule
186+
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
187+
**[] $VALUES;
188+
public *;
189+
}
190+
# for DexGuard only
191+
-keepresourcexmlelements manifest/application/meta-data@value=GlideModule
192+
183193
# Retrofit
184194
-dontwarn retrofit2.**
185195
-keep class retrofit2.** { *; }
@@ -300,3 +310,15 @@
300310

301311
# 数据库
302312
-keep class com.xuexiang.xuidemo.base.db.entity.** { *; }
313+
314+
# PictureSelector
315+
-keep class com.luck.picture.lib.** { *; }
316+
-dontwarn com.yalantis.ucrop**
317+
-keep class com.yalantis.ucrop** { *; }
318+
-keep interface com.yalantis.ucrop** { *; }
319+
320+
# camerakit
321+
-dontwarn com.google.android.gms.**
322+
-keepclasseswithmembers class com.camerakit.preview.CameraSurfaceView {
323+
native <methods>;
324+
}

app/src/main/java/com/xuexiang/xuidemo/MyApp.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.xuexiang.xormlite.annotation.DataBase;
1212
import com.xuexiang.xormlite.enums.DataBaseType;
1313
import com.xuexiang.xui.XUI;
14+
import com.xuexiang.xuidemo.utils.sdkinit.ANRWatchDogInit;
1415
import com.xuexiang.xuidemo.utils.sdkinit.AutoCameraStrategy;
1516
import com.xuexiang.xuidemo.utils.sdkinit.BuglyInit;
1617
import com.xuexiang.xuidemo.utils.sdkinit.TbsInit;
@@ -50,6 +51,8 @@ public void onCreate() {
5051
UMengInit.init(this);
5152
BuglyInit.init(this);
5253
}
54+
//ANR监控
55+
ANRWatchDogInit.init();
5356
}
5457

5558
/**

app/src/main/java/com/xuexiang/xuidemo/fragment/AboutFragment.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public class AboutFragment extends BaseFragment {
4343
TextView mVersionTextView;
4444
@BindView(R.id.about_list)
4545
XUIGroupListView mAboutGroupListView;
46-
@BindView(R.id.copyright) TextView mCopyrightTextView;
46+
@BindView(R.id.copyright)
47+
TextView mCopyrightTextView;
4748

4849
@Override
4950
protected int getLayoutId() {
@@ -78,6 +79,11 @@ public void onClick(View v) {
7879
public void onClick(View v) {
7980
Utils.checkUpdate(getContext(), true);
8081
}
82+
}).addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_sponsor)), new View.OnClickListener() {
83+
@Override
84+
public void onClick(View v) {
85+
openPage(SponsorFragment.class);
86+
}
8187
})
8288
.addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_add_qq_group)), v -> Utils.goWeb(getContext(), getString(R.string.url_add_qq_group)))
8389
.addTo(mAboutGroupListView);

app/src/main/java/com/xuexiang/xuidemo/fragment/LoginFragment.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import com.xuexiang.xuidemo.R;
3232
import com.xuexiang.xuidemo.activity.MainActivity;
3333
import com.xuexiang.xuidemo.base.BaseFragment;
34+
import com.xuexiang.xuidemo.utils.PrivacyUtils;
35+
import com.xuexiang.xuidemo.utils.SettingSPUtils;
3436
import com.xuexiang.xuidemo.utils.TokenUtils;
3537
import com.xuexiang.xuidemo.utils.XToastUtils;
3638
import com.xuexiang.xutil.app.ActivityUtils;
@@ -77,6 +79,14 @@ protected TitleBar initTitle() {
7779
protected void initViews() {
7880
mCountDownHelper = new CountDownButtonHelper(btnGetVerifyCode, 60);
7981

82+
//隐私政策弹窗
83+
SettingSPUtils spUtils = SettingSPUtils.getInstance();
84+
if (!spUtils.isAgreePrivacy()) {
85+
PrivacyUtils.showPrivacyDialog(getContext(), (dialog, which) -> {
86+
dialog.dismiss();
87+
spUtils.setIsAgreePrivacy(true);
88+
});
89+
}
8090
}
8191

8292
@SingleClick
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
/*
2+
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
package com.xuexiang.xuidemo.fragment;
19+
20+
import android.content.Intent;
21+
import android.graphics.Bitmap;
22+
import android.net.Uri;
23+
import android.os.Bundle;
24+
import android.view.View;
25+
import android.widget.ImageView;
26+
27+
import androidx.annotation.NonNull;
28+
import androidx.appcompat.widget.AppCompatImageView;
29+
30+
import com.xuexiang.xaop.annotation.SingleClick;
31+
import com.xuexiang.xpage.annotation.Page;
32+
import com.xuexiang.xqrcode.XQRCode;
33+
import com.xuexiang.xqrcode.util.QRCodeAnalyzeUtils;
34+
import com.xuexiang.xui.widget.dialog.bottomsheet.BottomSheet;
35+
import com.xuexiang.xuidemo.R;
36+
import com.xuexiang.xuidemo.base.BaseFragment;
37+
import com.xuexiang.xuidemo.fragment.components.imageview.DrawablePreviewFragment;
38+
import com.xuexiang.xuidemo.utils.XToastUtils;
39+
import com.xuexiang.xutil.app.PathUtils;
40+
import com.xuexiang.xutil.app.SocialShareUtils;
41+
import com.xuexiang.xutil.display.ImageUtils;
42+
import com.xuexiang.xutil.file.FileUtils;
43+
import com.xuexiang.xutil.net.NetworkUtils;
44+
45+
import java.io.File;
46+
47+
import butterknife.BindView;
48+
49+
import static com.xuexiang.xuidemo.fragment.components.imageview.DrawablePreviewFragment.DRAWABLE_ID;
50+
51+
/**
52+
* 赞助页面
53+
*
54+
* @author xuexiang
55+
* @since 2020-02-19 13:49
56+
*/
57+
@Page(name = "赞助项目")
58+
public class SponsorFragment extends BaseFragment implements View.OnClickListener, View.OnLongClickListener {
59+
60+
@BindView(R.id.iv_wei_xin_pay)
61+
AppCompatImageView ivWeiXinPay;
62+
@BindView(R.id.iv_ali_pay)
63+
AppCompatImageView ivAliPay;
64+
65+
@Override
66+
protected int getLayoutId() {
67+
return R.layout.fragment_sponsor;
68+
}
69+
70+
@Override
71+
protected void initViews() {
72+
73+
}
74+
75+
@Override
76+
protected void initListeners() {
77+
ivAliPay.setTag("ali_pay");
78+
ivAliPay.setOnClickListener(this);
79+
ivAliPay.setOnLongClickListener(this);
80+
ivWeiXinPay.setTag("wei_xin_pay");
81+
ivWeiXinPay.setOnClickListener(this);
82+
ivWeiXinPay.setOnLongClickListener(this);
83+
}
84+
85+
@SingleClick
86+
@Override
87+
public void onClick(View v) {
88+
Bundle bundle = new Bundle();
89+
switch (v.getId()) {
90+
case R.id.iv_wei_xin_pay:
91+
bundle.putInt(DRAWABLE_ID, R.drawable.img_wei_xin_pay);
92+
openPage(DrawablePreviewFragment.class, bundle);
93+
break;
94+
case R.id.iv_ali_pay:
95+
bundle.putInt(DRAWABLE_ID, R.drawable.img_ali_pay);
96+
openPage(DrawablePreviewFragment.class, bundle);
97+
break;
98+
default:
99+
break;
100+
}
101+
}
102+
103+
@Override
104+
public boolean onLongClick(View v) {
105+
if (v instanceof ImageView) {
106+
showBottomSheetList(v, ImageUtils.drawable2Bitmap(((ImageView) v).getDrawable()));
107+
}
108+
return true;
109+
}
110+
111+
@NonNull
112+
private String getImgFilePath(View v) {
113+
return FileUtils.getDiskFilesDir() + File.separator + v.getTag() + ".png";
114+
}
115+
116+
private void showBottomSheetList(View v, final Bitmap bitmap) {
117+
final String imgPath = getImgFilePath(v);
118+
BottomSheet.BottomListSheetBuilder builder = new BottomSheet.BottomListSheetBuilder(getActivity())
119+
.addItem("发送给朋友")
120+
.addItem("保存图片");
121+
if (v.getId() == R.id.iv_ali_pay) {
122+
builder.addItem("识别图中的二维码");
123+
}
124+
builder.setOnSheetItemClickListener((dialog, itemView, position, tag) -> {
125+
dialog.dismiss();
126+
boolean result = checkFile(imgPath, bitmap);
127+
switch (position) {
128+
case 0:
129+
if (result) {
130+
SocialShareUtils.sharePicture(getActivity(), PathUtils.getUriForFile(FileUtils.getFileByPath(imgPath)));
131+
} else {
132+
XToastUtils.toast("图片发送失败!");
133+
}
134+
break;
135+
case 1:
136+
if (result) {
137+
XToastUtils.toast("图片保存成功:" + imgPath);
138+
} else {
139+
XToastUtils.toast("图片保存失败!");
140+
}
141+
break;
142+
case 2:
143+
if (result) {
144+
XQRCode.analyzeQRCode(imgPath, new QRCodeAnalyzeUtils.AnalyzeCallback() {
145+
@Override
146+
public void onAnalyzeSuccess(Bitmap mBitmap, String result) {
147+
if (NetworkUtils.isUrlValid(result)) {
148+
goWeb(result);
149+
}
150+
}
151+
152+
@Override
153+
public void onAnalyzeFailed() {
154+
XToastUtils.toast("解析二维码失败!");
155+
}
156+
});
157+
} else {
158+
XToastUtils.toast("二维码识别失败!");
159+
}
160+
break;
161+
default:
162+
break;
163+
}
164+
})
165+
.build()
166+
.show();
167+
}
168+
169+
private boolean checkFile(String imgPath, Bitmap bitmap) {
170+
boolean result = FileUtils.isFileExists(imgPath);
171+
if (!result) {
172+
result = ImageUtils.save(bitmap, imgPath, Bitmap.CompressFormat.PNG);
173+
}
174+
return result;
175+
}
176+
177+
/**
178+
* 以系统API的方式请求浏览器
179+
*
180+
* @param url
181+
*/
182+
public void goWeb(final String url) {
183+
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
184+
startActivity(intent);
185+
}
186+
187+
}

0 commit comments

Comments
 (0)