添加注册界面

0515
panqihua 5 years ago
parent 3a79ba8aeb
commit e3f364cdd9
  1. 7
      app/src/main/java/com/community/pocket/ui/login/LoginActivity.java
  2. 26
      app/src/main/java/com/community/pocket/ui/register/RegisterActivity.java
  3. 20
      app/src/main/res/layout/activity_login.xml
  4. 100
      app/src/main/res/layout/activity_register.xml
  5. 21
      app/src/main/res/layout/titlebar_layout.xml
  6. 3
      app/src/main/res/values-en-rUS/dimens.xml
  7. 3
      app/src/main/res/values-en-rUS/strings.xml
  8. 3
      app/src/main/res/values-zh-rCN/dimens.xml
  9. 3
      app/src/main/res/values-zh-rCN/strings.xml
  10. 2
      app/src/main/res/values/dimens.xml
  11. 3
      app/src/main/res/values/strings.xml

@ -1,6 +1,7 @@
package com.community.pocket.ui.login;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
@ -20,6 +21,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.util.PropertiesUtil;
import org.xutils.view.annotation.ContentView;
@ -129,6 +131,11 @@ public class LoginActivity extends BaseActivity {
passwordEditText.getText().toString());
}
@Event(value = R.id.register)
private void register(View v) {
startActivity(new Intent(this, RegisterActivity.class));
}
//监听密码软键盘输入
@Event(type = TextView.OnEditorActionListener.class, value = R.id.password)
private boolean onEditorAction(TextView v, int actionId, KeyEvent event) {

@ -1,11 +1,35 @@
package com.community.pocket.ui.register;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.community.pocket.R;
import com.community.pocket.ui.BaseActivity;
import com.community.pocket.ui.login.LoginActivity;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
@ContentView(R.layout.activity_register)
public class RegisterActivity {
public class RegisterActivity extends BaseActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Event(value = R.id.register)
private void register(View v) {
Toast.makeText(this, getString(R.string.action_register), Toast.LENGTH_SHORT).show();
}
@Event(value = R.id.back)
private void back(View v) {
startActivity(new Intent(this, LoginActivity.class));
finish();
}
}

@ -11,19 +11,7 @@
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".ui.login.LoginActivity">
<com.wuhenzhizao.titlebar.widget.CommonTitleBar
android:id="@+id/titlebar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:leftText="@string/app_name"
app:leftType="textView"
app:rightCustomView="@layout/titlebar_view"
app:rightType="customView"
app:titleBarColor="#2CE1CF"
tools:leftText="@string/app_name" />
<include layout="@layout/titlebar_layout" />
<EditText
android:id="@+id/username"
@ -76,9 +64,11 @@
app:layout_constraintVertical_bias="0.3" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="250dp"
android:layout_width="0dp"
android:layout_height="49dp"
android:layout_marginStart="24dp"
android:layout_marginTop="50dp"
android:layout_marginEnd="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/password">
@ -87,6 +77,7 @@
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/size_50"
android:enabled="false"
android:text="@string/action_sign_in"
app:layout_constraintBottom_toBottomOf="parent"
@ -97,6 +88,7 @@
android:id="@+id/register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/size_50"
android:enabled="true"
android:text="@string/action_register"
app:layout_constraintBottom_toBottomOf="parent"

@ -6,6 +6,8 @@
android:layout_height="match_parent"
tools:context=".ui.register.RegisterActivity">
<include layout="@layout/titlebar_layout" />
<EditText
android:id="@+id/username"
android:layout_width="0dp"
@ -21,4 +23,102 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
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_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/username" />
<EditText
android:id="@+id/confirmPassword"
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_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/password" />
<EditText
android:id="@+id/phone"
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_phone"
android:inputType="text|phone"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/confirmPassword" />
<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|phone"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/phone" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/size_50"
android:layout_marginTop="24dp"
android:layout_marginEnd="@dimen/size_50"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/email">
<Button
android:id="@+id/register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/size_50"
android:text="@string/action_register"
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,21 @@
<?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">
<com.wuhenzhizao.titlebar.widget.CommonTitleBar
android:id="@+id/titlebar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:leftText="@string/app_name"
app:leftType="textView"
app:rightCustomView="@layout/titlebar_view"
app:rightType="customView"
app:titleBarColor="#2CE1CF"
tools:leftText="@string/app_name" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="size_8">8dp</dimen>
<dimen name="size_50">50dp</dimen>
</resources>

@ -18,4 +18,7 @@
<string name="action_register">Register</string>
<string name="action_back">back</string>
<string name="action_config">system config</string>
<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>
</resources>

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="size_8">8dp</dimen>
<dimen name="size_50">50dp</dimen>
</resources>

@ -18,4 +18,7 @@
<string name="action_register">注册</string>
<string name="action_back">返回</string>
<string name="action_config">配置</string>
<string name="prompt_confirm_password">请输入确认密码</string>
<string name="prompt_email">请输入邮箱</string>
<string name="prompt_phone">请输入手机号</string>
</resources>

@ -2,6 +2,6 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="size_8">8dp</dimen>
<dimen name="size_50">50dp</dimen>
</resources>

@ -18,6 +18,9 @@
<string name="action_register">Register</string>
<string name="action_back">back</string>
<string name="action_config">system config</string>
<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>
<!-- Strings used for fragments for navigation -->
<!-- Strings used for fragments for navigation -->

Loading…
Cancel
Save