display up button in key transfer activity

This commit is contained in:
Vincent Breitmoser 2018-05-12 19:32:01 +02:00 committed by cketti
parent 2c1d0cb290
commit 9d360286d6
2 changed files with 21 additions and 0 deletions

View file

@ -9,6 +9,7 @@ import android.os.Build
import android.os.Bundle
import android.transition.TransitionInflater
import android.transition.TransitionManager
import android.view.MenuItem
import android.view.View
import com.fsck.k9.R
import com.fsck.k9.activity.K9Activity
@ -30,12 +31,23 @@ class AutocryptKeyTransferActivity : K9Activity() {
val accountUuid = intent.getStringExtra(EXTRA_ACCOUNT)
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
transferSendButton.setOnClickListener { presenter.onClickTransferSend() }
transferButtonShowCode.setOnClickListener { presenter.onClickShowTransferCode() }
presenter.initFromIntent(accountUuid)
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
if (item?.itemId == android.R.id.home) {
presenter.onClickHome();
return true
} else {
return super.onOptionsItemSelected(item)
}
}
fun setAddress(address: String) {
transferAddress1.text = address
transferAddress2.text = address
@ -132,6 +144,11 @@ class AutocryptKeyTransferActivity : K9Activity() {
}
}
fun finishAsCancelled() {
setResult(RESULT_CANCELED)
finish()
}
companion object {
private const val EXTRA_ACCOUNT = "account"

View file

@ -60,6 +60,10 @@ class AutocryptKeyTransferPresenter internal constructor(
viewModel.autocryptSetupTransferLiveEvent.recall()
}
fun onClickHome() {
view.finishAsCancelled()
}
fun onClickTransferSend() {
view.sceneGeneratingAndSending()