ソースを参照

绘制注册页

316044749 7 年 前
コミット
4e31365395

+ 8 - 1
app/src/main/AndroidManifest.xml

@@ -38,12 +38,19 @@
             </intent-filter>
         </activity>
 
+        <!--登陆-->
         <activity android:name=".activity.LoginActivity"
-            android:screenOrientation="portrait"/>
+            android:screenOrientation="portrait"
+            android:launchMode="singleInstance"/>
 
+        <!--注册-->
         <activity android:name=".activity.RegisterActivity"
             android:screenOrientation="portrait"/>
 
+        <!--注册提交-->
+        <activity android:name=".activity.RegisterSubmitActivity"
+            android:screenOrientation="portrait"/>
+
         <!--定位服务-->
         <meta-data android:name="com.ynstkz.shitu.android.demo" android:value="a78b553a67f68d1d980f908eb1f034a8"/>
         <service android:name="com.amap.api.location.APSService"/>

+ 55 - 3
app/src/main/java/com/ynstkz/shitu/android/activity/LoginActivity.java

@@ -1,32 +1,84 @@
 package com.ynstkz.shitu.android.activity;
 
+import android.content.Intent;
 import android.os.Build;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
-import android.support.annotation.RequiresApi;
+import android.util.Log;
 import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
 
 import com.ynstkz.shitu.android.R;
 import com.ynstkz.shitu.android.base.TitleBarActivity;
 import com.ynstkz.shitu.android.utils.StatusBarUtil;
 
+import butterknife.Bind;
+import butterknife.ButterKnife;
+
 /**
  * 作者:fuchangle on 2018/1/31 16:29
  */
 
-public class LoginActivity extends TitleBarActivity{
+public class LoginActivity extends TitleBarActivity {
+
+    @Bind(R.id.iv_cancel)
+    ImageView ivCancel;
+    @Bind(R.id.tv_register)
+    TextView tvRegister;
+    @Bind(R.id.tv_phone_code_login)
+    TextView tvPhoneCodeLogin;
+    @Bind(R.id.edit_username)
+    EditText editUsername;
+    @Bind(R.id.edit_password)
+    EditText editPassword;
+    @Bind(R.id.tv_forget_pw)
+    TextView tvForgetPw;
+    @Bind(R.id.btn_login)
+    Button btnLogin;
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         StatusBarUtil.setTransparent(this);
-        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
             setStatusBarColor(this, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
         }
+        ButterKnife.bind(this);
+        initView();
+        initData();
+        setListener();
     }
 
     @Override
     protected int getLayoutId() {
         return R.layout.activity_login;
     }
+
+    private void initView(){
+
+    }
+
+    private void initData(){
+
+    }
+
+    private void setListener(){
+        //关闭
+        ivCancel.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                finish();
+            }
+        });
+        //注册
+        tvRegister.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startActivity(new Intent(LoginActivity.this, RegisterActivity.class));
+            }
+        });
+    }
 }

+ 62 - 2
app/src/main/java/com/ynstkz/shitu/android/activity/RegisterActivity.java

@@ -1,21 +1,50 @@
 package com.ynstkz.shitu.android.activity;
 
+import android.content.Intent;
+import android.os.Build;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
 
 import com.ynstkz.shitu.android.R;
 import com.ynstkz.shitu.android.base.TitleBarActivity;
+import com.ynstkz.shitu.android.utils.StatusBarUtil;
+
+import butterknife.Bind;
+import butterknife.ButterKnife;
 
 /**
  * 作者:fuchangle on 2018/1/31 16:29
  */
 
-public class RegisterActivity extends TitleBarActivity{
+public class RegisterActivity extends TitleBarActivity {
+
+    @Bind(R.id.iv_cancel)
+    ImageView ivCancel;
+    @Bind(R.id.tv_login)
+    TextView tvLogin;
+    @Bind(R.id.edit_phone_number)
+    EditText editPhoneNumber;
+    @Bind(R.id.edit_password)
+    EditText editPassword;
+    @Bind(R.id.btn_next)
+    Button btnNext;
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-
+        StatusBarUtil.setTransparent(this);
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            setStatusBarColor(this, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+        }
+        ButterKnife.bind(this);
+        initView();
+        initData();
+        setListener();
     }
 
     @Override
@@ -23,4 +52,35 @@ public class RegisterActivity extends TitleBarActivity{
         return R.layout.activity_register;
     }
 
+    private void initView(){
+
+    }
+
+    private void initData(){
+
+    }
+
+    private void setListener(){
+        //关闭
+        ivCancel.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                finish();
+            }
+        });
+        //登陆
+        tvLogin.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startActivity(new Intent(RegisterActivity.this, LoginActivity.class));
+            }
+        });
+        //下一步
+        btnNext.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                startActivity(new Intent(RegisterActivity.this, RegisterSubmitActivity.class));
+            }
+        });
+    }
 }

