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
private fun getNumberOfAttachmentsInGroupConvesationsFun() { | |
return getCount({conv -> conv.groupId != null}, {it -> it.type == MessageType.ATTACHMENT && it.unread}) | |
} | |
private fun getUnreadCountFromUsersFun() { | |
return getCount({conv -> conv.recipientId != null}, {message -> message.unread}) | |
} | |
private fun getTotalNumberOfMessages() = getCount({true}, {true}) |
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
private fun getUnreadCountFromUsers() { | |
val conversations = datasource.getConversations() | |
var count = 0 | |
for (conversation in conversations) { | |
if (conversation.recipientId != null) { | |
for (message in conversation.messages) { | |
if (message.unread) { | |
count += 1 | |
} | |
} |
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
fun flatTree(tree: TreeNode): List<TreeNode> | |
= listOf(tree, *tree.children.flatMap(::flatTree).toTypedArray()) |
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
selector(items = listOf("Like", "Dislike") { | |
when (it) { | |
0 -> if (!liked) likePost() | |
else -> if (!disLiked) disLikePost() | |
} | |
} | |
doAsync { | |
// Long background task | |
uiThread { |
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
info = AdditionalInfo().apply { userName = userNameET.text }.let { infoProcessor.process(it) } |
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
verticalLayout() { | |
friendsPanel = friendsPanel.with(friendsData).lparams(width = matchParent) | |
politicalMapCardView { | |
setMarker(quizManager.getMarker()) | |
}.lparams(width = matchParent) { topMargin = dip(10) } | |
cardView() { | |
verticalLayout() { |
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
items = StoreInfo().apply { storeItems = fetchItems() }.let { manager.process(it) } | |
container.apply { | |
removeAllViews() | |
items.forEach { addView(ShopItemView(context).withData(it)) } | |
} | |
fun ShopItemView.withData(item: StoreItem): ShopItemView { | |
title = item.title | |
image = item.image | |
Brand.findById(item.id)?.let { brandName = it.name } |
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
@Bind(R.id.first_name) | |
protected EditText firstName; | |
@Bind(R.id.last_name) | |
protected EditText lastName; | |
@Bind(R.id.address_line1) | |
protected EditText addressLine1; | |
@Bind(R.id.address_line2) |