仿拉手團購App5--登錄界面

来源:http://www.cnblogs.com/ganchuanpu/archive/2017/05/16/6864214.html
-Advertisement-
Play Games

activity_login.xml 快速登錄(獲得驗證碼和登錄) 賬號登錄(登錄和切換密碼明文) ...


    

 

 

 

 

 

activity_login.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.myxh.coolshopping.ui.activity.LoginActivity">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/common_titleBar_height"
        android:background="@color/title_bar_color">
        <ImageView
            android:id="@+id/login_titleBar_iv_back"
            style="@style/common_left_back_imageView_style"/>
        <TextView
            style="@style/base_textView_style"
            android:layout_centerInParent="true"
            android:gravity="center_vertical"
            android:text="@string/login_titleBar_login"
            android:textSize="@dimen/login_titleBar_login_size"
            android:textColor="@color/textColor_32"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
        <TextView
            android:id="@+id/login_titleBar_tv_register"
            style="@style/common_right_title_textView_style"
            android:gravity="center"
            android:text="@string/login_titleBar_register"
            android:textColor="@color/orange"
            android:textSize="@dimen/login_titleBar_register_size"/>
    </RelativeLayout>

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="@color/bg_common_gray"
        android:scrollbars="none">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/white_border_area">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">
                    <TextView
                        android:id="@+id/login_select_tv_quickLogin"
                        style="@style/login_select_textView_style"
                        android:text="@string/login_select_quick_login"
                        android:textColor="@color/app_yellow"/>
                    <View
                        style="@style/me_vertical_view_style"/>
                    <TextView
                        android:id="@+id/login_select_tv_accountLogin"
                        style="@style/login_select_textView_style"
                        android:text="@string/login_select_account_login"/>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:orientation="horizontal">
                    <View
                        android:id="@+id/login_select_left_line"
                        android:layout_width="0dp"
                        android:layout_height="@dimen/login_select_line_height"
                        android:layout_weight="1"
                        android:background="@color/orange"/>
                    <View
                        android:id="@+id/login_select_right_line"
                        android:layout_width="0dp"
                        android:layout_height="@dimen/login_select_line_height"
                        android:layout_weight="1"
                        android:background="@color/orange"
                        android:visibility="invisible"/>
                </LinearLayout>
            </RelativeLayout>

            <LinearLayout
                android:id="@+id/login_quick_login_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/login_layout_marginTop"
                android:orientation="vertical">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@color/app_white">
                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                        <EditText
                            android:id="@+id/login_quick_login_et_phoneNumber"
                            style="@style/login_editText_style"
                            android:inputType="number"
                            android:maxLength="11"
                            android:hint="@string/login_input_phoneNumber_hint"/>
                        <ImageView
                            android:id="@+id/login_quick_login_iv_clear_phoneNumber"
                            android:visibility="gone"
                            style="@style/common_clear_input_imageView_style"/>
                    </RelativeLayout>
                    <View
                        style="@style/me_horizontal_view_style"/>
                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                        <EditText
                            android:id="@+id/login_quick_login_et_code"
                            style="@style/login_editText_style"
                            android:inputType="number"
                            android:maxLength="6"
                            android:hint="@string/login_input_check_code_hint"/>
                        <Button
                            android:id="@+id/login_quick_login_btn_getCode"
                            style="@style/login_btn_getCode_style"/>
                        <ImageView
                            android:id="@+id/login_quick_login_iv_clear_code"
                            android:layout_toLeftOf="@+id/login_quick_login_btn_getCode"
                            android:layout_alignParentRight="false"
                            android:visibility="gone"
                            style="@style/common_clear_input_imageView_style"/>
                    </RelativeLayout>
                    <RelativeLayout
                        android:id="@+id/ll_check_picture"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:visibility="gone" >

                        <View
                            android:layout_width="fill_parent"
                            android:layout_height="1.0dip"
                            android:layout_marginLeft="14.0dip"
                            android:background="#ffdadada" />

                        <EditText
                            android:id="@+id/et_check_picture"
                            android:layout_width="120.0dip"
                            android:layout_height="wrap_content"
                            android:layout_centerVertical="true"
                            android:background="@null"
                            android:hint="驗證圖片"
                            android:padding="16.0dip"
                            android:scrollHorizontally="true"
                            android:singleLine="true"
                            android:textColorHint="@color/gray01"
                            android:textSize="@dimen/size_24" />

                        <ImageView
                            android:id="@+id/iv_check_picture"
                            android:layout_width="50.0dip"
                            android:layout_height="30.0dip"
                            android:layout_centerVertical="true"
                            android:layout_toRightOf="@id/et_check_picture"
                            android:scaleType="fitXY" />
                    </RelativeLayout>
                </LinearLayout>
                <Button
                    android:id="@+id/login_quick_login_btn"
                    style="@style/login_btn_style"/>
            </LinearLayout>

            <LinearLayout
                android:id="@+id/login_account_login_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/login_layout_marginTop"
                android:orientation="vertical"
                android:visibility="gone">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:background="@color/app_white">
                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                        <EditText
                            android:id="@+id/login_account_login_et_username"
                            style="@style/login_editText_style"
                            android:hint="@string/login_input_username_hint"/>
                        <ImageView
                            android:id="@+id/login_account_login_iv_clear_username"
                            android:visibility="gone"
                            style="@style/common_clear_input_imageView_style"/>
                    </RelativeLayout>
                    <View
                        style="@style/me_horizontal_view_style"/>
                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                        <EditText
                            android:id="@+id/login_account_login_et_password"
                            style="@style/login_editText_style"
                            android:inputType="textPassword"
                            android:hint="@string/login_input_password_hint"/>
                        <CheckBox
                            android:id="@+id/login_account_login_checkBox"
                            style="@style/login_checkBox_style"/>
                        <ImageView
                            android:id="@+id/login_account_login_iv_clear_password"
                            android:layout_toLeftOf="@+id/login_account_login_checkBox"
                            android:layout_alignParentRight="false"
                            android:visibility="gone"
                            style="@style/common_clear_input_imageView_style"/>
                    </RelativeLayout>
                    <RelativeLayout
                        android:id="@+id/ll_check_code"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        android:visibility="gone" >

                        <View
                            android:layout_width="fill_parent"
                            android:layout_height="1.0dip"
                            android:layout_marginLeft="14.0dip"
                            android:background="#ffdadada" />

                        <EditText
                            android:id="@+id/et_check_code"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentLeft="true"
                            android:layout_centerVertical="true"
                            android:background="@null"
                            android:hint="@string/login_input_check_code_hint"
                            android:maxWidth="150.0dip"
                            android:padding="16.0dip"
                            android:scrollHorizontally="true"
                            android:singleLine="true"
                            android:textColorHint="@color/gray01"
                            android:textSize="@dimen/size_24" />

                        <ImageView
                            android:id="@+id/iv_check_code"
                            android:layout_width="58.0dip"
                            android:layout_height="30.0dip"
                            android:layout_centerVertical="true"
                            android:layout_gravity="center_vertical"
                            android:layout_marginLeft="5.0dip"
                            android:layout_marginTop="1.0dip"
                            android:layout_toRightOf="@id/et_check_code"
                            android:scaleType="fitXY" />
                    </RelativeLayout>
                </LinearLayout>
                <Button
                    android:id="@+id/login_account_login_btn"
                    style="@style/login_btn_style"/>
                <TextView
                    android:id="@+id/login_account_login_tv_forget_password"
                    style="@style/base_textView_style"
                    android:layout_gravity="right"
                    android:layout_marginTop="@dimen/login_account_login_forget_password_marginTop"
                    android:layout_marginRight="@dimen/login_account_login_forget_password_marginRight"
                    android:drawableRight="@mipmap/yellow_arrow"
                    android:drawablePadding="5dp"
                    android:text="@string/login_account_forget_password"
                    android:textColor="@color/orange"
                    android:textSize="@dimen/login_content_size"/>
            </LinearLayout>

        </LinearLayout>

    </ScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:background="@drawable/white_border_area"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="@string/login_bottom_use_third_account"
            android:textSize="@dimen/textSize_16"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/login_bottom_icon_layout_marginTop"
            android:gravity="center"
            android:orientation="horizontal">
            <ImageView
                android:id="@+id/login_bottom_iv_qq"
                style="@style/base_imageView_style"
                android:src="@mipmap/ico_qq_accout"/>
            <ImageView
                android:id="@+id/login_bottom_iv_wechat"
                style="@style/base_imageView_style"
                android:layout_marginLeft="@dimen/login_bottom_icon_marginLeft"
                android:src="@mipmap/ico_qq_wixin"/>
            <ImageView
                android:id="@+id/login_bottom_iv_weibo"
                style="@style/base_imageView_style"
                android:layout_marginLeft="@dimen/login_bottom_icon_marginLeft"
                android:src="@mipmap/ico_sina_weibo"/>
            <ImageView
                android:id="@+id/login_bottom_iv_alipay"
                style="@style/base_imageView_style"
                android:layout_marginLeft="@dimen/login_bottom_icon_marginLeft"
                android:src="@mipmap/ico_alipay"
                android:visibility="gone"/>
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

