詹子聪 5 anni fa
parent
commit
bb56af2c09

+ 8 - 0
app/src/main/java/com/miekir/eden/ui/mine/login/LoginActivity.java

@@ -8,6 +8,7 @@ import android.text.TextUtils;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
+import android.widget.CheckBox;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -55,6 +56,7 @@ public class LoginActivity extends BaseBeiActivity implements View.OnClickListen
     private View til_password;
     private TextInputEditText et_email;
     private TextInputEditText et_password;
+    private CheckBox cb_adult;
 
     @InjectPresenter
     LoginPresenter presenter;
@@ -82,6 +84,7 @@ public class LoginActivity extends BaseBeiActivity implements View.OnClickListen
         til_password = findViewById(R.id.til_password);
         et_email = findViewById(R.id.et_email);
         et_password = findViewById(R.id.et_password);
+        cb_adult = findViewById(R.id.cb_adult);
         ViewTool.setOnClickListener(this, this, new int[]{R.id.btn_login, R.id.tv_forget, R.id.toolbar});
 
         //WifiManager wm = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
@@ -232,6 +235,11 @@ public class LoginActivity extends BaseBeiActivity implements View.OnClickListen
                     return;
                 }
 
+                if (!cb_adult.isChecked()) {
+                    ToastTool.showShort(StringTool.getString(R.string.login_adult_only));
+                    return;
+                }
+
                 showLoading();
                 presenter.submitLoginWithPassword(email, password);
                 break;

+ 13 - 3
app/src/main/res/layout/activity_login.xml

@@ -82,6 +82,16 @@
         android:layout_gravity="end"
         android:visibility="gone"/>
 
+    <CheckBox
+        android:id="@+id/cb_adult"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/margin_s"
+        android:layout_marginStart="@dimen/margin_default"
+        android:layout_marginEnd="@dimen/margin_default"
+        android:text="@string/login_adult"
+        android:textColor="@color/black_text"/>
+
     <android.widget.Button
         android:id="@+id/btn_login"
         android:layout_width="wrap_content"
@@ -90,7 +100,7 @@
         android:paddingStart="@dimen/size_image_normal"
         android:paddingEnd="@dimen/size_image_normal"
         android:minHeight="0dp"
-        android:layout_marginTop="@dimen/size_image_s"
+        android:layout_marginTop="@dimen/margin_s"
         android:layout_marginStart="@dimen/margin_default"
         android:layout_marginEnd="@dimen/margin_default"
         android:paddingTop="@dimen/padding_full_width"
@@ -109,13 +119,13 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginTop="@dimen/margin_message"
-        android:layout_marginBottom="@dimen/margin_message"
+        android:layout_marginBottom="@dimen/margin_default"
         android:layout_marginStart="@dimen/margin_default"
         android:layout_marginEnd="@dimen/margin_default"
         android:text="@string/login_attention"
         android:textColor="@color/red_droid"
         android:textStyle="bold"
-        android:textSize="@dimen/text_s"
+        android:textSize="@dimen/text_normal_s"
         android:background="?attr/selectableItemBackground"
         android:layout_gravity="center_horizontal" />
 </LinearLayout>

+ 2 - 0
app/src/main/res/values-zh-rCN/strings.xml

@@ -112,4 +112,6 @@
     <string name="menu_retry">重试</string>
     <string name="about_coupon">领美食券</string>
     <string name="login_get_region_failed">获取区域信息失败</string>
+    <string name="login_adult">我已满18周岁</string>
+    <string name="login_adult_only">本应用仅对成年人开放</string>
 </resources>

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -112,4 +112,6 @@
     <string name="menu_retry">Retry</string>
     <string name="about_coupon">Get Food Coupon</string>
     <string name="login_get_region_failed">Get region info failed</string>
+    <string name="login_adult">I am adult</string>
+    <string name="login_adult_only">Adult only</string>
 </resources>