仿拉手团购App5--登录界面

 

 

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;

  

时间: 2024-08-28 22:49:22

仿拉手团购App5--登录界面的相关文章

仿拉手团购App5--登录界面2

     ShareSDK第三方登录 case R.id.login_bottom_iv_qq: Platform qq = ShareSDK.getPlatform(QQ.NAME); authorize(qq); break; case R.id.login_bottom_iv_wechat: Platform wechat = ShareSDK.getPlatform(Wechat.NAME); authorize(wechat); break; case R.id.login_botto

仿拉手团购App6--注册界面

获得验证码 case R.id.register_btn_getCode: mPhoneNumber = mEtPhoneNumber.getText().toString(); if (LoginHelperUtil.isPhoneNumber(mPhoneNumber)) { BmobManager.getInstance(new BmobMsgSendCallback() { @Override public void onMsgSendSuccess() { ToastUtil.show

仿拉手团购App9-- 产品详情界面

  activity_detail.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://

仿拉手团购App7--个人中心界面

UserProfileActivity 退出登录 case R.id.user_btn_exit_login: User.logOut(); Intent data = new Intent(); getActivity().setResult(UserProfileActivity.PROFILE_RESULT_CODE,data); getActivity().finish(); break;

仿拉手团购App2--当前城市选择Activity

首页中点击城市TextView调转到当前城市选择Activity fragment_city.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background=&quo

项目拉手团购开发记录

项目:拉手团购 项目:拉手团购 11.07 构建框架 下载数据 注意字段名要一致 使用Gson解析JsonArray时,代码如下: Gson gson = new Gson(); Type type = new TypeToken<ArrayList<数据类型>>(){}.getType(); ArrayList<数据类型>list = gson.fromjson(json,type); 其中Type为Java.lang.reflect.type TypeToken为G

swift项目-模仿团购(主界面的搭建,以及首页的一些细节)

以前学习oc的时候写的一个团购的项目,现在学习swift,拿来用swift写一遍,也是连猜带蒙的,一点一点的往上凑. 今天主要是把主要的架子搭起来了. 主要有:UITabBarController,UINavigationController,还有navigationItem(这家伙给我搁着坑着了,那个寻思着做出这个效果呢,结果效果出来了,中间的titleview不居中了) 在导航控制器里核心代码: //初始化所有子视图控制器 func setAllChildVC(){ tabbarAddChi

翻页效果的实现(仿满座团购主页)

整体实现效果: 点击root,也就是红色的任何处,页面会像翻书一样翻转.翻转到first,也就是蓝色的界面.当点击顶部root页面部分的时候,页面会重新翻到root,也就是红色的界面. 开始时候的效果图: 点击root任何处的效果图: 点击first顶部的效果图: 代码: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //点击root,也就是红色的任何处,页面会像翻书一样翻转.翻转到first,也就是蓝色的界面

iOS开发:一个高仿美团的团购ipad客户端的设计和实现(功能:根据拼音进行检索并展示数据,离线缓存团购数据,浏览记录与收藏记录的批量删除等)

大致花了一个月时间,利用各种空闲时间,将这个客户端实现了,在这里主要是想记录下,设计的大体思路以及实现过程中遇到的坑...... 这个项目的github地址:https://github.com/wzpziyi1/GroupPurchase 主要实现的功能,用UICollectionViewController展示团购数据,根据拼音进行检索并展示数据,离线缓存团购数据,浏览记录与收藏记录的批量删除,友盟分享的集成,利用UIView+AutoLayout写布局,实现地图定位.自定义大头针等 整个项