Storage usage preference

This commit is contained in:
Koitharu
2023-07-20 15:50:32 +03:00
parent 513aa1a285
commit bc273bfb8f
15 changed files with 153 additions and 466 deletions

View File

@@ -1,88 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
<include
android:id="@+id/card_update"
layout="@layout/layout_app_update"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_normal"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/guideline"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<org.koitharu.kotatsu.settings.tools.views.MemoryUsageView
android:id="@+id/memory_usage_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_incognito"
style="?listItemTextViewStyle"
android:layout_width="0dp"
android:layout_height="?android:listPreferredItemHeightSmall"
android:layout_marginTop="2dp"
android:drawableStart="@drawable/ic_incognito"
android:drawablePadding="?android:listPreferredItemPaddingStart"
android:paddingStart="?android:listPreferredItemPaddingStart"
android:paddingEnd="?android:listPreferredItemPaddingEnd"
android:text="@string/incognito_mode"
android:textAppearance="?attr/textAppearanceButton"
android:textColor="?attr/colorControlNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@id/card_update"
app:layout_goneMarginTop="8dp" />
<org.koitharu.kotatsu.core.ui.widgets.ListItemTextView
android:id="@+id/button_downloads"
android:layout_width="0dp"
android:layout_height="?android:listPreferredItemHeightSmall"
android:drawableStart="@drawable/ic_download"
android:drawablePadding="?android:listPreferredItemPaddingStart"
android:paddingStart="?android:listPreferredItemPaddingStart"
android:paddingEnd="?android:listPreferredItemPaddingEnd"
android:text="@string/downloads"
android:textAppearance="?attr/textAppearanceButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@id/switch_incognito" />
<org.koitharu.kotatsu.core.ui.widgets.ListItemTextView
android:id="@+id/button_settings"
android:layout_width="0dp"
android:layout_height="?android:listPreferredItemHeightSmall"
android:drawableStart="@drawable/ic_settings"
android:drawablePadding="?android:listPreferredItemPaddingStart"
android:paddingStart="?android:listPreferredItemPaddingStart"
android:paddingEnd="?android:listPreferredItemPaddingEnd"
android:text="@string/settings"
android:textAppearance="?attr/textAppearanceButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@id/button_downloads" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="@+id/card_update"
layout="@layout/layout_app_update"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_normal"
android:visibility="gone"
tools:visibility="visible" />
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_normal"
app:cardBackgroundColor="?attr/colorSurfaceContainerLow"
app:cardCornerRadius="21dp">
<org.koitharu.kotatsu.core.ui.widgets.PieChart
android:id="@+id/chart"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_marginVertical="16dp"
android:layout_marginHorizontal="8dp"
app:pieChartCircleSectionSpace="6"
app:pieChartCircleStrokeWidth="18dp"
app:pieChartColors="@array/chart_colors"
app:pieChartTextAmount="Всего"
app:pieChartTextAmountColor="?attr/colorControlNormal"
app:pieChartTextDescriptionColor="?android:attr/textColorHint"
app:pieChartTextDescriptionSize="14sp"
app:pieChartTextNumberColor="?attr/colorControlNormal"
app:pieChartTextNumberSize="16sp" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_normal"
app:cardBackgroundColor="?attr/colorSurfaceContainerLow"
app:cardCornerRadius="21dp">
<org.koitharu.kotatsu.settings.tools.views.MemoryUsageView
android:id="@+id/memory_usage_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_normal"
app:cardBackgroundColor="?attr/colorSurfaceContainerLow"
app:cardCornerRadius="21dp"
app:contentPaddingBottom="8dp"
app:contentPaddingTop="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/switch_incognito"
style="?listItemTextViewStyle"
android:layout_width="match_parent"
android:layout_height="?android:listPreferredItemHeightSmall"
android:drawableStart="@drawable/ic_incognito"
android:drawablePadding="?android:listPreferredItemPaddingStart"
android:paddingStart="?android:listPreferredItemPaddingStart"
android:paddingEnd="?android:listPreferredItemPaddingEnd"
android:text="@string/incognito_mode"
android:textAppearance="?attr/textAppearanceButton"
android:textColor="?attr/colorControlNormal" />
<org.koitharu.kotatsu.core.ui.widgets.ListItemTextView
android:id="@+id/button_downloads"
android:layout_width="match_parent"
android:layout_height="?android:listPreferredItemHeightSmall"
android:drawableStart="@drawable/ic_download"
android:drawablePadding="?android:listPreferredItemPaddingStart"
android:paddingStart="?android:listPreferredItemPaddingStart"
android:paddingEnd="?android:listPreferredItemPaddingEnd"
android:text="@string/downloads"
android:textAppearance="?attr/textAppearanceButton" />
<org.koitharu.kotatsu.core.ui.widgets.ListItemTextView
android:id="@+id/button_settings"
android:layout_width="match_parent"
android:layout_height="?android:listPreferredItemHeightSmall"
android:drawableStart="@drawable/ic_settings"
android:drawablePadding="?android:listPreferredItemPaddingStart"
android:paddingStart="?android:listPreferredItemPaddingStart"
android:paddingEnd="?android:listPreferredItemPaddingEnd"
android:text="@string/settings"
android:textAppearance="?attr/textAppearanceButton" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -1,42 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="RtlSymmetry"
tools:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/screen_padding"
android:layout_marginTop="4dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/storage_usage"
android:textAppearance="?textAppearanceTitleMedium" />
<Button
android:id="@+id/button_manage"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:text="@string/manage" />
</LinearLayout>
android:orientation="vertical"
tools:ignore="RtlSymmetry">
<org.koitharu.kotatsu.core.ui.widgets.SegmentedBarView
android:id="@+id/bar"
android:layout_width="match_parent"
android:layout_height="18dp"
android:layout_marginStart="@dimen/screen_padding"
android:layout_marginTop="@dimen/screen_padding"
android:layout_marginEnd="@dimen/screen_padding"
android:background="?colorSecondaryContainer" />
@@ -89,4 +66,4 @@
app:drawableStartCompat="@drawable/bg_rounded_square"
app:drawableTint="?colorSecondaryContainer" />
</merge>
</LinearLayout>

View File

@@ -27,7 +27,7 @@
android:title="@string/network" />
<PreferenceScreen
android:fragment="org.koitharu.kotatsu.settings.UserDataSettingsFragment"
android:fragment="org.koitharu.kotatsu.settings.userdata.UserDataSettingsFragment"
android:icon="@drawable/ic_data_privacy"
android:key="userdata"
android:title="@string/data_and_privacy" />

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<SwitchPreferenceCompat
android:key="protect_app"
@@ -35,13 +36,16 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/data_deletion">
<PreferenceCategory android:title="@string/storage_usage">
<org.koitharu.kotatsu.settings.userdata.StorageUsagePreference android:key="storage_usage" />
<Preference
android:key="search_history_clear"
android:persistent="false"
android:summary="@string/loading_"
android:title="@string/clear_search_history" />
android:title="@string/clear_search_history"
app:allowDividerAbove="true" />
<Preference
android:key="updates_feed_clear"