mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
Beginning of participants list
This commit is contained in:
parent
b531ca59c6
commit
9cdce626e9
@ -17,8 +17,8 @@ android {
|
|||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
versionCode 66
|
versionCode 67
|
||||||
versionName "3.1.0beta3"
|
versionName "3.1.0beta4"
|
||||||
|
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
renderscriptTargetApi 19
|
renderscriptTargetApi 19
|
||||||
|
@ -70,8 +70,8 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (o instanceof UserItem) {
|
if (o instanceof AdvancedUserItem) {
|
||||||
UserItem inItem = (UserItem) o;
|
AdvancedUserItem inItem = (AdvancedUserItem) o;
|
||||||
return participant.equals(inItem.getModel());
|
return participant.equals(inItem.getModel());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -38,11 +38,16 @@ import android.widget.ImageView;
|
|||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.nextcloud.talk.adapters.items.AdvancedUserItem;
|
||||||
|
import com.nextcloud.talk.adapters.items.GenericTextHeaderItem;
|
||||||
|
import com.nextcloud.talk.adapters.items.UserItem;
|
||||||
import com.nextcloud.talk.api.NcApi;
|
import com.nextcloud.talk.api.NcApi;
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||||
import com.nextcloud.talk.controllers.base.BaseController;
|
import com.nextcloud.talk.controllers.base.BaseController;
|
||||||
import com.nextcloud.talk.models.database.UserEntity;
|
import com.nextcloud.talk.models.database.UserEntity;
|
||||||
import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter;
|
import com.nextcloud.talk.models.json.converters.EnumNotificationLevelConverter;
|
||||||
|
import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter;
|
||||||
|
import com.nextcloud.talk.models.json.participants.Participant;
|
||||||
import com.nextcloud.talk.models.json.rooms.Conversation;
|
import com.nextcloud.talk.models.json.rooms.Conversation;
|
||||||
import com.nextcloud.talk.models.json.rooms.RoomOverall;
|
import com.nextcloud.talk.models.json.rooms.RoomOverall;
|
||||||
import com.nextcloud.talk.utils.ApiUtils;
|
import com.nextcloud.talk.utils.ApiUtils;
|
||||||
@ -56,11 +61,22 @@ import com.yarolegovich.mp.MaterialPreferenceScreen;
|
|||||||
|
|
||||||
import org.parceler.Parcels;
|
import org.parceler.Parcels;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import autodagger.AutoInjector;
|
import autodagger.AutoInjector;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
import eu.davidea.flexibleadapter.FlexibleAdapter;
|
||||||
|
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager;
|
||||||
|
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
|
||||||
import io.reactivex.Observer;
|
import io.reactivex.Observer;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
@ -93,12 +109,21 @@ public class ConversationInfoController extends BaseController {
|
|||||||
@BindView(R.id.display_name_text)
|
@BindView(R.id.display_name_text)
|
||||||
TextView conversationDisplayName;
|
TextView conversationDisplayName;
|
||||||
|
|
||||||
|
@BindView(R.id.participants_list_category)
|
||||||
|
MaterialPreferenceCategory participantsListCategory;
|
||||||
|
|
||||||
|
@BindView(R.id.recycler_view)
|
||||||
|
RecyclerView recyclerView;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
NcApi ncApi;
|
NcApi ncApi;
|
||||||
|
|
||||||
private Disposable roomDisposable;
|
private Disposable roomDisposable;
|
||||||
private Conversation conversation;
|
private Conversation conversation;
|
||||||
|
|
||||||
|
private FlexibleAdapter<AbstractFlexibleItem> adapter;
|
||||||
|
private List<AbstractFlexibleItem> recyclerViewItems = new ArrayList<>();
|
||||||
|
|
||||||
public ConversationInfoController(Bundle args) {
|
public ConversationInfoController(Bundle args) {
|
||||||
super(args);
|
super(args);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
@ -134,6 +159,49 @@ public class ConversationInfoController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupAdapter() {
|
||||||
|
if (adapter == null) {
|
||||||
|
adapter = new FlexibleAdapter<>(recyclerViewItems, getActivity(), true);
|
||||||
|
}
|
||||||
|
SmoothScrollLinearLayoutManager layoutManager =
|
||||||
|
new SmoothScrollLinearLayoutManager(getActivity());
|
||||||
|
recyclerView.setLayoutManager(layoutManager);
|
||||||
|
recyclerView.setHasFixedSize(true);
|
||||||
|
|
||||||
|
recyclerView.setAdapter(adapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleParticipants() {
|
||||||
|
UserItem userItem;
|
||||||
|
Participant participant;
|
||||||
|
|
||||||
|
recyclerViewItems = new ArrayList<>();
|
||||||
|
|
||||||
|
GenericTextHeaderItem genericTextHeaderItem = new GenericTextHeaderItem("bla");
|
||||||
|
EnumParticipantTypeConverter enumParticipantTypeConverter = new EnumParticipantTypeConverter();
|
||||||
|
Iterator it = conversation.getParticipants().entrySet().iterator();
|
||||||
|
HashMap<String, Object> internalHashMap;
|
||||||
|
while (it.hasNext()) {
|
||||||
|
participant = new Participant();
|
||||||
|
Map.Entry pair = (Map.Entry)it.next();
|
||||||
|
participant.setUserId((String) pair.getKey());
|
||||||
|
internalHashMap = (HashMap<String, Object>) pair.getValue();
|
||||||
|
participant.setName((String) internalHashMap.get("name"));
|
||||||
|
participant.setParticipantFlags((long) internalHashMap.get("call"));
|
||||||
|
participant.setType(enumParticipantTypeConverter.getFromInt((int)(long) internalHashMap.get("type")));
|
||||||
|
|
||||||
|
userItem = new UserItem(participant, conversationUser, genericTextHeaderItem);
|
||||||
|
|
||||||
|
userItem.setEnabled(participant.getParticipantFlags() != 0);
|
||||||
|
|
||||||
|
recyclerViewItems.add(userItem);
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
setupAdapter();
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onAttach(@NonNull View view) {
|
protected void onAttach(@NonNull View view) {
|
||||||
super.onAttach(view);
|
super.onAttach(view);
|
||||||
@ -164,10 +232,10 @@ public class ConversationInfoController extends BaseController {
|
|||||||
if (progressBar != null) {
|
if (progressBar != null) {
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
materialPreferenceScreen.setVisibility(View.VISIBLE);
|
|
||||||
nameCategoryView.setVisibility(View.VISIBLE);
|
|
||||||
conversationDisplayName.setText(conversation.getDisplayName());
|
|
||||||
loadConversationAvatar();
|
loadConversationAvatar();
|
||||||
|
handleParticipants();
|
||||||
|
|
||||||
|
|
||||||
if (conversationUser.hasSpreedCapabilityWithName("notification-levels")) {
|
if (conversationUser.hasSpreedCapabilityWithName("notification-levels")) {
|
||||||
messageNotificationLevel.setEnabled(true);
|
messageNotificationLevel.setEnabled(true);
|
||||||
@ -198,6 +266,11 @@ public class ConversationInfoController extends BaseController {
|
|||||||
messageNotificationLevel.setAlpha(0.38f);
|
messageNotificationLevel.setAlpha(0.38f);
|
||||||
setProperNotificationValue(conversation);
|
setProperNotificationValue(conversation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
materialPreferenceScreen.setVisibility(View.VISIBLE);
|
||||||
|
nameCategoryView.setVisibility(View.VISIBLE);
|
||||||
|
participantsListCategory.setVisibility(View.VISIBLE);
|
||||||
|
conversationDisplayName.setText(conversation.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,7 +53,7 @@ public class Participant {
|
|||||||
boolean inCall;
|
boolean inCall;
|
||||||
|
|
||||||
@JsonField(name = "participantFlags")
|
@JsonField(name = "participantFlags")
|
||||||
int participantFlags;
|
long participantFlags;
|
||||||
|
|
||||||
String source;
|
String source;
|
||||||
|
|
||||||
|
@ -19,8 +19,11 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:apc="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/nc_white_color"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
@ -71,5 +74,22 @@
|
|||||||
android:layout_below="@id/conversation_info_name"
|
android:layout_below="@id/conversation_info_name"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<com.yarolegovich.mp.MaterialPreferenceCategory
|
||||||
|
android:id="@+id/participants_list_category"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/notification_settings"
|
||||||
|
android:visibility="gone"
|
||||||
|
apc:mpc_title="@string/nc_participants"
|
||||||
|
apc:mpc_title_color="@color/colorPrimary">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recycler_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:listitem="@layout/rv_item_contact"></androidx.recyclerview.widget.RecyclerView>
|
||||||
|
|
||||||
|
</com.yarolegovich.mp.MaterialPreferenceCategory>
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -240,5 +240,12 @@ Find Nextcloud on https://nextcloud.com</string>
|
|||||||
<!-- Other -->
|
<!-- Other -->
|
||||||
<string name="nc_limit_hit">1000 characters limit has been hit</string>
|
<string name="nc_limit_hit">1000 characters limit has been hit</string>
|
||||||
<string name="nc_groups">Groups</string>
|
<string name="nc_groups">Groups</string>
|
||||||
|
<string name="nc_participants">Participants</string>
|
||||||
|
|
||||||
|
<string name="nc_owner">Owner</string>
|
||||||
|
<string name="nc_moderator">Moderator</string>
|
||||||
|
<string name="nc_user">User</string>
|
||||||
|
<string name="nc_guest">Guest</string>
|
||||||
|
<string name="nc_following_link">User following a public link</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user