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