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
b9326410
Commit
b9326410
authored
Jan 11, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add implementation for room search
parent
226e069b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
0 deletions
+95
-0
ChatRoomSuggestion.kt
...hat/rocket/android/chatrooms/search/ChatRoomSuggestion.kt
+30
-0
SearchResultsListAdapter.kt
...cket/android/chatrooms/search/SearchResultsListAdapter.kt
+34
-0
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+7
-0
search_results_list_item.xml
app/src/main/res/layout/search_results_list_item.xml
+24
-0
No files found.
app/src/main/java/chat/rocket/android/chatrooms/search/ChatRoomSuggestion.kt
0 → 100644
View file @
b9326410
package
chat.rocket.android.chatrooms.search
import
android.os.Parcel
import
android.os.Parcelable
import
com.arlib.floatingsearchview.suggestions.model.SearchSuggestion
class
ChatRoomSuggestion
(
val
chatRoomName
:
String
)
:
SearchSuggestion
{
override
fun
getBody
():
String
=
chatRoomName
constructor
(
parcel
:
Parcel
)
:
this
(
parcel
.
readString
())
override
fun
writeToParcel
(
parcel
:
Parcel
,
flags
:
Int
)
{
parcel
.
writeString
(
chatRoomName
)
}
override
fun
describeContents
():
Int
{
return
0
}
companion
object
CREATOR
:
Parcelable
.
Creator
<
ChatRoomSuggestion
>
{
override
fun
createFromParcel
(
parcel
:
Parcel
):
ChatRoomSuggestion
{
return
ChatRoomSuggestion
(
parcel
)
}
override
fun
newArray
(
size
:
Int
):
Array
<
ChatRoomSuggestion
?
>
{
return
arrayOfNulls
(
size
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatrooms/search/SearchResultsListAdapter.kt
0 → 100644
View file @
b9326410
package
chat.rocket.android.chatrooms.search
import
android.support.v7.widget.RecyclerView
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
chat.rocket.android.R
class
SearchResultsListAdapter
(
private
var
data
:
List
<
ChatRoomSuggestion
>)
:
RecyclerView
.
Adapter
<
SearchResultsListAdapter
.
ViewHolder
>()
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
?,
viewType
:
Int
):
ViewHolder
{
val
view
=
LayoutInflater
.
from
(
parent
?.
getContext
())
.
inflate
(
R
.
layout
.
search_results_list_item
,
parent
,
false
)
return
ViewHolder
(
view
)
}
override
fun
onBindViewHolder
(
holder
:
ViewHolder
?,
position
:
Int
)
{
val
chatRoomSuggestion
=
data
[
position
]
holder
?.
chatRoomName
?.
text
=
chatRoomSuggestion
.
body
}
override
fun
getItemCount
():
Int
=
data
.
size
fun
swapData
(
newData
:
List
<
ChatRoomSuggestion
>)
{
data
=
newData
notifyDataSetChanged
()
}
class
ViewHolder
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
val
chatRoomName
:
TextView
=
view
.
findViewById
(
R
.
id
.
text_chat_suggestion_name
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
b9326410
...
...
@@ -33,6 +33,13 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
presenter
.
chatRooms
()
floating_search_view
.
setOnQueryChangeListener
{
oldQuery
,
newQuery
->
if
(
oldQuery
.
isNotEmpty
()
&&
newQuery
.
isEmpty
())
{
floating_search_view
.
clearSuggestions
()
}
else
{
floating_search_view
.
showProgress
()
}
}
}
override
fun
showChatRooms
(
dataSet
:
MutableList
<
ChatRoom
>)
{
...
...
app/src/main/res/layout/search_results_list_item.xml
0 → 100644
View file @
b9326410
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"175dp"
app:cardUseCompatPadding=
"true"
>
<LinearLayout
android:id=
"@+id/text_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"16dp"
>
<TextView
android:id=
"@+id/text_chat_suggestion_name"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:textSize=
"18sp"
android:textStyle=
"bold"
tools:text=
"androidnativeapp"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
\ 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