Skip to content

Commit

Permalink
update Profile
Browse files Browse the repository at this point in the history
  • Loading branch information
tien-awair committed Apr 29, 2022
1 parent 9fb6153 commit 512a6b8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
3 changes: 3 additions & 0 deletions uikit/src/main/java/com/sendbird/uikit/consts/StringSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public class StringSet {
public final static String KEY_STARTING_POINT = "KEY_STARTING_POINT";
public final static String KEY_FROM_SEARCH_RESULT = "KEY_FROM_SEARCH_RESULT";
public final static String KEY_SEARCH_BAR_BUTTON_TEXT = "KEY_SEARCH_BAR_BUTTON_TEXT";
public final static String KEY_ONE_ONE_CHAT = "KEY_ONE_ONE_CHAT";
public final static String KEY_USER_ID = "KEY_USER_ID";
public final static String KEY_ACTION_OPEN_USER_PROFILE = "KEY_ACTION_OPEN_USER_PROFILE";

public final static String sb_uikit = "sb_uikit";
public final static String audio = "audio";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;

/**
* Fragment displaying the list of messages in the channel.
Expand Down Expand Up @@ -326,10 +327,44 @@ private void initHeaderOnReady(GroupChannel channel) {

if (headerRightButtonListener != null) {
binding.chvChannelHeader.setRightImageButtonClickListener(headerRightButtonListener);
binding.chvChannelHeader.getTitleTextView().setOnClickListener(headerRightButtonListener);
binding.chvChannelHeader.getProfileView().setOnClickListener(headerRightButtonListener);
} else {
List<Member> members = channel.getMembers();
ArrayList<CharSequence> memberIds = new ArrayList<>();
for (Member member: members) {
memberIds.add(member.getUserId());
}

binding.chvChannelHeader.setRightImageButtonClickListener(v -> {
Intent intent = ChannelSettingsActivity.newIntent(getContext(), channel.getUrl());
startActivityForResult(intent, GROUP_CHANNEL_SETTINGS_REQUEST_CODE);
if (memberIds.size() > 2) {
Intent intent = ChannelSettingsActivity.newIntent(getContext(), channel.getUrl());
startActivityForResult(intent, GROUP_CHANNEL_SETTINGS_REQUEST_CODE);
} else {
Intent intent = new Intent(StringSet.KEY_ACTION_OPEN_USER_PROFILE);
intent.putCharSequenceArrayListExtra(StringSet.KEY_USER_ID, memberIds);
requireContext().sendBroadcast(intent);
}
});
binding.chvChannelHeader.getTitleTextView().setOnClickListener(v -> {
if (memberIds.size() > 2) {
Intent intent = ChannelSettingsActivity.newIntent(getContext(), channel.getUrl());
startActivityForResult(intent, GROUP_CHANNEL_SETTINGS_REQUEST_CODE);
} else {
Intent intent = new Intent(StringSet.KEY_ACTION_OPEN_USER_PROFILE);
intent.putCharSequenceArrayListExtra(StringSet.KEY_USER_ID, memberIds);
requireContext().sendBroadcast(intent);
}
});
binding.chvChannelHeader.getProfileView().setOnClickListener(v -> {
if (memberIds.size() > 2) {
Intent intent = ChannelSettingsActivity.newIntent(getContext(), channel.getUrl());
startActivityForResult(intent, GROUP_CHANNEL_SETTINGS_REQUEST_CODE);
} else {
Intent intent = new Intent(StringSet.KEY_ACTION_OPEN_USER_PROFILE);
intent.putCharSequenceArrayListExtra(StringSet.KEY_USER_ID, memberIds);
requireContext().sendBroadcast(intent);
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion uikit/src/main/res/layout/sb_view_channel_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
android:layout_height="@dimen/sb_size_56"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
android:visibility="visible"
android:paddingLeft="@dimen/sb_size_16"
android:paddingRight="@dimen/sb_size_16">

Expand Down

0 comments on commit 512a6b8

Please sign in to comment.