Commit 56d55ad5 authored by linfeng's avatar linfeng

个人中心优化

parent 8d604e43
...@@ -261,7 +261,6 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl ...@@ -261,7 +261,6 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
int id = view.getId(); int id = view.getId();
if (id == R.id.iv_item_setting) { if (id == R.id.iv_item_setting) {
//设置 //设置
if (isLogin()) return;
startActivityForResult(SettingActivity.getIntent(_mActivity), 101); startActivityForResult(SettingActivity.getIntent(_mActivity), 101);
} else if (id == R.id.iv_item_message) { } else if (id == R.id.iv_item_message) {
//消息通知 //消息通知
......
...@@ -4,6 +4,7 @@ import android.content.Context; ...@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
...@@ -15,31 +16,30 @@ import com.frame.base.bus.Observer; ...@@ -15,31 +16,30 @@ import com.frame.base.bus.Observer;
import com.frame.base.bus.RxBus; import com.frame.base.bus.RxBus;
import com.ruiwenliu.wrapper.base.BaseBean; import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity; import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.ruiwenliu.wrapper.other.TagAliasOperatorHelper; import com.ruiwenliu.wrapper.other.TagAliasOperatorHelper;
import com.ruiwenliu.wrapper.util.AppUtils; import com.ruiwenliu.wrapper.util.AppUtils;
import com.ruiwenliu.wrapper.util.UtilsManager;
import com.ruiwenliu.wrapper.weight.TitleView; import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.Cookie;
import com.rv.home.rv.module.ApiConfig; import com.rv.home.rv.module.ApiConfig;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter; import com.rv.home.rv.module.ui.login.LoginRvActivity;
import com.rv.home.rv.module.ui.login.RegisteredActivity; import com.rv.home.rv.module.ui.login.RegisteredActivity;
import com.rv.component.utils.RvCache;
import com.rv.rvmine.R; import com.rv.rvmine.R;
import com.rv.rvmine.R2; import com.rv.rvmine.R2;
import com.rv.version.bean.VersionCheckBean; import com.rv.version.bean.VersionCheckBean;
import com.rv.version.util.UpdateAppUtils; import com.rv.version.util.UpdateAppUtils;
import com.yuyife.okgo.OkGoUtil; import com.yuyife.okgo.OkGoUtil;
import java.io.File;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.ACTION_DELETE; import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.ACTION_DELETE;
import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.ACTION_SET;
import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.sequence; import static com.ruiwenliu.wrapper.other.TagAliasOperatorHelper.sequence;
/** /**
...@@ -50,6 +50,8 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -50,6 +50,8 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
@BindView(R2.id.tv_version) @BindView(R2.id.tv_version)
TextView tvVersion; TextView tvVersion;
@BindView(R2.id.tv_out_sign)
TextView tvOutSign;
private UpdateAppUtils updateAppUtils; private UpdateAppUtils updateAppUtils;
private VersionCheckBean versionCheckBean = null; private VersionCheckBean versionCheckBean = null;
...@@ -67,6 +69,27 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -67,6 +69,27 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) { protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle(getString(R.string.setting_title)); titleView.setTitle(getString(R.string.setting_title));
isShowLoadingError = false; isShowLoadingError = false;
initRxBus();
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
tvOutSign.setText("立即登录");
tvOutSign.setBackgroundResource(R.drawable.shape_rv_bg_shallow_dark_yellow_circle);
} else {
tvOutSign.setText("退出登录");
tvOutSign.setBackgroundResource(R.drawable.shape_rv_button_light_gray);
}
}
private void initRxBus() {
RxBus.tObservable(LoginSuccessfulEvent.class)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<LoginSuccessfulEvent>(disposable) {
@Override
public void onNext(LoginSuccessfulEvent event) {
tvOutSign.setText("退出登录");
tvOutSign.setBackgroundResource(R.drawable.shape_rv_button_light_gray);
}
});
} }
...@@ -108,6 +131,11 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -108,6 +131,11 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
int id = view.getId(); int id = view.getId();
if (id == R.id.rl_item_change_password) { if (id == R.id.rl_item_change_password) {
//修改密码 //修改密码
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
startActivity(LoginRvActivity.getIntent(mActivity, 0));
return;
}
startActivity(RegisteredActivity.getIntent(mActivity, 1, 0)); startActivity(RegisteredActivity.getIntent(mActivity, 1, 0));
} else if (id == R.id.ll_item_app_push) { } else if (id == R.id.ll_item_app_push) {
...@@ -115,7 +143,10 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -115,7 +143,10 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
showToast("亲,该功能还在开发中。。。"); showToast("亲,该功能还在开发中。。。");
} else if (id == R.id.rl_item_clear_cache) { } else if (id == R.id.rl_item_clear_cache) {
//清除缓存 //清除缓存
showToast("亲,该功能还在开发中。。。"); deleteDir(Environment.getExternalStorageDirectory() + "/photo/camera");
deleteDir(Environment.getExternalStorageDirectory() + "/photo/crop");
showToast("清理成功!");
} else if (id == R.id.rl_item_check_for_updates) { } else if (id == R.id.rl_item_check_for_updates) {
//检查更新 //检查更新
if (versionCheckBean != null && versionCheckBean.isRel() == false) { if (versionCheckBean != null && versionCheckBean.isRel() == false) {
...@@ -141,6 +172,12 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -141,6 +172,12 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
} else if (id == R.id.tv_out_sign) { } else if (id == R.id.tv_out_sign) {
//退出登录 //退出登录
//登录
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
startActivity(LoginRvActivity.getIntent(mActivity, 0));
return;
}
boolean isAliasAction = true; boolean isAliasAction = true;
TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean(); TagAliasOperatorHelper.TagAliasBean tagAliasBean = new TagAliasOperatorHelper.TagAliasBean();
tagAliasBean.action = ACTION_DELETE; tagAliasBean.action = ACTION_DELETE;
...@@ -186,4 +223,25 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> { ...@@ -186,4 +223,25 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
break; break;
} }
} }
public static boolean deleteDir(String path) {
File file = new File(path);
if (!file.exists()) {//判断是否待删除目录是否存在
return false;
}
String[] content = file.list();//取得当前目录下所有文件和文件夹
for (String name : content) {
File temp = new File(path, name);
if (temp.isDirectory()) {//判断是否是目录
deleteDir(temp.getAbsolutePath());//递归调用,删除目录里的内容
temp.delete();//删除空目录
} else {
if (!temp.delete()) {//直接删除文件
}
}
}
return true;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment