Skip to content

Commit 755f452

Browse files
committed
migrate remaining MikuBox UI layouts
1 parent a0866cd commit 755f452

9 files changed

Lines changed: 545 additions & 383 deletions

File tree

app/src/main/java/top/uwu/mikubox/ui/AppListActivity.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ class AppListActivity : AppCompatActivity() {
4040
AppMode.ALLOW_LIST -> binding.modeGroup.check(binding.modeAllow.id)
4141
AppMode.DISALLOW_LIST -> binding.modeGroup.check(binding.modeDisallow.id)
4242
}
43-
binding.modeGroup.addOnButtonCheckedListener { _, checkedId, isChecked ->
44-
if (!isChecked) return@addOnButtonCheckedListener
45-
val mode = when (checkedId) {
43+
binding.modeGroup.setOnCheckedStateChangeListener { _, checkedIds ->
44+
val mode = when (checkedIds.firstOrNull()) {
4645
binding.modeAllow.id -> AppMode.ALLOW_LIST
4746
binding.modeDisallow.id -> AppMode.DISALLOW_LIST
4847
else -> AppMode.ALL

app/src/main/java/top/uwu/mikubox/ui/ToolsActivity.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ class ToolsActivity : AppCompatActivity() {
2828
setContentView(binding.root)
2929

3030
binding.toolbar.setNavigationOnClickListener { finish() }
31+
binding.toolsTab.addTab(
32+
binding.toolsTab.newTab().setText(getString(R.string.tools_connection_test))
33+
)
3134
binding.btnTest.setOnClickListener { runTest() }
3235
binding.tvNetworkInfo.text = networkInfo()
3336
}

app/src/main/res/layout/activity_about.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
android:orientation="vertical"
7777
android:paddingTop="16dp">
7878

79-
<!-- App info -->
8079
<com.google.android.material.card.MaterialCardView
8180
android:layout_width="match_parent"
8281
android:layout_height="wrap_content"
@@ -133,7 +132,6 @@
133132
</LinearLayout>
134133
</com.google.android.material.card.MaterialCardView>
135134

136-
<!-- Who is Miku -->
137135
<com.google.android.material.card.MaterialCardView
138136
android:layout_width="match_parent"
139137
android:layout_height="wrap_content"
@@ -188,7 +186,6 @@
188186
</LinearLayout>
189187
</com.google.android.material.card.MaterialCardView>
190188

191-
<!-- Miku facts (populated in code) -->
192189
<HorizontalScrollView
193190
android:layout_width="match_parent"
194191
android:layout_height="wrap_content"
@@ -204,7 +201,6 @@
204201
android:orientation="horizontal" />
205202
</HorizontalScrollView>
206203

207-
<!-- License -->
208204
<com.google.android.material.card.MaterialCardView
209205
android:layout_width="match_parent"
210206
android:layout_height="wrap_content"

app/src/main/res/layout/activity_app_list.xml

Lines changed: 60 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
xmlns:app="http://schemas.android.com/apk/res-auto"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6-
android:background="?attr/colorPrimary"
76
android:fitsSystemWindows="true">
87

98
<com.google.android.material.appbar.AppBarLayout
9+
android:id="@+id/appbar"
1010
android:layout_width="match_parent"
1111
android:layout_height="200dp"
1212
android:background="?attr/colorPrimary"
@@ -16,22 +16,15 @@
1616
<com.google.android.material.appbar.CollapsingToolbarLayout
1717
android:layout_width="match_parent"
1818
android:layout_height="match_parent"
19+
app:collapsedTitleTextColor="?attr/colorOnPrimary"
1920
app:contentScrim="?attr/colorPrimary"
21+
app:expandedTitleMarginEnd="24dp"
2022
app:expandedTitleMarginStart="24dp"
2123
app:expandedTitleTextColor="?attr/colorOnPrimary"
2224
app:layout_scrollFlags="scroll|exitUntilCollapsed"
2325
app:title="@string/settings_per_app"
2426
app:titleCollapseMode="scale">
2527

26-
<ImageView
27-
android:layout_width="wrap_content"
28-
android:layout_height="match_parent"
29-
android:layout_gravity="end"
30-
android:alpha="0.65"
31-
android:contentDescription="@null"
32-
android:src="@drawable/uwu_banner_image_2"
33-
app:layout_collapseMode="parallax" />
34-
3528
<com.google.android.material.appbar.MaterialToolbar
3629
android:id="@+id/toolbar"
3730
android:layout_width="match_parent"
@@ -49,73 +42,76 @@
4942
android:background="@drawable/uwu_background_collapse"
5043
app:layout_behavior="@string/appbar_scrolling_view_behavior">
5144

52-
<LinearLayout
45+
<com.google.android.material.card.MaterialCardView
5346
android:layout_width="match_parent"
5447
android:layout_height="match_parent"
55-
android:orientation="vertical"
56-
android:paddingTop="16dp">
48+
android:layout_margin="16dp"
49+
android:paddingTop="16dp"
50+
app:cardBackgroundColor="@android:color/transparent"
51+
app:cardCornerRadius="14dp"
52+
app:cardElevation="0dp">
5753

58-
<com.google.android.material.card.MaterialCardView
54+
<LinearLayout
5955
android:layout_width="match_parent"
60-
android:layout_height="wrap_content"
61-
android:layout_marginHorizontal="16dp"
62-
app:cardBackgroundColor="?attr/colorCard"
63-
app:cardCornerRadius="14dp"
64-
app:cardElevation="0dp">
56+
android:layout_height="match_parent"
57+
android:orientation="vertical">
6558

66-
<com.google.android.material.button.MaterialButtonToggleGroup
67-
android:id="@+id/mode_group"
59+
<com.google.android.material.card.MaterialCardView
6860
android:layout_width="match_parent"
6961
android:layout_height="wrap_content"
70-
android:padding="8dp"
71-
app:selectionRequired="true"
72-
app:singleSelection="true">
62+
android:layout_marginBottom="4dp"
63+
app:cardBackgroundColor="?attr/colorCard"
64+
app:cardCornerRadius="14dp"
65+
app:cardElevation="0dp">
7366

74-
<com.google.android.material.button.MaterialButton
75-
android:id="@+id/mode_all"
76-
style="?attr/materialButtonOutlinedStyle"
77-
android:layout_width="0dp"
78-
android:layout_height="48dp"
79-
android:layout_weight="1"
80-
android:text="@string/per_app_mode_all" />
67+
<com.google.android.material.chip.ChipGroup
68+
android:id="@+id/mode_group"
69+
android:layout_width="match_parent"
70+
android:layout_height="wrap_content"
71+
android:padding="8dp"
72+
app:selectionRequired="true"
73+
app:singleLine="true"
74+
app:singleSelection="true">
8175

82-
<com.google.android.material.button.MaterialButton
83-
android:id="@+id/mode_allow"
84-
style="?attr/materialButtonOutlinedStyle"
85-
android:layout_width="0dp"
86-
android:layout_height="48dp"
87-
android:layout_weight="1"
88-
android:text="@string/per_app_mode_allow" />
76+
<com.google.android.material.chip.Chip
77+
android:id="@+id/mode_all"
78+
android:layout_width="wrap_content"
79+
android:layout_height="wrap_content"
80+
android:text="@string/per_app_mode_all" />
8981

90-
<com.google.android.material.button.MaterialButton
91-
android:id="@+id/mode_disallow"
92-
style="?attr/materialButtonOutlinedStyle"
93-
android:layout_width="0dp"
94-
android:layout_height="48dp"
95-
android:layout_weight="1"
96-
android:text="@string/per_app_mode_disallow" />
97-
</com.google.android.material.button.MaterialButtonToggleGroup>
98-
</com.google.android.material.card.MaterialCardView>
82+
<com.google.android.material.chip.Chip
83+
android:id="@+id/mode_allow"
84+
android:layout_width="wrap_content"
85+
android:layout_height="wrap_content"
86+
android:text="@string/per_app_mode_allow" />
9987

100-
<FrameLayout
101-
android:layout_width="match_parent"
102-
android:layout_height="0dp"
103-
android:layout_weight="1"
104-
android:layout_marginTop="8dp">
88+
<com.google.android.material.chip.Chip
89+
android:id="@+id/mode_disallow"
90+
android:layout_width="wrap_content"
91+
android:layout_height="wrap_content"
92+
android:text="@string/per_app_mode_disallow" />
93+
</com.google.android.material.chip.ChipGroup>
94+
</com.google.android.material.card.MaterialCardView>
10595

106-
<androidx.recyclerview.widget.RecyclerView
107-
android:id="@+id/rv_apps"
96+
<FrameLayout
10897
android:layout_width="match_parent"
109-
android:layout_height="match_parent"
110-
android:clipToPadding="false"
111-
android:paddingBottom="16dp" />
98+
android:layout_height="0dp"
99+
android:layout_weight="1">
112100

113-
<ProgressBar
114-
android:id="@+id/progress"
115-
android:layout_width="wrap_content"
116-
android:layout_height="wrap_content"
117-
android:layout_gravity="center" />
118-
</FrameLayout>
119-
</LinearLayout>
101+
<androidx.recyclerview.widget.RecyclerView
102+
android:id="@+id/rv_apps"
103+
android:layout_width="match_parent"
104+
android:layout_height="match_parent"
105+
android:clipToPadding="false"
106+
android:paddingBottom="64dp" />
107+
108+
<ProgressBar
109+
android:id="@+id/progress"
110+
android:layout_width="wrap_content"
111+
android:layout_height="wrap_content"
112+
android:layout_gravity="center" />
113+
</FrameLayout>
114+
</LinearLayout>
115+
</com.google.android.material.card.MaterialCardView>
120116
</FrameLayout>
121117
</androidx.coordinatorlayout.widget.CoordinatorLayout>

app/src/main/res/layout/activity_logcat.xml

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,81 +7,84 @@
77
android:fitsSystemWindows="true">
88

99
<com.google.android.material.appbar.AppBarLayout
10+
android:id="@+id/appbar"
1011
android:layout_width="match_parent"
1112
android:layout_height="200dp"
12-
android:fitsSystemWindows="true"
1313
android:background="?attr/colorPrimary"
14+
android:fitsSystemWindows="true"
1415
app:elevation="0dp">
1516

1617
<com.google.android.material.appbar.CollapsingToolbarLayout
1718
android:layout_width="match_parent"
1819
android:layout_height="match_parent"
20+
app:collapsedTitleTextColor="?attr/colorOnPrimary"
1921
app:contentScrim="?attr/colorPrimary"
20-
app:layout_scrollFlags="scroll|exitUntilCollapsed">
22+
app:expandedTitleMarginEnd="24dp"
23+
app:expandedTitleMarginStart="24dp"
24+
app:expandedTitleTextColor="?attr/colorOnPrimary"
25+
app:layout_scrollFlags="scroll|exitUntilCollapsed"
26+
app:title="@string/menu_log"
27+
app:titleCollapseMode="scale">
2128

2229
<ImageView
23-
android:layout_width="match_parent"
30+
android:layout_width="wrap_content"
2431
android:layout_height="match_parent"
25-
android:alpha="0.42"
32+
android:layout_gravity="end"
33+
android:alpha="0.7"
2634
android:contentDescription="@null"
27-
android:scaleType="centerCrop"
2835
android:src="@drawable/uwu_banner_image_2"
2936
app:layout_collapseMode="parallax" />
3037

31-
<View
32-
android:layout_width="match_parent"
33-
android:layout_height="match_parent"
34-
android:background="#40000000" />
35-
3638
<com.google.android.material.appbar.MaterialToolbar
3739
android:id="@+id/toolbar"
3840
android:layout_width="match_parent"
3941
android:layout_height="?attr/actionBarSize"
4042
app:layout_collapseMode="pin"
4143
app:navigationIcon="@drawable/ic_arrow_back"
4244
app:navigationIconTint="?attr/colorOnPrimary"
43-
app:title="@string/menu_log"
4445
app:titleTextColor="?attr/colorOnPrimary" />
45-
46-
<TextView
47-
android:layout_width="wrap_content"
48-
android:layout_height="wrap_content"
49-
android:layout_gravity="bottom|start"
50-
android:layout_marginStart="28dp"
51-
android:layout_marginBottom="28dp"
52-
android:text="LOGCAT"
53-
android:textColor="?attr/colorOnPrimary"
54-
android:textSize="31sp"
55-
android:textStyle="bold" />
5646
</com.google.android.material.appbar.CollapsingToolbarLayout>
5747
</com.google.android.material.appbar.AppBarLayout>
5848

59-
<androidx.core.widget.NestedScrollView
60-
android:id="@+id/logcat_scroll"
49+
<FrameLayout
6150
android:layout_width="match_parent"
6251
android:layout_height="match_parent"
63-
android:layout_marginTop="-24dp"
6452
android:background="@drawable/uwu_background_collapse"
65-
android:clipToPadding="false"
66-
android:padding="18dp"
6753
app:layout_behavior="@string/appbar_scrolling_view_behavior">
6854

69-
<HorizontalScrollView
55+
<com.google.android.material.card.MaterialCardView
7056
android:layout_width="match_parent"
71-
android:layout_height="wrap_content"
72-
android:scrollbars="none">
57+
android:layout_height="match_parent"
58+
android:layout_margin="16dp"
59+
android:padding="8dp"
60+
app:cardBackgroundColor="@android:color/transparent"
61+
app:cardCornerRadius="28dp"
62+
app:cardElevation="0dp">
7363

74-
<TextView
75-
android:id="@+id/logcat_text"
76-
android:layout_width="wrap_content"
77-
android:layout_height="wrap_content"
78-
android:fontFamily="monospace"
79-
android:paddingBottom="92dp"
80-
android:textColor="?attr/colorOnSurfaceVariant"
81-
android:textIsSelectable="true"
82-
android:textSize="11sp" />
83-
</HorizontalScrollView>
84-
</androidx.core.widget.NestedScrollView>
64+
<androidx.core.widget.NestedScrollView
65+
android:id="@+id/logcat_scroll"
66+
android:layout_width="match_parent"
67+
android:layout_height="match_parent">
68+
69+
<HorizontalScrollView
70+
android:layout_width="match_parent"
71+
android:layout_height="wrap_content"
72+
android:scrollbars="none">
73+
74+
<TextView
75+
android:id="@+id/logcat_text"
76+
android:layout_width="wrap_content"
77+
android:layout_height="wrap_content"
78+
android:fontFamily="monospace"
79+
android:padding="12dp"
80+
android:paddingBottom="96dp"
81+
android:textColor="?attr/colorOnSurfaceVariant"
82+
android:textIsSelectable="true"
83+
android:textSize="11sp" />
84+
</HorizontalScrollView>
85+
</androidx.core.widget.NestedScrollView>
86+
</com.google.android.material.card.MaterialCardView>
87+
</FrameLayout>
8588

8689
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
8790
android:id="@+id/fab_clear"
@@ -90,11 +93,10 @@
9093
android:layout_gravity="bottom|end"
9194
android:layout_margin="20dp"
9295
android:text="@string/action_clear"
96+
android:textColor="?attr/colorOnSurface"
9397
app:backgroundTint="?attr/colorCard"
9498
app:icon="@drawable/ic_action_delete"
9599
app:iconTint="?attr/colorOnSurface"
96100
app:strokeColor="?attr/colorOutline"
97-
app:strokeWidth="1dp"
98-
android:textColor="?attr/colorOnSurface" />
99-
101+
app:strokeWidth="1dp" />
100102
</androidx.coordinatorlayout.widget.CoordinatorLayout>

0 commit comments

Comments
 (0)