use conference subject to identiy room
This commit is contained in:
parent
4e4a767743
commit
b1a3d09ca6
|
@ -10,7 +10,6 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:textStyle="bold"
|
|
||||||
android:typeface="monospace"
|
android:typeface="monospace"
|
||||||
android:text="@string/no_otr_fingerprint"/>
|
android:text="@string/no_otr_fingerprint"/>
|
||||||
|
|
||||||
|
|
|
@ -49,5 +49,10 @@
|
||||||
android:title="Use Phones self contact picture"
|
android:title="Use Phones self contact picture"
|
||||||
android:summary="You may no longer be able to distinguish which account you are using in a conversation"
|
android:summary="You may no longer be able to distinguish which account you are using in a conversation"
|
||||||
android:defaultValue="true"/>
|
android:defaultValue="true"/>
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="use_subject_in_muc"
|
||||||
|
android:title="Conference Name"
|
||||||
|
android:summary="Use room’s subject to identify Conferences"
|
||||||
|
android:defaultValue="true"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -4,9 +4,6 @@ import java.security.interfaces.DSAPublicKey;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.siacs.conversations.crypto.OtrEngine;
|
|
||||||
import eu.siacs.conversations.xmpp.XmppConnection;
|
|
||||||
|
|
||||||
import net.java.otr4j.OtrException;
|
import net.java.otr4j.OtrException;
|
||||||
import net.java.otr4j.crypto.OtrCryptoEngineImpl;
|
import net.java.otr4j.crypto.OtrCryptoEngineImpl;
|
||||||
import net.java.otr4j.crypto.OtrCryptoException;
|
import net.java.otr4j.crypto.OtrCryptoException;
|
||||||
|
@ -23,13 +20,13 @@ import android.util.Log;
|
||||||
public class Conversation extends AbstractEntity {
|
public class Conversation extends AbstractEntity {
|
||||||
|
|
||||||
private static final long serialVersionUID = -6727528868973996739L;
|
private static final long serialVersionUID = -6727528868973996739L;
|
||||||
|
|
||||||
public static final String TABLENAME = "conversations";
|
public static final String TABLENAME = "conversations";
|
||||||
|
|
||||||
public static final int STATUS_AVAILABLE = 0;
|
public static final int STATUS_AVAILABLE = 0;
|
||||||
public static final int STATUS_ARCHIVED = 1;
|
public static final int STATUS_ARCHIVED = 1;
|
||||||
public static final int STATUS_DELETED = 2;
|
public static final int STATUS_DELETED = 2;
|
||||||
|
|
||||||
public static final int MODE_MULTI = 1;
|
public static final int MODE_MULTI = 1;
|
||||||
public static final int MODE_SINGLE = 0;
|
public static final int MODE_SINGLE = 0;
|
||||||
|
|
||||||
|
@ -52,24 +49,26 @@ public class Conversation extends AbstractEntity {
|
||||||
private transient List<Message> messages = null;
|
private transient List<Message> messages = null;
|
||||||
private transient Account account = null;
|
private transient Account account = null;
|
||||||
private transient Contact contact;
|
private transient Contact contact;
|
||||||
|
|
||||||
private transient SessionImpl otrSession;
|
private transient SessionImpl otrSession;
|
||||||
|
|
||||||
private transient String otrFingerprint = null;
|
private transient String otrFingerprint = null;
|
||||||
|
|
||||||
public int nextMessageEncryption = Message.ENCRYPTION_NONE;
|
public int nextMessageEncryption = Message.ENCRYPTION_NONE;
|
||||||
|
|
||||||
private transient MucOptions mucOptions = null;
|
private transient MucOptions mucOptions = null;
|
||||||
|
|
||||||
public Conversation(String name, Account account,
|
public Conversation(String name, Account account, String contactJid,
|
||||||
String contactJid, int mode) {
|
int mode) {
|
||||||
this(java.util.UUID.randomUUID().toString(), name, null, account.getUuid(), contactJid, System
|
this(java.util.UUID.randomUUID().toString(), name, null, account
|
||||||
.currentTimeMillis(), STATUS_AVAILABLE,mode);
|
.getUuid(), contactJid, System.currentTimeMillis(),
|
||||||
|
STATUS_AVAILABLE, mode);
|
||||||
this.account = account;
|
this.account = account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Conversation(String uuid, String name, String contactUuid,
|
public Conversation(String uuid, String name, String contactUuid,
|
||||||
String accountUuid, String contactJid, long created, int status, int mode) {
|
String accountUuid, String contactJid, long created, int status,
|
||||||
|
int mode) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.contactUuid = contactUuid;
|
this.contactUuid = contactUuid;
|
||||||
|
@ -81,33 +80,37 @@ public class Conversation extends AbstractEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Message> getMessages() {
|
public List<Message> getMessages() {
|
||||||
if (messages == null) this.messages = new ArrayList<Message>(); //prevent null pointer
|
if (messages == null)
|
||||||
|
this.messages = new ArrayList<Message>(); // prevent null pointer
|
||||||
//populate with Conversation (this)
|
|
||||||
|
// populate with Conversation (this)
|
||||||
for(Message msg : messages) {
|
|
||||||
|
for (Message msg : messages) {
|
||||||
msg.setConversation(this);
|
msg.setConversation(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRead() {
|
public boolean isRead() {
|
||||||
if ((this.messages == null)||(this.messages.size() == 0)) return true;
|
if ((this.messages == null) || (this.messages.size() == 0))
|
||||||
|
return true;
|
||||||
return this.messages.get(this.messages.size() - 1).isRead();
|
return this.messages.get(this.messages.size() - 1).isRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markRead() {
|
public void markRead() {
|
||||||
if (this.messages == null) return;
|
if (this.messages == null)
|
||||||
for(int i = this.messages.size() -1; i >= 0; --i) {
|
return;
|
||||||
if (messages.get(i).isRead()) return;
|
for (int i = this.messages.size() - 1; i >= 0; --i) {
|
||||||
|
if (messages.get(i).isRead())
|
||||||
|
return;
|
||||||
this.messages.get(i).markRead();
|
this.messages.get(i).markRead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Message getLatestMessage() {
|
public Message getLatestMessage() {
|
||||||
if ((this.messages == null)||(this.messages.size()==0)) {
|
if ((this.messages == null) || (this.messages.size() == 0)) {
|
||||||
Message message = new Message(this,"",Message.ENCRYPTION_NONE);
|
Message message = new Message(this, "", Message.ENCRYPTION_NONE);
|
||||||
message.setTime(getCreated());
|
message.setTime(getCreated());
|
||||||
return message;
|
return message;
|
||||||
} else {
|
} else {
|
||||||
|
@ -119,8 +122,10 @@ public class Conversation extends AbstractEntity {
|
||||||
this.messages = msgs;
|
this.messages = msgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName(boolean useSubject) {
|
||||||
if (this.contact!=null) {
|
if ((getMode() == MODE_MULTI) && (getMucOptions().getSubject() != null) && useSubject) {
|
||||||
|
return getMucOptions().getSubject();
|
||||||
|
} else if (this.contact != null) {
|
||||||
return this.contact.getDisplayName();
|
return this.contact.getDisplayName();
|
||||||
} else {
|
} else {
|
||||||
return this.name;
|
return this.name;
|
||||||
|
@ -128,7 +133,7 @@ public class Conversation extends AbstractEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProfilePhotoString() {
|
public String getProfilePhotoString() {
|
||||||
if (this.contact==null) {
|
if (this.contact == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return this.contact.getProfilePhoto();
|
return this.contact.getProfilePhoto();
|
||||||
|
@ -138,18 +143,18 @@ public class Conversation extends AbstractEntity {
|
||||||
public String getAccountUuid() {
|
public String getAccountUuid() {
|
||||||
return this.accountUuid;
|
return this.accountUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Account getAccount() {
|
public Account getAccount() {
|
||||||
return this.account;
|
return this.account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Contact getContact() {
|
public Contact getContact() {
|
||||||
return this.contact;
|
return this.contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContact(Contact contact) {
|
public void setContact(Contact contact) {
|
||||||
this.contact = contact;
|
this.contact = contact;
|
||||||
if (contact!=null) {
|
if (contact != null) {
|
||||||
this.contactUuid = contact.getUuid();
|
this.contactUuid = contact.getUuid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +162,7 @@ public class Conversation extends AbstractEntity {
|
||||||
public void setAccount(Account account) {
|
public void setAccount(Account account) {
|
||||||
this.account = account;
|
this.account = account;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContactJid() {
|
public String getContactJid() {
|
||||||
return this.contactJid;
|
return this.contactJid;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +177,7 @@ public class Conversation extends AbstractEntity {
|
||||||
public int getStatus() {
|
public int getStatus() {
|
||||||
return this.status;
|
return this.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCreated() {
|
public long getCreated() {
|
||||||
return this.created;
|
return this.created;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +191,7 @@ public class Conversation extends AbstractEntity {
|
||||||
values.put(CONTACTJID, contactJid);
|
values.put(CONTACTJID, contactJid);
|
||||||
values.put(CREATED, created);
|
values.put(CREATED, created);
|
||||||
values.put(STATUS, status);
|
values.put(STATUS, status);
|
||||||
values.put(MODE,mode);
|
values.put(MODE, mode);
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,18 +217,20 @@ public class Conversation extends AbstractEntity {
|
||||||
public void setMode(int mode) {
|
public void setMode(int mode) {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startOtrSession(Context context, String presence) {
|
public void startOtrSession(Context context, String presence) {
|
||||||
Log.d("xmppService","starting otr session with "+presence);
|
Log.d("xmppService", "starting otr session with " + presence);
|
||||||
SessionID sessionId = new SessionID(this.getContactJid(),presence,"xmpp");
|
SessionID sessionId = new SessionID(this.getContactJid(), presence,
|
||||||
this.otrSession = new SessionImpl(sessionId, getAccount().getOtrEngine(context));
|
"xmpp");
|
||||||
|
this.otrSession = new SessionImpl(sessionId, getAccount().getOtrEngine(
|
||||||
|
context));
|
||||||
try {
|
try {
|
||||||
this.otrSession.startSession();
|
this.otrSession.startSession();
|
||||||
} catch (OtrException e) {
|
} catch (OtrException e) {
|
||||||
Log.d("xmppServic","couldnt start otr");
|
Log.d("xmppServic", "couldnt start otr");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SessionImpl getOtrSession() {
|
public SessionImpl getOtrSession() {
|
||||||
return this.otrSession;
|
return this.otrSession;
|
||||||
}
|
}
|
||||||
|
@ -231,9 +238,9 @@ public class Conversation extends AbstractEntity {
|
||||||
public void resetOtrSession() {
|
public void resetOtrSession() {
|
||||||
this.otrSession = null;
|
this.otrSession = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void endOtrIfNeeded() {
|
public void endOtrIfNeeded() {
|
||||||
if (this.otrSession!=null) {
|
if (this.otrSession != null) {
|
||||||
if (this.otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) {
|
if (this.otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) {
|
||||||
try {
|
try {
|
||||||
this.otrSession.endSession();
|
this.otrSession.endSession();
|
||||||
|
@ -257,32 +264,34 @@ public class Conversation extends AbstractEntity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOtrFingerprint() {
|
public String getOtrFingerprint() {
|
||||||
if (this.otrFingerprint == null) {
|
if (this.otrFingerprint == null) {
|
||||||
try {
|
try {
|
||||||
DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession().getRemotePublicKey();
|
DSAPublicKey remotePubKey = (DSAPublicKey) getOtrSession()
|
||||||
StringBuilder builder = new StringBuilder(new OtrCryptoEngineImpl().getFingerprint(remotePubKey));
|
.getRemotePublicKey();
|
||||||
|
StringBuilder builder = new StringBuilder(
|
||||||
|
new OtrCryptoEngineImpl().getFingerprint(remotePubKey));
|
||||||
builder.insert(8, " ");
|
builder.insert(8, " ");
|
||||||
builder.insert(17, " ");
|
builder.insert(17, " ");
|
||||||
builder.insert(26, " ");
|
builder.insert(26, " ");
|
||||||
builder.insert(35, " ");
|
builder.insert(35, " ");
|
||||||
this.otrFingerprint = builder.toString();
|
this.otrFingerprint = builder.toString();
|
||||||
} catch (OtrCryptoException e) {
|
} catch (OtrCryptoException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.otrFingerprint;
|
return this.otrFingerprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MucOptions getMucOptions() {
|
public MucOptions getMucOptions() {
|
||||||
if (this.mucOptions == null) {
|
if (this.mucOptions == null) {
|
||||||
this.mucOptions = new MucOptions();
|
this.mucOptions = new MucOptions();
|
||||||
}
|
}
|
||||||
this.mucOptions.setConversation(this);
|
this.mucOptions.setConversation(this);
|
||||||
return this.mucOptions ;
|
return this.mucOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetMucOptions() {
|
public void resetMucOptions() {
|
||||||
this.mucOptions = null;
|
this.mucOptions = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ public class MucOptions {
|
||||||
private int error = 0;
|
private int error = 0;
|
||||||
private OnRenameListener renameListener = null;
|
private OnRenameListener renameListener = null;
|
||||||
private User self = new User();
|
private User self = new User();
|
||||||
|
private String subject = null;
|
||||||
|
|
||||||
|
|
||||||
public void deleteUser(String name) {
|
public void deleteUser(String name) {
|
||||||
|
@ -186,4 +187,12 @@ public class MucOptions {
|
||||||
public User getSelf() {
|
public User getSelf() {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSubject(String content) {
|
||||||
|
this.subject = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubject() {
|
||||||
|
return this.subject;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1225,4 +1225,10 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateConversationInGui() {
|
||||||
|
if (convChangedListener!=null) {
|
||||||
|
convChangedListener.onConversationListChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -12,11 +12,13 @@ import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.support.v4.widget.SlidingPaneLayout;
|
import android.support.v4.widget.SlidingPaneLayout;
|
||||||
|
@ -53,6 +55,7 @@ public class ConversationActivity extends XmppActivity {
|
||||||
private ListView listView;
|
private ListView listView;
|
||||||
|
|
||||||
private boolean paneShouldBeOpen = true;
|
private boolean paneShouldBeOpen = true;
|
||||||
|
private boolean useSubject = true;
|
||||||
private ArrayAdapter<Conversation> listAdapter;
|
private ArrayAdapter<Conversation> listAdapter;
|
||||||
|
|
||||||
private OnConversationListChangedListener onConvChanged = new OnConversationListChangedListener() {
|
private OnConversationListChangedListener onConvChanged = new OnConversationListChangedListener() {
|
||||||
|
@ -163,7 +166,7 @@ public class ConversationActivity extends XmppActivity {
|
||||||
view.setBackgroundColor(Color.TRANSPARENT);
|
view.setBackgroundColor(Color.TRANSPARENT);
|
||||||
}
|
}
|
||||||
TextView convName = (TextView) view.findViewById(R.id.conversation_name);
|
TextView convName = (TextView) view.findViewById(R.id.conversation_name);
|
||||||
convName.setText(conv.getName());
|
convName.setText(conv.getName(useSubject));
|
||||||
TextView convLastMsg = (TextView) view.findViewById(R.id.conversation_lastmsg);
|
TextView convLastMsg = (TextView) view.findViewById(R.id.conversation_lastmsg);
|
||||||
convLastMsg.setText(conv.getLatestMessage().getBody());
|
convLastMsg.setText(conv.getLatestMessage().getBody());
|
||||||
|
|
||||||
|
@ -179,7 +182,7 @@ public class ConversationActivity extends XmppActivity {
|
||||||
.setText(UIHelper.readableTimeDifference(conv.getLatestMessage().getTimeSent()));
|
.setText(UIHelper.readableTimeDifference(conv.getLatestMessage().getTimeSent()));
|
||||||
|
|
||||||
ImageView imageView = (ImageView) view.findViewById(R.id.conversation_image);
|
ImageView imageView = (ImageView) view.findViewById(R.id.conversation_image);
|
||||||
imageView.setImageBitmap(UIHelper.getContactPicture(conv.getContact(), conv.getName(),200, activity.getApplicationContext()));
|
imageView.setImageBitmap(UIHelper.getContactPicture(conv.getContact(), conv.getName(useSubject),200, activity.getApplicationContext()));
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +224,7 @@ public class ConversationActivity extends XmppActivity {
|
||||||
paneShouldBeOpen = false;
|
paneShouldBeOpen = false;
|
||||||
if (conversationList.size() > 0) {
|
if (conversationList.size() > 0) {
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
getActionBar().setTitle(getSelectedConversation().getName());
|
getActionBar().setTitle(getSelectedConversation().getName(useSubject));
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
if (!getSelectedConversation().isRead()) {
|
if (!getSelectedConversation().isRead()) {
|
||||||
getSelectedConversation().markRead();
|
getSelectedConversation().markRead();
|
||||||
|
@ -399,6 +402,8 @@ public class ConversationActivity extends XmppActivity {
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
this.registerListener();
|
this.registerListener();
|
||||||
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
this.useSubject = preferences.getBoolean("use_subject_in_muc", true);
|
||||||
if (conversationList.size()>=1) {
|
if (conversationList.size()>=1) {
|
||||||
onConvChanged.onConversationListChanged();
|
onConvChanged.onConversationListChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,8 @@ public class ConversationFragment extends Fragment {
|
||||||
private String pastedText = null;
|
private String pastedText = null;
|
||||||
|
|
||||||
protected Bitmap selfBitmap;
|
protected Bitmap selfBitmap;
|
||||||
|
|
||||||
|
private boolean useSubject = true;
|
||||||
|
|
||||||
private IntentSender askForPassphraseIntent = null;
|
private IntentSender askForPassphraseIntent = null;
|
||||||
|
|
||||||
|
@ -214,7 +216,7 @@ public class ConversationFragment extends Fragment {
|
||||||
if (item.getConversation().getMode() == Conversation.MODE_SINGLE) {
|
if (item.getConversation().getMode() == Conversation.MODE_SINGLE) {
|
||||||
|
|
||||||
viewHolder.imageView.setImageBitmap(mBitmapCache
|
viewHolder.imageView.setImageBitmap(mBitmapCache
|
||||||
.get(item.getConversation().getName(), item
|
.get(item.getConversation().getName(useSubject), item
|
||||||
.getConversation().getContact(),
|
.getConversation().getContact(),
|
||||||
getActivity()
|
getActivity()
|
||||||
.getApplicationContext()));
|
.getApplicationContext()));
|
||||||
|
@ -250,7 +252,7 @@ public class ConversationFragment extends Fragment {
|
||||||
.getApplicationContext()));
|
.getApplicationContext()));
|
||||||
} else {
|
} else {
|
||||||
viewHolder.imageView.setImageBitmap(mBitmapCache
|
viewHolder.imageView.setImageBitmap(mBitmapCache
|
||||||
.get(item.getConversation().getName(),
|
.get(item.getConversation().getName(useSubject),
|
||||||
null, getActivity()
|
null, getActivity()
|
||||||
.getApplicationContext()));
|
.getApplicationContext()));
|
||||||
}
|
}
|
||||||
|
@ -330,7 +332,7 @@ public class ConversationFragment extends Fragment {
|
||||||
if (!activity.shouldPaneBeOpen()) {
|
if (!activity.shouldPaneBeOpen()) {
|
||||||
activity.getSlidingPaneLayout().closePane();
|
activity.getSlidingPaneLayout().closePane();
|
||||||
activity.getActionBar().setDisplayHomeAsUpEnabled(true);
|
activity.getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
activity.getActionBar().setTitle(conversation.getName());
|
activity.getActionBar().setTitle(conversation.getName(useSubject));
|
||||||
activity.invalidateOptionsMenu();
|
activity.invalidateOptionsMenu();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@ import eu.siacs.conversations.entities.MucOptions;
|
||||||
import eu.siacs.conversations.entities.MucOptions.User;
|
import eu.siacs.conversations.entities.MucOptions.User;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -99,6 +101,8 @@ public class MucDetailsActivity extends XmppActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void onBackendConnected() {
|
void onBackendConnected() {
|
||||||
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
boolean useSubject = preferences.getBoolean("use_subject_in_muc", true);
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
for (Conversation mConv : xmppConnectionService.getConversations()) {
|
for (Conversation mConv : xmppConnectionService.getConversations()) {
|
||||||
if (mConv.getUuid().equals(uuid)) {
|
if (mConv.getUuid().equals(uuid)) {
|
||||||
|
@ -106,7 +110,7 @@ public class MucDetailsActivity extends XmppActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.conversation != null) {
|
if (this.conversation != null) {
|
||||||
setTitle(conversation.getName());
|
setTitle(conversation.getName(useSubject));
|
||||||
mFullJid.setText(conversation.getContactJid().split("/")[0]);
|
mFullJid.setText(conversation.getContactJid().split("/")[0]);
|
||||||
mYourNick.setText(conversation.getMucOptions().getNick());
|
mYourNick.setText(conversation.getMucOptions().getNick());
|
||||||
mRoleAffiliaton = (TextView) findViewById(R.id.muc_role);
|
mRoleAffiliaton = (TextView) findViewById(R.id.muc_role);
|
||||||
|
|
|
@ -13,8 +13,10 @@ import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
@ -66,6 +68,9 @@ public class ShareWithActivity extends XmppActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void onBackendConnected() {
|
void onBackendConnected() {
|
||||||
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
boolean useSubject = preferences.getBoolean("use_subject_in_muc", true);
|
||||||
|
|
||||||
Set<String> displayedContacts = new HashSet<String>();
|
Set<String> displayedContacts = new HashSet<String>();
|
||||||
conversations.removeAllViews();
|
conversations.removeAllViews();
|
||||||
List<Conversation> convList = xmppConnectionService.getConversations();
|
List<Conversation> convList = xmppConnectionService.getConversations();
|
||||||
|
@ -76,7 +81,7 @@ public class ShareWithActivity extends XmppActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for(final Conversation conversation : convList) {
|
for(final Conversation conversation : convList) {
|
||||||
View view = createContactView(conversation.getName(), conversation.getLatestMessage().getBody().trim(), UIHelper.getContactPicture(conversation.getContact(),conversation.getName(), 90,this.getApplicationContext()));
|
View view = createContactView(conversation.getName(useSubject), conversation.getLatestMessage().getBody().trim(), UIHelper.getContactPicture(conversation.getContact(),conversation.getName(useSubject), 90,this.getApplicationContext()));
|
||||||
view.setOnClickListener(new OnClickListener() {
|
view.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -96,7 +96,12 @@ public class MessageParser {
|
||||||
int status;
|
int status;
|
||||||
String[] fromParts = packet.getFrom().split("/");
|
String[] fromParts = packet.getFrom().split("/");
|
||||||
Conversation conversation = service.findOrCreateConversation(account, fromParts[0],true);
|
Conversation conversation = service.findOrCreateConversation(account, fromParts[0],true);
|
||||||
if ((fromParts.length == 1) || (packet.hasChild("subject"))) {
|
if (packet.hasChild("subject")) {
|
||||||
|
conversation.getMucOptions().setSubject(packet.findChild("subject").getContent());
|
||||||
|
service.updateConversationInGui();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ((fromParts.length == 1)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String counterPart = fromParts[1];
|
String counterPart = fromParts[1];
|
||||||
|
|
|
@ -133,6 +133,7 @@ public class UIHelper {
|
||||||
.getSystemService(Context.NOTIFICATION_SERVICE);
|
.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
boolean useSubject = preferences.getBoolean("use_subject_in_muc", true);
|
||||||
boolean showNofifications = preferences.getBoolean("show_notification",true);
|
boolean showNofifications = preferences.getBoolean("show_notification",true);
|
||||||
boolean vibrate = preferences.getBoolean("vibrate_on_notification", true);
|
boolean vibrate = preferences.getBoolean("vibrate_on_notification", true);
|
||||||
boolean alwaysNotify = preferences.getBoolean("notify_in_conversation_when_highlighted", false);
|
boolean alwaysNotify = preferences.getBoolean("notify_in_conversation_when_highlighted", false);
|
||||||
|
@ -171,9 +172,9 @@ public class UIHelper {
|
||||||
conversation.getName(),
|
conversation.getName(),
|
||||||
(int) res
|
(int) res
|
||||||
.getDimension(android.R.dimen.notification_large_icon_width)));*/
|
.getDimension(android.R.dimen.notification_large_icon_width)));*/
|
||||||
mBuilder.setLargeIcon(UIHelper.getContactPicture(conversation.getContact(), conversation.getName(), (int) res
|
mBuilder.setLargeIcon(UIHelper.getContactPicture(conversation.getContact(), conversation.getName(useSubject), (int) res
|
||||||
.getDimension(android.R.dimen.notification_large_icon_width), context));
|
.getDimension(android.R.dimen.notification_large_icon_width), context));
|
||||||
mBuilder.setContentTitle(conversation.getName());
|
mBuilder.setContentTitle(conversation.getName(useSubject));
|
||||||
if (notify) {
|
if (notify) {
|
||||||
mBuilder.setTicker(conversation.getLatestMessage().getBody().trim());
|
mBuilder.setTicker(conversation.getLatestMessage().getBody().trim());
|
||||||
}
|
}
|
||||||
|
@ -203,11 +204,11 @@ public class UIHelper {
|
||||||
for (int i = 0; i < unread.size(); ++i) {
|
for (int i = 0; i < unread.size(); ++i) {
|
||||||
targetUuid = unread.get(i).getUuid();
|
targetUuid = unread.get(i).getUuid();
|
||||||
if (i < unread.size() - 1) {
|
if (i < unread.size() - 1) {
|
||||||
names.append(unread.get(i).getName() + ", ");
|
names.append(unread.get(i).getName(useSubject) + ", ");
|
||||||
} else {
|
} else {
|
||||||
names.append(unread.get(i).getName());
|
names.append(unread.get(i).getName(useSubject));
|
||||||
}
|
}
|
||||||
style.addLine(Html.fromHtml("<b>" + unread.get(i).getName()
|
style.addLine(Html.fromHtml("<b>" + unread.get(i).getName(useSubject)
|
||||||
+ "</b> " + unread.get(i).getLatestMessage().getBody().trim()));
|
+ "</b> " + unread.get(i).getLatestMessage().getBody().trim()));
|
||||||
}
|
}
|
||||||
mBuilder.setContentTitle(unread.size() + " unread Conversations");
|
mBuilder.setContentTitle(unread.size() + " unread Conversations");
|
||||||
|
|
Loading…
Reference in a new issue