replaced account menu with save (check) icon

This commit is contained in:
Juha Heinanen
2018-05-27 09:52:02 +03:00
parent bd2ed2334d
commit 0a1593877e
7 changed files with 139 additions and 137 deletions
@@ -116,14 +116,14 @@ class AccountActivity : AppCompatActivity() {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
super.onCreateOptionsMenu(menu)
val inflater = menuInflater
inflater.inflate(R.menu.edit_menu, menu)
inflater.inflate(R.menu.check_icon, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
val intent = Intent(this, MainActivity::class.java)
when (item.itemId) {
R.id.save -> {
if (item.itemId == R.id.checkIcon) {
val dn = displayName.text.toString().trim()
if (dn != acc.displayName) {
if (checkDisplayName(dn)) {
@@ -218,7 +218,7 @@ class AccountActivity : AppCompatActivity() {
return false
}
val ac = ArrayList(LinkedHashSet<String>(newCodecs.filter{it != ""} as ArrayList<String>))
val ac = ArrayList(LinkedHashSet<String>(newCodecs.filter { it != "" } as ArrayList<String>))
if (ac != acc.audioCodec) {
Log.d("Baresip", "New codecs ${newCodecs.filter { it != "" }}")
val acParam = ";audio_codecs=" + Utils.implode(ac, ",")
@@ -260,19 +260,9 @@ class AccountActivity : AppCompatActivity() {
setResult(RESULT_OK, intent)
finish()
return true
}
R.id.cancel, android.R.id.home -> {
intent.putExtra("action", "cancel")
if (acc.regint > 0) {
Log.d("Baresip", "Registering ${acc.aor}")
UserAgent.ua_register(Account.findUA(acc.aor)!!.uap)
}
setResult(RESULT_OK, intent)
finish()
return true
}
else -> return super.onOptionsItemSelected(item)
}
} else
return super.onOptionsItemSelected(item)
}
private fun checkDisplayName(dn: String): Boolean {
Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/checkIcon"
android:title=""
app:showAsAction="always"
android:icon="@drawable/ic_action_check"
/>
</menu>