快速登錄(獲得驗證碼和登錄)

case R.id.login_quick_login_btn_getCode:
    mPhoneNumber = mQuickLoginEtPhoneNumber.getText().toString();
    if (LoginHelperUtil.isPhoneNumber(mPhoneNumber)) {
        BmobManager.getInstance(new BmobMsgSendCallback() {
            @Override
            public void onMsgSendSuccess() {
                ToastUtil.show(LoginActivity.this,R.string.sms_code_send_success);
                //驗證碼發送成功,倒計時
                setCodeTimeDown();
            }

            @Override
            public void onMsgSendFailure() {
                ToastUtil.show(LoginActivity.this,R.string.sms_code_send_failure);
            }
        }).sendMsgCode(mPhoneNumber);
    } else {
        ToastUtil.show(this,R.string.phone_number_incorrect);
    }
    break;
case R.id.login_quick_login_btn:
    mPhoneNumber = mQuickLoginEtPhoneNumber.getText().toString();
    String code = mQuickLoginEtCode.getText().toString();
    if (LoginHelperUtil.isCodeCorrect(code) && LoginHelperUtil.isPhoneNumber(mPhoneNumber)) {
        BmobManager.getInstance(new BmobLoginCallback() {
            @Override
            public void onLoginSuccess() {
                Log.i(TAG, "onLoginSuccess: 登陸成功");
                ToastUtil.show(LoginActivity.this,R.string.login_success);
            }

            @Override
            public void onLoginFailure() {
                Log.i(TAG, "onLoginFailure: 登陸失敗");
                ToastUtil.show(LoginActivity.this,R.string.login_failed);
            }
        }).signOrLoginByMsgCode(mPhoneNumber,code);
    } else {
        ToastUtil.showLong(this,R.string.quick_login_input_incorrect);
    }
    break;

 

