From 3b0581c6216f3a0988beff478717380e50cda045 Mon Sep 17 00:00:00 2001 From: md Date: Wed, 26 May 2021 18:45:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=9D=E5=A7=8B=E5=8C=96=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 1 + app/src/main/AndroidManifest.xml | 9 +- .../myapplication/activity/LoginActivity.java | 37 +++- .../activity/ManagementFragment.java | 31 +++ .../myapplication/base/BaseFragment.java | 7 +- .../bean/TaskSpecificationInfo.java | 5 + .../fragment/ForgetPawFragment.java | 32 +++ .../fragment/RegisterFragment.java | 62 ++++++ app/src/main/res/drawable/select_check.xml | 5 + app/src/main/res/drawable/shape_login.xml | 5 + app/src/main/res/layout/activity_login.xml | 18 +- .../main/res/layout/fragment_forget_paw.xml | 146 +++++++++++++ app/src/main/res/layout/fragment_register.xml | 206 ++++++++++++++++++ app/src/main/res/layout/register_title.xml | 28 +++ app/src/main/res/mipmap-xxhdpi/checkbox.png | Bin 0 -> 119 bytes .../res/mipmap-xxhdpi/checkbox_checked.png | Bin 0 -> 232 bytes .../main/res/mipmap-xxhdpi/icon_goback.png | Bin 0 -> 172 bytes app/src/main/res/mipmap-xxxhdpi/checkbox.png | Bin 0 -> 119 bytes .../res/mipmap-xxxhdpi/checkbox_checked.png | Bin 0 -> 232 bytes .../main/res/mipmap-xxxhdpi/icon_goback.png | Bin 0 -> 172 bytes app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/strings.xml | 2 + app/src/main/res/values/styles.xml | 14 +- 23 files changed, 584 insertions(+), 25 deletions(-) create mode 100644 app/src/main/java/com/example/myapplication/bean/TaskSpecificationInfo.java create mode 100644 app/src/main/java/com/example/myapplication/fragment/ForgetPawFragment.java create mode 100644 app/src/main/java/com/example/myapplication/fragment/RegisterFragment.java create mode 100644 app/src/main/res/drawable/select_check.xml create mode 100644 app/src/main/res/drawable/shape_login.xml create mode 100644 app/src/main/res/layout/fragment_forget_paw.xml create mode 100644 app/src/main/res/layout/fragment_register.xml create mode 100644 app/src/main/res/layout/register_title.xml create mode 100644 app/src/main/res/mipmap-xxhdpi/checkbox.png create mode 100644 app/src/main/res/mipmap-xxhdpi/checkbox_checked.png create mode 100644 app/src/main/res/mipmap-xxhdpi/icon_goback.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/checkbox.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/checkbox_checked.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/icon_goback.png diff --git a/app/build.gradle b/app/build.gradle index 8aed1e1..2adb66b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -34,6 +34,7 @@ dependencies { implementation 'com.google.android.material:material:1.0.0' implementation 'androidx.navigation:navigation-fragment:2.1.0' implementation 'androidx.navigation:navigation-ui:2.1.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ae18559..5181b9b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,12 +9,9 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - - - - - - + + + diff --git a/app/src/main/java/com/example/myapplication/activity/LoginActivity.java b/app/src/main/java/com/example/myapplication/activity/LoginActivity.java index 5e21383..61aaf86 100644 --- a/app/src/main/java/com/example/myapplication/activity/LoginActivity.java +++ b/app/src/main/java/com/example/myapplication/activity/LoginActivity.java @@ -1,12 +1,23 @@ package com.example.myapplication.activity; +import android.content.Intent; +import android.view.View; +import android.widget.EditText; +import android.widget.TextView; + import com.example.myapplication.R; import com.example.myapplication.base.BaseActivity; /** * 登录页 */ -public class LoginActivity extends BaseActivity { +public class LoginActivity extends BaseActivity implements View.OnClickListener { + private TextView tvRegister; + private android.widget.EditText etLoginName; + private android.widget.EditText etLoginPaw; + private TextView tvForgetPaw; + private TextView tvLogin; + @Override protected int getLayout() { return R.layout.activity_login; @@ -20,5 +31,29 @@ public class LoginActivity extends BaseActivity { @Override protected void initView() { super.initView(); + tvRegister = (TextView) findViewById(R.id.tv_register); + + etLoginName = (EditText) findViewById(R.id.et_login_name); + etLoginPaw = (EditText) findViewById(R.id.et_login_paw); + tvForgetPaw = (TextView) findViewById(R.id.tv_forget_paw); + tvLogin = (TextView) findViewById(R.id.tv_login); + tvRegister.setOnClickListener(this); + tvForgetPaw.setOnClickListener(this); + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.tv_register: + Intent register = new Intent(this, ManagementFragment.class); + register.putExtra("tag", 5); + startActivity(register); + break; + case R.id.tv_forget_paw: + Intent forgetPaw = new Intent(this, ManagementFragment.class); + forgetPaw.putExtra("tag", 6); + startActivity(forgetPaw); + break; + } } } diff --git a/app/src/main/java/com/example/myapplication/activity/ManagementFragment.java b/app/src/main/java/com/example/myapplication/activity/ManagementFragment.java index 4176a18..1c662df 100644 --- a/app/src/main/java/com/example/myapplication/activity/ManagementFragment.java +++ b/app/src/main/java/com/example/myapplication/activity/ManagementFragment.java @@ -7,8 +7,10 @@ import android.view.KeyEvent; import com.example.myapplication.R; import com.example.myapplication.base.BaseActivity; import com.example.myapplication.fragment.FindFragment; +import com.example.myapplication.fragment.ForgetPawFragment; import com.example.myapplication.fragment.MineFragment; import com.example.myapplication.fragment.RecordFragment; +import com.example.myapplication.fragment.RegisterFragment; import com.example.myapplication.fragment.TreasureFragment; import com.gyf.immersionbar.ImmersionBar; @@ -28,6 +30,8 @@ public class ManagementFragment extends BaseActivity { private FindFragment findFragment;//发现的fragment private RecordFragment recordFragment;//纪录的fragment private TreasureFragment treasureFragment;//寻宝的fragment + private RegisterFragment registerFragment;//注册的fragment + private ForgetPawFragment forgetPawFragment;//忘记密码fragment @Override @@ -56,6 +60,10 @@ public class ManagementFragment extends BaseActivity { fragmentTransaction.hide(recordFragment); if (treasureFragment != null) fragmentTransaction.hide(treasureFragment); + if (registerFragment != null) + fragmentTransaction.hide(registerFragment); + if (forgetPawFragment != null) + fragmentTransaction.hide(forgetPawFragment); } public void selectorFragment(int i) { @@ -97,6 +105,22 @@ public class ManagementFragment extends BaseActivity { fragmentTransaction.show(treasureFragment); } break; + case 5: + if (registerFragment == null) { + registerFragment = new RegisterFragment(); + fragmentTransaction.add(R.id.frame_layout, registerFragment); + } else { + fragmentTransaction.show(registerFragment); + } + break; + case 6: + if (forgetPawFragment == null) { + forgetPawFragment = new ForgetPawFragment(); + fragmentTransaction.add(R.id.frame_layout, forgetPawFragment); + } else { + fragmentTransaction.show(forgetPawFragment); + } + break; } fragmentTransaction.commit(); @@ -118,9 +142,16 @@ public class ManagementFragment extends BaseActivity { case 4: treasureFragment.onActivityResult(requestCode, resultCode, data); break; + case 5: + registerFragment.onActivityResult(requestCode, resultCode, data); + break; + case 6: + forgetPawFragment.onActivityResult(requestCode, resultCode, data); + break; } } + private void setZtlTextColor() { ImmersionBar.with(this) .statusBarDarkFont(true, 0.2f) //原理:如果当前设备支持状态栏字体变色,会设置状态栏字体为黑色,如果当前设备不支持状态栏字体变色,会使当前状态栏加上透明度,否则不执行透明度 diff --git a/app/src/main/java/com/example/myapplication/base/BaseFragment.java b/app/src/main/java/com/example/myapplication/base/BaseFragment.java index 639e082..4aba05a 100644 --- a/app/src/main/java/com/example/myapplication/base/BaseFragment.java +++ b/app/src/main/java/com/example/myapplication/base/BaseFragment.java @@ -13,22 +13,24 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.Fragment; +import com.example.myapplication.R; public abstract class BaseFragment extends Fragment { private AlertDialog alertDialog; + public View mview; @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { - View inflate = inflater.inflate(getLayout(), container, false); + mview = inflater.inflate(getLayout(), container, false); initMvp(); initView(); initData(); - return inflate; + return mview; } protected void initMvp() { @@ -70,6 +72,7 @@ public abstract class BaseFragment extends Fragment { protected void initView() { + } @Override diff --git a/app/src/main/java/com/example/myapplication/bean/TaskSpecificationInfo.java b/app/src/main/java/com/example/myapplication/bean/TaskSpecificationInfo.java new file mode 100644 index 0000000..bb82430 --- /dev/null +++ b/app/src/main/java/com/example/myapplication/bean/TaskSpecificationInfo.java @@ -0,0 +1,5 @@ +package com.example.myapplication.bean; + +public class TaskSpecificationInfo { + +} diff --git a/app/src/main/java/com/example/myapplication/fragment/ForgetPawFragment.java b/app/src/main/java/com/example/myapplication/fragment/ForgetPawFragment.java new file mode 100644 index 0000000..5bfa556 --- /dev/null +++ b/app/src/main/java/com/example/myapplication/fragment/ForgetPawFragment.java @@ -0,0 +1,32 @@ +package com.example.myapplication.fragment; + +import android.os.Bundle; + +import androidx.fragment.app.Fragment; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.example.myapplication.R; +import com.example.myapplication.base.BaseFragment; + +/** + *忘记密码页面 + */ +public class ForgetPawFragment extends BaseFragment { + @Override + protected int getLayout() { + return R.layout.fragment_forget_paw; + } + + @Override + protected void initView() { + super.initView(); + } + + @Override + protected void initData() { + super.initData(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/myapplication/fragment/RegisterFragment.java b/app/src/main/java/com/example/myapplication/fragment/RegisterFragment.java new file mode 100644 index 0000000..0bca853 --- /dev/null +++ b/app/src/main/java/com/example/myapplication/fragment/RegisterFragment.java @@ -0,0 +1,62 @@ +package com.example.myapplication.fragment; + +import android.view.View; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; + +import com.example.myapplication.R; +import com.example.myapplication.base.BaseFragment; + +/** + * 注册页面 + */ +public class RegisterFragment extends BaseFragment { + + + private EditText etRegisterPhone; + private EditText etRegisterNote; + private TextView registerGetNote; + private EditText etRegisterReferrer; + private EditText etRegisterPaw; + private EditText etRegisterConfirmPaw; + private ImageView ivRegisterCheck; + private TextView haveGoLogin; + private TextView tvRegister; + private ImageView ivFinish; + + + @Override + protected int getLayout() { + return R.layout.fragment_register; + } + + @Override + protected void initView() { + super.initView(); + ivFinish =mview.findViewById(R.id.iv_finish); + etRegisterPhone = mview.findViewById(R.id.et_register_phone); + etRegisterNote = mview.findViewById(R.id.et_register_note); + registerGetNote = mview.findViewById(R.id.register_get_note); + etRegisterReferrer = mview.findViewById(R.id.et_register_referrer); + etRegisterPaw = mview.findViewById(R.id.et_register_paw); + etRegisterConfirmPaw = mview.findViewById(R.id.et_register_confirm_paw); + ivRegisterCheck = mview.findViewById(R.id.iv_register_check); + haveGoLogin = mview.findViewById(R.id.have_go_login); + tvRegister = mview.findViewById(R.id.tv_register); + ivFinish.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getActivity().finish(); + } + }); + + } + + + @Override + protected void initData() { + super.initData(); + } + +} \ No newline at end of file diff --git a/app/src/main/res/drawable/select_check.xml b/app/src/main/res/drawable/select_check.xml new file mode 100644 index 0000000..b0c52fb --- /dev/null +++ b/app/src/main/res/drawable/select_check.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_login.xml b/app/src/main/res/drawable/shape_login.xml new file mode 100644 index 0000000..039c308 --- /dev/null +++ b/app/src/main/res/drawable/shape_login.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 70df88a..c7edd17 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -84,9 +84,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:buttonTint="@color/colorWhite" - android:text="免责声明" android:scaleX="0.7" android:scaleY="0.7" + android:text="免责声明" android:textColor="@color/colorWhite" android:textSize="14sp" app:layout_constraintLeft_toLeftOf="@id/et_login_paw" @@ -96,14 +96,13 @@ android:id="@+id/tv_register" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginTop="8dp" android:layout_marginRight="10dp" android:text="注册" android:textColor="@color/colorWhite" android:textSize="12sp" app:layout_constraintRight_toLeftOf="@id/tv_forget_paw" - app:layout_constraintTop_toBottomOf="@id/et_login_paw" - android:layout_marginTop="8dp" - /> + app:layout_constraintTop_toBottomOf="@id/et_login_paw" /> + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_forget_paw.xml b/app/src/main/res/layout/fragment_forget_paw.xml new file mode 100644 index 0000000..e58dae6 --- /dev/null +++ b/app/src/main/res/layout/fragment_forget_paw.xml @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_register.xml b/app/src/main/res/layout/fragment_register.xml new file mode 100644 index 0000000..a2d7ae5 --- /dev/null +++ b/app/src/main/res/layout/fragment_register.xml @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/register_title.xml b/app/src/main/res/layout/register_title.xml new file mode 100644 index 0000000..cac9eb5 --- /dev/null +++ b/app/src/main/res/layout/register_title.xml @@ -0,0 +1,28 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xxhdpi/checkbox.png b/app/src/main/res/mipmap-xxhdpi/checkbox.png new file mode 100644 index 0000000000000000000000000000000000000000..18b7dea34272dbfd407b0840c46257d71b770128 GIT binary patch literal 119 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-u0T32ttvjfIyS8;hABi7 z$Y(AI@(X6Dx0}3Sj}MS5?&;zf!f`!$hLn`lsRsuR9PqGYG|`k{5ZuF7S+(9AWCDYy LtDnm{r-UW|-V+^u literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-xxhdpi/checkbox_checked.png b/app/src/main/res/mipmap-xxhdpi/checkbox_checked.png new file mode 100644 index 0000000000000000000000000000000000000000..14e9c765903f7066c9d4c5df69912a7e18b6a58b GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!O@L2`E0B&$tBOyr4h+q=_Kdc4 zinMZyvT}~JbdCZdD<>c$($Xoy$|VY@#?~pu+9SrvDbAsxAvUdQL;rR^pnl}$kXb52x69eKfz6}gb z=a2CSCWy6sR%F_ literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-xxhdpi/icon_goback.png b/app/src/main/res/mipmap-xxhdpi/icon_goback.png new file mode 100644 index 0000000000000000000000000000000000000000..7b0fe61f1bab79bb967c1e8c54f14fd070d80147 GIT binary patch literal 172 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh-3?!F4n4AKnR04cLT!HjPFxb3#^R{i<_U+sE z|Ns9@U;q@^x^*j1a;2>62cSBhk|4iehNn9twb+@LPI8tP-@E^_7EoN<)5S4_<9ad! z(>5_S4Uh0vqZ?gJCxnwSxEeO{$R_Bd39@yuEPc?l*^z}|sujnw-RY52fZ7;5UHx3v IIVCg!05JGHFaQ7m literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-xxxhdpi/checkbox.png b/app/src/main/res/mipmap-xxxhdpi/checkbox.png new file mode 100644 index 0000000000000000000000000000000000000000..18b7dea34272dbfd407b0840c46257d71b770128 GIT binary patch literal 119 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9JOMr-u0T32ttvjfIyS8;hABi7 z$Y(AI@(X6Dx0}3Sj}MS5?&;zf!f`!$hLn`lsRsuR9PqGYG|`k{5ZuF7S+(9AWCDYy LtDnm{r-UW|-V+^u literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-xxxhdpi/checkbox_checked.png b/app/src/main/res/mipmap-xxxhdpi/checkbox_checked.png new file mode 100644 index 0000000000000000000000000000000000000000..14e9c765903f7066c9d4c5df69912a7e18b6a58b GIT binary patch literal 232 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!O@L2`E0B&$tBOyr4h+q=_Kdc4 zinMZyvT}~JbdCZdD<>c$($Xoy$|VY@#?~pu+9SrvDbAsxAvUdQL;rR^pnl}$kXb52x69eKfz6}gb z=a2CSCWy6sR%F_ literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-xxxhdpi/icon_goback.png b/app/src/main/res/mipmap-xxxhdpi/icon_goback.png new file mode 100644 index 0000000000000000000000000000000000000000..7b0fe61f1bab79bb967c1e8c54f14fd070d80147 GIT binary patch literal 172 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh-3?!F4n4AKnR04cLT!HjPFxb3#^R{i<_U+sE z|Ns9@U;q@^x^*j1a;2>62cSBhk|4iehNn9twb+@LPI8tP-@E^_7EoN<)5S4_<9ad! z(>5_S4Uh0vqZ?gJCxnwSxEeO{$R_Bd39@yuEPc?l*^z}|sujnw-RY52fZ7;5UHx3v IIVCg!05JGHFaQ7m literal 0 HcmV?d00001 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 3ac5e99..13a8a71 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -2,6 +2,7 @@ #6200EE #3700B3 + #03A9F4 #03DAC5 #000000 #FAFAFA diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 89586ef..0fec131 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -9,4 +9,6 @@ Hello first fragment Hello second fragment. Arg: %1$s + + Hello blank fragment \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 877311e..00c0626 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -15,20 +15,10 @@ --> - + - - - - - - - - + \ No newline at end of file