refactor: implements DrawerMenu with RecyclerView
This commit is contained in:
@@ -1,110 +0,0 @@
|
||||
<?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_service">
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
|
||||
android:id="@+id/accessibility_service"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:anti_shake="true"
|
||||
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:pref_key="@string/key_stable_mode"
|
||||
app:title="@string/text_stable_mode"
|
||||
app:with_switch="true"/>
|
||||
|
||||
<com.stardust.scriptdroid.ui.main.drawer.DrawerMenuItem
|
||||
android:id="@+id/notification_service"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:icon="@drawable/ic_ali_notification"
|
||||
app:title="@string/text_notification_permission"
|
||||
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:anti_shake="true"
|
||||
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:pref_key="@string/key_use_volume_control_record"
|
||||
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:anti_shake="true"
|
||||
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>
|
||||
18
app/src/main/res/layout/drawer_menu_group.xml
Normal file
18
app/src/main/res/layout/drawer_menu_group.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#f0f1f5"
|
||||
android:paddingTop="@dimen/divider_drawer_menu_group">
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#ffffff"
|
||||
android:padding="8dp"
|
||||
android:textColor="#999999"
|
||||
android:textSize="12sp">
|
||||
|
||||
</TextView>
|
||||
</FrameLayout>
|
||||
@@ -1,60 +0,0 @@
|
||||
<?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="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.stardust.scriptdroid.ui.edit.EditorView_
|
||||
android:id="@+id/editor_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.stardust.scriptdroid.ui.widget.ToolbarMenuItem
|
||||
android:id="@+id/close"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_close_white_48dp"
|
||||
app:text="@string/text_close"/>
|
||||
|
||||
<com.stardust.scriptdroid.ui.widget.ToolbarMenuItem
|
||||
android:id="@+id/move_or_resize"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_settings_ethernet_white_24dp"
|
||||
app:text="@string/text_adjust"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/resizer"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="@drawable/circle_cool_black"
|
||||
android:padding="6dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ic_resizer"
|
||||
android:tint="@android:color/white"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/move_cursor"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@drawable/circle_cool_black"
|
||||
android:padding="5dp"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ic_move_cursor"
|
||||
android:tint="@android:color/white"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -63,12 +63,13 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include
|
||||
layout="@layout/drawer_menu"
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/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"
|
||||
|
||||
Reference in New Issue
Block a user