Skip to content

Commit

Permalink
Glimpse: Show warning regarding trash's auto-empty behavior
Browse files Browse the repository at this point in the history
Change-Id: Ie1c49d1adb3119e8fe847744b8225299baab6aaf
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
  • Loading branch information
theimpulson authored and luca020400 committed Feb 21, 2025
1 parent 2162911 commit a05d2fa
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023-2024 The LineageOS Project
* SPDX-FileCopyrightText: 2023-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -21,6 +21,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.Toast
import android.widget.TextView
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.os.bundleOf
import androidx.core.view.ViewCompat
Expand Down Expand Up @@ -84,6 +85,8 @@ class AlbumFragment : Fragment(R.layout.fragment_album) {
private val noMediaLinearLayout by getViewProperty<LinearLayout>(R.id.noMediaLinearLayout)
private val recyclerView by getViewProperty<RecyclerView>(R.id.recyclerView)
private val toolbar by getViewProperty<MaterialToolbar>(R.id.toolbar)
private val warningTrashTimePeriod by getViewProperty<TextView>(R.id.warningTrashTimePeriod)
private val warningTrashTimePeriodToolbar by getViewProperty<TextView>(R.id.textView)

// System services
private val wallpaperManager by lazy {
Expand Down Expand Up @@ -462,6 +465,11 @@ class AlbumFragment : Fragment(R.layout.fragment_album) {
recyclerView.isVisible = !isEmpty
toolbar.menu.findItem(R.id.emptyTrash)?.isVisible = !isEmpty
noMediaLinearLayout.isVisible = isEmpty

if (albumRequest?.albumType == AlbumType.TRASH) {
warningTrashTimePeriod.isVisible = isEmpty
warningTrashTimePeriodToolbar.isVisible = !isEmpty
}
}

is RequestStatus.Error -> {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/ic_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#000000"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
Expand Down
14 changes: 13 additions & 1 deletion app/src/main/res/layout/fragment_album.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2023-2024 The LineageOS Project
SPDX-FileCopyrightText: 2023-2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
Expand All @@ -23,6 +23,18 @@
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways|snap" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="10dp"
android:drawablePadding="10dp"
android:text="@string/warning_bin_time_period"
android:textAppearance="?attr/textAppearanceBodyMedium"
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_info" />

</com.google.android.material.appbar.AppBarLayout>

<include
Expand Down
12 changes: 11 additions & 1 deletion app/src/main/res/layout/no_media_linear_layout.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2024 The LineageOS Project
SPDX-FileCopyrightText: 2024-2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Expand All @@ -24,4 +24,14 @@
android:text="@string/no_media"
android:textAppearance="?attr/textAppearanceBodyLarge" />

<TextView
android:id="@+id/warningTrashTimePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="80dp"
android:layout_marginVertical="10dp"
android:text="@string/warning_bin_time_period"
android:textAlignment="center"
android:textAppearance="?attr/textAppearanceBodyMedium"
android:visibility="gone" />
</LinearLayout>
5 changes: 4 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2023-2024 The LineageOS Project
SPDX-FileCopyrightText: 2023-2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
Expand Down Expand Up @@ -126,4 +126,7 @@
<string name="set_wallpaper_home_screen">Home screen</string>
<string name="set_wallpaper_lock_screen">Lock screen</string>
<string name="set_wallpaper_both">Home and lock screen</string>

<!-- Warnings and information -->
<string name="warning_bin_time_period">Files will be permanently deleted after 30 days.</string>
</resources>

0 comments on commit a05d2fa

Please sign in to comment.