添加忘记密码界面

0515
panqihua 5 years ago
parent e3f364cdd9
commit 163e238eef
  1. 7
      app/build.gradle
  2. 2
      app/src/main/AndroidManifest.xml
  3. 20
      app/src/main/java/com/community/pocket/ui/BaseFragment.java
  4. 10
      app/src/main/java/com/community/pocket/ui/login/LoginActivity.java
  5. 11
      app/src/main/java/com/community/pocket/ui/resetpwd/ResetPwdActivity.java
  6. 29
      app/src/main/java/com/community/pocket/ui/resetpwd/ResetPwdStep1.java
  7. 42
      app/src/main/java/com/community/pocket/ui/resetpwd/ResetPwdStep2.java
  8. 29
      app/src/main/java/com/community/pocket/ui/resetpwd/ResetPwdStep3.java
  9. 15
      app/src/main/res/layout/activity_login.xml
  10. 14
      app/src/main/res/layout/resetpwd/layout/activity.xml
  11. 19
      app/src/main/res/layout/resetpwd/layout/fragment.xml
  12. 70
      app/src/main/res/layout/resetpwd/layout/step1.xml
  13. 81
      app/src/main/res/layout/resetpwd/layout/step2.xml
  14. 67
      app/src/main/res/layout/resetpwd/layout/step3.xml
  15. 34
      app/src/main/res/navigation/nav_reset_pwd.xml
  16. 5
      app/src/main/res/values-en-rUS/strings.xml
  17. 5
      app/src/main/res/values-zh-rCN/strings.xml
  18. 1
      app/src/main/res/values/dimens.xml
  19. 8
      app/src/main/res/values/strings.xml
  20. 9
      app/src/main/res/values/styles.xml

@ -20,6 +20,13 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res {
srcDirs 'src/main/res', 'src/main/res/layout/resetpwd', 'src/main/res/layout/resetpwd/layout'
}
}
}
}

@ -10,7 +10,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar">
<activity android:name=".ui.resetpwd.ResetPwdActivity" />
<activity android:name=".ui.register.RegisterActivity" />
<activity android:name=".ui.login.LoginActivity">
<intent-filter>

@ -0,0 +1,20 @@
package com.community.pocket.ui;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import org.xutils.x;
public abstract class BaseFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return x.view().inject(this, inflater, container);//fragment注解
}
}

