use of org.awesomeapp.messenger.tasks.ChatSessionInitTask in project Zom-Android by zom.
the class ImUrlActivity method startChat.
public void startChat(long providerId, long accountId, String username, final boolean openChat) {
if (username != null)
new ChatSessionInitTask(((ImApp) getApplication()), providerId, accountId, Imps.Contacts.TYPE_NORMAL, true) {
@Override
protected void onPostExecute(Long chatId) {
if (chatId != -1 && openChat) {
Intent intent = new Intent(ImUrlActivity.this, ConversationDetailActivity.class);
intent.putExtra("id", chatId);
startActivity(intent);
}
finish();
super.onPostExecute(chatId);
}
}.executeOnExecutor(ImApp.sThreadPoolExecutor, new Contact(new XmppAddress(username)));
}
use of org.awesomeapp.messenger.tasks.ChatSessionInitTask in project Zom-Android by zom.
the class ConversationView method startChat.
private void startChat(String username) {
if (username != null) {
new ChatSessionInitTask(((ImApp) mActivity.getApplication()), mProviderId, mAccountId, Imps.Contacts.TYPE_NORMAL, true) {
@Override
protected void onPostExecute(Long chatId) {
if (chatId != -1 && true) {
Intent intent = new Intent(mActivity, ConversationDetailActivity.class);
intent.putExtra("id", chatId);
mActivity.startActivity(intent);
}
super.onPostExecute(chatId);
}
}.executeOnExecutor(ImApp.sThreadPoolExecutor, new Contact(new XmppAddress(username)));
mActivity.finish();
}
}
use of org.awesomeapp.messenger.tasks.ChatSessionInitTask in project Zom-Android by zom.
the class ContactDisplayActivity method startChat.
public void startChat() {
if (mConn == null)
return;
try {
IChatSessionManager manager = mConn.getChatSessionManager();
if (manager != null) {
IChatSession session = manager.getChatSession(mUsername);
if (session == null) {
new ChatSessionInitTask(((ImApp) getApplication()), mProviderId, mAccountId, Imps.Contacts.TYPE_NORMAL, false) {
@Override
protected void onPostExecute(Long chatId) {
super.onPostExecute(chatId);
if (mContactId == -1) {
Intent intent = new Intent(ContactDisplayActivity.this, ConversationDetailActivity.class);
intent.putExtra("id", chatId);
startActivity(intent);
finish();
}
}
}.executeOnExecutor(ImApp.sThreadPoolExecutor, new Contact(new XmppAddress(mUsername)));
// Toast.makeText(this, getString(R.string.message_waiting_for_friend), Toast.LENGTH_LONG).show();
} else {
Intent intent = new Intent(ContactDisplayActivity.this, ConversationDetailActivity.class);
intent.putExtra("id", session.getId());
startActivity(intent);
finish();
}
}
} catch (RemoteException re) {
}
if (mContactId != -1) {
Intent intent = new Intent(ContactDisplayActivity.this, ConversationDetailActivity.class);
intent.putExtra("id", mContactId);
startActivity(intent);
finish();
}
}
use of org.awesomeapp.messenger.tasks.ChatSessionInitTask in project Zom-Android by zom.
the class MainActivity method startChat.
public void startChat(long providerId, long accountId, String username, final boolean openChat) {
if (username != null)
new ChatSessionInitTask(((ImApp) getApplication()), providerId, accountId, Imps.Contacts.TYPE_NORMAL, true) {
@Override
protected void onPostExecute(Long chatId) {
if (chatId != -1 && openChat) {
Intent intent = new Intent(MainActivity.this, ConversationDetailActivity.class);
intent.putExtra("id", chatId);
startActivity(intent);
}
super.onPostExecute(chatId);
}
}.executeOnExecutor(ImApp.sThreadPoolExecutor, new Contact(new XmppAddress(username)));
}
Aggregations