Commit 0d49577b authored by Leonardo Aramaki's avatar Leonardo Aramaki

Get command description from strings

parent 530a49e9
......@@ -27,8 +27,11 @@ class CommandSuggestionsAdapter : SuggestionsAdapter<CommandSuggestionsViewHolde
with(itemView) {
val nameTextView = itemView.findViewById<TextView>(R.id.text_command_name)
val descriptionTextView = itemView.findViewById<TextView>(R.id.text_command_description)
nameTextView.text = item.text
descriptionTextView.text = item.description.replace("_", " ")
nameTextView.text = "/${item.text}"
val res = context.resources
val id = res.getIdentifier(item.description, "string", context.packageName)
val description = if (id > 0) res.getString(id) else ""
descriptionTextView.text = description
setOnClickListener {
itemClickListener?.onClick(item)
}
......
......@@ -495,6 +495,7 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
//TODO: cache the commands
val commands = client.commands(0, 100).result
view.populateCommandSuggestions(commands.map {
println("${it.command} - ${it.description}")
CommandSuggestionViewModel(it.command, it.description ?: "", listOf(it.command))
})
} catch (ex: RocketChatException) {
......
......@@ -13,7 +13,6 @@
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:ellipsize="end"
android:maxLines="1"
......@@ -23,14 +22,13 @@
<TextView
android:id="@+id/text_command_description"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_toEndOf="@id/text_command_name"
android:ellipsize="end"
android:maxLines="1"
android:layout_toRightOf="@id/text_command_name"
android:gravity="end"
android:textColor="@color/gray_material"
android:layout_marginEnd="16dp"
android:textSize="16sp"
tools:text="Leave a channel" />
......
......@@ -114,4 +114,28 @@
<string name="status_authenticating">autenticando</string>
<string name="status_disconnecting">desconectando</string>
<string name="status_waiting">conectando em %d segundos</string>
<!-- Slash Commands -->
<string name="Slash_Gimme_Description">Exibir ༼ つ ◕_◕ ༽つ antes de sua mensagem</string>
<string name="Slash_LennyFace_Description">Exibir ( ͡° ͜ʖ ͡°) depois de sua mensagem</string>
<string name="Slash_Shrug_Description">Exibir ¯\_(ツ)_/¯ depois de sua mensagem</string>
<string name="Slash_Tableflip_Description">Exibir (╯°□°)╯︵ ┻━┻</string>
<string name="Slash_TableUnflip_Description">Exibir ┬─┬ ノ( ゜-゜ノ)</string>
<string name="Create_A_New_Channel">Criar um novo canal</string>
<string name="Show_the_keyboard_shortcut_list">Show the keyboard shortcut list</string>
<string name="Invite_user_to_join_channel_all_from"> do [#canal] para entrar neste</string>
<string name="Invite_user_to_join_channel_all_to">Convidar todos os usuários deste canal para entrar no [#canal]</string>
<string name="Archive">Arquivar</string>
<string name="Remove_someone_from_room">Remover alguém do canal</string>
<string name="Leave_the_current_channel">Sair do canal atual</string>
<string name="Displays_action_text">Exibir texto de ação</string>
<string name="Direct_message_someone">Enviar DM para alguém</string>
<string name="Mute_someone_in_room">Mutar alguém</string>
<string name="Unmute_someone_in_room">Desmutar alguém na sala</string>
<string name="Invite_user_to_join_channel">Convidar algum usuário para entrar neste canal</string>
<string name="Unarchive">Desarquivar</string>
<string name="Join_the_given_channel">Entrar no canal especificado</string>
<string name="Guggy_Command_Description">Gera um gif baseado no texto dado</string>
<string name="Slash_Topic_Description">Definir tópico</string>
</resources>
\ No newline at end of file
......@@ -116,4 +116,27 @@
<string name="status_disconnecting">disconnecting</string>
<string name="status_waiting">connecting in %d seconds</string>
<!-- Slash Commands -->
<string name="Slash_Gimme_Description">Displays ༼ つ ◕_◕ ༽つ before your message</string>
<string name="Slash_LennyFace_Description">Displays ( ͡° ͜ʖ ͡°) after your message</string>
<string name="Slash_Shrug_Description">Displays ¯\_(ツ)_/¯ after your message</string>
<string name="Slash_Tableflip_Description">Displays (╯°□°)╯︵ ┻━┻</string>
<string name="Slash_TableUnflip_Description">Displays ┬─┬ ノ( ゜-゜ノ)</string>
<string name="Create_A_New_Channel">Create a new channel</string>
<string name="Show_the_keyboard_shortcut_list">Show the keyboard shortcut list</string>
<string name="Invite_user_to_join_channel_all_from">Invite all users from [#channel] to join this channel</string>
<string name="Invite_user_to_join_channel_all_to">Invite all users from this channel to join [#channel]</string>
<string name="Archive">Archive</string>
<string name="Remove_someone_from_room">Remove someone from the room</string>
<string name="Leave_the_current_channel">Leave the current channel</string>
<string name="Displays_action_text">Displays action text</string>
<string name="Direct_message_someone">Direct message someone</string>
<string name="Mute_someone_in_room">Mute someone in the room</string>
<string name="Unmute_someone_in_room">Unmute someone in the room</string>
<string name="Invite_user_to_join_channel">Invite one user to join this channel</string>
<string name="Unarchive">Unarchive</string>
<string name="Join_the_given_channel">Join the given channel</string>
<string name="Guggy_Command_Description">Generates a gif based upon the provided text</string>
<string name="Slash_Topic_Description">Set topic</string>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment