檢查版本更新,版本號,清除緩存
This commit is contained in:
parent
64fb7de187
commit
3189b39b97
@ -1,8 +1,10 @@
|
||||
package com.shayu.onetoone.activity.setting;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.shayu.onetoone.R;
|
||||
@ -11,14 +13,17 @@ import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.GlideCatchUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.VersionUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import java.io.File;
|
||||
@ -27,13 +32,16 @@ import cn.rongcloud.rtc.api.RCRTCEngine;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/30.
|
||||
* 设置
|
||||
*/
|
||||
@Route(path = RouteUtil.PATH_SETTING)
|
||||
public class SettingActivity extends AbsActivity {
|
||||
|
||||
private Handler mHandler;
|
||||
|
||||
private TextView versionCode;
|
||||
private TextView cacheSize;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_setting;
|
||||
@ -44,7 +52,10 @@ public class SettingActivity extends AbsActivity {
|
||||
setTitle(mContext.getString(R.string.set_up));
|
||||
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
|
||||
|
||||
//跳转自己
|
||||
versionCode = findViewById(R.id.versionCode);
|
||||
cacheSize = findViewById(R.id.cacheSize);
|
||||
|
||||
//编辑资料
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.personSet), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
@ -71,6 +82,21 @@ public class SettingActivity extends AbsActivity {
|
||||
RouteManager.forwardAuthBloggerInletActivity();
|
||||
}
|
||||
});
|
||||
//清除緩存
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.clearCaChe), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
clearCache();
|
||||
}
|
||||
});
|
||||
//检查版本更新
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.checkVersion), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
checkVersion();
|
||||
}
|
||||
});
|
||||
//退出登录
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.logout), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
@ -83,24 +109,32 @@ public class SettingActivity extends AbsActivity {
|
||||
startActivity(new Intent(SettingActivity.this, OneMsgSettActivity.class));
|
||||
}
|
||||
});
|
||||
intiData();
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void intiData() {
|
||||
versionCode.setText(VersionUtil.getVersion());
|
||||
cacheSize.setText(GlideCatchUtil.getInstance().getCacheSize() + "MB");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查更新
|
||||
*/
|
||||
private void checkVersion() {
|
||||
// CommonAppConfig.getInstance().getConfig(new CommonCallback<ConfigBean>() {
|
||||
// @Override
|
||||
// public void callback(ConfigBean configBean) {
|
||||
// if (configBean != null) {
|
||||
// if (VersionUtil.isLatest(configBean.getVersion())) {
|
||||
// ToastUtil.show(R.string.version_latest);
|
||||
// } else {
|
||||
// VersionUtil.showDialog(mContext, configBean, configBean.getDownloadApkUrl());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
CommonAppConfig.getInstance().getConfig(new CommonCallback<ConfigBean>() {
|
||||
@Override
|
||||
public void callback(ConfigBean configBean) {
|
||||
if (configBean != null) {
|
||||
if (VersionUtil.isLatest(configBean.getVersion())) {
|
||||
ToastUtil.show(R.string.version_latest);
|
||||
} else {
|
||||
VersionUtil.showDialog(mContext, configBean, configBean.getDownloadApkUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,7 +167,7 @@ public class SettingActivity extends AbsActivity {
|
||||
/**
|
||||
* 清除缓存
|
||||
*/
|
||||
private void clearCache(final int position) {
|
||||
private void clearCache() {
|
||||
final Dialog dialog = DialogUitl.loadingDialog(mContext, getString(R.string.setting_clear_cache_ing));
|
||||
dialog.show();
|
||||
GlideCatchUtil.getInstance().clearImageAllCache();
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
<include layout="@layout/view_title_custom" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -270,6 +270,7 @@
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/clearCaChe"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
@ -289,11 +290,14 @@
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="17dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="26.33dp"
|
||||
android:src="@mipmap/icon_arrow_right" />
|
||||
<TextView
|
||||
android:id="@+id/cacheSize"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:textColor="#8E7DDF"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -373,15 +377,19 @@
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="17dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginEnd="26.33dp"
|
||||
android:src="@mipmap/icon_arrow_right" />
|
||||
<TextView
|
||||
android:id="@+id/versionCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="25dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:textColor="#1E1F20"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/checkVersion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
|
@ -42,7 +42,7 @@ public class VersionUtil {
|
||||
|
||||
|
||||
//是否是谷歌版本
|
||||
public void showDialog(Activity context, ConfigBean configBean, String downloadUrl) {
|
||||
public static void showDialog(Activity context, ConfigBean configBean, String downloadUrl) {
|
||||
//不是谷歌
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||
//不强更
|
||||
|
Loading…
x
Reference in New Issue
Block a user