use of eu.siacs.conversations.entities.Conversation in project Conversations by siacs.
the class ConversationsActivity method onBackendConnected.
@Override
void onBackendConnected() {
if (performRedirectIfNecessary(true)) {
return;
}
xmppConnectionService.getNotificationService().setIsInForeground(true);
Intent intent = pendingViewIntent.pop();
if (intent != null) {
if (processViewIntent(intent)) {
if (binding.secondaryFragment != null) {
notifyFragmentOfBackendConnected(R.id.main_fragment);
}
invalidateActionBarTitle();
return;
}
}
for (@IdRes int id : FRAGMENT_ID_NOTIFICATION_ORDER) {
notifyFragmentOfBackendConnected(id);
}
ActivityResult activityResult = postponedActivityResult.pop();
if (activityResult != null) {
handleActivityResult(activityResult);
}
invalidateActionBarTitle();
if (binding.secondaryFragment != null && ConversationFragment.getConversation(this) == null) {
Conversation conversation = ConversationsOverviewFragment.getSuggestion(this);
if (conversation != null) {
openConversation(conversation, null);
}
}
showDialogsIfMainIsOverview();
}
use of eu.siacs.conversations.entities.Conversation in project Conversations by siacs.
the class ConversationsActivity method invalidateActionBarTitle.
private void invalidateActionBarTitle() {
final ActionBar actionBar = getSupportActionBar();
if (actionBar == null) {
return;
}
final FragmentManager fragmentManager = getFragmentManager();
final Fragment mainFragment = fragmentManager.findFragmentById(R.id.main_fragment);
if (mainFragment instanceof ConversationFragment) {
final Conversation conversation = ((ConversationFragment) mainFragment).getConversation();
if (conversation != null) {
actionBar.setTitle(EmojiWrapper.transform(conversation.getName()));
actionBar.setDisplayHomeAsUpEnabled(true);
ActionBarUtil.setActionBarOnClickListener(binding.toolbar, (v) -> openConversationDetails(conversation));
return;
}
}
actionBar.setTitle(R.string.app_name);
actionBar.setDisplayHomeAsUpEnabled(false);
ActionBarUtil.resetActionBarOnClickListeners(binding.toolbar);
}
use of eu.siacs.conversations.entities.Conversation in project Conversations by siacs.
the class ConversationsActivity method processViewIntent.
private boolean processViewIntent(Intent intent) {
final String uuid = intent.getStringExtra(EXTRA_CONVERSATION);
final Conversation conversation = uuid != null ? xmppConnectionService.findConversationByUuid(uuid) : null;
if (conversation == null) {
Log.d(Config.LOGTAG, "unable to view conversation with uuid:" + uuid);
return false;
}
openConversation(conversation, intent.getExtras());
return true;
}
use of eu.siacs.conversations.entities.Conversation in project Conversations by siacs.
the class ConversationsActivity method onConversationArchived.
@Override
public void onConversationArchived(Conversation conversation) {
if (performRedirectIfNecessary(conversation, false)) {
return;
}
final FragmentManager fragmentManager = getFragmentManager();
final Fragment mainFragment = fragmentManager.findFragmentById(R.id.main_fragment);
if (mainFragment instanceof ConversationFragment) {
try {
fragmentManager.popBackStack();
} catch (final IllegalStateException e) {
Log.w(Config.LOGTAG, "state loss while popping back state after archiving conversation", e);
// this usually means activity is no longer active; meaning on the next open we will run through this again
}
return;
}
final Fragment secondaryFragment = fragmentManager.findFragmentById(R.id.secondary_fragment);
if (secondaryFragment instanceof ConversationFragment) {
if (((ConversationFragment) secondaryFragment).getConversation() == conversation) {
Conversation suggestion = ConversationsOverviewFragment.getSuggestion(this, conversation);
if (suggestion != null) {
openConversation(suggestion, null);
}
}
}
}
use of eu.siacs.conversations.entities.Conversation in project Conversations by siacs.
the class ConversationFragment method onContactPictureClicked.
@Override
public void onContactPictureClicked(Message message) {
String fingerprint;
if (message.getEncryption() == Message.ENCRYPTION_PGP || message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
fingerprint = "pgp";
} else {
fingerprint = message.getFingerprint();
}
final boolean received = message.getStatus() <= Message.STATUS_RECEIVED;
if (received) {
if (message.getConversation() instanceof Conversation && message.getConversation().getMode() == Conversation.MODE_MULTI) {
Jid tcp = message.getTrueCounterpart();
Jid user = message.getCounterpart();
if (user != null && !user.isBareJid()) {
final MucOptions mucOptions = ((Conversation) message.getConversation()).getMucOptions();
if (mucOptions.participating() || ((Conversation) message.getConversation()).getNextCounterpart() != null) {
if (!mucOptions.isUserInRoom(user) && mucOptions.findUserByRealJid(tcp == null ? null : tcp.asBareJid()) == null) {
Toast.makeText(getActivity(), activity.getString(R.string.user_has_left_conference, user.getResource()), Toast.LENGTH_SHORT).show();
}
highlightInConference(user.getResource());
} else {
Toast.makeText(getActivity(), R.string.you_are_not_participating, Toast.LENGTH_SHORT).show();
}
}
return;
} else {
if (!message.getContact().isSelf()) {
activity.switchToContactDetails(message.getContact(), fingerprint);
return;
}
}
}
activity.switchToAccount(message.getConversation().getAccount(), fingerprint);
}
Aggregations