+ 32 - 0
app/src/main/java/com/ynstkz/shitu/android/activity/RegisterSubmitActivity.java

@@ -0,0 +1,32 @@
+package com.ynstkz.shitu.android.activity;
+
+import android.os.Build;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.View;
+
+import com.ynstkz.shitu.android.R;
+import com.ynstkz.shitu.android.base.TitleBarActivity;
+import com.ynstkz.shitu.android.utils.StatusBarUtil;
+
+/**
+ * 注册提交
+ * 作者:fuchangle on 2018/2/7 14:26
+ */
+
+public class RegisterSubmitActivity extends TitleBarActivity{
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        StatusBarUtil.setTransparent(this);
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            setStatusBarColor(this, View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+        }
+    }
+
+    @Override
+    protected int getLayoutId() {
+        return R.layout.activity_register_submint;
+    }
+}

+ 10 - 11
app/src/main/res/layout/activity_login.xml

@@ -9,10 +9,9 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
-        android:paddingLeft="@dimen/company_15dp"
-        android:paddingTop="@dimen/company_15dp"
-        android:paddingRight="@dimen/company_15dp">
-
+        android:paddingLeft="@dimen/default_content_margin"
+        android:paddingTop="@dimen/default_content_margin"
+        android:paddingRight="@dimen/default_content_margin">
 
         <RelativeLayout
             android:layout_width="match_parent"
@@ -95,7 +94,7 @@
             android:id="@+id/tv_forget_pw"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="@dimen/company_20dp"
+            android:layout_marginTop="@dimen/company_10dp"
             android:gravity="right"
             android:text="忘记密码"
             android:textColor="@color/main_color"
@@ -156,8 +155,8 @@
                 android:layout_height="wrap_content">
 
                 <ImageView
-                    android:layout_width="@dimen/company_60dp"
-                    android:layout_height="@dimen/company_60dp"
+                    android:layout_width="@dimen/company_50dp"
+                    android:layout_height="@dimen/company_50dp"
                     android:background="@drawable/weixin_icon"
                     android:layout_centerInParent="true"/>
 
@@ -169,8 +168,8 @@
                 android:layout_height="wrap_content">
 
                 <ImageView
-                    android:layout_width="@dimen/company_60dp"
-                    android:layout_height="@dimen/company_60dp"
+                    android:layout_width="@dimen/company_50dp"
+                    android:layout_height="@dimen/company_50dp"
                     android:background="@drawable/qq_icon"
                     android:layout_centerInParent="true"/>
 
@@ -182,8 +181,8 @@
                 android:layout_height="wrap_content">
 
                 <ImageView
-                    android:layout_width="@dimen/company_60dp"
-                    android:layout_height="@dimen/company_60dp"
+                    android:layout_width="@dimen/company_50dp"
+                    android:layout_height="@dimen/company_50dp"
                     android:background="@drawable/weibo_icon"
                     android:layout_centerInParent="true"/>
 

+ 96 - 2
app/src/main/res/layout/activity_register.xml

@@ -1,6 +1,100 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical" android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="@color/white">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingLeft="@dimen/default_content_margin"
+        android:paddingTop="@dimen/default_content_margin"
+        android:paddingRight="@dimen/default_content_margin">
+
+        <ImageView
+            android:id="@+id/iv_cancel"
+            android:layout_width="@dimen/company_20dp"
+            android:layout_height="@dimen/company_20dp"
+            android:src="@drawable/login_cancel_icon" />
+
+        <TextView
+            android:id="@+id/tv_login"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:text="登录"
+            android:textColor="@color/main_color"
+            android:textSize="@dimen/company_18sp" />
+
+    </RelativeLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/company_30dp"
+        android:gravity="center_horizontal"
+        android:orientation="vertical">
+
+        <ImageView
+            android:layout_width="62dp"
+            android:layout_height="62dp"
+            android:src="@drawable/logo" />
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/company_6dp"
+            android:text="仕  途  网"
+            android:textColor="@color/main_color"
+            android:textSize="@dimen/company_18sp"
+            android:textStyle="bold" />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:paddingLeft="@dimen/company_15dp"
+        android:paddingTop="@dimen/company_15dp"
+        android:paddingRight="@dimen/company_15dp">
+
+        <EditText
+            android:id="@+id/edit_phone_number"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/company_50dp"
+            android:layout_marginTop="@dimen/company_10dp"
+            android:background="@drawable/shapre_default_edit_bg"
+            android:hint="请输入用户名称/手机号/邮箱"
+            android:maxLines="1"
+            android:textCursorDrawable="@null"
+            android:textSize="@dimen/company_14sp" />
+
+        <EditText
+            android:id="@+id/edit_password"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/company_50dp"
+            android:layout_marginTop="@dimen/company_20dp"
+            android:background="@drawable/shapre_default_edit_bg"
+            android:hint="请输入登陆密码"
+            android:inputType="textPassword"
+            android:maxLines="1"
+            android:textCursorDrawable="@null"
+            android:textSize="@dimen/company_14sp" />
+
+    </LinearLayout>
+
+    <Button
+        android:id="@+id/btn_next"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/company_50dp"
+        android:layout_marginTop="@dimen/company_20dp"
+        android:background="@drawable/shape_default_btn_bg"
+        android:layout_marginLeft="@dimen/default_content_margin"
+        android:layout_marginRight="@dimen/default_content_margin"
+        android:textColor="@color/white"
+        android:textSize="@dimen/company_16sp"
+        android:text="下一步"/>
 
 </LinearLayout>

