Bmob之个人资料设置(二)

比别人多一点执着,你就会创造奇迹。

 

本讲内容:Bmob之个人资料设置

 

下面是manifest.xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.imdemo"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="21" />

    <!-- 在SDCard中创建与删除文件权限 -->
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <!-- 往SDCard写入数据权限 -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <!-- Bmob SDK权限 -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_LOGS" />

    <application
        android:name="com.imdemo.CustomApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.imdemo.activity.SplashActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.imdemo.activity.RegisterActivity" >
        </activity>
        <activity android:name="com.imdemo.MainActivity" >
        </activity>
        <activity android:name="com.imdemo.activity.SetMyInfoActivit" >
        </activity>
        <activity android:name="com.imdemo.activity.UpdateInfoActivity" >
        </activity>
        <activity android:name="com.imdemo.activity.LoginActivity"></activity>
    </application>

</manifest>


样式文件

<style name="ActionBar">
        <item name="android:orientation">horizontal</item>
        <item name="android:background">@drawable/top_bar</item>
        <item name="android:layout_width">fill_parent</item>
        <item name="android:gravity">center_vertical</item>
        <item name="android:layout_height">@dimen/base_action_bar_height</item>
    </style>

    <style name="ActionBarTitle">
        <item name="android:textSize">@dimen/base_action_bar_title_size</item>
        <item name="android:textColor">@color/white</item>
        <item name="android:gravity">left|center</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">fill_parent</item>
        <item name="android:singleLine">true</item>
        <item name="android:drawablePadding">1.0dip</item>
    </style>
    
     <style name="Register_Input">
        <item name="android:orientation">horizontal</item>
        <item name="android:background">@drawable/base_edit_input</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">@dimen/base_action_bar_height</item>
        <item name="android:layout_marginTop">@dimen/register_margin</item>
        <item name="android:layout_marginLeft">@dimen/register_margin</item>
        <item name="android:layout_marginRight">@dimen/register_margin</item>
    </style>
    
     <style name="Register_Edit">
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:layout_weight">1.0</item>
        <item name="android:layout_marginLeft">@dimen/register_margin</item>
        <item name="android:background">@color/transparent</item>
    </style>
    
     <style name="Animations_GrowFromBottom">
        <item name="@android:windowEnterAnimation">@anim/grow_from_bottom</item>
        <item name="@android:windowExitAnimation">@anim/shrink_from_top</item>
    </style>


dimen文件

<resources>

    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
    <dimen name="text_size_small">14sp</dimen>
    <dimen name="text_size_medium">16sp</dimen>
    <dimen name="text_size_large">18sp</dimen>
    <dimen name="base_action_bar_height">48dip</dimen>
    <dimen name="base_action_bar_title_size">22.0sp</dimen>
    <dimen name="register_margin">10.0dp</dimen>
    <dimen name="base_scrollview_top_height">50.0dip</dimen>
    <dimen name="tab_padding_top_bottom">15dp</dimen>
    <dimen name="tab_padding_left_right">40dp</dimen>
    <dimen name="tab_height">48dp</dimen>
    <dimen name="base_line_width_1">1dip</dimen>
    <dimen name="base_line_width_2">2dip</dimen>
    <dimen name="base_line_width">0.5dip</dimen>

    <dimen name="time_line_line_left_margin">24dip</dimen>
    <dimen name="time_line_line_width">2.0dip</dimen>
    <dimen name="time_line_content_left_margin">52.0dip</dimen>
    <dimen name="time_line_content_right_margin">7.0dip</dimen>
    
    <dimen name="score_item_height">100.0dip</dimen>
     <dimen name="message_top_height">70.0dip</dimen>
     
     <dimen name="margin_chat_top">5.0dip</dimen>
</resources>


下面是res/layout/activity_main.xml 布局文件:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/id_mainLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:id="@+id/id_main_bottom"
        android:layout_width="match_parent"
        android:layout_height="52dp"
        android:layout_alignParentBottom="true"
        android:gravity="center_vertical"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/id_message"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:drawableTop="@drawable/tab_message_btn"
            android:background="@drawable/top_bar"
            android:onClick="onTabSelect"
            android:paddingBottom="2dp"
            android:paddingTop="7dp"
            android:text="@string/main_tab_recent"
            android:textColor="@drawable/tab_textcolor"
            android:textSize="12sp" />

        <Button
            android:id="@+id/id_contract"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:drawableTop="@drawable/tab_contact_btn"
            android:background="@drawable/top_bar"
            android:onClick="onTabSelect"
            android:paddingBottom="2dp"
            android:paddingTop="7dp"
            android:text="@string/main_tab_contact"
            android:textColor="@drawable/tab_textcolor"
            android:textSize="12sp" />

        <Button
            android:id="@+id/id_set"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:drawableTop="@drawable/tab_set_btn"
            android:background="@drawable/top_bar"
            android:onClick="onTabSelect"
            android:paddingBottom="2dp"
            android:paddingTop="7dp"
            android:text="@string/main_tab_set"
            android:textColor="@drawable/tab_textcolor"
            android:textSize="12sp" />
    </LinearLayout>
    
    <RelativeLayout 
        android:id="@+id/id_fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@id/id_main_bottom"/>

</RelativeLayout>


下面是res/layout/activity_aplash.xml 布局文件:

<RelativeLayout 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" >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/login_logo" />

</RelativeLayout>

 

下面是res/layout/activity_register.xml 布局文件:

<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" >

    <include
        android:id="@+id/common_actionbar"
        layout="@layout/include_action_bar" />

    <LinearLayout style="@style/Register_Input" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center_vertical"
            android:paddingLeft="10dp"
            android:text="@string/login_account"
            android:textColor="@color/black"
            android:textSize="20sp"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/id_username"
            style="@style/Register_Edit"
            android:hint="@string/login_username_hint" />
    </LinearLayout>

    <LinearLayout style="@style/Register_Input" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center_vertical"
            android:paddingLeft="10dp"
            android:text="@string/login_pwd"
            android:textSize="20sp"
            android:textStyle="bold" >
        </TextView>

        <EditText
            android:id="@+id/id_password"
            style="@style/Register_Edit"
            android:hint="@string/login_password_hint"
            android:inputType="textPassword" />
    </LinearLayout>

    <LinearLayout style="@style/Register_Input" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center_vertical"
            android:paddingLeft="10dp"
            android:text="@string/login_email"
            android:textColor="@color/black"
            android:textSize="20sp"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/id_email"
            style="@style/Register_Edit"
            android:hint="@string/login_email_hint"
            android:inputType="textPassword" />
    </LinearLayout>

    <Button
        android:id="@+id/id_register"
        android:layout_width="match_parent"
        android:layout_height="@dimen/base_action_bar_height"
        android:layout_margin="@dimen/activity_vertical_margin"
        android:background="@drawable/btn_login_selector"
        android:text="@string/register"
        android:textColor="@color/white"
        android:textSize="@dimen/text_size_large" />

</LinearLayout>


下面是res/layout/activity_login.xml 布局文件:

<RelativeLayout 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:background="#F3F4F4" >

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

        <ImageView
            android:id="@+id/id_icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="30dp"
            android:src="@drawable/login_logo" />

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

            <EditText
                android:id="@+id/id_username"
                android:layout_width="match_parent"
                android:layout_height="@dimen/base_action_bar_height"
                android:background="@color/transparent"
                android:drawableLeft="@drawable/login_icon_account"
                android:drawablePadding="25dp"
                android:hint="@string/login_username_hint"
                android:paddingLeft="15dp"
                android:shadowDx="0.0"
                android:shadowDy="1.0"
                android:shadowRadius="1.0"
                android:textColorHint="#ffdddddd" />

            <View
                android:layout_width="match_parent"
                android:layout_height="0.5dp"
                android:background="@drawable/base_horization_line" />

            <EditText
                android:id="@+id/id_password"
                android:layout_width="match_parent"
                android:layout_height="@dimen/base_action_bar_height"
                android:background="@color/transparent"
                android:drawableLeft="@drawable/login_icon_password"
                android:drawablePadding="25dp"
                android:hint="@string/login_password_hint"
                android:inputType="textPassword"
                android:paddingLeft="15dp"
                android:textColorHint="#ffdddddd" />
        </LinearLayout>

        <Button
            android:id="@+id/id_login"
            android:layout_width="match_parent"
            android:layout_height="@dimen/base_action_bar_height"
            android:layout_margin="@dimen/activity_vertical_margin"
            android:background="@drawable/btn_login_selector"
            android:gravity="center"
            android:text="@string/login"
            android:textColor="@color/white"
            android:textSize="@dimen/text_size_large" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="20dp"
        android:gravity="center"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center_vertical"
            android:text="@string/register_txt1"
            android:textColor="@color/gray"
            android:textSize="20sp" />

        <TextView
            android:id="@+id/id_register"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="5dp"
            android:gravity="center_vertical"
            android:text="@string/register_txt2"
            android:textColor="@color/azure"
            android:textSize="20sp" />
    </LinearLayout>

</RelativeLayout>


下面是res/layout/common_header.xml 布局文件:

<?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" >

    <include
        android:id="@+id/common_actionbar"
        layout="@layout/include_action_bar" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/input_bg"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:gravity="center_vertical"
            android:text="@string/add_nick"
            android:textColor="@color/black"
            android:textSize="20sp" />

        <EditText
            android:id="@+id/id_nick"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@color/transparent"
            android:gravity="center_vertical"
            android:hint="@string/add_name_hint" />
    </LinearLayout>

</LinearLayout>


