增加个人信息UI数据管理

0515
panqihua 5 years ago
parent 6e932742ae
commit b4df990bcf
  1. 2
      app/build.gradle
  2. 50
      app/src/main/java/com/community/pocket/data/main/info/InfoRequest.java
  3. 87
      app/src/main/java/com/community/pocket/data/model/MyInfo.java
  4. 9
      app/src/main/java/com/community/pocket/ui/main/ui/forum/data/ForumDataActivity.java
  5. 49
      app/src/main/java/com/community/pocket/ui/main/ui/info/InfoFormState.java
  6. 208
      app/src/main/java/com/community/pocket/ui/main/ui/info/InfoFragment.java
  7. 47
      app/src/main/java/com/community/pocket/ui/main/ui/info/InfoResponse.java
  8. 63
      app/src/main/java/com/community/pocket/ui/main/ui/info/InfoViewModel.java
  9. 20
      app/src/main/java/com/community/pocket/ui/main/ui/info/InfoViewModelFactory.java
  10. 19
      app/src/main/res/layout/main/layout/info/layout/info_fragment.xml
  11. 66
      app/src/main/res/layout/main/layout/info/layout/modify_password.xml
  12. 7
      app/src/main/res/values-en-rUS/strings.xml
  13. 7
      app/src/main/res/values-zh-rCN/strings.xml
  14. 7
      app/src/main/res/values/strings.xml

