muc imporvements
This commit is contained in:
parent
e94aae746d
commit
07bef730aa
|
@ -10,6 +10,7 @@ import java.util.Collections;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
|
@ -493,6 +494,9 @@ public class MucOptions {
|
|||
}
|
||||
|
||||
public boolean setSubject(String subject) {
|
||||
if (!Objects.equals(getSubject(), subject)) {
|
||||
this.conversation.setAttribute("subjectTs", String.valueOf(System.currentTimeMillis()));
|
||||
}
|
||||
return this.conversation.setAttribute("subject", subject);
|
||||
}
|
||||
|
||||
|
@ -500,6 +504,27 @@ public class MucOptions {
|
|||
return this.conversation.getAttribute("subject");
|
||||
}
|
||||
|
||||
public void hideSubject() {
|
||||
String subjectTs = this.conversation.getAttribute("subjectTs");
|
||||
|
||||
if (subjectTs == null) {
|
||||
this.conversation.setAttribute("subjectTs", String.valueOf(System.currentTimeMillis() - 1));
|
||||
}
|
||||
|
||||
this.conversation.setAttribute("subjectHideTs", String.valueOf(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
public boolean subjectHidden() {
|
||||
String subjectTs = this.conversation.getAttribute("subjectTs");
|
||||
String hideTs = this.conversation.getAttribute("subjectHideTs");
|
||||
|
||||
if (subjectTs == null || hideTs == null) {
|
||||
return false;
|
||||
} else {
|
||||
return Long.parseLong(hideTs) >= Long.parseLong(subjectTs);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.conversation.getAttribute("muc_name");
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
|
|||
import eu.siacs.conversations.databinding.FragmentConversationBinding;
|
||||
import eu.siacs.conversations.entities.Account;
|
||||
import eu.siacs.conversations.entities.Blockable;
|
||||
import eu.siacs.conversations.entities.Bookmark;
|
||||
import eu.siacs.conversations.entities.Contact;
|
||||
import eu.siacs.conversations.entities.Conversation;
|
||||
import eu.siacs.conversations.entities.Conversational;
|
||||
|
@ -1369,6 +1370,7 @@ public class ConversationFragment extends XmppFragment
|
|||
public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
|
||||
menuInflater.inflate(R.menu.fragment_conversation, menu);
|
||||
final MenuItem menuMucDetails = menu.findItem(R.id.action_muc_details);
|
||||
final MenuItem menuMucParticipants = menu.findItem(R.id.action_muc_participants);
|
||||
final MenuItem menuContactDetails = menu.findItem(R.id.action_contact_details);
|
||||
final MenuItem menuInviteContact = menu.findItem(R.id.action_invite);
|
||||
final MenuItem menuMute = menu.findItem(R.id.action_mute);
|
||||
|
@ -1390,6 +1392,7 @@ public class ConversationFragment extends XmppFragment
|
|||
menuCall.setVisible(false);
|
||||
menuOngoingCall.setVisible(false);
|
||||
} else {
|
||||
menuMucParticipants.setVisible(false);
|
||||
final XmppConnectionService service =
|
||||
activity == null ? null : activity.xmppConnectionService;
|
||||
final Optional<OngoingRtpSession> ongoingRtpSession =
|
||||
|
@ -2028,6 +2031,11 @@ public class ConversationFragment extends XmppFragment
|
|||
case R.id.action_muc_details:
|
||||
ConferenceDetailsActivity.open(activity, conversation);
|
||||
break;
|
||||
case R.id.action_muc_participants:
|
||||
Intent intent = new Intent(activity, MucUsersActivity.class);
|
||||
intent.putExtra("uuid", conversation.getUuid());
|
||||
activity.startActivity(intent);
|
||||
break;
|
||||
case R.id.action_invite:
|
||||
startActivityForResult(
|
||||
ChooseContactActivity.create(activity, conversation),
|
||||
|
@ -2466,7 +2474,7 @@ public class ConversationFragment extends XmppFragment
|
|||
}
|
||||
|
||||
private void updateChatBG() {
|
||||
if (activity != null) {
|
||||
if (activity != null && conversation != null) {
|
||||
Uri uri = ChatBackgroundHelper.getBgUri(activity, conversation.getUuid());
|
||||
if (uri != null) {
|
||||
binding.backgroundImage.setImageURI(uri);
|
||||
|
@ -3603,6 +3611,26 @@ public class ConversationFragment extends XmppFragment
|
|||
updateSendButton();
|
||||
updateEditablity();
|
||||
conversation.refreshSessions();
|
||||
|
||||
|
||||
if (conversation != null && conversation.getMode() == Conversational.MODE_MULTI) {
|
||||
String subject = conversation.getMucOptions().getSubject();
|
||||
Boolean hidden = conversation.getMucOptions().subjectHidden();
|
||||
|
||||
if (Bookmark.printableValue(subject) && !hidden) {
|
||||
binding.mucSubjectText.setText(subject);
|
||||
binding.mucSubject.setOnClickListener(v -> ConferenceDetailsActivity.open(getActivity(), conversation));
|
||||
binding.mucSubjectHide.setOnClickListener(v -> {
|
||||
conversation.getMucOptions().hideSubject();
|
||||
binding.mucSubject.setVisibility(View.GONE);
|
||||
});
|
||||
binding.mucSubject.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.mucSubject.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
binding.mucSubject.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -778,7 +778,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
menuHideOffline.setChecked(this.mHideOfflineContacts);
|
||||
}
|
||||
|
||||
if (xmppConnectionService.getAccounts().size() != 1) {
|
||||
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() != 1) {
|
||||
noteToSelf.setVisible(false);
|
||||
}
|
||||
|
||||
|
@ -813,6 +813,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
boolean navBarVisible = binding.bottomNavigation.getVisibility() == VISIBLE;
|
||||
MenuItem manageAccount = menu.findItem(R.id.action_account);
|
||||
MenuItem manageAccounts = menu.findItem(R.id.action_accounts);
|
||||
MenuItem noteToSelf = menu.findItem(R.id.action_note_to_self);
|
||||
if (navBarVisible) {
|
||||
manageAccount.setVisible(false);
|
||||
manageAccounts.setVisible(false);
|
||||
|
@ -820,6 +821,10 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
AccountUtils.showHideMenuItems(menu);
|
||||
}
|
||||
|
||||
if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() != 1) {
|
||||
noteToSelf.setVisible(false);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -986,6 +991,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
|||
onActivityResult(mPostponedActivityResult.first, RESULT_OK, mPostponedActivityResult.second);
|
||||
this.mPostponedActivityResult = null;
|
||||
}
|
||||
|
||||
this.mActivatedAccounts.clear();
|
||||
this.mActivatedAccounts.addAll(AccountUtils.getEnabledAccounts(xmppConnectionService));
|
||||
configureHomeButton();
|
||||
|
|
9
src/main/res/drawable/ic_close_24dp_black.xml
Normal file
9
src/main/res/drawable/ic_close_24dp_black.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M256,767.65L192.35,704L416.35,480L192.35,256L256,192.35L480,416.35L704,192.35L767.65,256L543.65,480L767.65,704L704,767.65L480,543.65L256,767.65Z"/>
|
||||
</vector>
|
9
src/main/res/drawable/ic_pin_black.xml
Normal file
9
src/main/res/drawable/ic_pin_black.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="m640,480 l80,80v80L520,640v240l-40,40 -40,-40v-240L240,640v-80l80,-80v-280h-40v-80h400v80h-40v280ZM354,560h252l-46,-46v-314L400,200v314l-46,46ZM480,560Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
9
src/main/res/drawable/ic_pin_white.xml
Normal file
9
src/main/res/drawable/ic_pin_white.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="m640,480 l80,80v80L520,640v240l-40,40 -40,-40v-240L240,640v-80l80,-80v-280h-40v-80h400v80h-40v280ZM354,560h252l-46,-46v-314L400,200v314l-46,46ZM480,560Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
|
@ -37,6 +37,47 @@
|
|||
<RelativeLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/muc_subject"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:elevation="4dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:background="?attr/color_background_tertiary">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="?attr/ic_pin"
|
||||
android:layout_marginEnd="8dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/muc_subject_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:autoLink="web"
|
||||
android:textAppearance="@style/TextAppearance.Conversations.Subhead" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/muc_subject_hide"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="?attr/ic_close"
|
||||
android:layout_marginStart="8dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<eu.siacs.conversations.ui.DraggableListView
|
||||
android:id="@+id/messages_view"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -44,11 +85,11 @@
|
|||
android:layout_above="@+id/snackbar"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:divider="@null"
|
||||
android:listSelector="@android:color/transparent"
|
||||
android:stackFromBottom="true"
|
||||
android:transcriptMode="normal"
|
||||
android:layout_below="@+id/muc_subject"
|
||||
tools:listitem="@layout/message_sent"/>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -83,6 +83,12 @@
|
|||
android:title="@string/send_location" />
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/action_muc_participants"
|
||||
android:icon="?attr/icon_group"
|
||||
android:orderInCategory="40"
|
||||
android:title="@string/action_muc_details"
|
||||
app:showAsAction="always" />
|
||||
<item
|
||||
android:id="@+id/action_contact_details"
|
||||
android:orderInCategory="40"
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
<attr name="ic_send_videocam_offline" format="reference" />
|
||||
<attr name="ic_send_voice_offline" format="reference" />
|
||||
|
||||
<attr name="ic_pin" format="reference" />
|
||||
<attr name="ic_close" format="reference" />
|
||||
<attr name="ic_attach_camera" format="reference" />
|
||||
<attr name="ic_attach_videocam" format="reference" />
|
||||
<attr name="ic_attach_document" format="reference" />
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
<item name="ic_attach_camera" type="reference">@drawable/ic_attach_camera</item>
|
||||
<item name="ic_attach_videocam" type="reference">@drawable/ic_attach_videocam</item>
|
||||
<item name="ic_attach_document" type="reference">@drawable/ic_attach_document</item>
|
||||
<item name="ic_pin" type="reference">@drawable/ic_pin_black</item>
|
||||
<item name="ic_close" type="reference">@drawable/ic_close_24dp_black</item>
|
||||
<item name="ic_attach_location" type="reference">@drawable/ic_attach_location</item>
|
||||
<item name="ic_attach_photo" type="reference">@drawable/ic_attach_photo</item>
|
||||
<item name="ic_attach_record" type="reference">@drawable/ic_attach_record</item>
|
||||
|
@ -235,6 +237,8 @@
|
|||
<item name="ic_attach_camera" type="reference">@drawable/ic_attach_camera_white</item>
|
||||
<item name="ic_attach_videocam" type="reference">@drawable/ic_attach_videocam_white</item>
|
||||
<item name="ic_attach_document" type="reference">@drawable/ic_attach_document_white</item>
|
||||
<item name="ic_pin" type="reference">@drawable/ic_pin_white</item>
|
||||
<item name="ic_close" type="reference">@drawable/ic_close_24dp</item>
|
||||
<item name="ic_attach_location" type="reference">@drawable/ic_attach_location_white</item>
|
||||
<item name="ic_attach_photo" type="reference">@drawable/ic_attach_photo_white</item>
|
||||
<item name="ic_attach_record" type="reference">@drawable/ic_attach_record_white</item>
|
||||
|
|
|
@ -212,22 +212,6 @@
|
|||
android:ringtoneType="ringtone"
|
||||
android:summary="@string/pref_call_ringtone_summary"
|
||||
android:title="@string/pref_ringtone" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="unified_push"
|
||||
android:title="@string/unified_push_distributor">
|
||||
<ListPreference
|
||||
android:defaultValue="@string/default_push_account"
|
||||
android:key="up_push_account"
|
||||
android:summary="@string/pref_up_push_account_summary"
|
||||
android:title="@string/pref_up_push_account_title" />
|
||||
<EditTextPreference
|
||||
android:defaultValue="@string/default_push_server"
|
||||
android:key="up_push_server"
|
||||
android:summary="@string/pref_up_push_server_summary"
|
||||
android:title="@string/pref_up_push_server_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
|
@ -485,6 +469,23 @@
|
|||
android:summary="@string/pref_channel_discovery_summary"
|
||||
android:title="@string/pref_channel_discovery" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="unified_push"
|
||||
android:title="@string/unified_push_distributor">
|
||||
<ListPreference
|
||||
android:defaultValue="@string/default_push_account"
|
||||
android:key="up_push_account"
|
||||
android:summary="@string/pref_up_push_account_summary"
|
||||
android:title="@string/pref_up_push_account_title" />
|
||||
<EditTextPreference
|
||||
android:defaultValue="@string/default_push_server"
|
||||
android:key="up_push_server"
|
||||
android:summary="@string/pref_up_push_server_summary"
|
||||
android:title="@string/pref_up_push_server_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetClass="eu.siacs.conversations.ui.SettingsActivity"
|
||||
|
|
Loading…
Reference in a new issue