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

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size
android:width="100dp"
android:height="6dp"/>
<solid android:color="#f0f1f5"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

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>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:icon="@drawable/ic_settings"
android:title="@string/text_setting"/>
<item
android:icon="@drawable/ic_debug"
android:actionLayout="@layout/about_activity"
android:title="@string/debug"/>
<item
android:icon="@drawable/ic_service_green"
android:title="@string/text_accessibility_service"/>
</menu>

View File

@@ -150,7 +150,7 @@
<string name="text_root_script_record"></string>
<string name="text_processing">Processing</string>
<string name="text_pre_execute_script">Pre-execute script</string>
<string name="text_check_update">Check for updates</string>
<string name="text_check_for_updates">Check for updates</string>
<string name="text_new_directory">New Directory</string>
<string name="text_already_reset">已重置</string>
<string name="text_layout_inspector_is_dumping">布局分析中,请稍后点击</string>

View File

@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="title" format="string|reference"/>
<attr name="icon" format="reference"/>
<declare-styleable name="ToolbarMenuItem">
<attr name="text" format="string|reference"/>
<attr name="icon" format="reference"/>
<attr name="icon"/>
<attr name="icon_color" format="color|reference"/>
</declare-styleable>
@@ -12,6 +15,15 @@
<attr name="defaultValue" format="boolean"/>
</declare-styleable>
<declare-styleable name="DrawerMenuItem">
<attr name="title"/>
<attr name="icon"/>
<attr name="with_switch" format="boolean"/>
</declare-styleable>
<declare-styleable name="DrawerMenuGroup">
<attr name="title"/>
</declare-styleable>
<declare-styleable name="MaterialEditText">

View File

@@ -152,7 +152,7 @@
<string name="text_checking_update">正在检查更新</string>
<string name="text_new_version">新版本</string>
<string name="text_check_update_error">检查更新失败Orz</string>
<string name="text_check_update">检查更新</string>
<string name="text_check_for_updates">检查更新</string>
<string name="text_is_latest_version">已经是最新版本</string>
<string name="text_version_too_old">版本过低</string>
<string name="warning_version_too_old">当然版本为公测版,显现和潜在的问题很多,不再适合继续使用,</string>
@@ -233,6 +233,9 @@
<string name="text_script">脚本</string>
<string name="text_community">社区</string>
<string name="text_manage">管理</string>
<string name="not_login">未登录</string>
<string name="text_volume_down_control">音量下键控制</string>
<string name="text_others">其他</string>
<string-array name="record_control_keys">

View File

@@ -85,7 +85,7 @@
<com.stardust.theme.preference.ThemeColorPreferenceCategory android:title="@string/text_about">
<Preference android:title="@string/text_check_update"/>
<Preference android:title="@string/text_check_for_updates"/>
<Preference android:title="@string/text_join_qq_group"/>