@ -23,7 +23,7 @@ android {
sourceSets { sourceSets {
main { main {
res { res {
srcDirs 'src/main/res', 'src/main/res/layout/resetpwd', 'src/main/res/layout/resetpwd/layout', 'src/main/res/layout/main', 'src/main/res/layout/main/layout', 'src/main/res/layout/main/layout/forum', 'src/main/res/layout/main/layout/forum/layout', 'src/main/res/layout/main/layout/visitor', 'src/main/res/layout/main/layout/visitor/layout' srcDirs 'src/main/res', 'src/main/res/layout/resetpwd', 'src/main/res/layout/resetpwd/layout', 'src/main/res/layout/main', 'src/main/res/layout/main/layout', 'src/main/res/layout/main/layout/forum', 'src/main/res/layout/main/layout/forum/layout', 'src/main/res/layout/main/layout/visitor', 'src/main/res/layout/main/layout/visitor/layout','src/main/res/layout/main/layout/info','src/main/res/layout/main/layout/info/layout'
} }
} }
} }

@ -0,0 +1,50 @@
package com.community.pocket.data.main.info;
import com.community.pocket.R;
import com.community.pocket.data.model.MyInfo;
import com.community.pocket.ui.main.ui.info.InfoResponse;
import java.util.ArrayList;
import java.util.Random;
/**
* 个人信息请求接口
* TODO 完善逻辑
*/
public class InfoRequest {
private static volatile InfoRequest instance;
private InfoRequest() {
}
public static InfoRequest getInstance() {
if (instance == null) {
instance = new InfoRequest();
}
return instance;
}
//修改密码
public InfoResponse<String> modifyPwd(String oldpwd, String newpwd) {
return new InfoResponse<String>().setSuccess(R.string.modify_pwd_ok);
}
//获取个人信息
public InfoResponse<MyInfo> loadInfo() {
MyInfo myInfo = new MyInfo();
myInfo.setUsername("fff");
myInfo.setCreditScore(new Random().nextInt(100));
myInfo.setRecentPosts(new Random().nextInt(100));
myInfo.setRecentVisitors(new Random().nextInt(100));
myInfo.setMobie("123456");
myInfo.setEmail("abc@qq.com");
myInfo.setScoreHistory(new ArrayList<Integer>() {{
for (int i = 0; i < 100; i++) {
add(new Random().nextInt(100));
}
}});
return new InfoResponse<MyInfo>().setSuccess(R.string.load_info_ok).setBody(myInfo);
}
}

@ -0,0 +1,87 @@
package com.community.pocket.data.model;
import java.util.List;
public class MyInfo {
//用户名
private String username;
//信用分
private Integer creditScore;
//头像
private String headImg;
//最近发帖数
private Integer recentPosts;
//最近访客数
private Integer recentVisitors;
//手机号
private String mobie;
//邮箱
private String email;
//信用分历史记录
private List<Integer> scoreHistory;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Integer getCreditScore() {
return creditScore;
}
public void setCreditScore(Integer creditScore) {
this.creditScore = creditScore;
}
public String getHeadImg() {
return headImg;
}
public void setHeadImg(String headImg) {
this.headImg = headImg;
}
public Integer getRecentPosts() {
return recentPosts;
}
public void setRecentPosts(Integer recentPosts) {
this.recentPosts = recentPosts;
}
public Integer getRecentVisitors() {
return recentVisitors;
}
public void setRecentVisitors(Integer recentVisitors) {
this.recentVisitors = recentVisitors;
}
public String getMobie() {
return mobie;
}
public void setMobie(String mobie) {
this.mobie = mobie;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public List<Integer> getScoreHistory() {
return scoreHistory;
}
public void setScoreHistory(List<Integer> scoreHistory) {
this.scoreHistory = scoreHistory;
}
}

@ -53,17 +53,17 @@ public class ForumDataActivity extends BaseActivity {
private ForumDataViewModel viewModel; private ForumDataViewModel viewModel;
//关闭回帖窗口按钮
private Button close;
//回帖按钮 //回帖按钮
private Button reply; private Button reply;
//弹窗控制
private Handler handler; private Handler handler;
//打开回贴弹窗按钮
@ViewInject(R.id.open_reply) @ViewInject(R.id.open_reply)
private Button openReply; private Button openReply;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -155,7 +155,8 @@ public class ForumDataActivity extends BaseActivity {
View alertView = View.inflate(this, R.layout.forum_replay, null); View alertView = View.inflate(this, R.layout.forum_replay, null);
editText = alertView.findViewById(R.id.post_content); editText = alertView.findViewById(R.id.post_content);
close = alertView.findViewById(R.id.close); //关闭回帖窗口按钮
Button close = alertView.findViewById(R.id.close);
reply = alertView.findViewById(R.id.reply); reply = alertView.findViewById(R.id.reply);
reply.setOnClickListener(new View.OnClickListener() { reply.setOnClickListener(new View.OnClickListener() {
@Override @Override

@ -0,0 +1,49 @@
package com.community.pocket.ui.main.ui.info;
import androidx.annotation.Nullable;
/**
* 修改密码表单校验状态
*/
class InfoFormState {
//旧密码
@Nullable
private Integer oldPwdError;
//新密码
@Nullable
private Integer newPwdError;
//确认新密码
@Nullable
private Integer confirmNewPwdError;
private boolean isDataValid;
InfoFormState(@Nullable Integer oldPwdError, @Nullable Integer newPwdError, @Nullable Integer confirmNewPwdError) {
this.oldPwdError = oldPwdError;
this.newPwdError = newPwdError;
this.confirmNewPwdError = confirmNewPwdError;
}
InfoFormState(boolean isDataValid) {
this.isDataValid = isDataValid;
}
@Nullable
Integer getOldPwdError() {
return oldPwdError;
}
@Nullable
Integer getNewPwdError() {
return newPwdError;
}
@Nullable
Integer getConfirmNewPwdError() {
return confirmNewPwdError;
}
boolean isDataValid() {
return isDataValid;
}
}

@ -3,17 +3,31 @@ package com.community.pocket.ui.main.ui.info;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.community.pocket.R; import com.community.pocket.R;
import com.community.pocket.data.model.MyInfo;
import com.community.pocket.ui.BaseFragment; import com.community.pocket.ui.BaseFragment;
import com.community.pocket.ui.listener.MyTextChange;
import com.community.pocket.ui.login.LoginActivity; import com.community.pocket.ui.login.LoginActivity;
import com.community.pocket.util.PropertiesUtil;
import com.github.mikephil.charting.charts.LineChart; import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData; import com.github.mikephil.charting.data.LineData;
@ -25,7 +39,7 @@ import org.xutils.view.annotation.ViewInject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Objects;
/** /**
* 我的信息框架 * 我的信息框架
@ -53,21 +67,195 @@ public class InfoFragment extends BaseFragment {
@ViewInject(R.id.recentVisitors) @ViewInject(R.id.recentVisitors)
private TextView recentVisitors; private TextView recentVisitors;
//手机号
@ViewInject(R.id.mobie)
private TextView mobie;
//邮箱
@ViewInject(R.id.email)
private TextView email;
//信用分活动图表
@ViewInject(R.id.chart) @ViewInject(R.id.chart)
private LineChart lineChart; private LineChart lineChart;
//原密码
private EditText oldPwd;
//新密码
private EditText newPwd;
//确认新密码
private EditText confirmNewPwd;
//修改密码按钮
private Button modifyPwdBtn;
//打开修改密码弹窗
@ViewInject(R.id.open_modify_password)
private Button openModify;
private InfoViewModel viewModel;
//注销登录
@ViewInject(R.id.logout)
private Button logout;
private Handler handler;
@RequiresApi(api = Build.VERSION_CODES.KITKAT) @RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
nickname.setText(getString(R.string.nick_name, "。。。。。。")); viewModel = new ViewModelProvider(this, new InfoViewModelFactory()).get(InfoViewModel.class);
creditScore.setText(getString(R.string.credit_score, 0));
viewModel.loadInfo();
//监听修改密码表单状态
viewModel.getModifyFormState().observe(getViewLifecycleOwner(), new Observer<InfoFormState>() {
@Override
public void onChanged(InfoFormState infoFormState) {
if (infoFormState == null) {
return;
}
if (infoFormState.getOldPwdError() != null) {
oldPwd.setError(getString(infoFormState.getOldPwdError(), PropertiesUtil.getIntValue("password.length")));
}
if (infoFormState.getNewPwdError() != null) {
newPwd.setError(getString(infoFormState.getNewPwdError(), PropertiesUtil.getIntValue("password.length")));
}
if (infoFormState.getConfirmNewPwdError() != null) {
if (infoFormState.getConfirmNewPwdError() == R.string.invalid_password) {
confirmNewPwd.setError(getString(infoFormState.getConfirmNewPwdError(), PropertiesUtil.getIntValue("password.length")));
} else {
confirmNewPwd.setError(getString(infoFormState.getConfirmNewPwdError()));
}
}
modifyPwdBtn.setEnabled(infoFormState.isDataValid());
}
});
//监听修改密码的请求状态
viewModel.getModifyResponse().observe(getViewLifecycleOwner(), new Observer<InfoResponse>() {
@Override
public void onChanged(InfoResponse infoResponse) {
if (infoResponse == null) {
return;
}
if (infoResponse.getSuccess() != null) {
handler.sendEmptyMessage(0);
Toast.makeText(getContext(), infoResponse.getSuccess(), Toast.LENGTH_LONG).show();
logout(logout);
}
if (infoResponse.getError() != null) {
Toast.makeText(getContext(), infoResponse.getError(), Toast.LENGTH_LONG).show();
}
}
});
//监听个人信息请求状态
viewModel.getInfoResponse().observe(getViewLifecycleOwner(), new Observer<InfoResponse<MyInfo>>() {
@Override
public void onChanged(InfoResponse<MyInfo> myInfoInfoResponse) {
if (myInfoInfoResponse == null) {
return;
}
if (myInfoInfoResponse.getSuccess() != null) {
Toast.makeText(getContext(), R.string.load_info_ok, Toast.LENGTH_LONG).show();
loadInfo(myInfoInfoResponse.getBody());
}
recentPosts.setText(getString(R.string.recent_posts, 0)); if (myInfoInfoResponse.getError() != null) {
recentVisitors.setText(getString(R.string.recent_visitors, 0)); Toast.makeText(getContext(), R.string.load_info_fail, Toast.LENGTH_LONG).show();
}
}
});
//打开修改密码弹窗
openModify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openModifyPassword();
}
});
loadChart(); }
/**
* 加载个人信息
*
* @param myInfo 个人信息
*/
private void loadInfo(MyInfo myInfo) {
nickname.setText(getString(R.string.nick_name, myInfo.getUsername()));
creditScore.setText(getString(R.string.credit_score, myInfo.getCreditScore()));
recentVisitors.setText(getString(R.string.recent_visitors, myInfo.getRecentVisitors()));
recentPosts.setText(getString(R.string.recent_posts, myInfo.getRecentPosts()));
mobie.setText(myInfo.getMobie());
email.setText(myInfo.getEmail());
loadChart(myInfo.getScoreHistory());
}
/**
* 打开修改密码弹窗
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
private void openModifyPassword() {
View view = View.inflate(getContext(), R.layout.modify_password, null);
//原密码
oldPwd = view.findViewById(R.id.old_password);
//新密码
newPwd = view.findViewById(R.id.new_password);
//确认新密码
confirmNewPwd = view.findViewById(R.id.new_confirm_password);
TextWatcher textWatcher = new MyTextChange() {
@Override
public void afterTextChanged(Editable s) {
viewModel.modifyPwdChanged(oldPwd.getText().toString(), newPwd.getText().toString(), confirmNewPwd.getText().toString());
}
};
oldPwd.addTextChangedListener(textWatcher);
newPwd.addTextChangedListener(textWatcher);
confirmNewPwd.addTextChangedListener(textWatcher);
//修改密码按钮
modifyPwdBtn = view.findViewById(R.id.modify_password);
modifyPwdBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
viewModel.modifyPwd(oldPwd.getText().toString(), newPwd.getText().toString());
}
});
AlertDialog.Builder alert = new AlertDialog.Builder(Objects.requireNonNull(getContext()));
final AlertDialog alertDialog = alert.setTitle(R.string.modify_password).setView(view).create();
handler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(@NonNull Message msg) {
alertDialog.dismiss();
}
};
Button close = view.findViewById(R.id.close);
close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
handler.sendEmptyMessage(0);
}
});
alertDialog.show();
} }
/** /**
@ -80,12 +268,12 @@ public class InfoFragment extends BaseFragment {
} }
//加载图表数据 //加载图表数据
private void loadChart() { private void loadChart(List<Integer> values) {
LineData lineData = new LineData(); LineData lineData = new LineData();
List<Entry> entries = new ArrayList<>(); List<Entry> entries = new ArrayList<>();
//TODO 测试数据
for (int i = 0; i < 100; i++) { for (int i = 0; i < values.size(); i++) {
entries.add(new Entry(i, new Random().nextInt(100))); entries.add(new Entry(i, values.get(i)));
} }
LineDataSet lineDataSet = new LineDataSet(entries, getString(R.string.active_history)); LineDataSet lineDataSet = new LineDataSet(entries, getString(R.string.active_history));

@ -0,0 +1,47 @@
package com.community.pocket.ui.main.ui.info;
import androidx.annotation.Nullable;
/**
* 个人信息响应结果
*
* @param <T> 响应实体信息
*/
public class InfoResponse<T> {
@Nullable
private Integer success;
@Nullable
private Integer error;
private T body;
@Nullable
public Integer getSuccess() {
return success;
}
public InfoResponse<T> setSuccess(@Nullable Integer success) {
this.success = success;
return this;
}
@Nullable
public Integer getError() {
return error;
}
public InfoResponse<T> setError(@Nullable Integer error) {
this.error = error;
return this;
}
T getBody() {
return body;
}
public InfoResponse<T> setBody(T body) {
this.body = body;
return this;
}
}

@ -1,19 +1,68 @@
package com.community.pocket.ui.main.ui.info; package com.community.pocket.ui.main.ui.info;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel; import androidx.lifecycle.ViewModel;
import com.community.pocket.R;
import com.community.pocket.data.main.info.InfoRequest;
import com.community.pocket.data.model.MyInfo;
import com.community.pocket.util.ValidUtil;
//个人信息UI数据管理
class InfoViewModel extends ViewModel { class InfoViewModel extends ViewModel {
private MutableLiveData<String> mText; //修改密码表单校验状态
private MutableLiveData<InfoFormState> modifyFormState = new MutableLiveData<>();
//修改密码请求状态
private MutableLiveData<InfoResponse> modifyResponse = new MutableLiveData<>();
//个人信息请求状态
private MutableLiveData<InfoResponse<MyInfo>> infoResponse = new MutableLiveData<>();
//请求接口管理
private InfoRequest infoRequest;
InfoViewModel(InfoRequest infoRequest) {
this.infoRequest = infoRequest;
}
MutableLiveData<InfoFormState> getModifyFormState() {
return modifyFormState;
}
MutableLiveData<InfoResponse> getModifyResponse() {
return modifyResponse;
}
MutableLiveData<InfoResponse<MyInfo>> getInfoResponse() {
return infoResponse;
}
//修改密码表单校验状态
void modifyPwdChanged(String oldpwd, String newpwd, String confirmNewPwd) {
if (!ValidUtil.passwordvalid(oldpwd)) {
modifyFormState.setValue(new InfoFormState(R.string.invalid_password, null, null));
} else if (!ValidUtil.passwordvalid(newpwd)) {
modifyFormState.setValue(new InfoFormState(null, R.string.invalid_password, null));
} else if (!ValidUtil.passwordvalid(confirmNewPwd)) {
modifyFormState.setValue(new InfoFormState(null, null, R.string.invalid_password));
} else if (!newpwd.equals(confirmNewPwd)) {
modifyFormState.setValue(new InfoFormState(null, null, R.string.invalid_confirm_password));
} else {
modifyFormState.setValue(new InfoFormState(true));
}
}
public InfoViewModel() { //修改密码
mText = new MutableLiveData<>(); void modifyPwd(String oldpwd, String newpwd) {
mText.setValue("This is info fragment"); InfoResponse<String> infoResponse = infoRequest.modifyPwd(oldpwd, newpwd);
modifyResponse.setValue(infoResponse);
} }
LiveData<String> getText() { //获取个人信息
return mText; void loadInfo() {
InfoResponse<MyInfo> myInfoInfoResponse = infoRequest.loadInfo();
infoResponse.setValue(myInfoInfoResponse);
} }
} }

@ -0,0 +1,20 @@
package com.community.pocket.ui.main.ui.info;
import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import com.community.pocket.data.main.info.InfoRequest;
public class InfoViewModelFactory implements ViewModelProvider.Factory {
@NonNull
@Override
@SuppressWarnings("unchecked")
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
if (modelClass.isAssignableFrom(InfoViewModel.class)) {
return (T) new InfoViewModel(InfoRequest.getInstance());
} else {
throw new IllegalArgumentException("Unknown ViewModel class");
}
}
}

@ -18,7 +18,7 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="210dp" android:layout_height="wrap_content"
android:background="#77A3C7"> android:background="#77A3C7">
<ImageView <ImageView
@ -57,7 +57,7 @@
<TextView <TextView
android:id="@+id/recentPosts" android:id="@+id/recentPosts"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/border" android:background="@drawable/border"
@ -65,7 +65,7 @@
<TextView <TextView
android:id="@+id/recentVisitors" android:id="@+id/recentVisitors"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/border" android:background="@drawable/border"
@ -73,19 +73,20 @@
</LinearLayout> </LinearLayout>
<Button <Button
android:id="@+id/button" android:id="@+id/open_modify_password"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_30" android:layout_marginTop="@dimen/size_8"
android:text="@string/modify_password" /> android:text="@string/modify_password" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_8"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/border" android:background="@drawable/border"
@ -94,7 +95,7 @@
<TextView <TextView
android:id="@+id/mobie" android:id="@+id/mobie"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/border" android:background="@drawable/border"
@ -107,7 +108,7 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/border" android:background="@drawable/border"
@ -116,7 +117,7 @@
<TextView <TextView
android:id="@+id/email" android:id="@+id/email"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/border" android:background="@drawable/border"

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<EditText
android:id="@+id/old_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/prompt_old_password"
android:importantForAutofill="no"
android:inputType="textPassword"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/new_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ems="10"
android:hint="@string/prompt_new_password"
android:importantForAutofill="no"
android:inputType="textPassword"
app:layout_constraintTop_toBottomOf="@id/old_password" />
<EditText
android:id="@+id/new_confirm_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:ems="10"
android:hint="@string/prompt_confirm_new_password"
android:importantForAutofill="no"
android:inputType="textPassword"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/new_password" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/new_confirm_password">
<Button
android:id="@+id/modify_password"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:enabled="false"
android:text="@string/modify_password" />
<Button
android:id="@+id/close"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/action_close" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -132,4 +132,11 @@
<string name="forum_reply_fail">reply fail</string> <string name="forum_reply_fail">reply fail</string>
<string name="forum_data_ok">load success</string> <string name="forum_data_ok">load success</string>
<string name="forum_data_fail">load error</string> <string name="forum_data_fail">load error</string>
<string name="prompt_old_password">please input password</string>
<string name="prompt_new_password">please input new password</string>
<string name="prompt_confirm_new_password">please input new password again</string>
<string name="modify_pwd_ok">modify password success</string>
<string name="modify_pwd_fail">modify password error</string>
<string name="load_info_ok">load my info success</string>
<string name="load_info_fail">load my info error</string>
</resources> </resources>

@ -132,4 +132,11 @@
<string name="forum_reply_fail">回帖失败</string> <string name="forum_reply_fail">回帖失败</string>
<string name="forum_data_ok">帖子详情加载成功</string> <string name="forum_data_ok">帖子详情加载成功</string>
<string name="forum_data_fail">帖子详情加载失败</string> <string name="forum_data_fail">帖子详情加载失败</string>
<string name="prompt_old_password">请输入原密码</string>
<string name="prompt_new_password">请输入新密码</string>
<string name="prompt_confirm_new_password">请再输入一次新密码</string>
<string name="modify_pwd_ok">修改密码成功,请重新登录</string>
<string name="modify_pwd_fail">修改密码失败</string>
<string name="load_info_ok">加载个人信息成功</string>
<string name="load_info_fail">加载个人信息失败</string>
</resources> </resources>

@ -133,6 +133,13 @@
<string name="forum_reply_fail">reply fail</string> <string name="forum_reply_fail">reply fail</string>
<string name="forum_data_ok">load success</string> <string name="forum_data_ok">load success</string>
<string name="forum_data_fail">load error</string> <string name="forum_data_fail">load error</string>
<string name="prompt_old_password">please input password</string>
<string name="prompt_new_password">please input new password</string>
<string name="prompt_confirm_new_password">please input new password again</string>
<string name="modify_pwd_ok">modify password success</string>
<string name="modify_pwd_fail">modify password error</string>
<string name="load_info_ok">load my info success</string>
<string name="load_info_fail">load my info error</string>
<!-- Strings used for fragments for navigation --> <!-- Strings used for fragments for navigation -->
<!-- Strings used for fragments for navigation --> <!-- Strings used for fragments for navigation -->

Loading…
Cancel
Save