Commit 1d52dfe1 by 王宇航

模塊搭建完成,登陸功能未完善

parent 121e4351
/**
* @company: JOE工作室
* @Copyright: Copyright © 2013 - 2016 joe.All Rights Reserved.
* @Filename: ConvertDpAndPx.java
* @Description: TODO(用一句话描述该文件做什么)
* @Author: JOE
* @Date: 2016-9-2 下午6:16:29
**/
package com.joe.base.utils.screen;
/**
* @company: JOE工作室
* @ClassName: ConvertDpAndPx
* @Description: TODO(这里用一句话描述这个类的作用)
* @Author: JOE
* @Date: 2016-9-2 下午6:16:29
*/
import android.content.Context;
public class ConvertDpAndPx {
/**
* dp转换成px,代码写的是像素,而XML中写的是单位密度
* @param context
* @param dp
* @return
*/
public static int Dp2Px(Context context, float dp) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
}
/**
* px转换成dp,代码写的是像素,而XML中(dp)写的是单位密度
* @param context
* @param px
* @return
*/
public static int Px2Dp(Context context, float px) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (px / scale + 0.5f);
}
}
......@@ -6,7 +6,8 @@
<item name="colorPrimaryDark">@color/theme_color</item>
<item name="colorAccent">@color/theme_color</item>
<!--<item name="android:alertDialogTheme">@style/Theme.AppCompat.Light.Dialog.Alert.Self</item>-->
<item name="android:windowAnimationStyle">@style/activityAnimation</item><!-- 设置activity切换动画 -->
<item name="android:windowAnimationStyle">@style/activityAnimation
</item><!-- 设置activity切换动画 -->
</style>
<!-- animation 样式 -->
......@@ -18,8 +19,6 @@
</style>
<declare-styleable name="MyEditText">
<!-- 最大長度-->
<attr name="ed_MaxLength" format="integer" />
......@@ -36,16 +35,17 @@
<attr name="ed_maxLengthMarginLeft" format="dimension" />
<attr name="ed_maxLengthMarginRight" format="dimension" />
<attr name="ed_maxLengthMarginBottom" format="dimension" />
<!-- <attr name="ed_maxLengthLocation" format="enum">-->
<!-- <enum name="ALIGN_PARENT_BOTTOM">12</enum>-->
<!-- <enum name="ALIGN_PARENT_LEFT">9</enum>-->
<!-- <enum name="ALIGN_PARENT_RIGHT">11</enum>-->
<!-- <enum name="ALIGN_PARENT_TOP">10</enum>-->
<!-- <enum name="ALIGN_RIGHT">7</enum>-->
<!-- <enum name="ALIGN_TOP">6</enum>-->
<!-- <enum name="ALIGN_LEFT">5</enum>-->
<!-- <enum name="ALIGN_BOTTOM">8</enum>-->
<!-- </attr>-->
<attr name="ed_btn_marginTop" format="dimension" />
<attr name="ed_btn_marginRight" format="dimension" />
<attr name="ed_btn_marginBottom" format="dimension" />
<attr name="ed_btn_marginLeft" format="dimension" />
<attr name="ed_hint" format="string" />
<attr name="ed_hintColor" format="color" />
<attr name="ed_textColor" format="color" />
<attr name="ed_text" format="string" />
<attr name="ed_textSize" format="dimension" />
<!-- 是否能輸入表情-->
<attr name="ed_isInputIcon" format="boolean" />
<!-- 輸入表情時提示的內容-->
......@@ -67,6 +67,48 @@
<attr name="ed_singLeLine" format="boolean" />
<attr name="ed_clear_gravity">
<flag name="rightTop" value="1" />
<flag name="rightCenter" value="2" />
<flag name="rightBottom" value="3" />
</attr>
<attr name="ed_gravity">
<!-- Push object to the top of its container, not changing its size. -->
<flag name="top" value="0x30" />
<!-- Push object to the bottom of its container, not changing its size. -->
<flag name="bottom" value="0x50" />
<!-- Push object to the left of its container, not changing its size. -->
<flag name="left" value="0x03" />
<!-- Push object to the right of its container, not changing its size. -->
<flag name="right" value="0x05" />
<!-- Place object in the vertical center of its container, not changing its size. -->
<flag name="center_vertical" value="0x10" />
<!-- Grow the vertical size of the object if needed so it completely fills its container. -->
<flag name="fill_vertical" value="0x70" />
<!-- Place object in the horizontal center of its container, not changing its size. -->
<flag name="center_horizontal" value="0x01" />
<!-- Grow the horizontal size of the object if needed so it completely fills its container. -->
<flag name="fill_horizontal" value="0x07" />
<!-- Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. -->
<flag name="center" value="0x11" />
<!-- Grow the horizontal and vertical size of the object if needed so it completely fills its container. -->
<flag name="fill" value="0x77" />
<!-- Additional option that can be set to have the top and/or bottom edges of
the child clipped to its container's bounds.
The clip will be based on the vertical gravity: a top gravity will clip the bottom
edge, a bottom gravity will clip the top edge, and neither will clip both edges. -->
<flag name="clip_vertical" value="0x80" />
<!-- Additional option that can be set to have the left and/or right edges of
the child clipped to its container's bounds.
The clip will be based on the horizontal gravity: a left gravity will clip the right
edge, a right gravity will clip the left edge, and neither will clip both edges. -->
<flag name="clip_horizontal" value="0x08" />
<!-- Push object to the beginning of its container, not changing its size. -->
<flag name="start" value="0x00800003" />
<!-- Push object to the end of its container, not changing its size. -->
<flag name="end" value="0x00800005" />
</attr>
<attr name="inputType">
<!-- There is no content type. The text is not editable. -->
......
......@@ -43,7 +43,6 @@ dependencies {
implementation rootProject.ext.dependencies["constraintlayout"]
implementation rootProject.ext.dependencies["retrofit-url-manager"]
// annotationProcessor rootProject.ext.dependencies["butterknife-compiler"] //Butterknife 插件, 很多人因为没加这个而报错, 切记!!!
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]//依赖插件
implementation rootProject.ext.dependencies["autosize"]
......
......@@ -8,12 +8,6 @@
<meta-data
android:name="network.config.GlobalConfiguration"
android:value="ConfigModule" />
<meta-data
android:name="design_width_in_dp"
android:value="400" />
<meta-data
android:name="design_height_in_dp"
android:value="705" />
</application>
</manifest>
......@@ -16,6 +16,12 @@
</intent-filter>
</activity>
<meta-data
android:name="design_width_in_dp"
android:value="360" />
<meta-data
android:name="design_height_in_dp"
android:value="540" />
</application>
</manifest>
......
......@@ -2,6 +2,9 @@ package com.gingersoft.gsa.cloud.user.login.mvp.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.user.login.R;
import com.gingersoft.gsa.cloud.user.login.di.component.DaggerLoginComponent;
......@@ -12,10 +15,14 @@ import com.jess.arms.utils.ArmsUtils;
import com.gingersoft.gsa.cloud.user.login.mvp.contract.LoginContract;
import com.gingersoft.gsa.cloud.user.login.mvp.presenter.LoginPresenter;
import com.joe.base.widget.view.MyEditText;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import static com.jess.arms.utils.Preconditions.checkNotNull;
......@@ -32,7 +39,11 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public class LoginActivity extends BaseActivity<LoginPresenter> implements LoginContract.View {
public class LoginActivity extends BaseActivity<LoginPresenter> implements LoginContract.View, View.OnClickListener {
@BindView(R.id.ed_login_user_account)
MyEditText edAccount;
@BindView(R.id.ed_login_user_pwd)
MyEditText edPwd;
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
......@@ -46,11 +57,16 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login
@Override
public int initView(@Nullable Bundle savedInstanceState) {
return R.layout.user_login_activity_login; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
ButterKnife.bind(this);
findViewById(R.id.tv_gsa_user_login).setOnClickListener(this);
edAccount = findViewById(R.id.ed_login_user_account);
edPwd = findViewById(R.id.ed_login_user_pwd);
}
......@@ -85,4 +101,17 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login
public void loginOut() {
}
@OnClick({R.id.tv_gsa_user_login})
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_gsa_user_login:
//登陸
if (edAccount.getText() != null && edPwd.getText() != null) {
mPresenter.login(edAccount.getText().toString(), edPwd.getText().toString());
}
break;
}
}
}
......@@ -24,39 +24,78 @@
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="100dp"
android:background="@color/theme_color"
android:padding="8dp"
android:layout_marginTop="100dp"
android:src="@mipmap/ic_user"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/login_title"/>
app:layout_constraintTop_toBottomOf="@id/login_title" />
<EditText
<com.joe.base.widget.view.MyEditText
android:id="@+id/ed_login_user_account"
android:layout_width="0dp"
android:layout_height="0dp"
android:hint="請輸入賬戶"
android:padding="10dp"
android:textColorHint="@color/user_login_edit_color"
app:layout_constraintTop_toTopOf="@id/login_icon"
app:ed_MaxLength="11"
app:ed_clearIconSize="30dp"
app:ed_clearRes="@mipmap/ic_clear_text"
app:ed_hint="請輸入賬戶"
app:ed_hintColor="@color/user_login_edit_color"
app:ed_isInputIcon="false"
app:ed_singLeLine="true"
app:ed_text="admin"
app:ed_textColor="#333"
app:ed_textSize="@dimen/edit_text_size"
app:layout_constraintBottom_toBottomOf="@id/login_icon"
android:textSize="@dimen/edit_text_size"
app:layout_constraintLeft_toRightOf="@id/login_icon"
app:layout_constraintRight_toRightOf="parent" />
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/login_icon" />
<ImageView
android:id="@+id/iv_login_pwd_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:background="@color/theme_color"
android:padding="8dp"
android:src="@mipmap/ic_pwd"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/ed_login_user_account" />
<EditText
<com.joe.base.widget.view.MyEditText
android:id="@+id/ed_login_user_pwd"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#00000000"
android:hint="請輸入密碼"
android:padding="10dp"
android:textColor="#333"
android:textColorHint="@color/user_login_edit_color"
android:textSize="@dimen/edit_text_size"
app:layout_constraintTop_toBottomOf="@id/ed_login_user_account" />
app:ed_MaxLength="16"
app:ed_clearIconSize="30dp"
app:ed_clearRes="@mipmap/ic_clear_text"
app:ed_hint="請輸入密碼"
app:ed_hintColor="@color/user_login_edit_color"
app:ed_isInputIcon="false"
app:ed_singLeLine="true"
app:ed_text="123456"
app:ed_textColor="#333"
app:ed_textSize="@dimen/edit_text_size"
app:inputType="numberPassword"
app:layout_constraintBottom_toBottomOf="@id/iv_login_pwd_icon"
app:layout_constraintLeft_toRightOf="@id/iv_login_pwd_icon"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/iv_login_pwd_icon" />
<TextView
android:id="@+id/tv_forget_pwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="忘記密碼?"
android:textSize="14dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/ed_login_user_pwd" />
<TextView
android:id="@+id/tv_gsa_user_login"
......@@ -71,6 +110,6 @@
android:text="登陸"
android:textColor="#fff"
android:textSize="16dp"
app:layout_constraintTop_toBottomOf="@id/ed_login_user_pwd" />
app:layout_constraintTop_toBottomOf="@id/tv_forget_pwd" />
</androidx.constraintlayout.widget.ConstraintLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment