Skip to content
This repository has been archived by the owner on Jun 7, 2020. It is now read-only.

Commit

Permalink
add icon, update string files
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhsherl committed Feb 26, 2019
1 parent 8282965 commit fdaad2b
Show file tree
Hide file tree
Showing 21 changed files with 252 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ class MembersAdapter(private val listener: (MemberUiModel) -> Unit, presenter: M
notifyItemChanged(index)
}
}
R.id.action_member_ignore-> {
TODO("not implemented")
// presenter?.toggleIgnore(this.userId, false){}
}
R.id.action_member_mute-> {
presenter?.toggleMute(this.username, this.muted) {
dataSet[index].muted = !this.muted
Expand Down
29 changes: 13 additions & 16 deletions app/src/main/java/chat/rocket/android/members/adapter/ViewHolder.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package chat.rocket.android.members.adapter

import android.util.Log
import android.view.ContextThemeWrapper
import android.view.MenuItem
import android.view.View
Expand Down Expand Up @@ -33,9 +32,9 @@ class ViewHolder(
image_avatar.setImageURI(memberUiModel.avatarUri)
text_member.content = memberUiModel.displayName
text_member.setCompoundDrawablesRelativeWithIntrinsicBounds(DrawableHelper.getUserStatusDrawable(memberUiModel.status, context), null, null, null)
text_member_owner.content = "Owner"
text_member_leader.content = "Leader"
text_member_moderator.content = "Mod"
text_member_owner.setText(R.string.owner)
text_member_leader.setText(R.string.leader)
text_member_moderator.setText(R.string.moderator)
text_member_owner.isVisible =memberUiModel.roles?.contains("owner") == true
text_member_leader.isVisible = memberUiModel.roles?.contains("leader") == true
text_member_moderator.isVisible = memberUiModel.roles?.contains("moderator") == true
Expand All @@ -53,30 +52,28 @@ class ViewHolder(
data?.let {
var menuItems = view.context.inflate(R.menu.group_member_actions).toList()
if (!isOwner && !isMod)
menuItems = menuItems.filter { it.itemId == R.id.action_member_mute || it.itemId == R.id.action_member_ignore }
else if (isMod)
menuItems = menuItems.filter { it.itemId == R.id.action_member_mute || it.itemId == R.id.action_member_ignore || it.itemId == R.id.action_member_remove}
menuItems = menuItems.filter { it.itemId == R.id.action_member_mute }
else if (!isOwner && isMod)
menuItems = menuItems.filter { it.itemId == R.id.action_member_mute || it.itemId == R.id.action_member_remove}
menuItems.find { it.itemId == R.id.action_member_set_owner }?.apply {
if (it.roles?.contains("owner") == true) title = "Remove as Owner"
if (it.roles?.contains("owner") == true) setTitle(R.string.action_remove_owner)
}
menuItems.find { it.itemId == R.id.action_member_set_leader }?.apply {
if (it.roles?.contains("leader") == true) title = "Remove as Leader"
if (it.roles?.contains("leader") == true) setTitle(R.string.action_remove_leader)
}
menuItems.find { it.itemId == R.id.action_member_set_moderator }?.apply {
if (it.roles?.contains("moderator") == true) title = "Remove as Moderator"
if (it.roles?.contains("moderator") == true) setTitle(R.string.action_remove_moderator)
}
menuItems.find { it.itemId == R.id.action_member_mute }?.apply {
if (it.muted) {
title = "Unmute user"
setTitle(R.string.action_unmute_user)
setIcon(R.drawable.ic_mic_on_24dp)
}
}
menuItems.find { it.itemId == R.id.action_member_ignore }?.apply {
// TODO: Check why ignore is not working
// menuItems.find { it.itemId == R.id.action_member_ignore }?.apply {
// if (it.roles.contains("owner")) title = "Remove Owner"
}
menuItems.find { it.itemId == R.id.action_member_remove }?.apply {
// if (it.roles.contains("owner")) title = "Remove Owner"
}
// }
view.context?.let {
if (it is ContextThemeWrapper && it.baseContext is AppCompatActivity) {
with(it.baseContext as AppCompatActivity) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package chat.rocket.android.members.presentation

import chat.rocket.android.chatroom.presentation.ChatRoomNavigator
import android.util.Log
import chat.rocket.android.core.lifecycle.CancelStrategy
import chat.rocket.android.db.DatabaseManager
import chat.rocket.android.members.uimodel.MemberUiModel
import chat.rocket.android.members.uimodel.MemberUiModelMapper
import chat.rocket.android.server.infraestructure.RocketChatClientFactory
import chat.rocket.android.util.extension.launchUI
import chat.rocket.android.util.extensions.isNotNullNorEmpty
import chat.rocket.android.util.retryDB
import chat.rocket.android.util.retryIO
import chat.rocket.common.RocketChatException
import chat.rocket.common.model.RoomType
Expand Down Expand Up @@ -135,18 +133,6 @@ class MembersPresenter @Inject constructor(
}
}

fun toggleIgnore(userId: String, isIgnored: Boolean = false, notifier: () ->Unit) {
launchUI(strategy) {
try {
retryIO(description = "ignoreUser($roomId, $userId, ${!isIgnored})") { client.ignoreUser(roomId, userId, !isIgnored) }
notifier()
} catch (ex: RocketChatException) {
view.showMessage(ex.message!!) // TODO Remove.
Timber.e(ex) // FIXME: Right now we are only catching the exception with Timber.
}
}
}

fun toggleMute(username: String?, isMuted: Boolean = false, notifier: () ->Unit) {
launchUI(strategy) {
try {
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/drawable/ic_leader.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="93.602"
android:viewportWidth="93.602" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/actionMenuColor" android:pathData="M81.551,0h-69.5c-1.104,0 -2,0.896 -2,2v38.381c0,20.506 9.461,33.743 17.399,41.236c8.556,8.08 17.159,11.336 17.52,11.47l1.043,0.389c0.225,0.084 0.462,0.126 0.698,0.126c0.235,0 0.469,-0.041 0.693,-0.124l1.049,-0.387c0.365,-0.136 9.033,-3.415 17.602,-11.464c7.982,-7.496 17.496,-20.737 17.496,-41.246V2C83.551,0.896 82.654,0 81.551,0zM46.735,83.344c-6.157,-2.957 -26.684,-14.896 -26.684,-42.572V10.391h26.75L46.735,83.344z"/>
</vector>
4 changes: 4 additions & 0 deletions app/src/main/res/drawable/ic_moderator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="737.407"
android:viewportWidth="737.408" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/actionMenuColor" android:pathData="M674.417,123.507c-0.224,-9.759 -7.216,-18.177 -16.982,-19.511c-45.521,-6.252 -90.416,-17.129 -134.426,-33.248c-43.802,-16.042 -92.267,-38.436 -144.54,-67.93c-6.637,-3.747 -12.88,-3.77 -19.51,0c-51.911,29.479 -100.029,51.826 -144.177,67.93c-44.024,16.058 -88.897,27.004 -134.056,33.248c-9.767,1.349 -16.62,9.752 -17.707,19.511c-4.332,185.366 36.27,337.036 121.414,454.934c46.384,64.222 104.431,116.349 174.526,156.096c5.419,3.978 13.915,3.677 20.235,0c69.564,-40.41 127.534,-92.159 173.811,-156.096C638.262,460.62 678.533,308.88 674.417,123.507zM520.48,555.677c-40.225,55.564 -90.694,101.895 -151.762,139.112c-61.069,-37.218 -111.777,-83.378 -151.763,-139.112c-77.458,-107.962 -115.269,-246.08 -113.828,-414.463c42.637,-6.868 84.92,-18.432 127.195,-33.972c42.275,-15.533 88.528,-36.856 138.396,-63.952c49.868,27.096 95.757,48.419 138.033,63.952c42.275,15.541 84.912,27.104 127.557,33.972C635.75,310.684 597.699,448.995 520.48,555.677z"/>
</vector>
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_owner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:viewportHeight="374.10623"
android:viewportWidth="374" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/actionMenuColor" android:pathData="m328.664,75.746 l-140.605,-74.922c-2.086,-1.113 -4.586,-1.098 -6.656,0.039l-136.715,74.922c-2.242,1.23 -3.633,3.582 -3.633,6.141v97.867c0.082,80.449 47.746,153.23 121.457,185.461l18.977,8.27c1.773,0.773 3.793,0.777 5.57,0.008l21.383,-9.234c75.078,-31.531 123.922,-105.016 123.93,-186.445v-95.926c0,-2.586 -1.426,-4.965 -3.707,-6.18zM318.371,177.852c-0.016,75.816 -45.504,144.227 -115.41,173.566l-0.047,0.023 -18.621,8.039 -16.18,-7.059c-68.613,-30 -112.984,-97.742 -113.063,-172.629v-93.723l129.762,-71.117 133.559,71.168zM318.371,177.852"/>
<path android:fillColor="@color/actionMenuColor" android:pathData="m133.168,175.254c-2.512,-2.941 -6.93,-3.289 -9.871,-0.777 -2.941,2.508 -3.289,6.93 -0.777,9.867l36.977,43.301c2.469,2.891 6.793,3.285 9.738,0.887l86.117,-70.063c3,-2.438 3.453,-6.848 1.012,-9.848 -2.438,-2.996 -6.848,-3.453 -9.848,-1.012l-80.813,65.742zM133.168,175.254"/>
</vector>
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/ic_remove_red_24dp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">

<path
android:fillColor="@color/colorRed"
android:pathData="M10.09,15.59L11.5,17l5,-5 -5,-5 -1.41,1.41L12.67,11H3v2h9.67l-2.58,2.59zM19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z" />

</vector>
27 changes: 14 additions & 13 deletions app/src/main/res/menu/group_member_actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,31 @@

<item
android:id="@+id/action_member_set_owner"
android:icon="@drawable/ic_action_message_info_outline_24dp"
android:title="Set as Owner" />
android:icon="@drawable/ic_owner"
android:title="@string/action_set_owner" />
<item
android:id="@+id/action_member_set_leader"
android:icon="@drawable/ic_action_message_reply_24dp"
android:title="Set as Leader" />
android:icon="@drawable/ic_leader"
android:title="@string/action_set_leader" />
<item
android:id="@+id/action_member_set_moderator"
android:icon="@drawable/ic_action_message_edit_24dp"
android:title="Set as Moderator" />
android:icon="@drawable/ic_moderator"
android:title="@string/action_set_moderator" />

<item
android:id="@+id/action_member_ignore"
android:icon="@drawable/ic_ignore_24dp"
android:title="Ignore" />
<!--TODO implement ignoreUser-->
<!--<item-->
<!--android:id="@+id/action_member_ignore"-->
<!--android:icon="@drawable/ic_ignore_24dp"-->
<!--android:title="Ignore" />-->

<item
android:id="@+id/action_member_mute"
android:icon="@drawable/ic_mic_off_24dp"
android:title="Mute user" />
android:title="@string/action_mute_user" />

<item
android:id="@+id/action_member_remove"
android:icon="@drawable/ic_logout_black_24dp"
android:title="Remove from room" />
android:icon="@drawable/ic_remove_red_24dp"
android:title="@string/action_remove_user" />

</menu>
15 changes: 15 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,19 @@
<string name="required">*erforderlich</string>
<string name="report_sent">Ihr Bericht wurde gesendet!</string>

<!--Member Action--><!-- TODO Add translation -->
<string name="action_set_owner">Set as Owner</string>
<string name="action_set_moderator">Set as Moderator</string>
<string name="action_remove_owner">Remove as Owner</string>
<string name="action_remove_leader">Remove as Leader</string>
<string name="action_remove_moderator">Remove as Moderator</string>
<string name="action_mute_user">Mute User</string>
<string name="action_unmute_user">Unmute User</string>
<string name="action_remove_user">Remove from Room</string>
<string name="action_set_leader">Set as Leader</string>

<string name="owner">Owner</string>
<string name="leader">Leader</string>
<string name="moderator">Mod</string>

</resources>
17 changes: 16 additions & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,20 @@
<!-- Report -->
<string name="submit">Submit</string> <!--TODO - Add proper translation-->
<string name="required">*required</string> <!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string> <!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>

<!--Member Action--><!-- TODO Add translation -->
<string name="action_set_owner">Set as Owner</string>
<string name="action_set_moderator">Set as Moderator</string>
<string name="action_remove_owner">Remove as Owner</string>
<string name="action_remove_leader">Remove as Leader</string>
<string name="action_remove_moderator">Remove as Moderator</string>
<string name="action_mute_user">Mute User</string>
<string name="action_unmute_user">Unmute User</string>
<string name="action_remove_user">Remove from Room</string>
<string name="action_set_leader">Set as Leader</string> <!--TODO - Add proper translation-->

<string name="owner">Owner</string>
<string name="leader">Leader</string>
<string name="moderator">Mod</string>
</resources>
15 changes: 15 additions & 0 deletions app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -340,4 +340,19 @@
<string name="submit">واگذاری</string>
<string name="required">*required</string> <!-- TODO Add translation -->
<string name="report_sent">گزارش شما فرستاده شد</string>

<!--Member Action--><!-- TODO Add translation -->
<string name="action_set_owner">Set as Owner</string>
<string name="action_set_moderator">Set as Moderator</string>
<string name="action_remove_owner">Remove as Owner</string>
<string name="action_remove_leader">Remove as Leader</string>
<string name="action_remove_moderator">Remove as Moderator</string>
<string name="action_mute_user">Mute User</string>
<string name="action_unmute_user">Unmute User</string>
<string name="action_remove_user">Remove from Room</string>
<string name="action_set_leader">Set as Leader</string>

<string name="owner">Owner</string>
<string name="leader">Leader</string>
<string name="moderator">Mod</string>
</resources>
17 changes: 16 additions & 1 deletion app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -343,5 +343,20 @@
<!-- Report -->
<string name="submit">Submit</string> <!-- TODO - Add proper translation -->
<string name="required">*required</string> <!-- TODO - Add proper translation -->
<string name="report_sent">Your report has been sent!</string> <!-- TODO - Add proper translation -->
<string name="report_sent">Your report has been sent!</string>

<!--Member Action--><!-- TODO Add translation -->
<string name="action_set_owner">Set as Owner</string>
<string name="action_set_moderator">Set as Moderator</string>
<string name="action_remove_owner">Remove as Owner</string>
<string name="action_remove_leader">Remove as Leader</string>
<string name="action_remove_moderator">Remove as Moderator</string>
<string name="action_mute_user">Mute User</string>
<string name="action_unmute_user">Unmute User</string>
<string name="action_remove_user">Remove from Room</string>
<string name="action_set_leader">Set as Leader</string> <!-- TODO - Add proper translation -->

<string name="owner">Owner</string>
<string name="leader">Leader</string>
<string name="moderator">Mod</string>
</resources>
15 changes: 15 additions & 0 deletions app/src/main/res/values-hi-rIN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,19 @@
<string name="submit">जमा करें</string>
<string name="required">* आवश्यक</string>
<string name="report_sent">आपकी रिपोर्ट भेज दी गई है!</string>

<!--Member Action--><!-- TODO Add translation -->
<string name="action_set_owner">Set as Owner</string>
<string name="action_set_moderator">Set as Moderator</string>
<string name="action_remove_owner">Remove as Owner</string>
<string name="action_remove_leader">Remove as Leader</string>
<string name="action_remove_moderator">Remove as Moderator</string>
<string name="action_mute_user">Mute User</string>
<string name="action_unmute_user">Unmute User</string>
<string name="action_remove_user">Remove from Room</string>
<string name="action_set_leader">Set as Leader</string>

<string name="owner">Owner</string>
<string name="leader">Leader</string>
<string name="moderator">Mod</string>
</resources>
15 changes: 15 additions & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,19 @@
<string name="submit">Invia</string>
<string name="required">*necessario</string>
<string name="report_sent">Il tuo resoconto è stato inviato!</string>

<!--Member Action--><!-- TODO Add translation -->
<string name="action_set_owner">Set as Owner</string>
<string name="action_set_moderator">Set as Moderator</string>
<string name="action_remove_owner">Remove as Owner</string>
<string name="action_remove_leader">Remove as Leader</string>
<string name="action_remove_moderator">Remove as Moderator</string>
<string name="action_mute_user">Mute User</string>
<string name="action_unmute_user">Unmute User</string>
<string name="action_remove_user">Remove from Room</string>
<string name="action_set_leader">Set as Leader</string>

<string name="owner">Owner</string>
<string name="leader">Leader</string>
<string name="moderator">Mod</string>
</resources>
17 changes: 16 additions & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,20 @@
<!-- Report -->
<string name="submit">Submit</string> <!--TODO - Add proper translation-->
<string name="required">*required</string> <!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string> <!--TODO - Add proper translation-->
<string name="report_sent">Your report has been sent!</string>

<!--Member Action--><!-- TODO Add translation -->
<string name="action_set_owner">Set as Owner</string>
<string name="action_set_moderator">Set as Moderator</string>
<string name="action_remove_owner">Remove as Owner</string>
<string name="action_remove_leader">Remove as Leader</string>
<string name="action_remove_moderator">Remove as Moderator</string>
<string name="action_mute_user">Mute User</string>
<string name="action_unmute_user">Unmute User</string>
<string name="action_remove_user">Remove from Room</string>
<string name="action_set_leader">Set as Leader</string> <!--TODO - Add proper translation-->

<string name="owner">Owner</string>
<string name="leader">Leader</string>
<string name="moderator">Mod</string>
</resources>
15 changes: 15 additions & 0 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,19 @@
<string name="submit">Enviar</string>
<string name="required">*obrigatório</string>
<string name="report_sent">A mensagem foi reportada!</string>

<!--Member Action--><!-- TODO Add translation -->
<string name="action_set_owner">Set as Owner</string>
<string name="action_set_moderator">Set as Moderator</string>
<string name="action_remove_owner">Remove as Owner</string>
<string name="action_remove_leader">Remove as Leader</string>
<string name="action_remove_moderator">Remove as Moderator</string>
<string name="action_mute_user">Mute User</string>
<string name="action_unmute_user">Unmute User</string>
<string name="action_remove_user">Remove from Room</string>
<string name="action_set_leader">Set as Leader</string>

<string name="owner">Owner</string>
<string name="leader">Leader</string>
<string name="moderator">Mod</string>
</resources>
Loading

0 comments on commit fdaad2b

Please sign in to comment.