mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 03:32:15 -05:00
brought muc invites back. + couple of bug fixes + refactoring
This commit is contained in:
parent
670dead695
commit
38a9242955
@ -49,11 +49,11 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="eu.siacs.conversations.ui.StartConversation"
|
android:name="eu.siacs.conversations.ui.StartConversationActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="@string/title_activity_start_conversation"
|
android:label="@string/title_activity_start_conversation"
|
||||||
android:logo="@drawable/ic_activity"
|
android:logo="@drawable/ic_activity"
|
||||||
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity">
|
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SENDTO" />
|
<action android:name="android.intent.action.SENDTO" />
|
||||||
|
|
||||||
@ -68,6 +68,9 @@
|
|||||||
android:label="@string/title_activity_settings"
|
android:label="@string/title_activity_settings"
|
||||||
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity" >
|
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity" >
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name="eu.siacs.conversations.ui.ChooseContactActivity"
|
||||||
|
android:label="@string/title_activity_choose_contact">
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="eu.siacs.conversations.ui.ManageAccountActivity"
|
android:name="eu.siacs.conversations.ui.ManageAccountActivity"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
@ -75,7 +78,7 @@
|
|||||||
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity" >
|
android:parentActivityName="eu.siacs.conversations.ui.ConversationActivity" >
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="eu.siacs.conversations.ui.MucDetailsActivity"
|
android:name="eu.siacs.conversations.ui.ConferenceDetailsActivity"
|
||||||
android:label="@string/title_activity_conference_details"
|
android:label="@string/title_activity_conference_details"
|
||||||
android:windowSoftInputMode="stateHidden" >
|
android:windowSoftInputMode="stateHidden" >
|
||||||
</activity>
|
</activity>
|
||||||
|
13
res/layout/activity_choose_contact.xml
Normal file
13
res/layout/activity_choose_contact.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/choose_contact_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:listitem="@layout/contact" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -63,7 +63,6 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="hallo hallo"
|
|
||||||
android:textColor="@color/primarytext"
|
android:textColor="@color/primarytext"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp" />
|
||||||
|
|
||||||
@ -72,7 +71,6 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="Participant"
|
|
||||||
android:textColor="@color/primarytext"
|
android:textColor="@color/primarytext"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -123,7 +121,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:text="@string/invite_contacts" />
|
android:text="@string/invite_contact" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
10
res/menu/choose_contact.xml
Normal file
10
res/menu/choose_contact.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_search"
|
||||||
|
android:actionLayout="@layout/actionview_search"
|
||||||
|
android:icon="@drawable/ic_action_search"
|
||||||
|
android:showAsAction="collapseActionView|always"
|
||||||
|
android:title="@string/search"/>
|
||||||
|
</menu>
|
@ -2,47 +2,44 @@
|
|||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_add"
|
android:id="@+id/action_add"
|
||||||
android:orderInCategory="10"
|
|
||||||
android:icon="@drawable/ic_action_new"
|
android:icon="@drawable/ic_action_new"
|
||||||
|
android:orderInCategory="10"
|
||||||
android:showAsAction="always"
|
android:showAsAction="always"
|
||||||
android:title="@string/action_add" />
|
android:title="@string/action_add"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_security"
|
android:id="@+id/action_security"
|
||||||
|
android:icon="@drawable/ic_action_not_secure"
|
||||||
android:orderInCategory="20"
|
android:orderInCategory="20"
|
||||||
android:showAsAction="always"
|
android:showAsAction="always"
|
||||||
android:icon="@drawable/ic_action_not_secure"
|
android:title="@string/action_secure"/>
|
||||||
android:title="@string/action_secure" />
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_attach_file"
|
android:id="@+id/action_attach_file"
|
||||||
|
android:icon="@drawable/ic_action_new_attachment"
|
||||||
android:orderInCategory="30"
|
android:orderInCategory="30"
|
||||||
android:showAsAction="always"
|
android:showAsAction="always"
|
||||||
android:icon="@drawable/ic_action_new_attachment"
|
android:title="@string/attach_file"/>
|
||||||
android:title="@string/attach_file" />
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_contact_details"
|
android:id="@+id/action_contact_details"
|
||||||
android:orderInCategory="40"
|
android:orderInCategory="40"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/action_contact_details" />
|
android:title="@string/action_contact_details"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_muc_details"
|
android:id="@+id/action_muc_details"
|
||||||
|
android:icon="@drawable/ic_action_group"
|
||||||
android:orderInCategory="40"
|
android:orderInCategory="40"
|
||||||
android:showAsAction="ifRoom"
|
android:showAsAction="ifRoom"
|
||||||
android:icon="@drawable/ic_action_group"
|
android:title="@string/action_muc_details"/>
|
||||||
android:title="@string/action_muc_details" />
|
<item
|
||||||
<item
|
|
||||||
android:id="@+id/action_invite"
|
android:id="@+id/action_invite"
|
||||||
|
android:orderInCategory="45"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/invite_contacts" />
|
android:title="@string/invite_contact"/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_archive"
|
android:id="@+id/action_archive"
|
||||||
android:orderInCategory="50"
|
android:orderInCategory="50"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/action_end_conversation"/>
|
android:title="@string/action_end_conversation"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_clear_history"
|
android:id="@+id/action_clear_history"
|
||||||
android:orderInCategory="60"
|
android:orderInCategory="60"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
@ -51,13 +48,11 @@
|
|||||||
android:id="@+id/action_accounts"
|
android:id="@+id/action_accounts"
|
||||||
android:orderInCategory="90"
|
android:orderInCategory="90"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/action_accounts"
|
android:title="@string/action_accounts"/>
|
||||||
/>
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_settings"
|
android:id="@+id/action_settings"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/action_settings"/>
|
android:title="@string/action_settings"/>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
@ -47,10 +47,7 @@
|
|||||||
<string name="show_otr_key">OTR fingerprint</string>
|
<string name="show_otr_key">OTR fingerprint</string>
|
||||||
<string name="no_otr_fingerprint">No OTR Fingerprint generated. Just go ahead an start an encrypted conversation</string>
|
<string name="no_otr_fingerprint">No OTR Fingerprint generated. Just go ahead an start an encrypted conversation</string>
|
||||||
<string name="start_conversation">Start Conversation</string>
|
<string name="start_conversation">Start Conversation</string>
|
||||||
<string name="invite_contacts">Invite Contacts</string>
|
<string name="invite_contact">Invite Contact</string>
|
||||||
<string name="invite_contacts_to_existing">Invite to existing conference</string>
|
|
||||||
<string name="new_conference">Create new conference</string>
|
|
||||||
<string name="new_contact">Create new contact</string>
|
|
||||||
<string name="contacts">Contacts</string>
|
<string name="contacts">Contacts</string>
|
||||||
<string name="search_jabber_id">Search or enter Jabber ID</string>
|
<string name="search_jabber_id">Search or enter Jabber ID</string>
|
||||||
<string name="choose_account">Choose account</string>
|
<string name="choose_account">Choose account</string>
|
||||||
@ -272,4 +269,5 @@
|
|||||||
<string name="bookmark_already_exists">This bookmark already exists</string>
|
<string name="bookmark_already_exists">This bookmark already exists</string>
|
||||||
<string name="you">You</string>
|
<string name="you">You</string>
|
||||||
<string name="action_edit_subject">Edit conference subject</string>
|
<string name="action_edit_subject">Edit conference subject</string>
|
||||||
|
<string name="title_activity_choose_contact">Choose contact</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -220,10 +220,13 @@ public class MessageParser extends AbstractParser implements
|
|||||||
} else if (packet.hasChild("x")) {
|
} else if (packet.hasChild("x")) {
|
||||||
Element x = packet.findChild("x");
|
Element x = packet.findChild("x");
|
||||||
if (x.hasChild("invite")) {
|
if (x.hasChild("invite")) {
|
||||||
mXmppConnectionService
|
Conversation conversation = mXmppConnectionService
|
||||||
.findOrCreateConversation(account,
|
.findOrCreateConversation(account,
|
||||||
packet.getAttribute("from"), true);
|
packet.getAttribute("from"), true);
|
||||||
mXmppConnectionService.updateConversationUi();
|
if (!conversation.getMucOptions().online()) {
|
||||||
|
mXmppConnectionService.joinMuc(conversation);
|
||||||
|
mXmppConnectionService.updateConversationUi();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1189,21 +1189,18 @@ public class XmppConnectionService extends Service {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inviteToConference(Conversation conversation,
|
public void inviteToConference(Conversation conversation, String contactJid) {
|
||||||
List<Contact> contacts) {
|
Account account = conversation.getAccount();
|
||||||
for (Contact contact : contacts) {
|
MessagePacket packet = new MessagePacket();
|
||||||
MessagePacket packet = new MessagePacket();
|
packet.setTo(conversation.getContactJid().split("/")[0]);
|
||||||
packet.setTo(conversation.getContactJid().split("/")[0]);
|
packet.setFrom(account.getFullJid());
|
||||||
packet.setFrom(conversation.getAccount().getFullJid());
|
Element x = new Element("x");
|
||||||
Element x = new Element("x");
|
x.setAttribute("xmlns", "http://jabber.org/protocol/muc#user");
|
||||||
x.setAttribute("xmlns", "http://jabber.org/protocol/muc#user");
|
Element invite = new Element("invite");
|
||||||
Element invite = new Element("invite");
|
invite.setAttribute("to", contactJid);
|
||||||
invite.setAttribute("to", contact.getJid());
|
x.addChild(invite);
|
||||||
x.addChild(invite);
|
packet.addChild(x);
|
||||||
packet.addChild(x);
|
sendMessagePacket(account,packet);
|
||||||
Log.d(LOGTAG, packet.toString());
|
|
||||||
sendMessagePacket(conversation.getAccount(),packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1273,6 +1270,15 @@ public class XmppConnectionService extends Service {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Conversation findConversationByUuid(String uuid) {
|
||||||
|
for (Conversation conversation : getConversations()) {
|
||||||
|
if (conversation.getUuid().equals(uuid)) {
|
||||||
|
return conversation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void markRead(Conversation conversation) {
|
public void markRead(Conversation conversation) {
|
||||||
conversation.markRead();
|
conversation.markRead();
|
||||||
|
140
src/eu/siacs/conversations/ui/ChooseContactActivity.java
Normal file
140
src/eu/siacs/conversations/ui/ChooseContactActivity.java
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
package eu.siacs.conversations.ui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import eu.siacs.conversations.R;
|
||||||
|
import eu.siacs.conversations.entities.Account;
|
||||||
|
import eu.siacs.conversations.entities.Contact;
|
||||||
|
import eu.siacs.conversations.entities.ListItem;
|
||||||
|
import eu.siacs.conversations.ui.adapter.ListItemAdapter;
|
||||||
|
|
||||||
|
public class ChooseContactActivity extends XmppActivity {
|
||||||
|
|
||||||
|
private ListView mListView;
|
||||||
|
private ArrayList<ListItem> contacts = new ArrayList<ListItem>();
|
||||||
|
private ArrayAdapter<ListItem> mContactsAdapter;
|
||||||
|
|
||||||
|
private EditText mSearchEditText;
|
||||||
|
|
||||||
|
private TextWatcher mSearchTextWatcher = new TextWatcher() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable editable) {
|
||||||
|
filterContacts(editable.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||||
|
int after) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before,
|
||||||
|
int count) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private MenuItem.OnActionExpandListener mOnActionExpandListener = new MenuItem.OnActionExpandListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||||
|
mSearchEditText.post(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mSearchEditText.requestFocus();
|
||||||
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.showSoftInput(mSearchEditText,
|
||||||
|
InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||||
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.hideSoftInputFromWindow(mSearchEditText.getWindowToken(),
|
||||||
|
InputMethodManager.HIDE_IMPLICIT_ONLY);
|
||||||
|
mSearchEditText.setText("");
|
||||||
|
filterContacts(null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_choose_contact);
|
||||||
|
mListView = (ListView) findViewById(R.id.choose_contact_list);
|
||||||
|
mContactsAdapter = new ListItemAdapter(getApplicationContext(), contacts);
|
||||||
|
mListView.setAdapter(mContactsAdapter);
|
||||||
|
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
|
||||||
|
long arg3) {
|
||||||
|
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.hideSoftInputFromWindow(mSearchEditText.getWindowToken(),
|
||||||
|
InputMethodManager.HIDE_IMPLICIT_ONLY);
|
||||||
|
Intent request = getIntent();
|
||||||
|
Intent data = new Intent();
|
||||||
|
data.putExtra("contact",contacts.get(position).getJid());
|
||||||
|
data.putExtra("account",request.getStringExtra("account"));
|
||||||
|
data.putExtra("conversation",request.getStringExtra("conversation"));
|
||||||
|
setResult(RESULT_OK, data);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.choose_contact, menu);
|
||||||
|
MenuItem menuSearchView = (MenuItem) menu.findItem(R.id.action_search);
|
||||||
|
View mSearchView = menuSearchView.getActionView();
|
||||||
|
mSearchEditText = (EditText) mSearchView
|
||||||
|
.findViewById(R.id.search_field);
|
||||||
|
mSearchEditText.addTextChangedListener(mSearchTextWatcher);
|
||||||
|
menuSearchView.setOnActionExpandListener(mOnActionExpandListener);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void onBackendConnected() {
|
||||||
|
filterContacts(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void filterContacts(String needle) {
|
||||||
|
this.contacts.clear();
|
||||||
|
for (Account account : xmppConnectionService.getAccounts()) {
|
||||||
|
if (account.getStatus() != Account.STATUS_DISABLED) {
|
||||||
|
for (Contact contact : account.getRoster().getContacts()) {
|
||||||
|
if (contact.showInRoster() && contact.match(needle)) {
|
||||||
|
this.contacts.add(contact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.sort(this.contacts);
|
||||||
|
mContactsAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -31,7 +31,7 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class MucDetailsActivity extends XmppActivity {
|
public class ConferenceDetailsActivity extends XmppActivity {
|
||||||
public static final String ACTION_VIEW_MUC = "view_muc";
|
public static final String ACTION_VIEW_MUC = "view_muc";
|
||||||
private Conversation conversation;
|
private Conversation conversation;
|
||||||
private TextView mYourNick;
|
private TextView mYourNick;
|
||||||
@ -48,12 +48,7 @@ public class MucDetailsActivity extends XmppActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
/*
|
inviteToConversation(conversation);
|
||||||
* Intent intent = new Intent(getApplicationContext(),
|
|
||||||
* ContactsActivity.class); intent.setAction("invite");
|
|
||||||
* intent.putExtra("uuid",conversation.getUuid());
|
|
||||||
* startActivity(intent);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -155,11 +150,7 @@ public class MucDetailsActivity extends XmppActivity {
|
|||||||
this.uuid = getIntent().getExtras().getString("uuid");
|
this.uuid = getIntent().getExtras().getString("uuid");
|
||||||
}
|
}
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
for (Conversation mConv : xmppConnectionService.getConversations()) {
|
this.conversation = xmppConnectionService.findConversationByUuid(uuid);
|
||||||
if (mConv.getUuid().equals(uuid)) {
|
|
||||||
this.conversation = mConv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.conversation != null) {
|
if (this.conversation != null) {
|
||||||
populateView();
|
populateView();
|
||||||
}
|
}
|
||||||
@ -188,11 +179,11 @@ public class MucDetailsActivity extends XmppActivity {
|
|||||||
public void run() {
|
public void run() {
|
||||||
populateView();
|
populateView();
|
||||||
if (success) {
|
if (success) {
|
||||||
Toast.makeText(MucDetailsActivity.this,
|
Toast.makeText(ConferenceDetailsActivity.this,
|
||||||
getString(R.string.your_nick_has_been_changed),
|
getString(R.string.your_nick_has_been_changed),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(MucDetailsActivity.this,
|
Toast.makeText(ConferenceDetailsActivity.this,
|
||||||
getString(R.string.nick_in_use),
|
getString(R.string.nick_in_use),
|
||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
@ -21,7 +21,6 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.QuickContactBadge;
|
import android.widget.QuickContactBadge;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -45,7 +44,6 @@ public class ContactDetailsActivity extends XmppActivity {
|
|||||||
private String accountJid;
|
private String accountJid;
|
||||||
private String contactJid;
|
private String contactJid;
|
||||||
|
|
||||||
private EditText name;
|
|
||||||
private TextView contactJidTv;
|
private TextView contactJidTv;
|
||||||
private TextView accountJidTv;
|
private TextView accountJidTv;
|
||||||
private TextView status;
|
private TextView status;
|
||||||
@ -63,16 +61,6 @@ public class ContactDetailsActivity extends XmppActivity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private DialogInterface.OnClickListener editContactNameListener = new DialogInterface.OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
contact.setServerName(name.getText().toString());
|
|
||||||
activity.xmppConnectionService.pushContactToServer(contact);
|
|
||||||
populateView();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private DialogInterface.OnClickListener addToPhonebook = new DialogInterface.OnClickListener() {
|
private DialogInterface.OnClickListener addToPhonebook = new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,7 +98,7 @@ public class ConversationActivity extends XmppActivity {
|
|||||||
swapConversationFragment();
|
swapConversationFragment();
|
||||||
} else {
|
} else {
|
||||||
startActivity(new Intent(getApplicationContext(),
|
startActivity(new Intent(getApplicationContext(),
|
||||||
StartConversation.class));
|
StartConversationActivity.class));
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,23 +306,26 @@ public class ConversationActivity extends XmppActivity {
|
|||||||
.findItem(R.id.action_muc_details);
|
.findItem(R.id.action_muc_details);
|
||||||
MenuItem menuContactDetails = (MenuItem) menu
|
MenuItem menuContactDetails = (MenuItem) menu
|
||||||
.findItem(R.id.action_contact_details);
|
.findItem(R.id.action_contact_details);
|
||||||
MenuItem menuInviteContacts = (MenuItem) menu
|
|
||||||
.findItem(R.id.action_invite);
|
|
||||||
MenuItem menuAttach = (MenuItem) menu.findItem(R.id.action_attach_file);
|
MenuItem menuAttach = (MenuItem) menu.findItem(R.id.action_attach_file);
|
||||||
MenuItem menuClearHistory = (MenuItem) menu
|
MenuItem menuClearHistory = (MenuItem) menu
|
||||||
.findItem(R.id.action_clear_history);
|
.findItem(R.id.action_clear_history);
|
||||||
|
MenuItem menuManageAccounts = (MenuItem) menu.findItem(R.id.action_accounts);
|
||||||
|
MenuItem menuSettings = (MenuItem) menu.findItem(R.id.action_settings);
|
||||||
|
MenuItem menuAdd = (MenuItem) menu.findItem(R.id.action_add);
|
||||||
|
MenuItem menuInviteContact = (MenuItem) menu.findItem(R.id.action_invite);
|
||||||
|
|
||||||
if ((spl.isOpen() && (spl.isSlideable()))) {
|
if ((spl.isOpen() && (spl.isSlideable()))) {
|
||||||
menuArchive.setVisible(false);
|
menuArchive.setVisible(false);
|
||||||
menuMucDetails.setVisible(false);
|
menuMucDetails.setVisible(false);
|
||||||
menuContactDetails.setVisible(false);
|
menuContactDetails.setVisible(false);
|
||||||
menuSecure.setVisible(false);
|
menuSecure.setVisible(false);
|
||||||
menuInviteContacts.setVisible(false);
|
menuInviteContact.setVisible(false);
|
||||||
menuAttach.setVisible(false);
|
menuAttach.setVisible(false);
|
||||||
menuClearHistory.setVisible(false);
|
menuClearHistory.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
((MenuItem) menu.findItem(R.id.action_add)).setVisible(!spl
|
menuAdd.setVisible(!spl.isSlideable());
|
||||||
.isSlideable());
|
menuSettings.setVisible(!spl.isSlideable());
|
||||||
|
menuManageAccounts.setVisible(!spl.isSlideable());
|
||||||
if (this.getSelectedConversation() != null) {
|
if (this.getSelectedConversation() != null) {
|
||||||
if (this.getSelectedConversation().getLatestMessage()
|
if (this.getSelectedConversation().getLatestMessage()
|
||||||
.getEncryption() != Message.ENCRYPTION_NONE) {
|
.getEncryption() != Message.ENCRYPTION_NONE) {
|
||||||
@ -333,7 +336,7 @@ public class ConversationActivity extends XmppActivity {
|
|||||||
menuAttach.setVisible(false);
|
menuAttach.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
menuMucDetails.setVisible(false);
|
menuMucDetails.setVisible(false);
|
||||||
menuInviteContacts.setVisible(false);
|
menuInviteContact.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -458,7 +461,7 @@ public class ConversationActivity extends XmppActivity {
|
|||||||
attachFilePopup.show();
|
attachFilePopup.show();
|
||||||
break;
|
break;
|
||||||
case R.id.action_add:
|
case R.id.action_add:
|
||||||
startActivity(new Intent(this, StartConversation.class));
|
startActivity(new Intent(this, StartConversationActivity.class));
|
||||||
break;
|
break;
|
||||||
case R.id.action_archive:
|
case R.id.action_archive:
|
||||||
this.endConversation(getSelectedConversation());
|
this.endConversation(getSelectedConversation());
|
||||||
@ -472,17 +475,13 @@ public class ConversationActivity extends XmppActivity {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.action_muc_details:
|
case R.id.action_muc_details:
|
||||||
Intent intent = new Intent(this, MucDetailsActivity.class);
|
Intent intent = new Intent(this, ConferenceDetailsActivity.class);
|
||||||
intent.setAction(MucDetailsActivity.ACTION_VIEW_MUC);
|
intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
|
||||||
intent.putExtra("uuid", getSelectedConversation().getUuid());
|
intent.putExtra("uuid", getSelectedConversation().getUuid());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
case R.id.action_invite:
|
case R.id.action_invite:
|
||||||
/*Intent inviteIntent = new Intent(getApplicationContext(),
|
inviteToConversation(getSelectedConversation());
|
||||||
ContactsActivity.class);
|
|
||||||
inviteIntent.setAction("invite");
|
|
||||||
inviteIntent.putExtra("uuid", getSelectedConversation().getUuid());
|
|
||||||
startActivity(inviteIntent);*/
|
|
||||||
break;
|
break;
|
||||||
case R.id.action_security:
|
case R.id.action_security:
|
||||||
final Conversation conversation = getSelectedConversation();
|
final Conversation conversation = getSelectedConversation();
|
||||||
@ -699,7 +698,7 @@ public class ConversationActivity extends XmppActivity {
|
|||||||
finish();
|
finish();
|
||||||
} else if (conversationList.size() <= 0) {
|
} else if (conversationList.size() <= 0) {
|
||||||
// add no history
|
// add no history
|
||||||
startActivity(new Intent(this, StartConversation.class));
|
startActivity(new Intent(this, StartConversationActivity.class));
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
spl.openPane();
|
spl.openPane();
|
||||||
|
@ -12,9 +12,9 @@ import eu.siacs.conversations.entities.Contact;
|
|||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.entities.MucOptions;
|
import eu.siacs.conversations.entities.MucOptions;
|
||||||
import eu.siacs.conversations.entities.MucOptions.OnRenameListener;
|
|
||||||
import eu.siacs.conversations.services.ImageProvider;
|
import eu.siacs.conversations.services.ImageProvider;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
|
import eu.siacs.conversations.ui.XmppActivity.OnPresenceSelected;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
import eu.siacs.conversations.xmpp.jingle.JingleConnection;
|
import eu.siacs.conversations.xmpp.jingle.JingleConnection;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
@ -118,8 +118,8 @@ public class ConversationFragment extends Fragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(getActivity(), MucDetailsActivity.class);
|
Intent intent = new Intent(getActivity(), ConferenceDetailsActivity.class);
|
||||||
intent.setAction(MucDetailsActivity.ACTION_VIEW_MUC);
|
intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
|
||||||
intent.putExtra("uuid", conversation.getUuid());
|
intent.putExtra("uuid", conversation.getUuid());
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.utils.KnownHostsAdapter;
|
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
|
||||||
import eu.siacs.conversations.utils.Validator;
|
import eu.siacs.conversations.utils.Validator;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@ -21,7 +21,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class EditAccount extends DialogFragment {
|
public class EditAccountDialog extends DialogFragment {
|
||||||
|
|
||||||
protected Account account;
|
protected Account account;
|
||||||
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
|
import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
|
||||||
import eu.siacs.conversations.ui.EditAccount.EditAccountListener;
|
import eu.siacs.conversations.ui.EditAccountDialog.EditAccountListener;
|
||||||
import eu.siacs.conversations.xmpp.OnTLSExceptionReceived;
|
import eu.siacs.conversations.xmpp.OnTLSExceptionReceived;
|
||||||
import eu.siacs.conversations.xmpp.XmppConnection;
|
import eu.siacs.conversations.xmpp.XmppConnection;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -221,7 +221,7 @@ public class ManageAccountActivity extends XmppActivity {
|
|||||||
} else if (account.getStatus() == Account.STATUS_ONLINE) {
|
} else if (account.getStatus() == Account.STATUS_ONLINE) {
|
||||||
activity.startActivity(new Intent(activity
|
activity.startActivity(new Intent(activity
|
||||||
.getApplicationContext(),
|
.getApplicationContext(),
|
||||||
StartConversation.class));
|
StartConversationActivity.class));
|
||||||
} else if (account.getStatus() != Account.STATUS_DISABLED) {
|
} else if (account.getStatus() != Account.STATUS_DISABLED) {
|
||||||
editAccount(account);
|
editAccount(account);
|
||||||
}
|
}
|
||||||
@ -513,7 +513,7 @@ public class ManageAccountActivity extends XmppActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onNavigateUp() {
|
public boolean onNavigateUp() {
|
||||||
if (xmppConnectionService.getConversations().size() == 0) {
|
if (xmppConnectionService.getConversations().size() == 0) {
|
||||||
Intent contactsIntent = new Intent(this, StartConversation.class);
|
Intent contactsIntent = new Intent(this, StartConversationActivity.class);
|
||||||
contactsIntent.setFlags(
|
contactsIntent.setFlags(
|
||||||
// if activity exists in stack, pop the stack and go back to it
|
// if activity exists in stack, pop the stack and go back to it
|
||||||
Intent.FLAG_ACTIVITY_CLEAR_TOP |
|
Intent.FLAG_ACTIVITY_CLEAR_TOP |
|
||||||
@ -531,7 +531,7 @@ public class ManageAccountActivity extends XmppActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void editAccount(Account account) {
|
private void editAccount(Account account) {
|
||||||
EditAccount dialog = new EditAccount();
|
EditAccountDialog dialog = new EditAccountDialog();
|
||||||
dialog.setAccount(account);
|
dialog.setAccount(account);
|
||||||
dialog.setEditAccountListener(new EditAccountListener() {
|
dialog.setEditAccountListener(new EditAccountListener() {
|
||||||
|
|
||||||
@ -550,7 +550,7 @@ public class ManageAccountActivity extends XmppActivity {
|
|||||||
|
|
||||||
protected void addAccount() {
|
protected void addAccount() {
|
||||||
final Activity activity = this;
|
final Activity activity = this;
|
||||||
EditAccount dialog = new EditAccount();
|
EditAccountDialog dialog = new EditAccountDialog();
|
||||||
dialog.setEditAccountListener(new EditAccountListener() {
|
dialog.setEditAccountListener(new EditAccountListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
package eu.siacs.conversations.ui;
|
|
||||||
|
|
||||||
public interface OnPresenceSelected {
|
|
||||||
public void onPresenceSelected();
|
|
||||||
}
|
|
@ -21,11 +21,9 @@ import android.text.Editable;
|
|||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
@ -34,20 +32,19 @@ import android.widget.ArrayAdapter;
|
|||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Bookmark;
|
import eu.siacs.conversations.entities.Bookmark;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.ListItem;
|
import eu.siacs.conversations.entities.ListItem;
|
||||||
import eu.siacs.conversations.utils.KnownHostsAdapter;
|
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
|
||||||
|
import eu.siacs.conversations.ui.adapter.ListItemAdapter;
|
||||||
import eu.siacs.conversations.utils.Validator;
|
import eu.siacs.conversations.utils.Validator;
|
||||||
|
|
||||||
public class StartConversation extends XmppActivity {
|
public class StartConversationActivity extends XmppActivity {
|
||||||
|
|
||||||
private Tab mContactsTab;
|
private Tab mContactsTab;
|
||||||
private Tab mConferencesTab;
|
private Tab mConferencesTab;
|
||||||
@ -176,7 +173,7 @@ public class StartConversation extends XmppActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mConferenceAdapter = new ListItemAdapter(conferences);
|
mConferenceAdapter = new ListItemAdapter(getApplicationContext(),conferences);
|
||||||
mConferenceListFragment.setListAdapter(mConferenceAdapter);
|
mConferenceListFragment.setListAdapter(mConferenceAdapter);
|
||||||
mConferenceListFragment.setContextMenu(R.menu.conference_context);
|
mConferenceListFragment.setContextMenu(R.menu.conference_context);
|
||||||
mConferenceListFragment
|
mConferenceListFragment
|
||||||
@ -189,7 +186,7 @@ public class StartConversation extends XmppActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mContactsAdapter = new ListItemAdapter(contacts);
|
mContactsAdapter = new ListItemAdapter(getApplicationContext(),contacts);
|
||||||
mContactsListFragment.setListAdapter(mContactsAdapter);
|
mContactsListFragment.setListAdapter(mContactsAdapter);
|
||||||
mContactsListFragment.setContextMenu(R.menu.contact_context);
|
mContactsListFragment.setContextMenu(R.menu.contact_context);
|
||||||
mContactsListFragment
|
mContactsListFragment
|
||||||
@ -502,33 +499,6 @@ public class StartConversation extends XmppActivity {
|
|||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ListItemAdapter extends ArrayAdapter<ListItem> {
|
|
||||||
|
|
||||||
public ListItemAdapter(List<ListItem> objects) {
|
|
||||||
super(getApplicationContext(), 0, objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View getView(int position, View view, ViewGroup parent) {
|
|
||||||
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
ListItem item = getItem(position);
|
|
||||||
if (view == null) {
|
|
||||||
view = (View) inflater.inflate(R.layout.contact, null);
|
|
||||||
}
|
|
||||||
TextView name = (TextView) view
|
|
||||||
.findViewById(R.id.contact_display_name);
|
|
||||||
TextView jid = (TextView) view.findViewById(R.id.contact_jid);
|
|
||||||
ImageView picture = (ImageView) view
|
|
||||||
.findViewById(R.id.contact_photo);
|
|
||||||
|
|
||||||
jid.setText(item.getJid());
|
|
||||||
name.setText(item.getDisplayName());
|
|
||||||
picture.setImageBitmap(item.getImage(48, getApplicationContext()));
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class MyListFragment extends ListFragment {
|
public static class MyListFragment extends ListFragment {
|
||||||
private AdapterView.OnItemClickListener mOnItemClickListener;
|
private AdapterView.OnItemClickListener mOnItemClickListener;
|
||||||
private int mResContextMenu;
|
private int mResContextMenu;
|
||||||
@ -558,7 +528,7 @@ public class StartConversation extends XmppActivity {
|
|||||||
public void onCreateContextMenu(ContextMenu menu, View v,
|
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||||
ContextMenuInfo menuInfo) {
|
ContextMenuInfo menuInfo) {
|
||||||
super.onCreateContextMenu(menu, v, menuInfo);
|
super.onCreateContextMenu(menu, v, menuInfo);
|
||||||
StartConversation activity = (StartConversation) getActivity();
|
StartConversationActivity activity = (StartConversationActivity) getActivity();
|
||||||
activity.getMenuInflater().inflate(mResContextMenu, menu);
|
activity.getMenuInflater().inflate(mResContextMenu, menu);
|
||||||
AdapterView.AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;
|
AdapterView.AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;
|
||||||
if (mResContextMenu == R.menu.conference_context) {
|
if (mResContextMenu == R.menu.conference_context) {
|
||||||
@ -570,7 +540,7 @@ public class StartConversation extends XmppActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextItemSelected(MenuItem item) {
|
public boolean onContextItemSelected(MenuItem item) {
|
||||||
StartConversation activity = (StartConversation) getActivity();
|
StartConversationActivity activity = (StartConversationActivity) getActivity();
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.context_start_conversation:
|
case R.id.context_start_conversation:
|
||||||
activity.openConversationForContact();
|
activity.openConversationForContact();
|
@ -23,6 +23,7 @@ import android.content.ServiceConnection;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
@ -31,6 +32,7 @@ import android.widget.EditText;
|
|||||||
public abstract class XmppActivity extends Activity {
|
public abstract class XmppActivity extends Activity {
|
||||||
|
|
||||||
public static final int REQUEST_ANNOUNCE_PGP = 0x73731;
|
public static final int REQUEST_ANNOUNCE_PGP = 0x73731;
|
||||||
|
protected static final int REQUEST_INVITE_TO_CONVERSATION = 0x341830;
|
||||||
|
|
||||||
protected final static String LOGTAG = "xmppService";
|
protected final static String LOGTAG = "xmppService";
|
||||||
|
|
||||||
@ -41,6 +43,10 @@ public abstract class XmppActivity extends Activity {
|
|||||||
protected interface OnValueEdited {
|
protected interface OnValueEdited {
|
||||||
public void onValueEdited(String value);
|
public void onValueEdited(String value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface OnPresenceSelected {
|
||||||
|
public void onPresenceSelected();
|
||||||
|
}
|
||||||
|
|
||||||
protected ServiceConnection mConnection = new ServiceConnection() {
|
protected ServiceConnection mConnection = new ServiceConnection() {
|
||||||
|
|
||||||
@ -187,6 +193,12 @@ public abstract class XmppActivity extends Activity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void inviteToConversation(Conversation conversation) {
|
||||||
|
Intent intent = new Intent(getApplicationContext(), ChooseContactActivity.class);
|
||||||
|
intent.putExtra("conversation",conversation.getUuid());
|
||||||
|
startActivityForResult(intent, REQUEST_INVITE_TO_CONVERSATION);
|
||||||
|
}
|
||||||
|
|
||||||
protected void announcePgp(Account account, final Conversation conversation) {
|
protected void announcePgp(Account account, final Conversation conversation) {
|
||||||
xmppConnectionService.getPgpEngine().generateSignature(account,
|
xmppConnectionService.getPgpEngine().generateSignature(account,
|
||||||
"online", new UiCallback<Account>() {
|
"online", new UiCallback<Account>() {
|
||||||
@ -328,4 +340,18 @@ public abstract class XmppActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode,
|
||||||
|
final Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
if (requestCode == REQUEST_INVITE_TO_CONVERSATION && resultCode == RESULT_OK) {
|
||||||
|
String contactJid = data.getStringExtra("contact");
|
||||||
|
String conversationUuid = data.getStringExtra("conversation");
|
||||||
|
Conversation conversation = xmppConnectionService.findConversationByUuid(conversationUuid);
|
||||||
|
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
||||||
|
xmppConnectionService.inviteToConference(conversation, contactJid);
|
||||||
|
}
|
||||||
|
Log.d("xmppService","inviting "+contactJid+" to "+conversation.getName(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package eu.siacs.conversations.utils;
|
package eu.siacs.conversations.ui.adapter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -42,7 +42,7 @@ public class KnownHostsAdapter extends ArrayAdapter<String> {
|
|||||||
@Override
|
@Override
|
||||||
protected void publishResults(CharSequence constraint,
|
protected void publishResults(CharSequence constraint,
|
||||||
FilterResults results) {
|
FilterResults results) {
|
||||||
ArrayList<String> filteredList = ((ArrayList<String>) results.values);
|
ArrayList<String> filteredList = (ArrayList<String>) results.values;
|
||||||
if (results != null && results.count > 0) {
|
if (results != null && results.count > 0) {
|
||||||
clear();
|
clear();
|
||||||
for (String c : filteredList) {
|
for (String c : filteredList) {
|
39
src/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
Normal file
39
src/eu/siacs/conversations/ui/adapter/ListItemAdapter.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package eu.siacs.conversations.ui.adapter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.R;
|
||||||
|
import eu.siacs.conversations.entities.ListItem;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class ListItemAdapter extends ArrayAdapter<ListItem> {
|
||||||
|
|
||||||
|
public ListItemAdapter(Context context, List<ListItem> objects) {
|
||||||
|
super(context, 0, objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View view, ViewGroup parent) {
|
||||||
|
LayoutInflater inflater = (LayoutInflater) getContext()
|
||||||
|
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
ListItem item = getItem(position);
|
||||||
|
if (view == null) {
|
||||||
|
view = (View) inflater.inflate(R.layout.contact, null);
|
||||||
|
}
|
||||||
|
TextView name = (TextView) view.findViewById(R.id.contact_display_name);
|
||||||
|
TextView jid = (TextView) view.findViewById(R.id.contact_jid);
|
||||||
|
ImageView picture = (ImageView) view.findViewById(R.id.contact_photo);
|
||||||
|
|
||||||
|
jid.setText(item.getJid());
|
||||||
|
name.setText(item.getDisplayName());
|
||||||
|
picture.setImageBitmap(item.getImage(48, getContext()));
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -13,7 +13,6 @@ import eu.siacs.conversations.R;
|
|||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.ListItem;
|
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.entities.MucOptions.User;
|
import eu.siacs.conversations.entities.MucOptions.User;
|
||||||
import eu.siacs.conversations.ui.ConversationActivity;
|
import eu.siacs.conversations.ui.ConversationActivity;
|
||||||
|
Loading…
Reference in New Issue
Block a user