diff --git a/app/src/main/java/com/community/pocket/ui/login/LoginActivity.java b/app/src/main/java/com/community/pocket/ui/login/LoginActivity.java index 0fadf14..525a69b 100644 --- a/app/src/main/java/com/community/pocket/ui/login/LoginActivity.java +++ b/app/src/main/java/com/community/pocket/ui/login/LoginActivity.java @@ -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) { diff --git a/app/src/main/java/com/community/pocket/ui/register/RegisterActivity.java b/app/src/main/java/com/community/pocket/ui/register/RegisterActivity.java index b0cde42..dcbf79e 100644 --- a/app/src/main/java/com/community/pocket/ui/register/RegisterActivity.java +++ b/app/src/main/java/com/community/pocket/ui/register/RegisterActivity.java @@ -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(); + } } diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index cadf781..27b1073 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -11,19 +11,7 @@ android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".ui.login.LoginActivity"> - + @@ -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" diff --git a/app/src/main/res/layout/activity_register.xml b/app/src/main/res/layout/activity_register.xml index 363b50c..6871723 100644 --- a/app/src/main/res/layout/activity_register.xml +++ b/app/src/main/res/layout/activity_register.xml @@ -6,6 +6,8 @@ android:layout_height="match_parent" tools:context=".ui.register.RegisterActivity"> + + + + + + + + + + + + + +