From e79a34b651a626b93686b8c578280b77c54b6138 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Wed, 16 Jul 2014 12:34:09 +0200 Subject: redesigned muc details a little bit --- src/eu/siacs/conversations/ui/XmppActivity.java | 31 +++++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'src/eu/siacs/conversations/ui/XmppActivity.java') diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java index 217bae55..2592bebc 100644 --- a/src/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/eu/siacs/conversations/ui/XmppActivity.java @@ -23,10 +23,10 @@ import android.content.ServiceConnection; import android.net.Uri; import android.os.Bundle; import android.os.IBinder; -import android.util.Log; import android.view.MenuItem; import android.view.View; import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; public abstract class XmppActivity extends Activity { @@ -37,6 +37,10 @@ public abstract class XmppActivity extends Activity { public XmppConnectionService xmppConnectionService; public boolean xmppConnectionServiceBound = false; protected boolean handledViewIntent = false; + + protected interface OnValueEdited { + public void onValueEdited(String value); + } protected ServiceConnection mConnection = new ServiceConnection() { @@ -193,10 +197,7 @@ public abstract class XmppActivity extends Activity { try { startIntentSenderForResult(pi.getIntentSender(), REQUEST_ANNOUNCE_PGP, null, 0, 0, 0); - } catch (SendIntentException e) { - Log.d("xmppService", - "coulnd start intent for pgp anncouncment"); - } + } catch (SendIntentException e) {} } @Override @@ -256,6 +257,26 @@ public abstract class XmppActivity extends Activity { builder.create().show(); } + protected void quickEdit(final String previousValue, final OnValueEdited callback) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + View view = (View) getLayoutInflater().inflate(R.layout.quickedit, null); + final EditText editor = (EditText) view.findViewById(R.id.editor); + editor.setText(previousValue); + builder.setView(view); + builder.setNegativeButton(R.string.cancel, null); + builder.setPositiveButton(R.string.edit, new OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + String value = editor.getText().toString(); + if (!previousValue.equals(value) && value.trim().length() > 0) { + callback.onValueEdited(value); + } + } + }); + builder.create().show(); + } + public void selectPresence(final Conversation conversation, final OnPresenceSelected listener) { Contact contact = conversation.getContact(); -- cgit v1.2.3