info about pm on muc details screen

This commit is contained in:
kosyak 2023-12-17 23:46:06 +01:00
parent 3ddf8d33f0
commit 7f7e4b10a4
8 changed files with 130 additions and 2 deletions

View file

@ -52,6 +52,7 @@ import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.MucConfiguration; import eu.siacs.conversations.ui.util.MucConfiguration;
import eu.siacs.conversations.ui.util.MucDetailsContextMenuHelper; import eu.siacs.conversations.ui.util.MucDetailsContextMenuHelper;
import eu.siacs.conversations.ui.util.MyLinkify; import eu.siacs.conversations.ui.util.MyLinkify;
import eu.siacs.conversations.ui.util.ShareUtil;
import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.Compatibility; import eu.siacs.conversations.utils.Compatibility;
@ -110,6 +111,13 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
} }
intent.putExtra("uuid", uuid); intent.putExtra("uuid", uuid);
Jid counterpart = conversation.getNextCounterpart();
if (counterpart != null) {
intent.putExtra("counterpart", counterpart.toEscapedString());
}
activity.startActivity(intent); activity.startActivity(intent);
} }
@ -510,6 +518,27 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
if (mConversation == null) { if (mConversation == null) {
return; return;
} }
String counterpart = getIntent().getStringExtra("counterpart");
if (counterpart != null) {
binding.mucPmInfo.setVisibility(View.VISIBLE);
Jid counterpartJid = Jid.of(counterpart);
binding.mucPmCounterpartName.setText(getResources().getString(R.string.muc_private_conversation_title, counterpartJid.getResource(), mConversation.getName()));
binding.mucPmCounterpartJid.setText(counterpart);
binding.mucPmCounterpartJid.setOnClickListener(v -> ShareUtil.copyJidToClipboard(ConferenceDetailsActivity.this, counterpartJid));
Conversation conversation = xmppConnectionService.find(mConversation.getAccount(), mConversation.getJid(), counterpartJid);
if (conversation != null) {
binding.mucPmCounterpartAvatar.setVisibility(View.VISIBLE);
AvatarWorkerTask.loadAvatar(conversation, binding.mucPmCounterpartAvatar, R.dimen.avatar_on_details_screen_size);
} else {
binding.mucPmCounterpartAvatar.setVisibility(View.GONE);
}
}
final MucOptions mucOptions = mConversation.getMucOptions(); final MucOptions mucOptions = mConversation.getMucOptions();
final User self = mucOptions.getSelf(); final User self = mucOptions.getSelf();
String account; String account;
@ -524,8 +553,6 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
this.binding.detailsAccount.setText(getString(R.string.using_account, account)); this.binding.detailsAccount.setText(getString(R.string.using_account, account));
if (mConversation.isPrivateAndNonAnonymous()) { if (mConversation.isPrivateAndNonAnonymous()) {
this.binding.jid.setText(getString(R.string.hosted_on, mConversation.getJid().getDomain())); this.binding.jid.setText(getString(R.string.hosted_on, mConversation.getJid().getDomain()));
} else {
this.binding.jid.setText(mConversation.getJid().asBareJid().toEscapedString());
} }
AvatarWorkerTask.loadAvatar(mConversation, binding.yourPhoto, R.dimen.avatar_on_details_screen_size); AvatarWorkerTask.loadAvatar(mConversation, binding.yourPhoto, R.dimen.avatar_on_details_screen_size);
String roomName = mucOptions.getName(); String roomName = mucOptions.getName();
@ -543,6 +570,11 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
hasTitle = false; hasTitle = false;
this.binding.mucTitle.setVisibility(View.GONE); this.binding.mucTitle.setVisibility(View.GONE);
} }
this.binding.mucJid.setText(mConversation.getJid().asBareJid().toEscapedString());
binding.mucJid.setOnClickListener(v -> ShareUtil.copyJidToClipboard(ConferenceDetailsActivity.this, mConversation.getJid().asBareJid()));
if (printableValue(subject)) { if (printableValue(subject)) {
SpannableStringBuilder spannable = new SpannableStringBuilder(subject); SpannableStringBuilder spannable = new SpannableStringBuilder(subject);
StylingHelper.format(spannable, this.binding.mucSubject.getCurrentTextColor()); StylingHelper.format(spannable, this.binding.mucSubject.getCurrentTextColor());

View file

@ -256,4 +256,10 @@ public class ShareUtil {
} }
return null; return null;
} }
public static void copyJidToClipboard(final XmppActivity activity, Jid jid) {
if (copyTextToClipboard(activity, jid.toEscapedString(), R.string.account_settings_jabber_id)) {
Toast.makeText(activity, R.string.jabber_id_copied_to_clipboard, Toast.LENGTH_SHORT).show();
}
}
} }

View file

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="12dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/black"
android:pathData="M360,720Q327,720 303.5,696.5Q280,673 280,640L280,160Q280,127 303.5,103.5Q327,80 360,80L720,80Q753,80 776.5,103.5Q800,127 800,160L800,640Q800,673 776.5,696.5Q753,720 720,720L360,720ZM360,640L720,640Q720,640 720,640Q720,640 720,640L720,160Q720,160 720,160Q720,160 720,160L360,160Q360,160 360,160Q360,160 360,160L360,640Q360,640 360,640Q360,640 360,640ZM200,880Q167,880 143.5,856.5Q120,833 120,800L120,240L200,240L200,800Q200,800 200,800Q200,800 200,800L640,800L640,880L200,880ZM360,640Q360,640 360,640Q360,640 360,640L360,160Q360,160 360,160Q360,160 360,160L360,160Q360,160 360,160Q360,160 360,160L360,640Q360,640 360,640Q360,640 360,640L360,640Z"/>
</vector>

