mirror of https://git.sr.ht/~oppen/ariane
add cache clear menu option
This commit is contained in:
parent
171d7276b0
commit
37d05f2c91
|
@ -13,4 +13,6 @@ object RuntimeCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun get(uri: URI): Pair<GeminiResponse.Header, List<String>>? = lruCache[uri.toString()]
|
fun get(uri: URI): Pair<GeminiResponse.Header, List<String>>? = lruCache[uri.toString()]
|
||||||
|
|
||||||
|
fun clear() = lruCache.evictAll()
|
||||||
}
|
}
|
|
@ -16,6 +16,7 @@ import com.google.android.material.snackbar.Snackbar
|
||||||
import oppen.tva.R
|
import oppen.tva.R
|
||||||
import oppen.tva.databinding.ActivityTvaBinding
|
import oppen.tva.databinding.ActivityTvaBinding
|
||||||
import oppen.tva.io.GeminiResponse
|
import oppen.tva.io.GeminiResponse
|
||||||
|
import oppen.tva.io.RuntimeCache
|
||||||
import oppen.tva.io.TvaState
|
import oppen.tva.io.TvaState
|
||||||
import oppen.tva.io.history.CacheInterface
|
import oppen.tva.io.history.CacheInterface
|
||||||
import oppen.tva.ui.about.AboutDialog
|
import oppen.tva.ui.about.AboutDialog
|
||||||
|
@ -91,6 +92,10 @@ class TvaActivity : AppCompatActivity() {
|
||||||
startActivity(Intent.createChooser(this, null))
|
startActivity(Intent.createChooser(this, null))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
R.id.overflow_menu_clear_cache -> {
|
||||||
|
RuntimeCache.clear()
|
||||||
|
showAlert("Runtime cache cleared")
|
||||||
|
}
|
||||||
R.id.overflow_menu_about -> AboutDialog.show(this)
|
R.id.overflow_menu_about -> AboutDialog.show(this)
|
||||||
R.id.overflow_menu_set_home -> {
|
R.id.overflow_menu_set_home -> {
|
||||||
SetHomeDialog.show(this, binding.addressEdit.text.toString()){
|
SetHomeDialog.show(this, binding.addressEdit.text.toString()){
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
android:title="@string/set_home" />
|
android:title="@string/set_home" />
|
||||||
</group>
|
</group>
|
||||||
<group android:id="@+id/other" >
|
<group android:id="@+id/other" >
|
||||||
|
<item android:id="@+id/overflow_menu_clear_cache"
|
||||||
|
android:title="@string/clear_cache" />
|
||||||
<item android:id="@+id/overflow_menu_about"
|
<item android:id="@+id/overflow_menu_about"
|
||||||
android:title="@string/about" />
|
android:title="@string/about" />
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -16,4 +16,5 @@
|
||||||
\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or any later version.\n
|
\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or any later version.\n
|
||||||
\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n
|
\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n
|
||||||
\nYou should have received a copy of the GNU General Public License along with this program. If not, see www.gnu.org/licenses</string>
|
\nYou should have received a copy of the GNU General Public License along with this program. If not, see www.gnu.org/licenses</string>
|
||||||
|
<string name="clear_cache">Clear cache</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue