show hint in subject quick edit. only show subject as preset
This commit is contained in:
parent
d84cf4e6d1
commit
abbdf232c6
|
@ -252,6 +252,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
quickEdit(mConversation.getMucOptions().getActualNick(),
|
||||
0,
|
||||
new OnValueEdited() {
|
||||
|
||||
@Override
|
||||
|
@ -278,7 +279,9 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
|
|||
break;
|
||||
case R.id.action_edit_subject:
|
||||
if (mConversation != null) {
|
||||
quickEdit(mConversation.getName(),this.onSubjectEdited);
|
||||
quickEdit(mConversation.getMucOptions().getSubject(),
|
||||
R.string.action_edit_subject,
|
||||
this.onSubjectEdited);
|
||||
}
|
||||
break;
|
||||
case R.id.action_share:
|
||||
|
|
|
@ -243,7 +243,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
|
|||
break;
|
||||
case R.id.action_edit_contact:
|
||||
if (contact.getSystemAccount() == null) {
|
||||
quickEdit(contact.getDisplayName(), new OnValueEdited() {
|
||||
quickEdit(contact.getDisplayName(), 0, new OnValueEdited() {
|
||||
|
||||
@Override
|
||||
public void onValueEdited(String value) {
|
||||
|
|
|
@ -662,18 +662,19 @@ public abstract class XmppActivity extends Activity {
|
|||
builder.create().show();
|
||||
}
|
||||
|
||||
protected void quickEdit(String previousValue, OnValueEdited callback) {
|
||||
quickEdit(previousValue, callback, false);
|
||||
protected void quickEdit(String previousValue, int hint, OnValueEdited callback) {
|
||||
quickEdit(previousValue, callback, hint, false);
|
||||
}
|
||||
|
||||
protected void quickPasswordEdit(String previousValue,
|
||||
OnValueEdited callback) {
|
||||
quickEdit(previousValue, callback, true);
|
||||
protected void quickPasswordEdit(String previousValue, OnValueEdited callback) {
|
||||
quickEdit(previousValue, callback, R.string.password, true);
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
private void quickEdit(final String previousValue,
|
||||
final OnValueEdited callback, boolean password) {
|
||||
final OnValueEdited callback,
|
||||
final int hint,
|
||||
boolean password) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
View view = getLayoutInflater().inflate(R.layout.quickedit, null);
|
||||
final EditText editor = (EditText) view.findViewById(R.id.editor);
|
||||
|
@ -682,7 +683,7 @@ public abstract class XmppActivity extends Activity {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String value = editor.getText().toString();
|
||||
if (!previousValue.equals(value) && value.trim().length() > 0) {
|
||||
if (!value.equals(previousValue) && value.trim().length() > 0) {
|
||||
callback.onValueEdited(value);
|
||||
}
|
||||
}
|
||||
|
@ -690,13 +691,18 @@ public abstract class XmppActivity extends Activity {
|
|||
if (password) {
|
||||
editor.setInputType(InputType.TYPE_CLASS_TEXT
|
||||
| InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
editor.setHint(R.string.password);
|
||||
builder.setPositiveButton(R.string.accept, mClickListener);
|
||||
} else {
|
||||
builder.setPositiveButton(R.string.edit, mClickListener);
|
||||
}
|
||||
if (hint != 0) {
|
||||
editor.setHint(hint);
|
||||
}
|
||||
editor.requestFocus();
|
||||
editor.setText(previousValue);
|
||||
editor.setText("");
|
||||
if (previousValue != null) {
|
||||
editor.getText().append(previousValue);
|
||||
}
|
||||
builder.setView(view);
|
||||
builder.setNegativeButton(R.string.cancel, null);
|
||||
builder.create().show();
|
||||
|
|
Loading…
Reference in New Issue