View file

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="12dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M360,720Q327,720 303.5,696.5Q280,673 280,640L280,160Q280,127 303.5,103.5Q327,80 360,80L720,80Q753,80 776.5,103.5Q800,127 800,160L800,640Q800,673 776.5,696.5Q753,720 720,720L360,720ZM360,640L720,640Q720,640 720,640Q720,640 720,640L720,160Q720,160 720,160Q720,160 720,160L360,160Q360,160 360,160Q360,160 360,160L360,640Q360,640 360,640Q360,640 360,640ZM200,880Q167,880 143.5,856.5Q120,833 120,800L120,240L200,240L200,800Q200,800 200,800Q200,800 200,800L640,800L640,880L200,880ZM360,640Q360,640 360,640Q360,640 360,640L360,160Q360,160 360,160Q360,160 360,160L360,160Q360,160 360,160Q360,160 360,160L360,640Q360,640 360,640Q360,640 360,640L360,640Z"/>
</vector>

View file

@ -23,6 +23,61 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<androidx.cardview.widget.CardView
android:id="@+id/muc_pm_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:padding="16dp">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/muc_pm_counterpart_avatar"
android:layout_width="@dimen/avatar_on_details_screen_size"
android:layout_height="@dimen/avatar_on_details_screen_size"
app:riv_corner_radius="8dp"
android:layout_marginEnd="@dimen/avatar_item_distance"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/muc_private_conversation_info_title"
android:layout_marginBottom="4dp"
android:textAppearance="@style/TextAppearance.Conversations.Caption"/>
<TextView
android:id="@+id/muc_pm_counterpart_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Conversations.Title"/>
<TextView
android:id="@+id/muc_pm_counterpart_jid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Conversations.Caption"
android:drawablePadding="4dp"
app:drawableEndCompat="?attr/icon_copy_bar_small"/>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -80,6 +135,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Conversations.Title"/> android:textAppearance="@style/TextAppearance.Conversations.Title"/>
<TextView
android:id="@+id/muc_jid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:textAppearance="@style/TextAppearance.Conversations.Caption"
android:drawablePadding="4dp"
app:drawableEndCompat="?attr/icon_copy_bar_small" />
<TextView <TextView
android:id="@+id/muc_subject" android:id="@+id/muc_subject"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -117,6 +117,7 @@
<attr name="icon_gps_fixed" format="reference" /> <attr name="icon_gps_fixed" format="reference" />
<attr name="icon_directions" format="reference" /> <attr name="icon_directions" format="reference" />
<attr name="icon_copy_bar" format="reference" /> <attr name="icon_copy_bar" format="reference" />
<attr name="icon_copy_bar_small" format="reference" />
<attr name="icon_notifications" format="reference" /> <attr name="icon_notifications" format="reference" />
<attr name="icon_notifications_off" format="reference" /> <attr name="icon_notifications_off" format="reference" />

View file

@ -1065,6 +1065,7 @@
<string name="filter">filter</string> <string name="filter">filter</string>
<string name="could_not_create_file">could_not_create_file</string> <string name="could_not_create_file">could_not_create_file</string>
<string name="muc_private_conversation_title">%1$s (%2$s)</string> <string name="muc_private_conversation_title">%1$s (%2$s)</string>
<string name="muc_private_conversation_info_title">Private conversation with:</string>
<string name="message_selection_title">%1$d selected</string> <string name="message_selection_title">%1$d selected</string>
<string name="contact_tag_general">General</string> <string name="contact_tag_general">General</string>
<string name="contact_tag_with_total">%1$s (%2$d)</string> <string name="contact_tag_with_total">%1$s (%2$d)</string>

View file

@ -142,6 +142,7 @@
<item name="icon_gps_fixed" type="reference">@drawable/ic_gps_fixed_black_24dp</item> <item name="icon_gps_fixed" type="reference">@drawable/ic_gps_fixed_black_24dp</item>
<item name="icon_directions" type="reference">@drawable/ic_directions_black_24dp</item> <item name="icon_directions" type="reference">@drawable/ic_directions_black_24dp</item>
<item name="icon_copy_bar" type="reference">@drawable/ic_content_copy_white_24dp</item> <item name="icon_copy_bar" type="reference">@drawable/ic_content_copy_white_24dp</item>
<item name="icon_copy_bar_small" type="reference">@drawable/content_copy_12dp</item>
<item name="icon_notifications" type="reference">@drawable/ic_notifications_black_24dp <item name="icon_notifications" type="reference">@drawable/ic_notifications_black_24dp
</item> </item>
@ -309,6 +310,7 @@
<item name="icon_gps_fixed" type="reference">@drawable/ic_gps_fixed_white_24dp</item> <item name="icon_gps_fixed" type="reference">@drawable/ic_gps_fixed_white_24dp</item>
<item name="icon_directions" type="reference">@drawable/ic_directions_white_24dp</item> <item name="icon_directions" type="reference">@drawable/ic_directions_white_24dp</item>
<item name="icon_copy_bar" type="reference">@drawable/ic_content_copy_white_24dp</item> <item name="icon_copy_bar" type="reference">@drawable/ic_content_copy_white_24dp</item>
<item name="icon_copy_bar_small" type="reference">@drawable/content_copy_12dp_white</item>
<item name="icon_notifications" type="reference">@drawable/ic_notifications_white_24dp <item name="icon_notifications" type="reference">@drawable/ic_notifications_white_24dp
</item> </item>