update 封装base库;集成flowwindow库;悬浮窗功能;赞助和分享;集成企微sdk;界面更新;添加待办修复;滚动手势优化;建群达到上限检查;兼容减号和括号搜索;应用保活;其他已知缺陷修复
This commit is contained in:
1
baselibrary/.gitignore
vendored
Normal file
1
baselibrary/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
67
baselibrary/build.gradle
Normal file
67
baselibrary/build.gradle
Normal file
@@ -0,0 +1,67 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
api 'androidx.core:core-ktx:1.3.2'
|
||||
api 'androidx.appcompat:appcompat:1.3.1'
|
||||
api 'com.google.android.material:material:1.4.0'
|
||||
|
||||
//工具集
|
||||
api 'com.blankj:utilcodex:1.31.0'
|
||||
//toast
|
||||
api 'com.github.getActivity:ToastUtils:10.5'
|
||||
//Gson
|
||||
api 'com.google.code.gson:gson:2.8.5'
|
||||
//网络
|
||||
api 'com.github.bumptech.glide:okhttp3-integration:4.9.0'
|
||||
//自动更新
|
||||
api 'com.teprinciple:updateapputilsx:2.3.0'
|
||||
//okgo
|
||||
api 'com.lzy.net:okgo:3.0.4'
|
||||
//qrcode
|
||||
api 'com.github.yoojia:next-qrcode:2.0-2'
|
||||
//QMUI
|
||||
api 'com.qmuiteam:qmui:2.0.0-alpha10'
|
||||
//recyclerview
|
||||
api 'androidx.recyclerview:recyclerview:1.2.0-alpha05'
|
||||
//glide
|
||||
api 'com.github.bumptech.glide:glide:4.9.0'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
|
||||
//photoview
|
||||
api 'com.github.chrisbanes:PhotoView:2.1.3'
|
||||
//悬浮窗框架
|
||||
api 'com.github.princekin-f:EasyFloat:1.3.4'
|
||||
|
||||
//leak
|
||||
// debugApi 'com.squareup.leakcanary:leakcanary-android:1.5.4'
|
||||
// releaseApi 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
|
||||
// testApi 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
21
baselibrary/proguard-rules.pro
vendored
Normal file
21
baselibrary/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
2
baselibrary/src/main/AndroidManifest.xml
Normal file
2
baselibrary/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="base" />
|
||||
95
baselibrary/src/main/java/base/adapter/RvSimpleAdapter.java
Normal file
95
baselibrary/src/main/java/base/adapter/RvSimpleAdapter.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package base.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by gallon on 2019/7/26.
|
||||
*/
|
||||
|
||||
public abstract class RvSimpleAdapter<T> extends RecyclerView.Adapter<RvViewHolder> {
|
||||
|
||||
protected LayoutInflater mInflater;
|
||||
public List<T> mData;
|
||||
public int mHeaderCount = 0;
|
||||
public Context mContext;
|
||||
protected int mLayoutId;
|
||||
|
||||
public static abstract class OnItemClickListener {
|
||||
public abstract void onItemClick(View view, int position, RvViewHolder holder);
|
||||
|
||||
public void onItemLongClick(View view, int position, RvViewHolder holder) {
|
||||
}
|
||||
}
|
||||
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.onItemClickListener = listener;
|
||||
}
|
||||
|
||||
public RvSimpleAdapter(Context context, List<T> data, int layoutId) {
|
||||
this.mContext = context;
|
||||
this.mData = data;
|
||||
this.mLayoutId = layoutId;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return null == mData ? 0 : mData.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(final RvViewHolder holder, final int position) {
|
||||
convert(holder, mData.get(holder.getLayoutPosition() - mHeaderCount), position);
|
||||
setUpItemEvent(holder);
|
||||
}
|
||||
|
||||
public abstract void convert(RvViewHolder holder, T bean, int position);
|
||||
|
||||
public void setUpItemEvent(final RvViewHolder holder) {
|
||||
if (onItemClickListener != null) {
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
//这个获取位置的方法,防止添加删除导致位置不变
|
||||
int layoutPosition = holder.getAdapterPosition() - mHeaderCount;
|
||||
onItemClickListener.onItemClick(holder.itemView, layoutPosition, holder);
|
||||
});
|
||||
holder.itemView.setOnLongClickListener(v -> {
|
||||
int layoutPosition = holder.getAdapterPosition() - mHeaderCount;
|
||||
onItemClickListener.onItemLongClick(holder.itemView, layoutPosition, holder);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RvViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
RvViewHolder viewHolder = onCreateDefViewHolder(parent, viewType);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
protected RvViewHolder onCreateDefViewHolder(ViewGroup parent, int viewType) {
|
||||
return new RvViewHolder(mInflater.inflate(mLayoutId, parent, false));
|
||||
}
|
||||
|
||||
public void addData(T datas) {
|
||||
mData.add(mData.size(), datas);
|
||||
notifyItemInserted(mData.size());
|
||||
}
|
||||
|
||||
public void addData(int pos, T datas) {
|
||||
mData.add(pos, datas);
|
||||
notifyItemInserted(pos);
|
||||
}
|
||||
|
||||
|
||||
public void deleteData(int pos) {
|
||||
mData.remove(pos);
|
||||
notifyItemRemoved(pos);
|
||||
}
|
||||
}
|
||||
59
baselibrary/src/main/java/base/adapter/RvViewHolder.java
Normal file
59
baselibrary/src/main/java/base/adapter/RvViewHolder.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package base.adapter;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* Created by gallon on 2019/7/26.
|
||||
*/
|
||||
|
||||
public class RvViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private SparseArray<View> mViews;
|
||||
|
||||
public RvViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mViews = new SparseArray<View>();
|
||||
}
|
||||
|
||||
//通过viewId获取控件
|
||||
public <T extends View> T getView(int viewId) {
|
||||
View view = mViews.get(viewId);
|
||||
if (view == null) {
|
||||
view = itemView.findViewById(viewId);
|
||||
mViews.put(viewId, view);
|
||||
}
|
||||
return (T) view;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置TextView的值
|
||||
*/
|
||||
public RvViewHolder setText(int viewId, String text) {
|
||||
TextView tv = getView(viewId);
|
||||
tv.setText(text);
|
||||
return this;
|
||||
}
|
||||
|
||||
public RvViewHolder setImageResource(int viewId, int resId) {
|
||||
ImageView view = getView(viewId);
|
||||
view.setImageResource(resId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public RvViewHolder setImageBitamp(int viewId, Bitmap bitmap) {
|
||||
ImageView view = getView(viewId);
|
||||
view.setImageBitmap(bitmap);
|
||||
return this;
|
||||
}
|
||||
|
||||
public RvViewHolder setImageURI(int viewId, String uri) {
|
||||
ImageView view = getView(viewId);
|
||||
// Imageloader.getInstance().loadImg(view,uri);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
2
baselibrary/src/main/res/values/strings.xml
Normal file
2
baselibrary/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<resources>
|
||||
</resources>
|
||||
2
baselibrary/src/main/res/values/styles.xml
Normal file
2
baselibrary/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<resources>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user