made muc password dialog hide the password (password field)
This commit is contained in:
parent
7a3bc5dc45
commit
9817251ed5
|
@ -138,7 +138,7 @@ public class ConversationFragment extends Fragment {
|
||||||
if (password==null) {
|
if (password==null) {
|
||||||
password = "";
|
password = "";
|
||||||
}
|
}
|
||||||
activity.quickEdit(password, new OnValueEdited() {
|
activity.quickPasswordEdit(password, new OnValueEdited() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueEdited(String value) {
|
public void onValueEdited(String value) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.text.InputType;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -297,16 +298,22 @@ public abstract class XmppActivity extends Activity {
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void quickEdit(final String previousValue,
|
protected void quickEdit(String previousValue, OnValueEdited callback) {
|
||||||
final OnValueEdited callback) {
|
quickEdit(previousValue, callback, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void quickPasswordEdit(String previousValue,
|
||||||
|
OnValueEdited callback) {
|
||||||
|
quickEdit(previousValue, callback, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void quickEdit(final String previousValue,
|
||||||
|
final OnValueEdited callback, boolean password) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
View view = (View) getLayoutInflater()
|
View view = (View) getLayoutInflater()
|
||||||
.inflate(R.layout.quickedit, null);
|
.inflate(R.layout.quickedit, null);
|
||||||
final EditText editor = (EditText) view.findViewById(R.id.editor);
|
final EditText editor = (EditText) view.findViewById(R.id.editor);
|
||||||
editor.setText(previousValue);
|
OnClickListener mClickListener = new OnClickListener() {
|
||||||
builder.setView(view);
|
|
||||||
builder.setNegativeButton(R.string.cancel, null);
|
|
||||||
builder.setPositiveButton(R.string.edit, new OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
@ -315,7 +322,19 @@ public abstract class XmppActivity extends Activity {
|
||||||
callback.onValueEdited(value);
|
callback.onValueEdited(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
editor.requestFocus();
|
||||||
|
editor.setText(previousValue);
|
||||||
|
builder.setView(view);
|
||||||
|
builder.setNegativeButton(R.string.cancel, null);
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue