mirror of https://github.com/Corewala/Buran
Made clear runtime cache button actually do something
This commit is contained in:
parent
8f8bb15455
commit
bd8bbbc903
|
@ -87,6 +87,10 @@ class OmniTerm(private val listener: Listener) {
|
||||||
return history.last().toString()
|
return history.last().toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun clearCache() {
|
||||||
|
history.clear()
|
||||||
|
}
|
||||||
|
|
||||||
interface Listener{
|
interface Listener{
|
||||||
fun request(address: String)
|
fun request(address: String)
|
||||||
fun openExternal(address: String)
|
fun openExternal(address: String)
|
||||||
|
|
|
@ -264,7 +264,8 @@ class GemActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
R.id.overflow_menu_history -> HistoryDialog.show(
|
R.id.overflow_menu_history -> HistoryDialog.show(
|
||||||
this,
|
this,
|
||||||
db.history()
|
db.history(),
|
||||||
|
omniTerm
|
||||||
) { historyAddress ->
|
) { historyAddress ->
|
||||||
gemRequest(historyAddress)
|
gemRequest(historyAddress)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@ import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatDialog
|
import androidx.appcompat.app.AppCompatDialog
|
||||||
import androidx.core.view.forEach
|
import androidx.core.view.forEach
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import corewala.buran.OmniTerm
|
||||||
import kotlinx.android.synthetic.main.dialog_history.view.*
|
import kotlinx.android.synthetic.main.dialog_history.view.*
|
||||||
import corewala.buran.R
|
import corewala.buran.R
|
||||||
import corewala.buran.io.database.history.BuranHistory
|
import corewala.buran.io.database.history.BuranHistory
|
||||||
import kotlinx.android.synthetic.main.dialog_bookmarks.view.*
|
|
||||||
|
|
||||||
object HistoryDialog {
|
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)
|
val dialog = AppCompatDialog(context, R.style.AppTheme)
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ object HistoryDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
R.id.menu_action_clear_runtime_cache -> {
|
R.id.menu_action_clear_runtime_cache -> {
|
||||||
|
omniTerm.clearCache()
|
||||||
Toast.makeText(context, context.getString(R.string.runtime_cache_cleared), Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, context.getString(R.string.runtime_cache_cleared), Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
|
Loading…
Reference in New Issue