Skip to content

Commit

Permalink
Merge pull request #60 from xuexiangjys/dev/1.1.3
Browse files Browse the repository at this point in the history
Dev/1.1.3
  • Loading branch information
xuexiangjys authored Mar 2, 2020
2 parents cadeb65 + 8fce103 commit 7bcbfe1
Show file tree
Hide file tree
Showing 29 changed files with 961 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These are supported funding model platforms

custom: https://github.com/xuexiangjys/Resource/blob/master/doc/sponsor.md
custom: https://gitee.com/xuexiangjys/Resource/blob/master/doc/sponsor.md
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@

## X系列库快速集成

为了方便大家快速集成X系列框架库,我提供了一个空壳模版供大家参考使用: https://github.com/xuexiangjys/TemplateAppProject
为了方便大家快速集成X系列框架库,我提供了一个空壳模版供大家参考使用: [https://github.com/xuexiangjys/TemplateAppProject](https://github.com/xuexiangjys/TemplateAppProject)

除此之外,我还特别制作了几期[视频教程](https://space.bilibili.com/483850585/channel/detail?cid=104998)供大家学习参考.

----

Expand Down Expand Up @@ -63,12 +65,12 @@ allprojects {
dependencies {
...
//androidx项目
implementation 'com.github.xuexiangjys:XUI:1.1.2'
implementation 'com.github.xuexiangjys:XUI:1.1.3'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0-beta01'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
}
```

Expand Down Expand Up @@ -223,6 +225,10 @@ C*y | 1¥ | 微信
*清红 | 1¥ | 支付宝
*口 | 5¥ | 微信
\* | 10.24¥ | 微信
*俊耀 | 100¥ | 支付宝
*俊杰 | 1¥ | 支付宝
*鸥 | 10.24¥ | 微信
*云 | 20.21¥ | 支付宝


## 联系方式
Expand Down
22 changes: 14 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId "com.xuexiang.xuidemo"
minSdkVersion 17
targetSdkVersion build_versions.target_sdk
versionCode 13
versionName "1.1.2"
versionCode 14
versionName "1.1.3"

multiDexEnabled true
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -99,16 +99,16 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0-beta01'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'

//XUI框架
// implementation project(':xui_lib')
implementation 'com.github.xuexiangjys:XUI:1.1.2'
implementation project(':xui_lib')
// implementation 'com.github.xuexiangjys:XUI:1.1.2'
// implementation 'com.qmuiteam:qmui:1.2.0'

//工具类
implementation 'com.github.xuexiangjys.XUtil:xutil-core:1.1.6'
implementation 'com.github.xuexiangjys.XUtil:xutil-sub:1.1.6'
implementation 'com.github.xuexiangjys.XUtil:xutil-core:1.1.7'
implementation 'com.github.xuexiangjys.XUtil:xutil-sub:1.1.7'
//切片
implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.0.5x'
//页面路由
Expand Down Expand Up @@ -191,8 +191,11 @@ dependencies {
//相机拍摄
implementation 'com.github.xuexiangjys:CameraView:1.0.3'

//另一款相机拍摄库,使用更简单
implementation 'com.wonderkiln:camerakit:0.13.1'

//版本更新
implementation 'com.github.xuexiangjys:XUpdate:1.1.1'
implementation 'com.github.xuexiangjys:XUpdate:1.1.4'
implementation 'com.zhy:okhttputils:2.6.2'
//腾讯的键值对存储mmkv
implementation 'com.tencent:mmkv:1.0.22'
Expand All @@ -204,6 +207,9 @@ dependencies {
implementation 'com.umeng.umsdk:analytics:8.0.2'
implementation 'com.umeng.umsdk:common:2.0.2'

//ANR异常捕获
implementation 'com.github.anrwatchdog:anrwatchdog:1.4.0'

//bugly统计
implementation 'com.tencent.bugly:crashreport:3.0.0'
//其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如2.1.9
Expand Down
22 changes: 22 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@
-keep class com.google.gson.stream.** { *; }
-keep class com.google.gson.examples.android.model.** { *; }

# Glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
# for DexGuard only
-keepresourcexmlelements manifest/application/meta-data@value=GlideModule

# Retrofit
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
Expand Down Expand Up @@ -300,3 +310,15 @@

# 数据库
-keep class com.xuexiang.xuidemo.base.db.entity.** { *; }

# PictureSelector
-keep class com.luck.picture.lib.** { *; }
-dontwarn com.yalantis.ucrop**
-keep class com.yalantis.ucrop** { *; }
-keep interface com.yalantis.ucrop** { *; }

# camerakit
-dontwarn com.google.android.gms.**
-keepclasseswithmembers class com.camerakit.preview.CameraSurfaceView {
native <methods>;
}
3 changes: 3 additions & 0 deletions app/src/main/java/com/xuexiang/xuidemo/MyApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.xuexiang.xormlite.annotation.DataBase;
import com.xuexiang.xormlite.enums.DataBaseType;
import com.xuexiang.xui.XUI;
import com.xuexiang.xuidemo.utils.sdkinit.ANRWatchDogInit;
import com.xuexiang.xuidemo.utils.sdkinit.AutoCameraStrategy;
import com.xuexiang.xuidemo.utils.sdkinit.BuglyInit;
import com.xuexiang.xuidemo.utils.sdkinit.TbsInit;
Expand Down Expand Up @@ -50,6 +51,8 @@ public void onCreate() {
UMengInit.init(this);
BuglyInit.init(this);
}
//ANR监控
ANRWatchDogInit.init();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public class AboutFragment extends BaseFragment {
TextView mVersionTextView;
@BindView(R.id.about_list)
XUIGroupListView mAboutGroupListView;
@BindView(R.id.copyright) TextView mCopyrightTextView;
@BindView(R.id.copyright)
TextView mCopyrightTextView;

@Override
protected int getLayoutId() {
Expand Down Expand Up @@ -78,6 +79,11 @@ public void onClick(View v) {
public void onClick(View v) {
Utils.checkUpdate(getContext(), true);
}
}).addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_sponsor)), new View.OnClickListener() {
@Override
public void onClick(View v) {
openPage(SponsorFragment.class);
}
})
.addItemView(mAboutGroupListView.createItemView(getResources().getString(R.string.about_item_add_qq_group)), v -> Utils.goWeb(getContext(), getString(R.string.url_add_qq_group)))
.addTo(mAboutGroupListView);
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/com/xuexiang/xuidemo/fragment/LoginFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import com.xuexiang.xuidemo.R;
import com.xuexiang.xuidemo.activity.MainActivity;
import com.xuexiang.xuidemo.base.BaseFragment;
import com.xuexiang.xuidemo.utils.PrivacyUtils;
import com.xuexiang.xuidemo.utils.SettingSPUtils;
import com.xuexiang.xuidemo.utils.TokenUtils;
import com.xuexiang.xuidemo.utils.XToastUtils;
import com.xuexiang.xutil.app.ActivityUtils;
Expand Down Expand Up @@ -77,6 +79,14 @@ protected TitleBar initTitle() {
protected void initViews() {
mCountDownHelper = new CountDownButtonHelper(btnGetVerifyCode, 60);

//隐私政策弹窗
SettingSPUtils spUtils = SettingSPUtils.getInstance();
if (!spUtils.isAgreePrivacy()) {
PrivacyUtils.showPrivacyDialog(getContext(), (dialog, which) -> {
dialog.dismiss();
spUtils.setIsAgreePrivacy(true);
});
}
}

@SingleClick
Expand Down
187 changes: 187 additions & 0 deletions app/src/main/java/com/xuexiang/xuidemo/fragment/SponsorFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package com.xuexiang.xuidemo.fragment;

import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatImageView;

import com.xuexiang.xaop.annotation.SingleClick;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xqrcode.XQRCode;
import com.xuexiang.xqrcode.util.QRCodeAnalyzeUtils;
import com.xuexiang.xui.widget.dialog.bottomsheet.BottomSheet;
import com.xuexiang.xuidemo.R;
import com.xuexiang.xuidemo.base.BaseFragment;
import com.xuexiang.xuidemo.fragment.components.imageview.DrawablePreviewFragment;
import com.xuexiang.xuidemo.utils.XToastUtils;
import com.xuexiang.xutil.app.PathUtils;
import com.xuexiang.xutil.app.SocialShareUtils;
import com.xuexiang.xutil.display.ImageUtils;
import com.xuexiang.xutil.file.FileUtils;
import com.xuexiang.xutil.net.NetworkUtils;

import java.io.File;

import butterknife.BindView;

import static com.xuexiang.xuidemo.fragment.components.imageview.DrawablePreviewFragment.DRAWABLE_ID;

/**
* 赞助页面
*
* @author xuexiang
* @since 2020-02-19 13:49
*/
@Page(name = "赞助项目")
public class SponsorFragment extends BaseFragment implements View.OnClickListener, View.OnLongClickListener {

@BindView(R.id.iv_wei_xin_pay)
AppCompatImageView ivWeiXinPay;
@BindView(R.id.iv_ali_pay)
AppCompatImageView ivAliPay;

@Override
protected int getLayoutId() {
return R.layout.fragment_sponsor;
}

@Override
protected void initViews() {

}

@Override
protected void initListeners() {
ivAliPay.setTag("ali_pay");
ivAliPay.setOnClickListener(this);
ivAliPay.setOnLongClickListener(this);
ivWeiXinPay.setTag("wei_xin_pay");
ivWeiXinPay.setOnClickListener(this);
ivWeiXinPay.setOnLongClickListener(this);
}

@SingleClick
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
switch (v.getId()) {
case R.id.iv_wei_xin_pay:
bundle.putInt(DRAWABLE_ID, R.drawable.img_wei_xin_pay);
openPage(DrawablePreviewFragment.class, bundle);
break;
case R.id.iv_ali_pay:
bundle.putInt(DRAWABLE_ID, R.drawable.img_ali_pay);
openPage(DrawablePreviewFragment.class, bundle);
break;
default:
break;
}
}

@Override
public boolean onLongClick(View v) {
if (v instanceof ImageView) {
showBottomSheetList(v, ImageUtils.drawable2Bitmap(((ImageView) v).getDrawable()));
}
return true;
}

@NonNull
private String getImgFilePath(View v) {
return FileUtils.getDiskFilesDir() + File.separator + v.getTag() + ".png";
}

private void showBottomSheetList(View v, final Bitmap bitmap) {
final String imgPath = getImgFilePath(v);
BottomSheet.BottomListSheetBuilder builder = new BottomSheet.BottomListSheetBuilder(getActivity())
.addItem("发送给朋友")
.addItem("保存图片");
if (v.getId() == R.id.iv_ali_pay) {
builder.addItem("识别图中的二维码");
}
builder.setOnSheetItemClickListener((dialog, itemView, position, tag) -> {
dialog.dismiss();
boolean result = checkFile(imgPath, bitmap);
switch (position) {
case 0:
if (result) {
SocialShareUtils.sharePicture(getActivity(), PathUtils.getUriForFile(FileUtils.getFileByPath(imgPath)));
} else {
XToastUtils.toast("图片发送失败!");
}
break;
case 1:
if (result) {
XToastUtils.toast("图片保存成功:" + imgPath);
} else {
XToastUtils.toast("图片保存失败!");
}
break;
case 2:
if (result) {
XQRCode.analyzeQRCode(imgPath, new QRCodeAnalyzeUtils.AnalyzeCallback() {
@Override
public void onAnalyzeSuccess(Bitmap mBitmap, String result) {
if (NetworkUtils.isUrlValid(result)) {
goWeb(result);
}
}

@Override
public void onAnalyzeFailed() {
XToastUtils.toast("解析二维码失败!");
}
});
} else {
XToastUtils.toast("二维码识别失败!");
}
break;
default:
break;
}
})
.build()
.show();
}

private boolean checkFile(String imgPath, Bitmap bitmap) {
boolean result = FileUtils.isFileExists(imgPath);
if (!result) {
result = ImageUtils.save(bitmap, imgPath, Bitmap.CompressFormat.PNG);
}
return result;
}

/**
* 以系统API的方式请求浏览器
*
* @param url
*/
public void goWeb(final String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
}

}
Loading

0 comments on commit 7bcbfe1

Please sign in to comment.