Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RvApp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lify
RvApp
Commits
56d55ad5
Commit
56d55ad5
authored
Oct 11, 2019
by
linfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
个人中心优化
parent
8d604e43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
7 deletions
+64
-7
MineFragment.java
module_mine/src/main/java/com/rv/rvmine/MineFragment.java
+0
-1
SettingActivity.java
...src/main/java/com/rv/rvmine/traveler/SettingActivity.java
+64
-6
No files found.
module_mine/src/main/java/com/rv/rvmine/MineFragment.java
View file @
56d55ad5
...
...
@@ -261,7 +261,6 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
int
id
=
view
.
getId
();
if
(
id
==
R
.
id
.
iv_item_setting
)
{
//设置
if
(
isLogin
())
return
;
startActivityForResult
(
SettingActivity
.
getIntent
(
_mActivity
),
101
);
}
else
if
(
id
==
R
.
id
.
iv_item_message
)
{
//消息通知
...
...
module_mine/src/main/java/com/rv/rvmine/traveler/SettingActivity.java
View file @
56d55ad5
...
...
@@ -4,6 +4,7 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.support.annotation.NonNull
;
import
android.text.TextUtils
;
import
android.view.View
;
...
...
@@ -15,31 +16,30 @@ import com.frame.base.bus.Observer;
import
com.frame.base.bus.RxBus
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.base.presenter.CommonPresenter
;
import
com.ruiwenliu.wrapper.other.TagAliasOperatorHelper
;
import
com.ruiwenliu.wrapper.util.AppUtils
;
import
com.ruiwenliu.wrapper.util.UtilsManager
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.rv.component.utils.Cookie
;
import
com.rv.home.rv.module.ApiConfig
;
import
com.r
uiwenliu.wrapper.base.presenter.CommonPresenter
;
import
com.r
v.home.rv.module.ui.login.LoginRvActivity
;
import
com.rv.home.rv.module.ui.login.RegisteredActivity
;
import
com.rv.component.utils.RvCache
;
import
com.rv.rvmine.R
;
import
com.rv.rvmine.R2
;
import
com.rv.version.bean.VersionCheckBean
;
import
com.rv.version.util.UpdateAppUtils
;
import
com.yuyife.okgo.OkGoUtil
;
import
java.io.File
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.schedulers.Schedulers
;
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
;
/**
...
...
@@ -50,6 +50,8 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
@BindView
(
R2
.
id
.
tv_version
)
TextView
tvVersion
;
@BindView
(
R2
.
id
.
tv_out_sign
)
TextView
tvOutSign
;
private
UpdateAppUtils
updateAppUtils
;
private
VersionCheckBean
versionCheckBean
=
null
;
...
...
@@ -67,6 +69,27 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
titleView
.
setTitle
(
getString
(
R
.
string
.
setting_title
));
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> {
int
id
=
view
.
getId
();
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
));
}
else
if
(
id
==
R
.
id
.
ll_item_app_push
)
{
...
...
@@ -115,7 +143,10 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
showToast
(
"亲,该功能还在开发中。。。"
);
}
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
)
{
//检查更新
if
(
versionCheckBean
!=
null
&&
versionCheckBean
.
isRel
()
==
false
)
{
...
...
@@ -141,6 +172,12 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
}
else
if
(
id
==
R
.
id
.
tv_out_sign
)
{
//退出登录
//登录
if
(
TextUtils
.
isEmpty
(
OkGoUtil
.
getToken
()))
{
startActivity
(
LoginRvActivity
.
getIntent
(
mActivity
,
0
));
return
;
}
boolean
isAliasAction
=
true
;
TagAliasOperatorHelper
.
TagAliasBean
tagAliasBean
=
new
TagAliasOperatorHelper
.
TagAliasBean
();
tagAliasBean
.
action
=
ACTION_DELETE
;
...
...
@@ -186,4 +223,25 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> {
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
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment