Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
f4f34ec5
Commit
f4f34ec5
authored
Mar 14, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Layout adjustments on commands
parent
f1b43573
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
8 deletions
+31
-8
CommandSuggestionsAdapter.kt
...ket/android/chatroom/adapter/CommandSuggestionsAdapter.kt
+1
-1
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+1
-0
SuggestionsView.kt
...ocket/android/widget/autocompletion/ui/SuggestionsView.kt
+17
-0
suggestion_command_item.xml
app/src/main/res/layout/suggestion_command_item.xml
+11
-7
dimens.xml
app/src/main/res/values/dimens.xml
+1
-0
No files found.
app/src/main/java/chat/rocket/android/chatroom/adapter/CommandSuggestionsAdapter.kt
View file @
f4f34ec5
...
...
@@ -31,7 +31,7 @@ class CommandSuggestionsAdapter : SuggestionsAdapter<CommandSuggestionsViewHolde
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
descriptionTextView
.
text
=
description
.
toLowerCase
()
setOnClickListener
{
itemClickListener
?.
onClick
(
item
)
}
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
f4f34ec5
...
...
@@ -499,6 +499,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private
fun
setupSuggestionsView
()
{
suggestions_view
.
anchorTo
(
text_message
)
.
setMaximumHeight
(
resources
.
getDimensionPixelSize
(
R
.
dimen
.
suggestions_box_max_height
))
.
addTokenAdapter
(
PeopleSuggestionsAdapter
())
.
addTokenAdapter
(
CommandSuggestionsAdapter
())
.
addTokenAdapter
(
RoomSuggestionsAdapter
())
...
...
app/src/main/java/chat/rocket/android/widget/autocompletion/ui/SuggestionsView.kt
View file @
f4f34ec5
...
...
@@ -40,6 +40,7 @@ class SuggestionsView : FrameLayout, TextWatcher {
private
val
localProvidersByToken
=
hashMapOf
<
String
,
HashMap
<
String
,
List
<
SuggestionModel
>>>()
private
var
editor
:
WeakReference
<
EditText
>?
=
null
private
var
completionStartIndex
=
AtomicInteger
(
NO_STATE_INDEX
)
private
var
maxHeight
:
Int
=
0
companion
object
{
private
val
SLIDE_TRANSITION
=
Slide
(
Gravity
.
BOTTOM
).
setDuration
(
200
)
...
...
@@ -117,6 +118,15 @@ class SuggestionsView : FrameLayout, TextWatcher {
}
}
override
fun
onMeasure
(
widthMeasureSpec
:
Int
,
heightMeasureSpec
:
Int
)
{
if
(
maxHeight
>
0
)
{
val
hSpec
=
MeasureSpec
.
makeMeasureSpec
(
maxHeight
,
MeasureSpec
.
AT_MOST
)
super
.
onMeasure
(
widthMeasureSpec
,
hSpec
)
}
else
{
super
.
onMeasure
(
widthMeasureSpec
,
heightMeasureSpec
)
}
}
private
fun
swapAdapter
(
adapter
:
SuggestionsAdapter
<
*
>):
SuggestionsView
{
recyclerView
.
adapter
=
adapter
// Don't override if user has set an item click listener already
...
...
@@ -153,6 +163,13 @@ class SuggestionsView : FrameLayout, TextWatcher {
return
this
}
fun
setMaximumHeight
(
height
:
Int
):
SuggestionsView
{
check
(
height
>
0
)
this
.
maxHeight
=
height
requestLayout
()
return
this
}
fun
setOnItemClickListener
(
tokenAdapter
:
SuggestionsAdapter
<
*
>,
clickListener
:
(
item
:
SuggestionModel
)
->
Unit
):
SuggestionsView
{
tokenAdapter
.
setOnClickListener
(
object
:
SuggestionsAdapter
.
ItemClickListener
{
...
...
app/src/main/res/layout/suggestion_command_item.xml
View file @
f4f34ec5
...
...
@@ -3,9 +3,11 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"2dp"
android:layout_marginBottom=
"4dp"
android:layout_marginTop=
"4dp"
android:background=
"@color/suggestion_background_color"
android:orientation=
"horizontal"
>
android:orientation=
"horizontal"
android:paddingTop=
"2dp"
>
<TextView
android:id=
"@+id/text_command_name"
...
...
@@ -13,23 +15,25 @@
android:layout_height=
"wrap_content"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_marginStart=
"
16
dp"
android:layout_marginStart=
"
8
dp"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"@color/black"
android:textSize=
"1
6
sp"
android:textSize=
"1
4
sp"
tools:text=
"/leave"
/>
<TextView
android:id=
"@+id/text_command_description"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"8dp"
android:layout_marginStart=
"16dp"
android:layout_toRightOf=
"@id/text_command_name"
android:gravity=
"end"
android:ellipsize=
"end"
android:gravity=
"start"
android:maxLines=
"1"
android:textColor=
"@color/gray_material"
android:layout_marginEnd=
"16dp"
android:textSize=
"16sp"
android:textSize=
"14sp"
tools:text=
"Leave a channel"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/values/dimens.xml
View file @
f4f34ec5
...
...
@@ -34,5 +34,6 @@
<!-- Autocomplete Popup -->
<dimen
name=
"popup_max_height"
>
150dp
</dimen>
<dimen
name=
"suggestions_box_max_height"
>
250dp
</dimen>
</resources>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment