Skip to content

Commit

Permalink
update faq
Browse files Browse the repository at this point in the history
  • Loading branch information
newhinton committed May 16, 2024
1 parent 84a5679 commit 6eda1c5
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 41 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/de/felixnuesse/disky/FAQActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class FAQActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContentView(R.layout.activity_faqactivity)
setContentView(R.layout.activity_faq)
setSupportActionBar(findViewById(R.id.toolbar))
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
Expand Down
26 changes: 20 additions & 6 deletions app/src/main/java/de/felixnuesse/disky/ui/RecyclerViewAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent
import android.net.Uri
import android.provider.DocumentsContract
import android.util.Log
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.ViewGroup
Expand All @@ -23,6 +24,7 @@ import de.felixnuesse.disky.model.StorageLeaf
import de.felixnuesse.disky.model.StoragePrototype
import de.felixnuesse.disky.model.StorageType
import de.felixnuesse.disky.ui.dialogs.DeleteDialog
import de.felixnuesse.disky.ui.dialogs.HelpDialog
import java.io.File


Expand Down Expand Up @@ -75,8 +77,12 @@ class RecyclerViewAdapter(private var mContext: Context, private val folders: Li
binding.title.text = name
binding.size.text = readableFileSize(getCalculatedSize())

val leaf = this
when(StorageType.fromInt(holder.itemViewType)) {
StorageType.OS,
StorageType.OS -> {
setMenu(R.menu.context_os_menu, leaf)
setImage(R.drawable.icon_android)
}
StorageType.APP_APK,
StorageType.APP -> {
setImage(R.drawable.icon_android)
Expand All @@ -91,7 +97,7 @@ class RecyclerViewAdapter(private var mContext: Context, private val folders: Li
setImage(R.drawable.icon_account)
}
StorageType.FILE -> {
leafItem = folders[position] as StorageLeaf
leafItem = leaf
enableDeletion()
}
else -> {}
Expand All @@ -101,7 +107,6 @@ class RecyclerViewAdapter(private var mContext: Context, private val folders: Li
}
}


override fun getItemViewType(position: Int): Int {
return folders[position].storageType.ordinal
}
Expand Down Expand Up @@ -170,15 +175,20 @@ class RecyclerViewAdapter(private var mContext: Context, private val folders: Li
private var popupMenuEnableDeletion = false

init {
setMenu(R.menu.context_file_menu, null)
}

fun setMenu(menu: Int, leaf: StorageLeaf?) {
leaf.let{leafItem = it}
binding.root.setOnLongClickListener {
if(leafItem == null) {
return@setOnLongClickListener true
}
val context = binding.root.context
var popup = PopupMenu(context, it)
val popup = PopupMenu(context, it)
popup.setOnMenuItemClickListener(this)
popup.menuInflater.inflate(R.menu.context_file_menu, popup.menu)
popup.menu.findItem(R.id.action_file_delete).setVisible(popupMenuEnableDeletion)
popup.menuInflater.inflate(menu, popup.menu)
popup.menu.findItem(R.id.action_file_delete)?.setVisible(popupMenuEnableDeletion)
popup.setForceShowIcon(true)
popup.show()
true
Expand Down Expand Up @@ -215,6 +225,10 @@ class RecyclerViewAdapter(private var mContext: Context, private val folders: Li
DeleteDialog(mContext, File(leafItem!!.getParentPath())).askDelete()
true
}
R.id.action_os_help -> {
HelpDialog(mContext).help(R.string.help_android_os, R.string.help_android_os_description)
true
}
else -> {
false
}
Expand Down
21 changes: 21 additions & 0 deletions app/src/main/java/de/felixnuesse/disky/ui/dialogs/HelpDialog.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package de.felixnuesse.disky.ui.dialogs

import android.content.Context
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import de.felixnuesse.disky.R

class HelpDialog(private var mContext: Context) {

fun help(title: Int, message: Int) {
MaterialAlertDialogBuilder(mContext)
.setTitle(mContext.getString(title))
.setMessage(mContext.getString(message))
.setPositiveButton(
R.string.ok
) { dialog, _ ->
dialog.dismiss();
}
.setIcon(R.drawable.icon_help)
.show()
}
}
19 changes: 19 additions & 0 deletions app/src/main/res/drawable/icon_help.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:autoMirrored="true"
android:tint="?attr/iconTint"
android:viewportWidth="24"
android:viewportHeight="24">

<path
android:fillAlpha="0.3"
android:fillColor="@android:color/white"
android:pathData="M12,4c-4.41,0 -8,3.59 -8,8s3.59,8 8,8 8,-3.59 8,-8 -3.59,-8 -8,-8zM13,18h-2v-2h2v2zM13,15h-2c0,-3.25 3,-3 3,-5 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,10c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,2.5 -3,2.75 -3,5z"
android:strokeAlpha="0.3" />

<path
android:fillColor="@android:color/white"
android:pathData="M11,16h2v2h-2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM12,6c-2.21,0 -4,1.79 -4,4h2c0,-1.1 0.9,-2 2,-2s2,0.9 2,2c0,2 -3,1.75 -3,5h2c0,-2.25 3,-2.5 3,-5 0,-2.21 -1.79,-4 -4,-4z" />

</vector>
73 changes: 73 additions & 0 deletions app/src/main/res/layout/activity_faq.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FAQActivity">


<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@null"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navigationIcon="@drawable/icon_logo"
app:title="@string/faq" />

<TextView
android:id="@+id/faq_label_accuracy"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:fontFamily="sans-serif-medium"
android:text="@string/faq_label_accuracy"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar" />

<TextView
android:id="@+id/faq_answer_accuracy"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/faq_answer_accuracy"
app:layout_constraintEnd_toEndOf="@+id/faq_label_accuracy"
app:layout_constraintStart_toStartOf="@+id/faq_label_accuracy"
app:layout_constraintTop_toBottomOf="@+id/faq_label_accuracy" />

<TextView
android:id="@+id/faq_label_androidos"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:fontFamily="sans-serif-medium"
android:text="@string/faq_label_androidos"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/faq_answer_accuracy" />

<TextView
android:id="@+id/faq_answer_androidos"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="@string/faq_answer_androidos"
app:layout_constraintEnd_toEndOf="@+id/faq_label_androidos"
app:layout_constraintStart_toStartOf="@+id/faq_label_androidos"
app:layout_constraintTop_toBottomOf="@+id/faq_label_androidos" />


</androidx.constraintlayout.widget.ConstraintLayout>
34 changes: 0 additions & 34 deletions app/src/main/res/layout/activity_faqactivity.xml

This file was deleted.

10 changes: 10 additions & 0 deletions app/src/main/res/menu/context_os_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/action_os_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:icon="@drawable/icon_help"
android:title="@string/help" />
</menu>
10 changes: 10 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,14 @@
<string name="faq_description">Wenn du Fragen hast, werden sie hier vielleicht beantwortet.</string>
<string name="sortorder_aplhabet">Alphabet</string>
<string name="sortorder_size">Größe</string>
<string name="ok">ok</string>
<string name="help_android_os">Android OS</string>
<string name="faq_label_accuracy">Ist diese App genau?</string>
<string name="faq_label_androidos">Was ist \"Android OS\"?</string>

<string name="help_android_os_description">Dies zeigt die Differenz zwischen dem gesamten Speicher, wieviel von deinen Dateien und dem freien Speicher an.\n\nDies enthält nicht nur das Android System, sondern auch temoräre Dateien und Apps und Dateien von anderen Profilen. Das bedeutet das dieser Wert ungenau ist.</string>
<string name="faq_answer_accuracy">Nein. Wir können zwar Apps und Dateien korrekt berechnen, aber nicht die des Android Systems. Das bedeutet das diese Werte sich vermutlich jedesmal ändern wenn du einen neuen Scan startest. Das ist eine Begrenzung von Android.</string>
<string name="faq_answer_androidos">Das ist all der Speicher den wir nicht direkt scannen können. Das beinhaltet andere Profile, deren Dateien und Apps, sowie temporäre Systemdateien. Der berechnete Wert ist deshalb nur eine Schätzung.</string>


</resources>
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,11 @@
<string name="faq_description">If you have questions, they might be answered here</string>
<string name="sortorder_aplhabet">Alphabet</string>
<string name="sortorder_size">Size</string>
<string name="ok">ok</string>
<string name="help_android_os">Android OS</string>
<string name="help_android_os_description">This collects the difference between the total available diskspace, how much is used by your files and the known free storage.\n\nThis not only includes the android system itself, but also other profiles apps and files, and temporary system files. This means that this value is inaccurate.</string>
<string name="faq_label_accuracy">Is this app accurate?</string>
<string name="faq_answer_accuracy">No. We can calculate your files and apps properly, but not your android system. That means you will likely get different results for the system each time you refresh the scan. This is a limitation of android itself.</string>
<string name="faq_label_androidos">What is \"Android OS\"?</string>
<string name="faq_answer_androidos">This is all the used space that we can\'t access. That includes other profiles and their apps and the system itself. The calculated value is therefore only an estimation of its true size.</string>
</resources>

0 comments on commit 6eda1c5

Please sign in to comment.