+ 111 - 0
app/src/main/res/layout/activity_register_submint.xml

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <RelativeLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingLeft="@dimen/default_content_margin"
+        android:paddingTop="@dimen/default_content_margin"
+        android:paddingRight="@dimen/default_content_margin">
+
+        <ImageView
+            android:id="@+id/iv_cancel"
+            android:layout_width="@dimen/company_20dp"
+            android:layout_height="@dimen/company_20dp"
+            android:src="@drawable/login_cancel_icon" />
+
+        <TextView
+            android:id="@+id/tv_login"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:text="登录"
+            android:textColor="@color/main_color"
+            android:textSize="@dimen/company_18sp" />
+
+    </RelativeLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/company_30dp"
+        android:gravity="center_horizontal"
+        android:orientation="vertical">
+
+        <ImageView
+            android:layout_width="62dp"
+            android:layout_height="62dp"
+            android:src="@drawable/logo" />
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/company_6dp"
+            android:text="仕  途  网"
+            android:textColor="@color/main_color"
+            android:textSize="@dimen/company_18sp"
+            android:textStyle="bold" />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:layout_marginLeft="@dimen/default_content_margin"
+        android:layout_marginRight="@dimen/default_content_margin">
+
+        <EditText
+            android:id="@+id/edit_username"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/company_50dp"
+            android:layout_marginTop="@dimen/company_10dp"
+            android:background="@drawable/shapre_default_edit_bg"
+            android:hint="请输入您的用户名"
+            android:maxLines="1"
+            android:textCursorDrawable="@null"
+            android:textSize="@dimen/company_14sp" />
+
+        <EditText
+            android:id="@+id/edit_password"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/company_50dp"
+            android:layout_marginTop="@dimen/company_10dp"
+            android:background="@drawable/shapre_default_edit_bg"
+            android:hint="请输入密码"
+            android:maxLines="1"
+            android:textCursorDrawable="@null"
+            android:textSize="@dimen/company_14sp"
+            android:inputType="textPassword"/>
+
+
+        <EditText
+            android:id="@+id/edit_password_again"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/company_50dp"
+            android:layout_marginTop="@dimen/company_10dp"
+            android:background="@drawable/shapre_default_edit_bg"
+            android:hint="请再次输入一次密码"
+            android:maxLines="1"
+            android:textCursorDrawable="@null"
+            android:textSize="@dimen/company_14sp"
+            android:inputType="textPassword"/>
+
+    </LinearLayout>
+
+    <Button
+        android:id="@+id/btn_register"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/company_50dp"
+        android:layout_marginTop="@dimen/company_20dp"
+        android:layout_marginLeft="@dimen/default_content_margin"
+        android:layout_marginRight="@dimen/default_content_margin"
+        android:background="@drawable/shape_default_btn_bg"
+        android:textColor="@color/white"
+        android:textSize="@dimen/company_16sp"
+        android:text="注册"/>
+
+</LinearLayout>

+ 1 - 0
library/src/main/res/values/dimens.xml

@@ -8,6 +8,7 @@
     <dimen name="default_btn_height">38dp</dimen>
     <dimen name="newslist_icon_height">190dp</dimen>
     <dimen name="hotspecial_icon_height">182dp</dimen>
+    <dimen name="default_content_margin">15dp</dimen>
 
     <!-- dp单位   添加字段后马上更新提交,预防冲突-->
     <dimen name="company_8sp">8sp</dimen>