add hints to 'Edit Name' dialog

This commit is contained in:
B. Petersen 2024-08-22 14:01:51 +02:00 committed by bjoern
parent 7d42d79216
commit bf918590c9
2 changed files with 14 additions and 0 deletions

View file

@ -6,6 +6,7 @@ import android.media.RingtoneManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.text.TextUtils;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -550,12 +551,21 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
} }
else { else {
DcContact dcContact = dcContext.getContact(contactId); DcContact dcContact = dcContext.getContact(contactId);
String authName = dcContact.getAuthName();
if (TextUtils.isEmpty(authName)) {
authName = dcContact.getAddr();
}
View gl = View.inflate(this, R.layout.single_line_input, null); View gl = View.inflate(this, R.layout.single_line_input, null);
EditText inputField = gl.findViewById(R.id.input_field); EditText inputField = gl.findViewById(R.id.input_field);
inputField.setText(dcContact.getName()); inputField.setText(dcContact.getName());
inputField.setSelection(inputField.getText().length()); inputField.setSelection(inputField.getText().length());
inputField.setHint(getString(R.string.edit_name_placeholder, authName));
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setTitle(R.string.menu_edit_name) .setTitle(R.string.menu_edit_name)
.setMessage(getString(R.string.edit_name_explain, authName))
.setView(gl) .setView(gl)
.setPositiveButton(android.R.string.ok, (dialog, whichButton) -> { .setPositiveButton(android.R.string.ok, (dialog, whichButton) -> {
String newName = inputField.getText().toString(); String newName = inputField.getText().toString();

View file

@ -267,6 +267,10 @@
<string name="select_chat">Select Chat</string> <string name="select_chat">Select Chat</string>
<string name="select_more">Select more</string> <string name="select_more">Select more</string>
<string name="menu_edit_name">Edit Name</string> <string name="menu_edit_name">Edit Name</string>
<!-- The placeholder will be replaced by the name the contact gave themself (if any) or by an e-mail address. -->
<string name="edit_name_explain">Set a nickname that will be displayed for you instead of \"%1$s\". Leave empty to use the user\'s chosen name.</string>
<!-- The placeholder will be replaced by the name the contact gave themself (if any) or by an e-mail address. -->
<string name="edit_name_placeholder">Nickname for \"%1$s\"</string>
<string name="menu_settings">Settings</string> <string name="menu_settings">Settings</string>
<string name="menu_advanced">Advanced</string> <string name="menu_advanced">Advanced</string>
<string name="menu_view_profile">View Profile</string> <string name="menu_view_profile">View Profile</string>