Skip to content

Commit 20d9e11

Browse files
committed
Improve about app bottom sheet
1 parent fbc5d00 commit 20d9e11

File tree

8 files changed

+56
-47
lines changed

8 files changed

+56
-47
lines changed

app/src/main/java/com/wstxda/toolkit/component/AboutApplicationBottomSheetDialog.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import android.os.Bundle
55
import android.view.LayoutInflater
66
import android.view.View
77
import android.view.ViewGroup
8+
import android.view.animation.LinearInterpolator
89
import androidx.fragment.app.viewModels
910
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
1011
import com.wstxda.toolkit.R
@@ -19,7 +20,6 @@ class AboutApplicationBottomSheetDialog : BottomSheetDialogFragment() {
1920
private var _binding: BottomSheetAboutBinding? = null
2021
private lateinit var haptics: Haptics
2122
private val binding get() = _binding!!
22-
2323
private val viewModel: AboutApplicationViewModel by viewModels()
2424

2525
override fun onCreateView(
@@ -37,14 +37,18 @@ class AboutApplicationBottomSheetDialog : BottomSheetDialogFragment() {
3737
val adapter = AboutApplicationAdapter(viewModel::openUrl)
3838
binding.recyclerLinks.adapter = adapter
3939

40+
binding.appIconShape.animate().rotationBy(360f).setDuration(20_000)
41+
.setInterpolator(LinearInterpolator())
42+
.withEndAction { binding.appIconShape.animate().rotationBy(360f).start() }.start()
43+
4044
viewModel.applicationVersion.observe(viewLifecycleOwner) { version ->
4145
binding.appUpdate.text = getString(R.string.about_version, version)
4246

4347
binding.appUpdate.setOnClickListener {
4448
UpdaterService.checkForUpdates(requireContext(), it)
4549
}
4650

47-
binding.appIcon.setOnClickListener {
51+
binding.appIconContainer.setOnClickListener {
4852
haptics.tick()
4953
viewModel.openAppInfo()
5054
}
@@ -57,6 +61,7 @@ class AboutApplicationBottomSheetDialog : BottomSheetDialogFragment() {
5761

5862
override fun onDestroyView() {
5963
super.onDestroyView()
64+
binding.appIconShape.animate().cancel()
6065
_binding = null
6166
}
6267

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="100dp"
3+
android:height="100dp"
4+
android:viewportWidth="100"
5+
android:viewportHeight="100">
6+
<path
7+
android:fillColor="?attr/colorOnPrimaryContainer"
8+
android:pathData="M31.97 67c-1.38 0-2.55-0.48-3.52-1.44-0.97-0.96-1.45-2.13-1.45-3.5v-9.44h12.59v0.84c0 0.45 0.14 0.83 0.44 1.13 0.3 0.3 0.68 0.44 1.14 0.44 0.46 0 0.84-0.15 1.14-0.44 0.3-0.3 0.45-0.68 0.45-1.13v-0.84h13.43v0.84c0 0.45 0.15 0.83 0.45 1.13 0.3 0.3 0.68 0.44 1.14 0.44 0.45 0 0.83-0.15 1.13-0.44 0.3-0.3 0.45-0.68 0.45-1.13v-0.84H72v9.45c0 1.36-0.49 2.53-1.47 3.49-0.98 0.96-2.16 1.44-3.55 1.44h-35Zm-4.5-17.53l5.14-12.44c0.4-0.74 0.98-1.36 1.72-1.84 0.74-0.49 1.56-0.73 2.45-0.73h3.39v-2.68c0-1.05 0.36-1.94 1.1-2.68 0.72-0.73 1.61-1.1 2.65-1.1h11.05c1.04 0 1.93 0.37 2.66 1.1 0.73 0.74 1.1 1.63 1.1 2.68v2.68h3.38c0.9 0 1.72 0.24 2.45 0.73 0.74 0.48 1.32 1.1 1.73 1.84l5.18 12.44h-12.1v-0.84c0-0.46-0.16-0.83-0.46-1.13-0.3-0.3-0.68-0.45-1.13-0.45-0.46 0-0.84 0.15-1.14 0.45-0.3 0.3-0.45 0.67-0.45 1.13v0.84H42.76v-0.84c0-0.46-0.15-0.83-0.45-1.13-0.3-0.3-0.68-0.45-1.14-0.45-0.46 0-0.84 0.15-1.14 0.45-0.3 0.3-0.44 0.67-0.44 1.13v0.84H27.48Zm16.45-15.01h11.05v-2.68H43.92v2.68Z" />
9+
</vector>
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
android:width="100dp"
3-
android:height="100dp"
4-
android:viewportWidth="100"
5-
android:viewportHeight="100">
6-
<group>
7-
<path
8-
android:fillColor="?attr/colorPrimaryContainer"
9-
android:pathData="M42.05 6.44c3.5-5.87 12.14-5.87 15.62 0 2.31 3.88 7.25 5.48 11.4 3.7 6.27-2.7 13.26 2.38 12.64 9.18-0.41 4.5 2.64 8.7 7.04 9.7 6.66 1.5 9.33 9.72 4.83 14.85-2.98 3.4-2.98 8.6 0 11.99 4.5 5.13 1.83 13.35-4.83 14.85-4.4 1-7.45 5.2-7.04 9.7 0.62 6.8-6.37 11.87-12.64 9.18-4.15-1.78-9.09-0.18-11.4 3.7-3.48 5.87-12.13 5.87-15.62 0-2.3-3.88-7.24-5.48-11.4-3.7-6.26 2.7-13.26-2.39-12.63-9.18 0.41-4.5-2.64-8.7-7.04-9.7-6.66-1.5-9.33-9.72-4.83-14.85 2.98-3.4 2.98-8.6 0-11.99-4.5-5.13-1.83-13.35 4.82-14.85 4.41-1 7.46-5.2 7.05-9.7-0.63-6.8 6.37-11.88 12.64-9.18 4.15 1.78 9.09 0.18 11.4-3.7Z" />
10-
<path
11-
android:fillColor="?attr/colorOnPrimaryContainer"
12-
android:pathData="M31.97 67c-1.38 0-2.55-0.48-3.52-1.44-0.97-0.96-1.45-2.13-1.45-3.5v-9.44h12.59v0.84c0 0.45 0.14 0.83 0.44 1.13 0.3 0.3 0.68 0.44 1.14 0.44 0.46 0 0.84-0.15 1.14-0.44 0.3-0.3 0.45-0.68 0.45-1.13v-0.84h13.43v0.84c0 0.45 0.15 0.83 0.45 1.13 0.3 0.3 0.68 0.44 1.14 0.44 0.45 0 0.83-0.15 1.13-0.44 0.3-0.3 0.45-0.68 0.45-1.13v-0.84H72v9.45c0 1.36-0.49 2.53-1.47 3.49-0.98 0.96-2.16 1.44-3.55 1.44h-35Zm-4.5-17.53l5.14-12.44c0.4-0.74 0.98-1.36 1.72-1.84 0.74-0.49 1.56-0.73 2.45-0.73h3.39v-2.68c0-1.05 0.36-1.94 1.1-2.68 0.72-0.73 1.61-1.1 2.65-1.1h11.05c1.04 0 1.93 0.37 2.66 1.1 0.73 0.74 1.1 1.63 1.1 2.68v2.68h3.38c0.9 0 1.72 0.24 2.45 0.73 0.74 0.48 1.32 1.1 1.73 1.84l5.18 12.44h-12.1v-0.84c0-0.46-0.16-0.83-0.46-1.13-0.3-0.3-0.68-0.45-1.13-0.45-0.46 0-0.84 0.15-1.14 0.45-0.3 0.3-0.45 0.67-0.45 1.13v0.84H42.76v-0.84c0-0.46-0.15-0.83-0.45-1.13-0.3-0.3-0.68-0.45-1.14-0.45-0.46 0-0.84 0.15-1.14 0.45-0.3 0.3-0.44 0.67-0.44 1.13v0.84H27.48Zm16.45-15.01h11.05v-2.68H43.92v2.68Z" />
13-
</group>
14-
</vector>
1+
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:color="@color/m3_card_ripple_color"
4+
tools:ignore="PrivateResource">
5+
<item>
6+
<vector
7+
android:width="100dp"
8+
android:height="100dp"
9+
android:viewportWidth="100"
10+
android:viewportHeight="100">
11+
<path
12+
android:fillColor="?attr/colorPrimaryContainer"
13+
android:pathData="M42.05 6.44c3.5-5.87 12.14-5.87 15.62 0 2.31 3.88 7.25 5.48 11.4 3.7 6.27-2.7 13.26 2.38 12.64 9.18-0.41 4.5 2.64 8.7 7.04 9.7 6.66 1.5 9.33 9.72 4.83 14.85-2.98 3.4-2.98 8.6 0 11.99 4.5 5.13 1.83 13.35-4.83 14.85-4.4 1-7.45 5.2-7.04 9.7 0.62 6.8-6.37 11.87-12.64 9.18-4.15-1.78-9.09-0.18-11.4 3.7-3.48 5.87-12.13 5.87-15.62 0-2.3-3.88-7.24-5.48-11.4-3.7-6.26 2.7-13.26-2.39-12.63-9.18 0.41-4.5-2.64-8.7-7.04-9.7-6.66-1.5-9.33-9.72-4.83-14.85 2.98-3.4 2.98-8.6 0-11.99-4.5-5.13-1.83-13.35 4.82-14.85 4.41-1 7.46-5.2 7.05-9.7-0.63-6.8 6.37-11.88 12.64-9.18 4.15 1.78 9.09 0.18 11.4-3.7Z" />
14+
</vector>
15+
</item>
16+
</ripple>

app/src/main/res/drawable/ic_shape_idle.xml

Lines changed: 0 additions & 21 deletions
This file was deleted.

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,28 @@
1010
android:layout_height="wrap_content"
1111
app:layout_constraintTop_toTopOf="parent" />
1212

13-
<com.google.android.material.imageview.ShapeableImageView
14-
android:id="@+id/app_icon"
13+
<FrameLayout
14+
android:id="@+id/app_icon_container"
1515
android:layout_width="120dp"
1616
android:layout_height="120dp"
17-
android:src="@drawable/ic_icon_shape"
1817
app:layout_constraintEnd_toEndOf="parent"
1918
app:layout_constraintStart_toStartOf="parent"
20-
app:layout_constraintTop_toBottomOf="@id/drag_handle"
21-
app:shapeAppearance="@style/ShapeAppearance.Material3.ListItem.Last" />
19+
app:layout_constraintTop_toBottomOf="@id/drag_handle">
20+
21+
<com.google.android.material.imageview.ShapeableImageView
22+
android:id="@+id/app_icon_shape"
23+
android:layout_width="match_parent"
24+
android:layout_height="match_parent"
25+
android:importantForAccessibility="no"
26+
android:src="@drawable/ic_icon_shape" />
27+
28+
<com.google.android.material.imageview.ShapeableImageView
29+
android:id="@+id/app_icon_logo"
30+
android:layout_width="match_parent"
31+
android:layout_height="match_parent"
32+
android:importantForAccessibility="no"
33+
android:src="@drawable/ic_icon_logo" />
34+
</FrameLayout>
2235

2336
<com.google.android.material.textview.MaterialTextView
2437
android:id="@+id/app_name"
@@ -30,7 +43,7 @@
3043
android:textColor="?attr/colorOnSurface"
3144
app:layout_constraintEnd_toEndOf="parent"
3245
app:layout_constraintStart_toStartOf="parent"
33-
app:layout_constraintTop_toBottomOf="@id/app_icon" />
46+
app:layout_constraintTop_toBottomOf="@id/app_icon_container" />
3447

3548
<com.google.android.material.button.MaterialButton
3649
android:id="@+id/app_update"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<androidx.appcompat.widget.LinearLayoutCompat
3131
android:layout_width="0dp"
3232
android:layout_height="wrap_content"
33+
android:layout_marginEnd="8dp"
3334
android:layout_weight="1"
3435
android:orientation="vertical">
3536

app/src/main/res/values-night-v31/colors.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
<!--app icon-->
44

5-
<color name="ic_launcher_foreground">@android:color/system_accent2_100</color>
6-
<color name="ic_launcher_background">@android:color/system_accent2_700</color>
5+
<color name="ic_launcher_foreground">@android:color/system_accent1_100</color>
6+
<color name="ic_launcher_background">@android:color/system_accent1_700</color>
77
</resources>

app/src/main/res/values-v31/colors.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
<!--app icon-->
44

5-
<color name="ic_launcher_foreground">@android:color/system_accent2_900</color>
6-
<color name="ic_launcher_background">@android:color/system_accent2_100</color>
5+
<color name="ic_launcher_foreground">@android:color/system_accent1_900</color>
6+
<color name="ic_launcher_background">@android:color/system_accent1_100</color>
77
</resources>

0 commit comments

Comments
 (0)