添加log and crash 保存本地,分享。
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package com.xscm.modulemain.activity.user.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
|
||||
@@ -9,7 +11,11 @@ import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.FileUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.blankj.utilcode.util.ZipUtils;
|
||||
import com.tencent.qcloud.tuikit.timcommon.util.FileProvider;
|
||||
import com.xscm.modulemain.Application;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.databinding.ActivitySettingBinding;
|
||||
import com.xscm.modulemain.activity.user.conacts.SettingConacts;
|
||||
@@ -24,6 +30,17 @@ import com.xscm.moduleutil.utils.config.ConfigManager;
|
||||
import com.xscm.moduleutil.utils.config.EnvironmentEnum;
|
||||
import com.xscm.moduleutil.utils.config.EnvironmentPrefs;
|
||||
import com.xscm.moduleutil.widget.CommonAppConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/8/14
|
||||
@@ -67,8 +84,10 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
|
||||
mBinding.llZhxiao.setOnClickListener(this::onClick);
|
||||
mBinding.llGywm.setOnClickListener(this::onClick);
|
||||
mBinding.llBbh.setOnClickListener(this::onClick);
|
||||
mBinding.tvShare.setOnClickListener(this::onClick);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void onClick(View view) {
|
||||
if (view.getId() == R.id.ll_youth) {
|
||||
// startActivity(new Intent(this, UnderageActivity.class));
|
||||
@@ -184,6 +203,47 @@ public class SettingActivity extends BaseMvpActivity<SettingPresenter, ActivityS
|
||||
handler.postDelayed(resetRunnable, RESET_DELAY);
|
||||
}
|
||||
}
|
||||
} else if (view.getId() == R.id.tv_share) {
|
||||
|
||||
Observable.create(new ObservableOnSubscribe<Boolean>() {
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Boolean> emitter) throws Exception {
|
||||
try {
|
||||
File file = new File(Application.Companion.getInstance().getAppContent());
|
||||
|
||||
if (FileUtils.isFileExists(file.getParent() +"/DataInfo.zip")){
|
||||
FileUtils.delete(file.getParent() +"/DataInfo.zip");
|
||||
}
|
||||
boolean isZip = ZipUtils.zipFile(Application.Companion.getInstance().getAppContent(),
|
||||
file.getParent() +"/DataInfo.zip");
|
||||
emitter.onNext(isZip);
|
||||
}catch (Exception e){
|
||||
LogUtils.e("压缩失败",e.toString());
|
||||
emitter.onNext(false);
|
||||
}
|
||||
}
|
||||
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<Boolean>() {
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public void accept(Boolean aBoolean) {
|
||||
if (aBoolean){
|
||||
File file = new File(Application.Companion.getInstance().getAppContent()+"/DataInfo.zip");
|
||||
Uri uri = FileProvider.getUriForFile(SettingActivity.this, getPackageName()+".fileprovider", file);
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("*/*");
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
startActivity(Intent.createChooser(intent,"分享到"));
|
||||
}else {
|
||||
LogUtils.e("压缩失败");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
private void showYouthModelDialog() {
|
||||
|
||||
@@ -128,7 +128,8 @@ public class UnderageActivity extends BaseMvpActivity<UnderagePresenter, Activit
|
||||
// ToastUtils.showShort("密码验证成功");
|
||||
|
||||
ARouter.getInstance().build(ARouteConstants.ME).navigation();
|
||||
ActivityUtils.finishAllActivities();
|
||||
ActivityUtils.finishActivity(WebViewActivity.class);
|
||||
finish();
|
||||
} else {
|
||||
// 密码错误,提示并清空输入框
|
||||
ToastUtils.showShort("密码错误,请重新输入");
|
||||
@@ -191,10 +192,6 @@ public class UnderageActivity extends BaseMvpActivity<UnderagePresenter, Activit
|
||||
* 跳转到下一个页面
|
||||
*/
|
||||
private void navigateToNextPage() {
|
||||
// ToastUtils.showShort("密码设置成功");
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken())
|
||||
// .withString("type", "1").navigation();
|
||||
Intent intent = new Intent(UnderageActivity.this, WebViewActivity.class);
|
||||
intent.putExtra("type", "1");
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken());
|
||||
@@ -203,8 +200,6 @@ public class UnderageActivity extends BaseMvpActivity<UnderagePresenter, Activit
|
||||
|
||||
mBinding.verificationcodeview.setText("");
|
||||
finish();
|
||||
// 这里可以添加页面跳转逻辑
|
||||
ActivityUtils.finishAllActivities();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user