用户注册以及loading优化
This commit is contained in:
@@ -111,6 +111,7 @@ dependencies {
|
||||
// exclude(module: 'alicloud-android-utdid')
|
||||
// exclude(module: 'alicloud-android-utils')
|
||||
// }
|
||||
api 'com.aliyun.dpa:oss-android-sdk:2.9.5'
|
||||
// api 'com.aliyun.dpa:oss-android-sdk:2.9.5'
|
||||
api 'com.aliyun.dpa:oss-android-sdk:2.9.13'
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.ColorRes;
|
||||
@@ -24,9 +22,10 @@ import androidx.viewbinding.ViewBinding;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.callback.RefreshCallBack;
|
||||
import com.dahe.mylibrary.utils.BarUtils;
|
||||
import com.dahe.mylibrary.utils.ConvertUtils;
|
||||
import com.dahe.mylibrary.utils.LoadingUtils;
|
||||
import com.dahe.mylibrary.utils.StatusBar;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
import com.lxj.xpopup.impl.LoadingPopupView;
|
||||
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smart.refresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smart.refresh.layout.constant.RefreshState;
|
||||
@@ -189,7 +188,7 @@ public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActi
|
||||
((TextView) findViewById(R.id.common_toolBar_title)).setTextColor(isWhite ? getColor(R.color.colorWhite) : getColor(R.color.black));
|
||||
((TextView) findViewById(R.id.common_toolBar_title)).setText(title);
|
||||
}
|
||||
if (isWhite){
|
||||
if (isWhite) {
|
||||
StatusBar.cancelLightStatusBar(this);//图标文字白色
|
||||
}
|
||||
|
||||
@@ -230,7 +229,7 @@ public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActi
|
||||
// llContent.setLayoutParams(closeLayoutParams);
|
||||
|
||||
|
||||
llContent.setPadding(0,BarUtils.getStatusBarHeight(),0,0);
|
||||
llContent.setPadding(0, BarUtils.getStatusBarHeight(), 0, 0);
|
||||
}
|
||||
|
||||
protected abstract void initView(Bundle savedInstanceState);
|
||||
@@ -255,6 +254,7 @@ public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActi
|
||||
super.onDestroy();
|
||||
//释放持有,防止泄露
|
||||
binding = null;
|
||||
LoadingUtils.Companion.getInstance().dissLoading();
|
||||
}
|
||||
|
||||
|
||||
@@ -334,5 +334,16 @@ public abstract class BaseActivity<VB extends ViewBinding> extends AppCompatActi
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
LoadingPopupView loadingPopup;
|
||||
|
||||
public void showLoading() {
|
||||
// LoadingUtils3.Companion.getInstance(this).showLoading("网络请求中......");
|
||||
LoadingUtils.Companion.getInstance().showLoading(this,"网络请求中......");
|
||||
|
||||
}
|
||||
|
||||
public void dissLoading() {
|
||||
// LoadingUtils3.Companion.getInstance(this).dissLoading();
|
||||
LoadingUtils.Companion.getInstance().dissLoading();
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import org.json.JSONObject;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import kotlin.Pair;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
|
||||
@@ -50,7 +50,7 @@ class PopNorBottomPic(
|
||||
// .setCameraInterceptListener(getCustomCameraEvent())//自定义相机
|
||||
// .setRecordAudioInterceptListener(MainActivity.MeOnRecordAudioInterceptListener())//录音回调事件
|
||||
// .setCropEngine(ImageFileCropEngine())//裁剪
|
||||
.setCompressEngine(ImageFileCompressEngine())//压缩
|
||||
// .setCompressEngine(ImageFileCompressEngine())//压缩
|
||||
|
||||
// .setSelectLimitTipsListener(MainActivity.MeOnSelectLimitTipsListener())//拦截自定义提示
|
||||
// .setAddBitmapWatermarkListener(getAddBitmapWatermarkListener())//给图片添加水印
|
||||
|
||||
@@ -51,13 +51,25 @@ public class ActivityUtils {
|
||||
*/
|
||||
public static void startPushActivity(@NonNull Context context, @NonNull Class<?> clz, Bundle bundle) {
|
||||
Intent intent = new Intent(context, clz);
|
||||
if (null != bundle){
|
||||
if (null != bundle) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtras(bundle);
|
||||
}
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动Activity
|
||||
*
|
||||
* @param context
|
||||
* @param clz
|
||||
*/
|
||||
public static void startHomeActivity(@NonNull Context context, @NonNull Class<?> clz) {
|
||||
Intent intent = new Intent(context, clz);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK & Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动Activity
|
||||
*
|
||||
@@ -265,7 +277,7 @@ public class ActivityUtils {
|
||||
finishActivity(aActivity);
|
||||
}
|
||||
return true;
|
||||
}else{
|
||||
} else {
|
||||
finishActivity(aActivity);
|
||||
}
|
||||
// finishActivity(aActivity);
|
||||
@@ -310,6 +322,21 @@ public class ActivityUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除除本activity之外所有的activity
|
||||
*
|
||||
* @param clz 本activity的类名
|
||||
*/
|
||||
public static void finishOtherActivitiesToNew(Context context,@NonNull final Class<?> clz) {
|
||||
List<Activity> activities = CommonBaseLibrary.activityList;
|
||||
for (Activity activity : activities) {
|
||||
if (!activity.getClass().equals(clz)) {
|
||||
finishActivity(activity);
|
||||
}
|
||||
}
|
||||
startActivity(context,clz);
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束所有activity
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.dahe.mylibrary.utils
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.lxj.xpopup.XPopup
|
||||
import com.lxj.xpopup.impl.LoadingPopupView
|
||||
|
||||
/**
|
||||
* @ClassName LoadingUtils
|
||||
* @Author john
|
||||
* @Date 2024/2/29 11:10
|
||||
* @Description TODO
|
||||
*/
|
||||
class LoadingUtils private constructor() {
|
||||
var loadingPopup: LoadingPopupView? = null
|
||||
lateinit var activity: AppCompatActivity
|
||||
|
||||
|
||||
companion object {
|
||||
val instance = Holder.holder
|
||||
}
|
||||
|
||||
object Holder {
|
||||
val holder = LoadingUtils()
|
||||
}
|
||||
|
||||
|
||||
fun init(activity: AppCompatActivity, message: String = "网络请求中......"): LoadingPopupView? {
|
||||
loadingPopup = XPopup.Builder(activity)
|
||||
.dismissOnBackPressed(false)
|
||||
.isLightNavigationBar(true)
|
||||
.asLoading(message, LoadingPopupView.Style.ProgressBar)
|
||||
|
||||
return loadingPopup
|
||||
}
|
||||
|
||||
fun showLoading(activity: AppCompatActivity, message: String = "网络请求中......") {
|
||||
if (!activity.isDestroyed)
|
||||
loadingPopup = XPopup.Builder(activity)
|
||||
.dismissOnBackPressed(true)
|
||||
.isLightNavigationBar(true)
|
||||
.asLoading(message, LoadingPopupView.Style.ProgressBar)
|
||||
.show() as LoadingPopupView
|
||||
}
|
||||
|
||||
fun dissLoading() {
|
||||
if (loadingPopup != null && loadingPopup!!.isShow) {
|
||||
loadingPopup!!.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
fun isShow() = loadingPopup?.isShow
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.dahe.mylibrary.utils
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.dahe.mylibrary.base.SingletonHolder
|
||||
import com.lxj.xpopup.XPopup
|
||||
import com.lxj.xpopup.impl.LoadingPopupView
|
||||
|
||||
/**
|
||||
* @ClassName LoadingUtils
|
||||
* @Author john
|
||||
* @Date 2024/2/29 11:10
|
||||
* @Description TODO
|
||||
*/
|
||||
class LoadingUtils3 private constructor(activity: AppCompatActivity) {
|
||||
var loadingPopup: LoadingPopupView? = null
|
||||
lateinit var activity: AppCompatActivity
|
||||
|
||||
companion object : SingletonHolder<LoadingUtils3, AppCompatActivity>(::LoadingUtils3)
|
||||
|
||||
init {
|
||||
this.activity = activity
|
||||
}
|
||||
|
||||
fun init(message: String = "网络请求中......"): LoadingPopupView? {
|
||||
if (loadingPopup == null) {
|
||||
loadingPopup = XPopup.Builder(activity)
|
||||
.dismissOnBackPressed(false)
|
||||
.isLightNavigationBar(true)
|
||||
.asLoading(message, LoadingPopupView.Style.ProgressBar)
|
||||
}
|
||||
|
||||
return loadingPopup
|
||||
}
|
||||
|
||||
fun showLoading(message: String = "网络请求中......") {
|
||||
loadingPopup = XPopup.Builder(activity)
|
||||
.dismissOnBackPressed(false)
|
||||
.isLightNavigationBar(true)
|
||||
.asLoading(message, LoadingPopupView.Style.ProgressBar)
|
||||
.show() as LoadingPopupView
|
||||
}
|
||||
|
||||
fun dissLoading() {
|
||||
if (loadingPopup != null && loadingPopup!!.isShow) {
|
||||
loadingPopup!!.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
fun isShow() = loadingPopup?.isShow
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.dahe.mylibrary.utils
|
||||
|
||||
import android.content.Context
|
||||
import com.dahe.mylibrary.adapter.GridImageAdapter
|
||||
import com.dahe.mylibrary.base.SingletonHolder
|
||||
import com.dahe.mylibrary.base.SingletonNoPHolder
|
||||
import com.dahe.mylibrary.callback.OnPicResultListener
|
||||
import com.dahe.mylibrary.pop.PopBottomPic
|
||||
|
||||
Reference in New Issue
Block a user