-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d934102
commit c017656
Showing
75 changed files
with
2,622 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
...ava/com/sendbird/uikit/samples/customization/channelsettings/GroupChannelSettingSample.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package com.sendbird.uikit.samples.customization.channelsettings | ||
|
||
import android.app.Activity | ||
import com.sendbird.uikit.activities.ChannelSettingsActivity | ||
import com.sendbird.uikit.consts.SingleMenuType | ||
import com.sendbird.uikit.interfaces.providers.ChannelSettingsModuleProvider | ||
import com.sendbird.uikit.modules.ChannelSettingsModule | ||
import com.sendbird.uikit.modules.components.ChannelSettingsMenuComponent | ||
import com.sendbird.uikit.providers.ModuleProviders | ||
import com.sendbird.uikit.samples.R | ||
import com.sendbird.uikit.samples.customization.GroupChannelRepository | ||
|
||
fun showAppendNewCustomGroupChannelSettingsMenuSample(activity: Activity) { | ||
// You can customize the Group Channel settings menu using the following code. | ||
// The following code is an example of how to customize the Group Channel settings menu. | ||
// If you want to handle the CUSTOM menu click event, you should handle it yourself after creating a custom menu view. | ||
ModuleProviders.channelSettings = ChannelSettingsModuleProvider { context, _ -> | ||
val module = ChannelSettingsModule(context).apply { | ||
val customMenuList = ChannelSettingsMenuComponent.defaultMenuSet.toMutableList().apply { | ||
add(ChannelSettingsMenuComponent.Menu.CUSTOM) | ||
} | ||
val component = ChannelSettingsMenuComponent().apply { | ||
// set the custom menu list. | ||
params.setMenuList(customMenuList) { context, _ -> // create custom menu view. | ||
createMenuView( | ||
context, | ||
"Go to Chat", | ||
null, | ||
SingleMenuType.NEXT, | ||
R.drawable.icon_chat, | ||
0 | ||
).apply { | ||
// set the click event listener here. | ||
setOnClickListener { | ||
println(">>>>>> Go to Chat") | ||
} | ||
} | ||
} | ||
} | ||
setChannelSettingsMenuComponent(component) | ||
} | ||
module | ||
} | ||
|
||
GroupChannelRepository.getRandomChannel(activity) { channel -> | ||
activity.startActivity(ChannelSettingsActivity.newIntent(activity, channel.url)) | ||
} | ||
} | ||
|
||
fun showCustomGroupChannelSettingsMenuSample(activity: Activity) { | ||
// You can customize the Group Channel settings menu using the following code. | ||
// It shows how to make custom menu items in the Group Channel settings menu. | ||
// If you want to handle the CUSTOM menu click event, you should handle it yourself after creating a custom menu view. | ||
ModuleProviders.channelSettings = ChannelSettingsModuleProvider { context, _ -> | ||
val module = ChannelSettingsModule(context).apply { | ||
val component = ChannelSettingsMenuComponent().apply { | ||
// set the custom menu list. | ||
params.setMenuList( | ||
listOf( | ||
ChannelSettingsMenuComponent.Menu.CUSTOM, | ||
ChannelSettingsMenuComponent.Menu.MEMBERS, | ||
ChannelSettingsMenuComponent.Menu.LEAVE_CHANNEL, | ||
) | ||
) { context, _ -> // create custom menu view. | ||
createMenuView( | ||
context, | ||
"Go to Chat", | ||
null, | ||
SingleMenuType.NEXT, | ||
R.drawable.icon_chat, | ||
0 | ||
).apply { | ||
// set the click event listener here. | ||
setOnClickListener { | ||
println(">>>>>> Go to Chat") | ||
} | ||
} | ||
} | ||
} | ||
setChannelSettingsMenuComponent(component) | ||
} | ||
module | ||
} | ||
|
||
GroupChannelRepository.getRandomChannel(activity) { channel -> | ||
activity.startActivity(ChannelSettingsActivity.newIntent(activity, channel.url)) | ||
} | ||
} | ||
|
||
fun showHidingChannelSettingsMenuSample(activity: Activity) { | ||
// It shows how to hide the default menu items in the Group Channel settings menu. | ||
ModuleProviders.channelSettings = ChannelSettingsModuleProvider { context, _ -> | ||
val module = ChannelSettingsModule(context).apply { | ||
val customMenuList = ChannelSettingsMenuComponent.defaultMenuSet.toMutableList().apply { | ||
remove(ChannelSettingsMenuComponent.Menu.LEAVE_CHANNEL) | ||
} | ||
val component = ChannelSettingsMenuComponent().apply { | ||
// hide LEAVE_CHANNEL menu. | ||
params.setMenuList(customMenuList, null) | ||
} | ||
setChannelSettingsMenuComponent(component) | ||
} | ||
module | ||
} | ||
|
||
GroupChannelRepository.getRandomChannel(activity) { channel -> | ||
activity.startActivity(ChannelSettingsActivity.newIntent(activity, channel.url)) | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...rc/main/java/com/sendbird/uikit/samples/customization/userlist/MemberContextMenuSample.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.sendbird.uikit.samples.customization.userlist | ||
|
||
import android.app.Activity | ||
import com.sendbird.android.channel.GroupChannel | ||
import com.sendbird.android.user.Member | ||
import com.sendbird.uikit.activities.MemberListActivity | ||
import com.sendbird.uikit.fragments.MemberListFragment | ||
import com.sendbird.uikit.interfaces.providers.MemberListFragmentProvider | ||
import com.sendbird.uikit.model.DialogListItem | ||
import com.sendbird.uikit.providers.FragmentProviders | ||
import com.sendbird.uikit.samples.R | ||
import com.sendbird.uikit.samples.customization.GroupChannelRepository | ||
|
||
fun showCustomMemberContextMenuSample(activity: Activity) { | ||
GroupChannelRepository.getRandomChannel(activity) { channel -> | ||
FragmentProviders.memberList = MemberListFragmentProvider { channelUrl, _ -> | ||
MemberListFragment.Builder(channelUrl) | ||
.setCustomFragment(CustomMemberListFragment()) | ||
.build() | ||
} | ||
activity.startActivity(MemberListActivity.newIntent(activity, channel.url)) | ||
} | ||
} | ||
|
||
class CustomMemberListFragment : MemberListFragment() { | ||
override fun getActionContextMenuTitle(member: Member, channel: GroupChannel?): String { | ||
return "Custom Context Menu" | ||
} | ||
|
||
override fun makeActionContextMenu(member: Member, channel: GroupChannel?): MutableList<DialogListItem> { | ||
return super.makeActionContextMenu(member, channel).apply { | ||
add(DialogListItem(R.string.text_menu_thumbs_up, R.drawable.icon_good)) | ||
add(DialogListItem(R.string.text_menu_thumbs_down, R.drawable.icon_bad)) | ||
} | ||
} | ||
|
||
override fun onActionContextMenuItemClicked(member: Member, item: DialogListItem, channel: GroupChannel?): Boolean { | ||
return when (item.key) { | ||
R.string.text_menu_thumbs_up -> { | ||
println(">>>>>> Thumbs Up") | ||
true | ||
} | ||
R.string.text_menu_thumbs_down -> { | ||
println(">>>>>> Thumbs Down") | ||
true | ||
} | ||
else -> super.onActionContextMenuItemClicked(member, item, channel) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-4.96 KB
(29%)
uikit-samples/src/main/res/drawable-hdpi/logo_sendbird_full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-3.36 KB
(28%)
uikit-samples/src/main/res/drawable-mdpi/logo_sendbird_full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.66 KB
uikit-samples/src/main/res/drawable-xhdpi/logo_business_messaging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-6.87 KB
(28%)
uikit-samples/src/main/res/drawable-xhdpi/logo_sendbird_full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
uikit-samples/src/main/res/drawable-xxhdpi/logo_business_messaging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-10.4 KB
(27%)
uikit-samples/src/main/res/drawable-xxhdpi/logo_sendbird_full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.6 KB
uikit-samples/src/main/res/drawable-xxxhdpi/logo_business_messaging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-14.7 KB
(25%)
uikit-samples/src/main/res/drawable-xxxhdpi/logo_sendbird_full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.