Made clear runtime cache button actually do something

This commit is contained in:
Corewala 2022-06-09 11:21:41 -04:00
parent 8f8bb15455
commit bd8bbbc903
3 changed files with 9 additions and 3 deletions

View File

@ -87,6 +87,10 @@ class OmniTerm(private val listener: Listener) {
return history.last().toString()
}
fun clearCache() {
history.clear()
}
interface Listener{
fun request(address: String)
fun openExternal(address: String)

View File

@ -264,7 +264,8 @@ class GemActivity : AppCompatActivity() {
}
R.id.overflow_menu_history -> HistoryDialog.show(
this,
db.history()
db.history(),
omniTerm
) { historyAddress ->
gemRequest(historyAddress)
}

View File

@ -8,13 +8,13 @@ import android.widget.Toast
import androidx.appcompat.app.AppCompatDialog
import androidx.core.view.forEach
import androidx.recyclerview.widget.LinearLayoutManager
import corewala.buran.OmniTerm
import kotlinx.android.synthetic.main.dialog_history.view.*
import corewala.buran.R
import corewala.buran.io.database.history.BuranHistory
import kotlinx.android.synthetic.main.dialog_bookmarks.view.*
object HistoryDialog {
fun show(context: Context, history: BuranHistory, onHistoryItem: (address: String) -> Unit){
fun show(context: Context, history: BuranHistory, omniTerm: OmniTerm, onHistoryItem: (address: String) -> Unit){
val dialog = AppCompatDialog(context, R.style.AppTheme)
@ -37,6 +37,7 @@ object HistoryDialog {
}
}
R.id.menu_action_clear_runtime_cache -> {
omniTerm.clearCache()
Toast.makeText(context, context.getString(R.string.runtime_cache_cleared), Toast.LENGTH_SHORT).show()
}
else -> {