- String and layout related improvements.

This commit is contained in:
Juha Heinanen
2019-05-08 21:33:35 +03:00
parent 6faf86bd2a
commit 884b762fbf
5 changed files with 27 additions and 19 deletions

View File

@ -3,6 +3,7 @@ package com.tutpro.baresip
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.res.Resources
import android.os.Bundle import android.os.Bundle
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater import android.view.LayoutInflater
@ -38,8 +39,11 @@ class AccountListAdapter(private val cxt: Context, private val rows: ArrayList<A
actionView.setOnClickListener { _ -> actionView.setOnClickListener { _ ->
Log.d("Baresip", "Delete button clicked") Log.d("Baresip", "Delete button clicked")
val deleteDialog = AlertDialog.Builder(cxt) val deleteDialog = AlertDialog.Builder(cxt)
deleteDialog.setMessage("Do you want to delete account ${ua.account.aor}?") deleteDialog.setMessage("${cxt.getString(R.string.delete_account)} ${ua.account.aor}?")
deleteDialog.setPositiveButton("Delete") { dialog, _ -> deleteDialog.setPositiveButton(cxt.getText(R.string.cancel)) { dialog, _ ->
dialog.dismiss()
}
deleteDialog.setNegativeButton(cxt.getText(R.string.delete)) { dialog, _ ->
Api.ua_destroy(ua.uap) Api.ua_destroy(ua.uap)
UserAgent.remove(ua) UserAgent.remove(ua)
AccountsActivity.generateAccounts() AccountsActivity.generateAccounts()
@ -47,9 +51,6 @@ class AccountListAdapter(private val cxt: Context, private val rows: ArrayList<A
this.notifyDataSetChanged() this.notifyDataSetChanged()
dialog.dismiss() dialog.dismiss()
} }
deleteDialog.setNegativeButton("No") { dialog, _ ->
dialog.dismiss()
}
deleteDialog.create().show() deleteDialog.create().show()
} }
return rowView return rowView

View File

@ -103,13 +103,13 @@ class ChatActivity : AppCompatActivity() {
builder.setMessage(String.format(getString(R.string.long_message_question), builder.setMessage(String.format(getString(R.string.long_message_question),
chatPeer)) chatPeer))
.setPositiveButton(getString(R.string.cancel), dialogClickListener) .setPositiveButton(getString(R.string.cancel), dialogClickListener)
.setNegativeButton(getString(R.string.delete_message), dialogClickListener) .setNegativeButton(getString(R.string.delete), dialogClickListener)
.setNeutralButton(getString(R.string.add_contact), dialogClickListener) .setNeutralButton(getString(R.string.add_contact), dialogClickListener)
.show() .show()
else else
builder.setMessage(getText(R.string.short_message_question)) builder.setMessage(getText(R.string.short_message_question))
.setPositiveButton(getString(R.string.cancel), dialogClickListener) .setPositiveButton(getString(R.string.cancel), dialogClickListener)
.setNegativeButton(getString(R.string.delete_message), dialogClickListener) .setNegativeButton(getString(R.string.delete), dialogClickListener)
.show() .show()
true true
} }

View File

@ -84,16 +84,16 @@ class ChatsActivity: AppCompatActivity() {
val builder = AlertDialog.Builder(this@ChatsActivity, R.style.Theme_AppCompat) val builder = AlertDialog.Builder(this@ChatsActivity, R.style.Theme_AppCompat)
val peer = ContactsActivity.contactName(uaMessages[pos].peerUri) val peer = ContactsActivity.contactName(uaMessages[pos].peerUri)
if (peer.startsWith("sip:")) if (peer.startsWith("sip:"))
builder.setMessage("Do you want to delete chat with peer " + builder.setMessage(String.format(getString(R.string.long_chat_question),
"${Utils.friendlyUri(peer, Utils.aorDomain(aor))} or add peer to contacts?") Utils.friendlyUri(peer, Utils.aorDomain(aor))))
.setPositiveButton("Cancel", dialogClickListener) .setPositiveButton(getText(R.string.cancel), dialogClickListener)
.setNegativeButton("Delete Chat", dialogClickListener) .setNegativeButton(getText(R.string.delete), dialogClickListener)
.setNeutralButton("Add Contact", dialogClickListener) .setNeutralButton(getText(R.string.add_contact), dialogClickListener)
.show() .show()
else else
builder.setMessage("Do you want to delete chat with '$peer'?") builder.setMessage("${getString(R.string.short_chat_question)} '$peer'?")
.setPositiveButton("Cancel", dialogClickListener) .setPositiveButton(getText(R.string.cancel), dialogClickListener)
.setNegativeButton("Delete Chat", dialogClickListener) .setNegativeButton(getText(R.string.delete), dialogClickListener)
.show() .show()
true true
} }

