updating commons
This commit is contained in:
parent
a7c33fc5a0
commit
b117c15ae6
2 changed files with 11 additions and 7 deletions
|
@ -63,7 +63,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:bcf4a22735'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:7daedc5c5d'
|
||||
implementation 'me.grantland:autofittextview:0.2.1'
|
||||
implementation 'net.objecthunter:exp4j:0.4.8'
|
||||
|
||||
|
|
|
@ -12,23 +12,27 @@ import com.simplemobiletools.commons.extensions.toast
|
|||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import kotlinx.android.synthetic.main.dialog_history.view.*
|
||||
|
||||
class HistoryDialog() {
|
||||
constructor(activity: SimpleActivity, items: List<History>, calculator: CalculatorImpl) : this() {
|
||||
class HistoryDialog(activity: SimpleActivity, items: List<History>, calculator: CalculatorImpl) {
|
||||
var dialog: AlertDialog? = null
|
||||
|
||||
init {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_history, null)
|
||||
|
||||
val dialog = AlertDialog.Builder(activity)
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.setNeutralButton(R.string.clear_history) { _, _ ->
|
||||
ensureBackgroundThread {
|
||||
activity.applicationContext.calculatorDB.deleteHistory()
|
||||
activity.toast(R.string.history_cleared)
|
||||
}
|
||||
}.create().apply {
|
||||
activity.setupDialogStuff(view, this, R.string.history)
|
||||
}.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.history) { alertDialog ->
|
||||
dialog = alertDialog
|
||||
}
|
||||
}
|
||||
|
||||
view.history_list.adapter = HistoryAdapter(activity, items, calculator) {
|
||||
dialog.dismiss()
|
||||
dialog?.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue