From 82fbf5fc5c45bf592d277ee3757e102f867fbab2 Mon Sep 17 00:00:00 2001
From: Runt <qingingrunt2010@qq.com>
Date: Tue, 29 Mar 2022 15:53:33 +0000
Subject: [PATCH] 简单视图搭建

---
 app/src/main/res/values-night/themes.xml   |    8 +-
 app/src/main/res/drawable-v21/bg_white.xml |   27 ++++++
 app/src/main/res/values/themes.xml         |    8 +-
 app/src/main/res/layout/float_view.xml     |   46 +++++++++++
 app/src/main/AndroidManifest.xml           |    3 
 app/src/main/res/layout/activity_main.xml  |   64 ++++++++++++++-
 app/src/main/res/values/colors.xml         |   28 +++++++
 7 files changed, 170 insertions(+), 14 deletions(-)

diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 877aa6e..63276b4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
+    tools:ignore="ProtectedPermissions"
     package="com.auto.lyric">
 
     <uses-permission android:name="android.permission.INTERNET" />
@@ -23,6 +24,8 @@
     <uses-permission android:name="android.permission.READ_LOGS"
         tools:ignore="ProtectedPermissions" />
     <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
+    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+    <uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE" />
     <application
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
diff --git a/app/src/main/res/drawable-v21/bg_white.xml b/app/src/main/res/drawable-v21/bg_white.xml
new file mode 100644
index 0000000..5efddc3
--- /dev/null
+++ b/app/src/main/res/drawable-v21/bg_white.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+    android:color="@color/color_gray">
+    <item>
+        <selector>
+            <item android:state_pressed="true">
+                <shape android:shape="rectangle">
+                    <solid android:color="@color/gray_pressed" />
+                </shape>
+            </item>
+
+            <item android:state_enabled="false">
+                <shape android:shape="rectangle">
+                    <solid android:color="@color/cut_off_line" />
+                </shape>
+            </item>
+
+            <item>
+                <shape android:shape="rectangle">
+                    <solid android:color="@color/white" />
+                </shape>
+            </item>
+
+        </selector>
+    </item>
+
+</ripple>
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 4fc2444..fdf1f7a 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -6,13 +6,65 @@
     android:layout_height="match_parent"
     tools:context=".MainActivity">
 
-    <TextView
+    <EditText
+        android:id="@+id/edit"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:minHeight="200dp"
+        android:maxHeight="500dp"
+        android:hint="输入歌词"
+        android:padding="10dp"
+        android:gravity="left"
+        android:scrollbars="vertical"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent" />
+
+    <androidx.appcompat.widget.AppCompatButton
+        android:id="@+id/button"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="Hello World!"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        android:text="确认"
+        android:layout_margin="10dp"
+        app:layout_constraintBottom_toBottomOf="@id/edit"
+        app:layout_constraintRight_toRightOf="@id/edit"/>
 
+    <TextView
+        android:id="@+id/txt_local"
+        android:layout_width="match_parent"
+        android:layout_height="40dp"
+        android:text="本地歌词"
+        android:gravity="center_vertical"
+        android:paddingLeft="16dp"
+        android:textSize="16sp"
+        android:background="@drawable/bg_white"
+        app:layout_constraintTop_toBottomOf="@id/edit"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"/>
+    <TextView
+        android:id="@+id/txt_favorite"
+        android:layout_width="match_parent"
+        android:layout_height="40dp"
+        android:text="我的收藏"
+        android:gravity="center_vertical"
+        android:paddingLeft="16dp"
+        android:textSize="16sp"
+        android:background="@drawable/bg_white"
+        app:layout_constraintTop_toBottomOf="@id/txt_local"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"/>
+
+
+    <TextView
+        android:id="@+id/txt_setting"
+        android:layout_width="match_parent"
+        android:layout_height="40dp"
+        android:text="设置"
+        android:gravity="center_vertical"
+        android:paddingLeft="16dp"
+        android:textSize="16sp"
+        android:background="@drawable/bg_white"
+        app:layout_constraintTop_toBottomOf="@id/txt_favorite"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"/>
 </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/float_view.xml b/app/src/main/res/layout/float_view.xml
new file mode 100644
index 0000000..39a9218
--- /dev/null
+++ b/app/src/main/res/layout/float_view.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <com.google.android.material.floatingactionbutton.FloatingActionButton
+        android:id="@+id/floating"
+        android:layout_width="40dp"
+        android:layout_height="wrap_content"
+        android:alpha="0.9"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent" />
+
+
+
+    <com.google.android.material.button.MaterialButton
+        android:id="@+id/btn_back"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="后退"
+        android:textColor="@color/black"
+        android:alpha="0.2"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"/>
+
+    <com.google.android.material.button.MaterialButton
+        android:id="@+id/btn_pause"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="暂停"
+        android:textColor="@color/black"
+        android:alpha="0.2"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toRightOf="@id/btn_back"
+        app:layout_constraintRight_toLeftOf="@id/btn_fast"/>
+    <com.google.android.material.button.MaterialButton
+        android:id="@+id/btn_fast"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="快进"
+        android:textColor="@color/black"
+        android:alpha="0.2"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintRight_toRightOf="parent"/>
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
index 95d7d45..40d9949 100644
--- a/app/src/main/res/values-night/themes.xml
+++ b/app/src/main/res/values-night/themes.xml
@@ -2,12 +2,12 @@
     <!-- Base application theme. -->
     <style name="Theme.AutoLyric" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
         <!-- Primary brand color. -->
-        <item name="colorPrimary">@color/purple_200</item>
-        <item name="colorPrimaryVariant">@color/purple_700</item>
+        <item name="colorPrimary">@color/white</item>
+        <item name="colorPrimaryVariant">@color/color_gray</item>
         <item name="colorOnPrimary">@color/black</item>
         <!-- Secondary brand color. -->
-        <item name="colorSecondary">@color/teal_200</item>
-        <item name="colorSecondaryVariant">@color/teal_200</item>
+        <item name="colorSecondary">@color/white</item>
+        <item name="colorSecondaryVariant">@color/color_gray</item>
         <item name="colorOnSecondary">@color/black</item>
         <!-- Status bar color. -->
         <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index f8c6127..78793ab 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -7,4 +7,32 @@
     <color name="teal_700">#FF018786</color>
     <color name="black">#FF000000</color>
     <color name="white">#FFFFFFFF</color>
+
+
+    <color name="orange">#FFA500</color>
+    <color name="gray_pressed">#b5b5b6</color>
+    <color name="gray_normal">#666667</color>
+    <color name="grid_state_pressed">#1Affffff</color>
+    <color name="grid_state_focused">#80000000</color>
+    <color name="voip_interface_text_color">#bababa</color>
+    <color name="black_deep">#FF000000</color>
+    <color name="transparent">#00000000</color>
+    <color name="err">#f90c10</color>
+    <color name="green">#06ae3b</color>
+    <color name="red">#ca0408</color>
+    <color name="theme">#3D71E5</color>
+    <color name="link">@color/theme</color>
+    <color name="deep_blue">#0864ce</color>
+    <color name="txt_enable">#9D9D9D</color>
+    <color name="cut_off_line">#DDDDDD</color>
+    <color name="cut_off_circle">#A4A4A4</color>
+    <color name="txt_normal">#333333</color>
+    <color name="txt_hint">#F9FAFC</color>
+    <color name="input_bg">#F9FAFC</color>
+    <color name="background_color">#f7f7f7</color>
+    <color name="color_gray">#e6ebee</color>
+    <color name="color_gray8">#e6e6e6</color>
+    <color name="ske_blue">#34a7ff</color>
+    <color name="gold">#ffba02</color>
+    <color name="sign_today">#ff6b6a</color>
 </resources>
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 57598d5..c80f365 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -2,12 +2,12 @@
     <!-- Base application theme. -->
     <style name="Theme.AutoLyric" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
         <!-- Primary brand color. -->
-        <item name="colorPrimary">@color/purple_500</item>
-        <item name="colorPrimaryVariant">@color/purple_700</item>
+        <item name="colorPrimary">@color/white</item>
+        <item name="colorPrimaryVariant">@color/color_gray</item>
         <item name="colorOnPrimary">@color/white</item>
         <!-- Secondary brand color. -->
-        <item name="colorSecondary">@color/teal_200</item>
-        <item name="colorSecondaryVariant">@color/teal_700</item>
+        <item name="colorSecondary">@color/white</item>
+        <item name="colorSecondaryVariant">@color/color_gray</item>
         <item name="colorOnSecondary">@color/black</item>
         <!-- Status bar color. -->
         <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>

--
Gitblit v1.9.1