View File

@ -27,8 +27,9 @@
android:textSize="20sp" android:textSize="20sp"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_marginStart="0dp" android:layout_marginStart="0dp"
android:layout_toLeftOf="@+id/addAccount" android:layout_toStartOf="@+id/addAccount"
android:inputType="textEmailAddress" android:inputType="textEmailAddress"
android:autofillHints="username"
android:hint="@string/sip_uri_user_domain" > android:hint="@string/sip_uri_user_domain" >
</EditText> </EditText>
@ -38,8 +39,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginLeft="6dp" android:layout_gravity="end"
android:layout_marginStart="6dp"
android:src="@drawable/action_add" android:src="@drawable/action_add"
android:contentDescription="@string/add"
android:scaleType="centerCrop" > android:scaleType="centerCrop" >
</ImageButton> </ImageButton>

View File

@ -81,6 +81,7 @@
<string name="sip_uri_user_domain">SIP URI user@domain</string> <string name="sip_uri_user_domain">SIP URI user@domain</string>
<string name="export_accounts">Export</string> <string name="export_accounts">Export</string>
<string name="import_accounts">Import</string> <string name="import_accounts">Import</string>
<string name="delete_account">Do you want to delete account</string>
<!-- Baresip Service --> <!-- Baresip Service -->
<string name="answer">Answer</string> <string name="answer">Answer</string>
@ -98,14 +99,15 @@
<string name="new_message">New message</string> <string name="new_message">New message</string>
<string name="long_message_question">Do you want to delete message or add peer %1$s to contacts?</string> <string name="long_message_question">Do you want to delete message or add peer %1$s to contacts?</string>
<string name="short_message_question">Do you want to delete message?</string> <string name="short_message_question">Do you want to delete message?</string>
<string name="delete_message">Delete Message</string>
<string name="add_contact">Add Contact</string> <string name="add_contact">Add Contact</string>
<string name="message_failed">Sending of message failed</string> <string name="message_failed">Sending of message failed</string>
<!-- Chats Activity --> <!-- Chats Activity -->
<string name="chats">Chat History</string> <string name="chats">Chat History</string>
<string name="new_chat_peer">New Chat Peer</string> <string name="new_chat_peer">New Chat Peer</string>
<string name="long_chat_question">Do you want to delete chat with peer %1$s or
add peer to contacts?</string>
<string name="short_chat_question">Do you want to delete chat with</string>
<!-- Config Activity --> <!-- Config Activity -->
<string name="configuration">Configuration</string> <string name="configuration">Configuration</string>
@ -161,6 +163,8 @@
<string name="user_id">User ID</string> <string name="user_id">User ID</string>
<string name="password">Password</string> <string name="password">Password</string>
<string name="sip_uri">SIP URI</string> <string name="sip_uri">SIP URI</string>
<string name="add">Add</string>
<string name="delete">Delete</string>
<string name="dots">&#8230;</string> <string name="dots">&#8230;</string>
<!-- Main Activity --> <!-- Main Activity -->