add: new ui for drawer

This commit is contained in:
hyb1996
2017-08-25 13:10:52 +08:00
parent 16d48bd6b5
commit 5d6e66d5d5
27 changed files with 419 additions and 328 deletions

View File

@@ -150,13 +150,12 @@
</android.support.design.widget.CoordinatorLayout>
<include
android:id="@+id/drawer"
layout="@layout/drawer"
android:layout_width="304dp"
<fragment
android:name="com.stardust.scriptdroid.ui.main.drawer.DrawerFragment_"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="false"
/>
android:fitsSystemWindows="false"/>
</android.support.v4.widget.DrawerLayout>

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@drawable/drawer_menu_divider"
android:orientation="vertical"
android:showDividers="middle">
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:title="@string/text_accessibility_service">
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
android:id="@+id/accessibility_service"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_service_green"
app:title="@string/text_accessibility_service"
app:with_switch="true"/>
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
android:id="@+id/stable_mode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_stable"
app:title="@string/text_stable_mode"
app:with_switch="true"/>
</com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup>
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:title="@string/text_script_record">
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
android:id="@+id/floating_window"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_robot_64"
app:title="@string/text_floating_window"
app:with_switch="true"/>
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
android:id="@+id/volume_down_control"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_volume"
app:title="@string/text_volume_down_control"
app:with_switch="true"/>
</com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup>
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:title="@string/text_others">
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
android:id="@+id/debug"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_debug"
app:title="@string/debug"
app:with_switch="true"/>
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
android:id="@+id/theme_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_personalize"
app:title="@string/text_theme_color"/>
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
android:id="@+id/check_for_updates"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_check_for_updates"
app:title="@string/text_check_for_updates"/>
</com.stardust.scriptdroid.ui.main.drawer.DrawerMenuGroup>
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,35 @@
<?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="48dp"
android:background="?selectableItemBackground"
android:orientation="horizontal">
<ImageView
android:id="@+id/icon"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_margin="16dp"
android:tint="#999999"
tools:src="@drawable/ic_service_green"/>
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:textColor="#484C4F"
android:textSize="14sp"
tools:text="@string/text_auto_operate_service"/>
<com.stardust.theme.widget.ThemeColorSwitch
android:id="@+id/sw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="16dp"
android:visibility="gone"/>
</LinearLayout>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="304dp"
android:layout_height="match_parent"
@@ -11,39 +12,45 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginBottom="5dp">
android:layout_height="170dp"
android:layout_marginBottom="5dp"
android:background="#5cab7d">
<ImageView
android:id="@+id/drawer_header_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_above="@+id/username"
android:layout_marginBottom="16dp"
android:layout_marginLeft="8dp"
android:scaleType="fitXY"
android:src="@drawable/side_menu_bg"/>
android:src="@drawable/profile_avatar_placeholder"
app:riv_border_color="#77f2f3f5"
app:riv_border_width="0.5dp"
app:riv_corner_radius="40dp"/>
<TextView
android:id="@+id/version"
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_alignParentLeft="true"
android:layout_marginBottom="16dp"
android:layout_marginLeft="12dp"
android:gravity="center"
android:text="@string/not_login"
android:textColor="@android:color/white"
android:textSize="14sp"/>
<TextView
android:id="@+id/app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/version"
android:layout_marginLeft="8dp"
android:gravity="center"
android:text="@string/_app_name"
android:textColor="@android:color/white"
android:textSize="28sp"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="118dp"
android:layout_marginLeft="-12dp"
android:layout_toRightOf="@+id/avatar"
android:layout_alignParentBottom="true"
android:src="@drawable/android_eating_half"
android:alpha="0.08"
android:tint="#000000"/>
</RelativeLayout>
@@ -54,15 +61,20 @@
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/fragment_slide_menu"
<include
layout="@layout/drawer_menu"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#f2f3f5"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_height="44dp"
android:layout_gravity="bottom"
android:baselineAligned="false">
@@ -75,15 +87,18 @@
android:gravity="center"
android:orientation="horizontal">
<com.stardust.theme.widget.ThemeColorImageViewCompat
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="6dp"
android:src="@drawable/ic_settings"/>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="12dp"
android:src="@drawable/ic_ali_settings"
android:tint="#666666"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:text="@string/text_setting"
android:textSize="15sp"/>
@@ -98,15 +113,18 @@
android:gravity="center"
android:orientation="horizontal">
<com.stardust.theme.widget.ThemeColorImageViewCompat
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="6dp"
android:src="@drawable/ic_exit"/>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="12dp"
android:src="@drawable/ic_ali_exit"
android:tint="#666666"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:text="@string/text_exit"
android:textSize="15sp"/>