@ -22,6 +22,7 @@ import androidx.lifecycle.ViewModelProvider;
import com.community.pocket.R;
import com.community.pocket.ui.BaseActivity;
import com.community.pocket.ui.register.RegisterActivity;
import com.community.pocket.ui.resetpwd.ResetPwdActivity;
import com.community.pocket.util.PropertiesUtil;
import org.xutils.view.annotation.ContentView;
@ -46,7 +47,7 @@ public class LoginActivity extends BaseActivity {
private EditText passwordEditText;
//登录按钮
@ViewInject(R.id.login)
@ViewInject(R.id.back)
private Button loginButton;
//进度条
@ -123,7 +124,7 @@ public class LoginActivity extends BaseActivity {
}
//登录按钮触发登录请求操作
@Event(value = R.id.login)
@Event(value = R.id.back)
private void login(View v) {
//显示登录请求处理进度
loadingProgressBar.setVisibility(View.VISIBLE);
@ -148,6 +149,11 @@ public class LoginActivity extends BaseActivity {
return false;
}
@Event(value = R.id.login_to_resetPwd)
private void resetRwd(View v) {
startActivity(new Intent(this, ResetPwdActivity.class));
}
//登陆成功信息
private void updateUiWithUser(LoggedInUserView model) {
String welcome = getString(R.string.welcome) + model.getDisplayName();

@ -0,0 +1,11 @@
package com.community.pocket.ui.resetpwd;
import com.community.pocket.R;
import com.community.pocket.ui.BaseActivity;
import org.xutils.view.annotation.ContentView;
@ContentView(R.layout.activity)
public class ResetPwdActivity extends BaseActivity {
}

@ -0,0 +1,29 @@
package com.community.pocket.ui.resetpwd;
import android.content.Intent;
import android.view.View;
import androidx.navigation.fragment.NavHostFragment;
import com.community.pocket.R;
import com.community.pocket.ui.BaseFragment;
import com.community.pocket.ui.login.LoginActivity;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
@ContentView(R.layout.step1)
public class ResetPwdStep1 extends BaseFragment {
//进入下一步发送验证码
@Event(value = R.id.next)
private void onClick(View view) {
NavHostFragment.findNavController(ResetPwdStep1.this)
.navigate(R.id.action_First2Fragment_to_Second2Fragment);
}
//返回登陆
@Event(value = R.id.back)
private void back(View view) {
startActivity(new Intent(getContext(), LoginActivity.class));
}
}

@ -0,0 +1,42 @@
package com.community.pocket.ui.resetpwd;
import android.view.View;
import android.widget.Toast;
import androidx.navigation.fragment.NavHostFragment;
import com.community.pocket.R;
import com.community.pocket.ui.BaseFragment;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
@ContentView(R.layout.step2)
public class ResetPwdStep2 extends BaseFragment {
/**
* 返回第一步输入账号邮箱
*/
@Event(value = R.id.back)
private void onClick(View view) {
NavHostFragment.findNavController(ResetPwdStep2.this)
.navigate(R.id.action_Second2Fragment_to_First2Fragment);
}
/**
* 进入下一步重置密码
*/
@Event(value = R.id.next)
private void next(View view) {
NavHostFragment.findNavController(ResetPwdStep2.this)
.navigate(R.id.action_Second2Fragment_to_threeFragment);
}
/**
* 发送验证码
*/
@Event(value = R.id.sendcode)
private void sendCode(View view) {
Toast.makeText(getContext(), R.string.action_sendcode, Toast.LENGTH_SHORT).show();
}
}

@ -0,0 +1,29 @@
package com.community.pocket.ui.resetpwd;
import android.content.Intent;
import android.view.View;
import android.widget.Toast;
import com.community.pocket.R;
import com.community.pocket.ui.BaseFragment;
import com.community.pocket.ui.login.LoginActivity;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
/**
* 重置密码第三步输入密码
*/
@ContentView(R.layout.step3)
public class ResetPwdStep3 extends BaseFragment {
@Event(value = R.id.reset_pwd)
private void resetPwd(View v) {
Toast.makeText(getContext(), R.string.action_reset_password, Toast.LENGTH_SHORT).show();
}
@Event(value = R.id.back)
private void back(View v) {
startActivity(new Intent(getContext(), LoginActivity.class));
}
}

@ -35,7 +35,6 @@
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/AUTOFILL_HINT_PASSWORD"
android:hint="@string/prompt_password"
@ -43,7 +42,7 @@
android:imeOptions="actionDone"
android:inputType="textPassword"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/login_to_resetPwd"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/username" />
@ -74,7 +73,7 @@
app:layout_constraintTop_toBottomOf="@+id/password">
<Button
android:id="@+id/login"
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/size_50"
@ -95,4 +94,14 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
android:id="@+id/login_to_resetPwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/action_reset_password"
app:layout_constraintBottom_toBottomOf="@+id/password"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/username" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.resetpwd.ResetPwdActivity">
<include layout="@layout/titlebar_layout" />
<include layout="@layout/fragment" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,19 @@
<?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="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_reset_pwd" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,70 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.resetpwd.ResetPwdStep1">
<EditText
android:id="@+id/username"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="96dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/AUTOFILL_HINT_USERNAME"
android:hint="@string/prompt_user"
android:inputType="text"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/AUTOFILL_HINT_USERNAME"
android:hint="@string/prompt_email"
android:inputType="text|textEmailAddress"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/username"
tools:layout_constraintTop_toBottomOf="@id/username" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/email">
<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/size_50"
android:text="@string/next"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/size_50"
android:text="@string/action_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,81 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.resetpwd.ResetPwdStep2">
<EditText
android:id="@+id/username"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="96dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/AUTOFILL_HINT_USERNAME"
android:enabled="false"
android:hint="@string/prompt_user"
android:inputType="text"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:autofillHints="@string/AUTOFILL_HINT_USERNAME"
android:enabled="false"
android:hint="@string/prompt_email"
android:inputType="text|textEmailAddress"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toStartOf="@id/sendcode"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/username"
tools:layout_constraintTop_toBottomOf="@id/username" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/email">
<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/size_50"
android:text="@string/next"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/size_50"
android:text="@string/previous"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
android:id="@+id/sendcode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/action_sendcode"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/username" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,67 @@
<?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="match_parent">
<EditText
android:id="@+id/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="96dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/AUTOFILL_HINT_USERNAME"
android:hint="@string/prompt_password"
android:inputType="text|textPassword"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/confirmPwd"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/AUTOFILL_HINT_USERNAME"
android:hint="@string/prompt_confirm_password"
android:inputType="text|textPassword"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/password" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/confirmPwd">
<Button
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/size_50"
android:text="@string/action_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/reset_pwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/size_50"
android:text="@string/action_reset_password"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_graph2"
app:startDestination="@id/First2Fragment"
tools:ignore="UnusedNavigation">
<fragment
android:id="@+id/First2Fragment"
android:name="com.community.pocket.ui.resetpwd.ResetPwdStep1"
tools:layout="@layout/step1">
<action
android:id="@+id/action_First2Fragment_to_Second2Fragment"
app:destination="@id/Second2Fragment" />
</fragment>
<fragment
android:id="@+id/Second2Fragment"
android:name="com.community.pocket.ui.resetpwd.ResetPwdStep2"
tools:layout="@layout/step2">
<action
android:id="@+id/action_Second2Fragment_to_First2Fragment"
app:destination="@id/First2Fragment" />
<action
android:id="@+id/action_Second2Fragment_to_threeFragment"
app:destination="@id/threeFragment" />
</fragment>
<fragment
android:id="@+id/threeFragment"
android:name="com.community.pocket.ui.resetpwd.ResetPwdStep3"
android:label="ThreeFragment" />
</navigation>

@ -21,4 +21,9 @@
<string name="prompt_confirm_password">please input confirm password</string>
<string name="prompt_email">please input email</string>
<string name="prompt_phone">please input phone</string>
<string name="action_reset_password">reset password</string>
<string name="title_activity_resetpwd">reset password</string>
<string name="next">Next</string>
<string name="previous">Previous</string>
<string name="action_sendcode">send code</string>
</resources>

@ -21,4 +21,9 @@
<string name="prompt_confirm_password">请输入确认密码</string>
<string name="prompt_email">请输入邮箱</string>
<string name="prompt_phone">请输入手机号</string>
<string name="action_reset_password">重置密码</string>
<string name="title_activity_resetpwd">重置密码</string>
<string name="next">下一步</string>
<string name="previous">上一步</string>
<string name="action_sendcode">发送验证码</string>
</resources>

@ -4,4 +4,5 @@
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="size_8">8dp</dimen>
<dimen name="size_50">50dp</dimen>
<dimen name="fab_margin">16dp</dimen>
</resources>

@ -21,6 +21,14 @@
<string name="prompt_confirm_password">please input confirm password</string>
<string name="prompt_email">please input email</string>
<string name="prompt_phone">please input phone</string>
<string name="action_reset_password">reset password</string>
<string name="title_activity_resetpwd">reset password</string>
<!-- Strings used for fragments for navigation -->
<string name="next">Next</string>
<string name="previous">Previous</string>
<string name="action_sendcode">send code</string>
<!-- Strings used for fragments for navigation -->
<!-- Strings used for fragments for navigation -->
<!-- Strings used for fragments for navigation -->

@ -17,4 +17,13 @@
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.NoActionBar.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.NoActionBar.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.NoActionBar.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

Loading…
Cancel
Save