賬號登錄(登錄和切換密碼明文)

AccountLoginCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
                //切換明密文
                if (checked) {
                    mAccountLoginEtPassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                } else {
                    mAccountLoginEtPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
                }
                //游標在末尾顯示
                mAccountLoginEtPassword.setSelection(mAccountLoginEtPassword.length());
            }
        });

  

 

case R.id.login_account_login_btn:
    String username = mAccountLoginEtUsername.getText().toString();
    String password = mAccountLoginEtPassword.getText().toString();
    if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password)) {
        BmobManager.getInstance(new BmobLoginCallback() {
            @Override
            public void onLoginSuccess() {
                ToastUtil.show(LoginActivity.this,R.string.login_success);
                Intent data = new Intent();
                setResult(LOGIN_RESULT_CODE,data);
                finish();
            }
            @Override
            public void onLoginFailure() {
                ToastUtil.show(LoginActivity.this,R.string.login_failed);
            }
        }).login(username,password);
    } else {
        ToastUtil.show(this,R.string.login_input_empty);
    }
    break;

  

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • Dom是Document Object Model的縮寫,意思是文檔對象模型。DOM是一種與瀏覽器、平臺、語言無關的介面,使用該介面可以輕鬆訪問頁面中所有的標準組件。DOM操作可以分為三個方面即DOM Core(核心)、HTM-DOM和CSS-DOM。 每一個網頁都可以用DOM表示出來,每個DOM都 ...
  • jQuery 篩選 1)過濾 2)查找 3)串聯 eq(index| index) 獲取匹配的第二個元素 HTML 代碼: This is just a test. So is this jQuery 代碼: $("p").eq(1).css("color","red") 結果: [ So is t ...
  • 這幾天在接谷歌的支付,在拉谷歌商品列表的時候轉菊花,長時間不返回(querySkuDetails),一開始以為因為IAP有key不對導致的,查了下發現沒有問題。 再看logcat,發現了這行: 確實IAP商品有23個,解決方案有兩個: 1. https://code.google.com/archi ...
  • 前言 雖然實習工作還沒有著落,但學習還是要繼續的嘛,今天就來學習使用下 Mac 下截取網路封包的工具:Charles。 我想,如果你是個善於利用搜索引擎的人,那麼在 Google 中輸入「Charles 使用」等相應的關鍵字,便會出現一大把文章。不過呢,之所以會有這篇文章,就是因為今天在安裝和初步使 ...
  • 代碼: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. NSLog(@"--系統的所有字體--%@",[self getAllSystemFonts]); NS ...
  • UserProfileActivity 退出登錄 ...
  • 獲得驗證碼 註冊 ...
  • ShareSDK第三方登錄 ...
一周排行
    -Advertisement-
    Play Games
  • 前言 本文介紹一款使用 C# 與 WPF 開發的音頻播放器,其界面簡潔大方,操作體驗流暢。該播放器支持多種音頻格式(如 MP4、WMA、OGG、FLAC 等),並具備標記、實時歌詞顯示等功能。 另外,還支持換膚及多語言(中英文)切換。核心音頻處理採用 FFmpeg 組件,獲得了廣泛認可,目前 Git ...
  • OAuth2.0授權驗證-gitee授權碼模式 本文主要介紹如何筆者自己是如何使用gitee提供的OAuth2.0協議完成授權驗證並登錄到自己的系統,完整模式如圖 1、創建應用 打開gitee個人中心->第三方應用->創建應用 創建應用後在我的應用界面,查看已創建應用的Client ID和Clien ...
  • 解決了這個問題:《winForm下,fastReport.net 從.net framework 升級到.net5遇到的錯誤“Operation is not supported on this platform.”》 本文內容轉載自:https://www.fcnsoft.com/Home/Sho ...
  • 國內文章 WPF 從裸 Win 32 的 WM_Pointer 消息獲取觸摸點繪製筆跡 https://www.cnblogs.com/lindexi/p/18390983 本文將告訴大家如何在 WPF 裡面,接收裸 Win 32 的 WM_Pointer 消息,從消息裡面獲取觸摸點信息,使用觸摸點 ...
  • 前言 給大家推薦一個專為新零售快消行業打造了一套高效的進銷存管理系統。 系統不僅具備強大的庫存管理功能,還集成了高性能的輕量級 POS 解決方案,確保頁面載入速度極快,提供良好的用戶體驗。 項目介紹 Dorisoy.POS 是一款基於 .NET 7 和 Angular 4 開發的新零售快消進銷存管理 ...
  • ABP CLI常用的代碼分享 一、確保環境配置正確 安裝.NET CLI: ABP CLI是基於.NET Core或.NET 5/6/7等更高版本構建的,因此首先需要在你的開發環境中安裝.NET CLI。這可以通過訪問Microsoft官網下載並安裝相應版本的.NET SDK來實現。 安裝ABP ...
  • 問題 問題是這樣的:第三方的webapi,需要先調用登陸介面獲取Cookie,訪問其它介面時攜帶Cookie信息。 但使用HttpClient類調用登陸介面,返回的Headers中沒有找到Cookie信息。 分析 首先,使用Postman測試該登陸介面,正常返回Cookie信息,說明是HttpCli ...
  • 國內文章 關於.NET在中國為什麼工資低的分析 https://www.cnblogs.com/thinkingmore/p/18406244 .NET在中國開發者的薪資偏低,主要因市場需求、技術棧選擇和企業文化等因素所致。歷史上,.NET曾因微軟的閉源策略發展受限,儘管後來推出了跨平臺的.NET ...
  • 在WPF開發應用中,動畫不僅可以引起用戶的註意與興趣,而且還使軟體更加便於使用。前面幾篇文章講解了畫筆(Brush),形狀(Shape),幾何圖形(Geometry),變換(Transform)等相關內容,今天繼續講解動畫相關內容和知識點,僅供學習分享使用,如有不足之處,還請指正。 ...
  • 什麼是委托? 委托可以說是把一個方法代入另一個方法執行,相當於指向函數的指針;事件就相當於保存委托的數組; 1.實例化委托的方式: 方式1:通過new創建實例: public delegate void ShowDelegate(); 或者 public delegate string ShowDe ...