View File

@@ -1,181 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/console"
android:layout_width="match_parent"
android:layout_height="52dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.stardust.theme.widget.ThemeColorImageViewCompat
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_margin="16dp"
android:src="@drawable/ic_console_green"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/text_log"
android:textColor="@android:color/primary_text_light"/>
</LinearLayout>
<LinearLayout
android:id="@+id/syntax_and_api"
android:layout_width="match_parent"
android:layout_height="52dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.stardust.theme.widget.ThemeColorImageViewCompat
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_margin="16dp"
android:src="@drawable/ic_speech_bubble"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/text_syntax_and_api"
android:textColor="@android:color/primary_text_light"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/auto_operate_service"
android:layout_width="match_parent"
android:layout_height="52dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical">
<com.stardust.theme.widget.ThemeColorImageViewCompat
android:id="@+id/icon_service"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_margin="16dp"
android:src="@drawable/ic_service_green"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/icon_service"
android:gravity="center"
android:text="@string/text_auto_operate_service"
android:textColor="@android:color/primary_text_light"/>
<com.stardust.theme.widget.ThemeColorSwitch
android:id="@+id/sw_accessibility_service"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginRight="16dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/floating_window"
android:layout_width="match_parent"
android:layout_height="52dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical">
<com.stardust.theme.widget.ThemeColorImageViewCompat
android:id="@+id/icon_assist_service"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_margin="16dp"
android:src="@drawable/ic_robot_64"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/icon_assist_service"
android:gravity="center"
android:text="@string/text_floating_window"
android:textColor="@android:color/primary_text_light"/>
<com.stardust.theme.widget.ThemeColorSwitch
android:id="@+id/sw_floating_window"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginRight="16dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/debug"
android:layout_width="match_parent"
android:layout_height="52dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical">
<com.stardust.theme.widget.ThemeColorImageViewCompat
android:id="@+id/icon_debug"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_margin="16dp"
android:src="@drawable/ic_debug"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/icon_debug"
android:gravity="center"
android:text="@string/debug"
android:textColor="@android:color/primary_text_light"/>
<com.stardust.theme.widget.ThemeColorSwitch
android:id="@+id/sw_debug"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginRight="16dp"/>
</RelativeLayout>
<LinearLayout
android:id="@+id/stop_all_running_scripts"
android:layout_width="match_parent"
android:layout_height="52dp"
android:background="?selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.stardust.theme.widget.ThemeColorImageViewCompat
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_margin="16dp"
android:src="@drawable/ic_close_green_48dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/text_close_all_running_scripts"
android:textColor="@android:color/primary_text_light"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="170dp"
android:layout_marginBottom="5dp"
android:background="@drawable/profile_bg">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_above="@+id/username"
android:layout_marginBottom="16dp"
android:layout_marginLeft="8dp"
android:scaleType="fitXY"
android:src="@drawable/profile_avatar_placeholder"
app:riv_border_color="@android:color/white"
app:riv_border_width="1dp"
app:riv_corner_radius="32dp"/>
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="16dp"
android:layout_marginLeft="8dp"
android:gravity="center"
android:text="@string/not_login"
android:textColor="@android:color/white"
android:textSize="16sp"/>
</RelativeLayout>