From a582d44dbac87e546254de9daa6810663ca7f10a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 20 May 2014 10:15:47 +0200 Subject: [PATCH 1/4] added search icon --- res/drawable-hdpi/ic_action_search.png | Bin 0 -> 702 bytes res/drawable-mdpi/ic_action_search.png | Bin 0 -> 479 bytes res/drawable-xhdpi/ic_action_search.png | Bin 0 -> 900 bytes res/drawable-xxhdpi/ic_action_search.png | Bin 0 -> 1153 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 res/drawable-hdpi/ic_action_search.png create mode 100644 res/drawable-mdpi/ic_action_search.png create mode 100644 res/drawable-xhdpi/ic_action_search.png create mode 100644 res/drawable-xxhdpi/ic_action_search.png diff --git a/res/drawable-hdpi/ic_action_search.png b/res/drawable-hdpi/ic_action_search.png new file mode 100644 index 0000000000000000000000000000000000000000..f594b4e482c7db630737b6b68c8646726480d4af GIT binary patch literal 702 zcmV;v0zv(WP)`- zYT3@c^WFKbjfR7RgM&i_cse#237;HVvt20r{a~c`dF|yDzzbtGju@$VR-^F1ro_g2$1rRf{V;Sp=H5*BpHGX zIl@TxNvBIS72F1uKc^v7`UMpEELyYM?S4VFolfV2+^tRP`!N1)lmIC40FO(iJSaXv z1!dO4ydNTQMI_qr+e30X2%Jf}PM>p|nd(OO0+cEl=4CSp1uu)27NuV! z1lWi6MFFdTIrkpaPJn`!9rdQ_$0+--4Ae7m0=|$obs)>xyH*#n8vmX^DwGF0(B(>t zdI?aa8vUo}v{ap_y4yeUudhY*07*qoM6N<$f@EtW!Ti(^`#)-zx#^ji+0NFC1by}d3d=;zzAt%~TnHRcUe_h#B`??G9``=?>wDDq zu5A7U@b3X``UFK$6rgy3uiybcF5x+OmSyF+0J9#+A31rORqzi$9K->T{0YS!S1G{} zi8Qy-^8_AqJGH%v0azoa5$;XmhByLA;S2cN(3$W%*4%R?CqtV;@yyi?-d#wX0+amU zN?wCdJPY>{04uYu1Nt&kzm@<9cw~A&UzPptSb*xO+Ffcwf&Q;sS5&abY!=+lOQI=TT5ycC$M*WVo9~vrJCnnMl`|= zi%gT13}#{~E;YkcqW~DfDBQZX+m%^!#E^LHYM`AEGs!azh?j=PP6+8QBHbeEyS7V8 z8es2$NG}e+)7%De`zs%%4v0pLm|x<8DT?A0hT#`}F5xHmJHU?KU$p6u$pr8tzyP+N VjEWx1<;nm6002ovPDHLkV1lr>(e3~M literal 0 HcmV?d00001 diff --git a/res/drawable-xhdpi/ic_action_search.png b/res/drawable-xhdpi/ic_action_search.png new file mode 100644 index 0000000000000000000000000000000000000000..aad535e9781380fe111046fa0bbd14de899c7a39 GIT binary patch literal 900 zcmV-~1AF|5P)n&Xh zIyrLelkdCt-rak45RgbD5{X12k&aWLi%!Sm@c<4N&@S;5|NRDyLEA!GuU4z#-~hnD zM{t-x8#TC`gUF#R0LHr40AS!L9A?mB!!9yt&j5n;4gd^(3WuAT%L;@O*I2|8K*)Ll z0R8+9T3RuqycP1S!hH$eb5j9i4)-kk0N_sH>je&gwRD}%AcPjpp8N2^(2}MYJVkx) zVx(H~FfnF^wsqUZhRYOyocPRaCMyW^ zzm(W@iA)OsR&STmYB04l_< z`1wgVoxnNXe#8HN4b1*Cv~xMvfWDkph}#rJCkm4-^Z7+xDGQ_hZB4$v#7dEW0Cqqq zLFAa#F~ue))!0Wkg<#{wNZYqUVtUOgEF#1H6TI%xRK%(Frv|An zFRVUupNGCa;y^|5_;4nyJXdhti*CGeVgZV1UcMYnYw`;2BAIHPSCq)Bw&o9QEg^In zU@&2liy5rR-oE0^lXVDA0knkoRpAQOA)EyMD$%&^-gHauGk`)9mJx)=*U>|i=RxvH zi2ijtGg%$H1;7Wv2jdz-F4C`8~hq z*bxGPAP9mW2!bF8f*=TjAP9n-YsBeduCK3Cc^K2j@3NJ$<@CAu`1mLQz^=isJ zg&tq0gKV!7Lv0IW{*{F37I!4l}(nh^Jk^WZ#kVEj`t-^m~; zMvy}=vQxqfo387>@TJ0|1rr4gQ8WGLiKPh{+`QcxbadccK6<4-8nG#UTJ<&99* zV}g*%>syBI0SiN(e{gO5h7jhINreZ1djH%s;P!b#1Yv6kMaxhly;P<0oI6T$ zziLLEB{%@OlryuDYIe}3#kCF>0A)T&3j_4!1)0eULh}IKv_Qe6_}LjUq9h~$SB8Si zyC?*f4X=5y08*|1sIz^o001In4@d>% z6+j6S`UQ{=^uCKw0O)kd%-BiD0CYDpVK(iX1`B{5^Rccp4c8J>2+|c@Qw}#ro|tm3 z4V(dBGVgw)%iK6s>NWtF=6x0n?oT)M{25XjT8#s`9yRyr1@sVJmkhiI1%R|OOjF!? zjQzT2)CIRiT2=tiyt}R_ThOAZzO@qid8&W+2n(ika41_*5=_LfAuT*qL-Z80xpb~~D!5vfbuo)>ifqyuU5wX#a0|1mo&U53ioQ{Trm)q_5l|uzFpML&#Hc-bOv=5H3U8R7}C>j7mBF(@@J05&-ZEAqN0|5IQgPjlL4@2;mKdm_G=){N4rt{6MJw7nQJw zIw7Y5tOS65At-~t*$6uT&R1R* literal 0 HcmV?d00001 From 8f92d8d109e2d62816c5d3fe1b9d21ab4802ccc8 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 20 May 2014 10:48:07 +0200 Subject: [PATCH 2/4] ported pending subscription support to new roster mgmt --- .../siacs/conversations/entities/Contact.java | 1 + .../services/XmppConnectionService.java | 19 +++---------------- .../conversations/xmpp/XmppConnection.java | 13 +------------ 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/src/eu/siacs/conversations/entities/Contact.java b/src/eu/siacs/conversations/entities/Contact.java index ff1459a50..22e2661bf 100644 --- a/src/eu/siacs/conversations/entities/Contact.java +++ b/src/eu/siacs/conversations/entities/Contact.java @@ -286,5 +286,6 @@ public class Contact { public static final int ASKING = 2; public static final int PREEMPTIVE_GRANT = 4; public static final int IN_ROSTER = 8; + public static final int PENDING_SUBSCRIPTION_REQUEST = 16; } } diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 35e5fb514..9ea7f2b1f 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -303,12 +303,6 @@ public class XmppConnectionService extends Service { } else { Contact contact = account.getRoster().getContact( packet.getFrom()); - /* - * if (contact == null) { if ("subscribe".equals(type)) { - * account.getXmppConnection().addPendingSubscription( - * fromParts[0]); } else { // Log.d(LOGTAG,packet.getFrom()+ - * // " could not be found"); } return; } - */ if (type == null) { if (fromParts.length == 2) { contact.updatePresence(fromParts[1], Presences @@ -327,12 +321,6 @@ public class XmppConnectionService extends Service { } contact.setPgpKeyId(pgp.fetchKeyId(account, msg, x.getContent())); - Log.d("xmppService", - account.getJid() - + ": fetched key id for " - + contact.getJid() - + " was:" - + contact.getPgpKeyId()); } } } else { @@ -357,8 +345,7 @@ public class XmppConnectionService extends Service { requestPresenceUpdatesFrom(contact); } } else { - account.getXmppConnection().addPendingSubscription( - fromParts[0]); + contact.setOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST); } } else { // Log.d(LOGTAG, packet.toString()); @@ -1198,8 +1185,7 @@ public class XmppConnectionService extends Service { pushContactToServer(contact); if (autoGrant) { requestPresenceUpdatesFrom(contact); - if (contact.getAccount().getXmppConnection().hasPendingSubscription( - contact.getJid())) { + if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { Log.d("xmppService", "contact had pending subscription"); sendPresenceUpdatesTo(contact); } @@ -1260,6 +1246,7 @@ public class XmppConnectionService extends Service { packet.setAttribute("from", contact.getAccount().getJid()); Log.d(LOGTAG, packet.toString()); contact.getAccount().getXmppConnection().sendPresencePacket(packet); + contact.resetOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST); } public void sendPresence(Account account) { diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index 58e110d6d..23613cd5b 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -74,9 +74,7 @@ public class XmppConnection implements Runnable { private boolean shouldAuthenticate = true; private Element streamFeatures; private HashMap> disco = new HashMap>(); - - private HashSet pendingSubscriptions = new HashSet(); - + private String streamId = null; private int smVersion = 3; @@ -904,15 +902,6 @@ public class XmppConnection implements Runnable { return findDiscoItemByFeature("http://jabber.org/protocol/muc"); } - public boolean hasPendingSubscription(String jid) { - return this.pendingSubscriptions.contains(jid); - } - - public void addPendingSubscription(String jid) { - Log.d(LOGTAG,"adding "+jid+" to pending subscriptions"); - this.pendingSubscriptions.add(jid); - } - public int getTimeToNextAttempt() { int interval = (int) (25 * Math.pow(1.5,attempt)); int secondsSinceLast = (int) ((SystemClock.elapsedRealtime() - this.lastConnect) / 1000); From 13f9f23946a1e8260b92c6006d0f7981fff8d35c Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 20 May 2014 11:05:03 +0200 Subject: [PATCH 3/4] fixed ping time out after session resume --- src/eu/siacs/conversations/xmpp/XmppConnection.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index 23613cd5b..0ba9677ac 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -259,6 +259,7 @@ public class XmppConnection implements Runnable { RequestPacket r = new RequestPacket(smVersion); tagWriter.writeStanzaAsync(r); } else if (nextTag.isStart("resumed")) { + lastPaketReceived = SystemClock.elapsedRealtime(); Log.d(LOGTAG,account.getJid()+": session resumed"); tagReader.readElement(nextTag); sendPing(); From f79d92ab67206254df1c0c348898d60c3a741e0e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 20 May 2014 11:44:43 +0200 Subject: [PATCH 4/4] highlight people in conferences by clicken on their picture --- .../ui/ConversationFragment.java | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index b551e6adc..7ab019361 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -392,20 +392,17 @@ public class ConversationFragment extends Fragment { if (type == RECIEVED) { if (item.getConversation().getMode() == Conversation.MODE_MULTI) { - if (item.getCounterpart() != null) { - viewHolder.contact_picture - .setImageBitmap(mBitmapCache.get(item - .getCounterpart(), null, - getActivity() - .getApplicationContext())); - } else { - viewHolder.contact_picture - .setImageBitmap(mBitmapCache.get( - item.getConversation().getName( - useSubject), null, - getActivity() - .getApplicationContext())); - } + viewHolder.contact_picture.setImageBitmap(mBitmapCache + .get(item.getCounterpart(), null, getActivity() + .getApplicationContext())); + viewHolder.contact_picture + .setOnClickListener(new OnClickListener() { + + @Override + public void onClick(View v) { + highlightInConference(item.getCounterpart()); + } + }); } } @@ -461,6 +458,22 @@ public class ConversationFragment extends Fragment { return view; } + protected void highlightInConference(String nick) { + if (chatMsg.getText().toString().isEmpty()) { + chatMsg.setText(nick+": "); + } else { + String oldString = chatMsg.getText().toString(); + if (oldString.endsWith(" ")) { + chatMsg.setText(oldString+nick+" "); + } else { + chatMsg.setText(oldString+" "+nick+" "); + } + } + int position = chatMsg.length(); + Editable etext = chatMsg.getText(); + Selection.setSelection(etext, position); + } + protected Bitmap findSelfPicture() { SharedPreferences sharedPref = PreferenceManager .getDefaultSharedPreferences(getActivity()