下面是res/layout/common_header.xml 布局文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layout_all"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <include
        android:id="@+id/common_actionbar"
        layout="@layout/include_action_bar" />

    <RelativeLayout
        android:id="@+id/id_layout_head"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/btn_selector"
        android:minHeight="80dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:text="@string/add_avator"
            android:textColor="@color/black"
            android:textSize="20sp" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:gravity="center_vertical"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/id_set_avator"
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:padding="5dp"
                android:src="@drawable/head" />

            <ImageView
                android:id="@+id/id_arraw"
                android:layout_width="20dp"
                android:layout_height="wrap_content"
                android:contentDescription="@string/action_settings"
                android:src="@drawable/register_bottom_arrow" />
        </LinearLayout>
    </RelativeLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="@dimen/base_line_width_1"
        android:background="@drawable/base_horization_line" />

    <RelativeLayout
        android:id="@+id/id_layout_nick"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/btn_selector"
        android:padding="10dp" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:text="@string/add_nick"
            android:textColor="@color/black"
            android:textSize="20sp" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/id_set_nick"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="20sp" />

            <ImageView
                android:id="@+id/id_nickarraw"
                android:layout_width="20dp"
                android:layout_height="wrap_content"
                android:contentDescription="@string/action_settings"
                android:src="@drawable/register_bottom_arrow" />
        </LinearLayout>
    </RelativeLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="@dimen/base_line_width_1"
        android:background="@drawable/base_horization_line" />

    <RelativeLayout
        android:id="@+id/id_layout_account"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/btn_selector"
        android:padding="10dp" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:text="@string/add_name"
            android:textColor="@color/black"
            android:textSize="20sp" />

        <TextView
            android:id="@+id/id_set_account"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:textSize="20sp"
            android:layout_marginRight="20dp" />
    </RelativeLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="@dimen/base_line_width_1"
        android:background="@drawable/base_horization_line" />

    <RelativeLayout
        android:id="@+id/id_layout_gender"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/btn_selector"
        android:padding="10dp" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:text="@string/add_gender"
            android:textColor="@color/black"
            android:textSize="20sp" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:gravity="center_vertical"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/id_set_gender"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="20dp"
                android:drawablePadding="10dp"
                android:textSize="20sp"
                android:textColor="@color/black" />
        </LinearLayout>
    </RelativeLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="@dimen/base_line_width_1"
        android:background="@drawable/base_horization_line" />

</LinearLayout>


下面是res/layout/common_header.xml 布局文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#88000000" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@drawable/pop_bg"
        android:orientation="vertical" >

        <RelativeLayout
            android:id="@+id/layout_photo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@drawable/btn_selector"
            android:clickable="true" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:layout_margin="10dp"
                android:drawablePadding="20dp"
                android:gravity="center"
                android:textColor="@color/black"
                android:textSize="18sp"
                android:text="@string/pop_photo" />
        </RelativeLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@drawable/base_horization_line" >
        </View>

        <RelativeLayout
            android:id="@+id/layout_choose"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@drawable/btn_selector"
            android:clickable="true" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:layout_margin="10dp"
                android:drawablePadding="20dp"
                android:gravity="center"
                android:textColor="@color/black"
                android:textSize="18sp"
                android:text="@string/pop_choose" />
        </RelativeLayout>
    </LinearLayout>

</RelativeLayout>


 

下面是res/anim/grow_form_bottom.xml 文件:

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

    <scale
        android:duration="@android:integer/config_shortAnimTime"
        android:fromXScale="0.3"
        android:fromYScale="0.3"
        android:pivotX="50%"
        android:pivotY="100%"
        android:toXScale="1.0"
        android:toYScale="1.0" />

    <alpha
        android:duration="@android:integer/config_shortAnimTime"
        android:fromAlpha="0.0"
        android:interpolator="@android:anim/decelerate_interpolator"
        android:toAlpha="1.0" />

</set>


 

下面是res/anim/shrink_from_top.xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
	<scale
		android:fromXScale="1.0" android:toXScale="0.3"
		android:fromYScale="1.0" android:toYScale="0.3"
		android:pivotX="50%" android:pivotY="100%"
		android:duration="@android:integer/config_shortAnimTime"/>
	<alpha
		android:interpolator="@android:anim/accelerate_interpolator"
		android:fromAlpha="1.0" android:toAlpha="0.0"
		android:duration="@android:integer/config_shortAnimTime"/>
</set>

 

 

 下面是res/drawable/btn_selector.xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@color/color_theme" android:state_pressed="true"/>
    <item android:drawable="@color/color_theme" android:state_selected="true"/>
    <item android:drawable="@android:color/transparent"/>

</selector>


下面是res/layout/include_action_bar.xml 布局文件:

<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/btn_login_n"  android:state_pressed="false"/>
    <item android:drawable="@drawable/btn_login_p" android:state_pressed="true"/>

</selector>


下面是res/layout/include_action_bar.xml 布局文件:

<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item  android:state_selected="true" android:color="@color/color_bottom_text_press"/>
    <item android:state_selected="false" android:color="@color/color_bottom_text_normal"/>

</selector>


 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值