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
7435abb5
Commit
7435abb5
authored
May 23, 2018
by
aniket
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
completes basic implementation of adding users to a new channel
parent
11b54eda
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
191 additions
and
74 deletions
+191
-74
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+2
-2
AddMembersModule.kt
...t/android/createChannel/addMembers/di/AddMembersModule.kt
+1
-3
AddMembersProvider.kt
...android/createChannel/addMembers/di/AddMembersProvider.kt
+1
-1
AddMembersPresenter.kt
...ateChannel/addMembers/presentation/AddMembersPresenter.kt
+11
-2
AddMembersView.kt
...d/createChannel/addMembers/presentation/AddMembersView.kt
+7
-0
AddMembersActivity.kt
...android/createChannel/addMembers/ui/AddMembersActivity.kt
+98
-46
CreateNewChannelActivity.kt
...cket/android/createChannel/ui/CreateNewChannelActivity.kt
+30
-8
ActivityBuilder.kt
...java/chat/rocket/android/dagger/module/ActivityBuilder.kt
+6
-0
EndlessRecyclerViewScrollListener.kt
...ocket/android/helper/EndlessRecyclerViewScrollListener.kt
+1
-1
MembersAdapter.kt
...ava/chat/rocket/android/members/adapter/MembersAdapter.kt
+4
-0
PopupRecyclerView.kt
...ket/android/widget/autocompletion/ui/PopupRecyclerView.kt
+1
-1
activity_add_members.xml
app/src/main/res/layout/activity_add_members.xml
+26
-7
activity_create_new_channel.xml
app/src/main/res/layout/activity_create_new_channel.xml
+2
-2
strings.xml
app/src/main/res/values/strings.xml
+1
-1
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
7435abb5
...
@@ -544,7 +544,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -544,7 +544,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
onEmojiAdded
(
emoji
:
Emoji
)
{
override
fun
onEmojiAdded
(
emoji
:
Emoji
)
{
val
cursorPosition
=
text_message
.
selectionStart
val
cursorPosition
=
text_message
.
selectionStart
if
(
cursorPosition
>
-
1
)
{
if
(
cursorPosition
>
-
1
)
{
text_message
.
text
.
insert
(
cursorPosition
,
EmojiParser
.
parse
(
emoji
.
shortname
))
text_message
.
text
?
.
insert
(
cursorPosition
,
EmojiParser
.
parse
(
emoji
.
shortname
))
text_message
.
setSelection
(
cursorPosition
+
emoji
.
unicode
.
length
)
text_message
.
setSelection
(
cursorPosition
+
emoji
.
unicode
.
length
)
}
}
}
}
...
@@ -552,7 +552,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -552,7 +552,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
onNonEmojiKeyPressed
(
keyCode
:
Int
)
{
override
fun
onNonEmojiKeyPressed
(
keyCode
:
Int
)
{
when
(
keyCode
)
{
when
(
keyCode
)
{
KeyEvent
.
KEYCODE_BACK
->
with
(
text_message
)
{
KeyEvent
.
KEYCODE_BACK
->
with
(
text_message
)
{
if
(
selectionStart
>
0
)
text
.
delete
(
selectionStart
-
1
,
selectionStart
)
if
(
selectionStart
>
0
)
text
!!
.
delete
(
selectionStart
-
1
,
selectionStart
)
}
}
else
->
throw
IllegalArgumentException
(
"pressed key not expected"
)
else
->
throw
IllegalArgumentException
(
"pressed key not expected"
)
}
}
...
...
app/src/main/java/chat/rocket/android/createChannel/addMembers/di/AddMembersModule.kt
View file @
7435abb5
...
@@ -4,8 +4,6 @@ import android.arch.lifecycle.LifecycleOwner
...
@@ -4,8 +4,6 @@ import android.arch.lifecycle.LifecycleOwner
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.createChannel.addMembers.presentation.AddMembersView
import
chat.rocket.android.createChannel.addMembers.presentation.AddMembersView
import
chat.rocket.android.createChannel.addMembers.ui.AddMembersActivity
import
chat.rocket.android.createChannel.addMembers.ui.AddMembersActivity
import
chat.rocket.android.createChannel.presentation.CreateNewChannelView
import
chat.rocket.android.createChannel.ui.CreateNewChannelActivity
import
chat.rocket.android.dagger.scope.PerActivity
import
chat.rocket.android.dagger.scope.PerActivity
import
dagger.Module
import
dagger.Module
import
dagger.Provides
import
dagger.Provides
...
@@ -20,7 +18,7 @@ class AddMembersModule {
...
@@ -20,7 +18,7 @@ class AddMembersModule {
@Provides
@Provides
@PerActivity
@PerActivity
fun
addMembersView
(
activity
:
AddMembersActivity
):
AddMembersView
{
fun
addMembersView
(
activity
:
AddMembersActivity
):
AddMembersView
{
return
activity
return
activity
}
}
...
...
app/src/main/java/chat/rocket/android/createChannel/addMembers/di/AddMembersProvider.kt
View file @
7435abb5
...
@@ -7,5 +7,5 @@ import dagger.android.ContributesAndroidInjector
...
@@ -7,5 +7,5 @@ import dagger.android.ContributesAndroidInjector
@Module
@Module
abstract
class
AddMembersProvider
{
abstract
class
AddMembersProvider
{
@ContributesAndroidInjector
(
modules
=
[
AddMembersModule
::
class
])
@ContributesAndroidInjector
(
modules
=
[
AddMembersModule
::
class
])
abstract
fun
provide
NewChannel
Activity
():
AddMembersActivity
abstract
fun
provide
AddMembers
Activity
():
AddMembersActivity
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/createChannel/addMembers/presentation/AddMembersPresenter.kt
View file @
7435abb5
package
chat.rocket.android.createChannel.addMembers.presentation
package
chat.rocket.android.createChannel.addMembers.presentation
import
chat.rocket.android.core.behaviours.showMessage
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.members.viewmodel.MemberViewModelMapper
import
chat.rocket.android.members.viewmodel.MemberViewModelMapper
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
...
@@ -7,7 +8,7 @@ import chat.rocket.android.server.infraestructure.RocketChatClientFactory
...
@@ -7,7 +8,7 @@ import chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.android.util.retryIO
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatException
import
chat.rocket.common.RocketChatException
import
chat.rocket.co
re.RocketChatClient
import
chat.rocket.co
mmon.util.ifNull
import
chat.rocket.core.internal.rest.queryUsers
import
chat.rocket.core.internal.rest.queryUsers
import
javax.inject.Inject
import
javax.inject.Inject
...
@@ -23,14 +24,22 @@ class AddMembersPresenter @Inject constructor(
...
@@ -23,14 +24,22 @@ class AddMembersPresenter @Inject constructor(
fun
queryUsersFromRegex
(
queryParam
:
String
)
{
fun
queryUsersFromRegex
(
queryParam
:
String
)
{
if
(
client
!=
null
)
{
if
(
client
!=
null
)
{
view
.
showLoading
()
launchUI
(
strategy
)
{
launchUI
(
strategy
)
{
try
{
try
{
val
allMembers
=
retryIO
(
"queryUsers($queryParam)"
)
{
val
allMembers
=
retryIO
(
"queryUsers($queryParam)"
)
{
client
.
queryUsers
(
queryParam
)
client
.
queryUsers
(
queryParam
)
}
}
val
memberViewModelMapper
=
mapper
.
mapToViewModelList
(
allMembers
.
result
)
val
memberViewModelMapper
=
mapper
.
mapToViewModelList
(
allMembers
.
result
)
view
.
showMembers
(
memberViewModelMapper
,
allMembers
.
total
)
}
catch
(
ex
:
RocketChatException
)
{
}
catch
(
ex
:
RocketChatException
)
{
ex
.
message
?.
let
{
view
.
showMessage
(
it
)
}.
ifNull
{
view
.
showGenericErrorMessage
()
}
}
finally
{
view
.
hideLoading
()
}
}
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/createChannel/addMembers/presentation/AddMembersView.kt
View file @
7435abb5
...
@@ -2,6 +2,13 @@ package chat.rocket.android.createChannel.addMembers.presentation
...
@@ -2,6 +2,13 @@ package chat.rocket.android.createChannel.addMembers.presentation
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.LoadingView
import
chat.rocket.android.core.behaviours.MessageView
import
chat.rocket.android.core.behaviours.MessageView
import
chat.rocket.android.members.viewmodel.MemberViewModel
interface
AddMembersView
:
LoadingView
,
MessageView
{
interface
AddMembersView
:
LoadingView
,
MessageView
{
/**
* Show members on the basis of query
* @param dataSet The list of members
* @param total The number of members returned
*/
fun
showMembers
(
dataSet
:
List
<
MemberViewModel
>,
total
:
Long
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/createChannel/addMembers/ui/AddMembersActivity.kt
View file @
7435abb5
package
chat.rocket.android.createChannel.addMembers.ui
package
chat.rocket.android.createChannel.addMembers.ui
import
android.os.Bundle
import
android.os.Bundle
import
android.support.design.chip.Chip
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
import
android.widget.SearchView
import
android.support.v7.widget.LinearLayoutManager
import
android.widget.EditText
import
android.widget.Toast
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.createChannel.addMembers.presentation.AddMembersPresenter
import
chat.rocket.android.createChannel.addMembers.presentation.AddMembersPresenter
import
chat.rocket.android.createChannel.addMembers.presentation.AddMembersView
import
chat.rocket.android.createChannel.addMembers.presentation.AddMembersView
import
chat.rocket.android.members.adapter.MembersAdapter
import
chat.rocket.android.members.viewmodel.MemberViewModel
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.widget.DividerItemDecoration
import
com.jakewharton.rxbinding2.widget.RxTextView
import
com.jakewharton.rxbinding2.widget.RxTextView
import
dagger.android.AndroidInjection
import
io.reactivex.Observable
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.subjects.BehaviorSubject
import
io.reactivex.subjects.BehaviorSubject
import
kotlinx.android.synthetic.main.activity_add_members.*
import
kotlinx.android.synthetic.main.activity_add_members.*
import
kotlinx.android.synthetic.main.activity_create_new_channel.*
import
kotlinx.android.synthetic.main.layout_toolbar.*
import
kotlinx.android.synthetic.main.layout_toolbar.*
import
java.util.concurrent.TimeUnit
import
java.util.concurrent.TimeUnit
import
javax.inject.Inject
import
javax.inject.Inject
class
AddMembersActivity
:
AppCompatActivity
(),
AddMembersView
{
class
AddMembersActivity
:
AppCompatActivity
(),
AddMembersView
{
override
fun
showLoading
()
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
override
fun
hideLoading
()
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
override
fun
showMessage
(
resId
:
Int
)
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
override
fun
showMessage
(
message
:
String
)
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
override
fun
showGenericErrorMessage
()
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
@Inject
@Inject
lateinit
var
presenter
:
AddMembersPresenter
lateinit
var
presenter
:
AddMembersPresenter
private
var
membersToAdd
:
ArrayList
<
String
>
=
ArrayList
()
private
val
adapter
:
MembersAdapter
=
MembersAdapter
{
memberViewModel
->
addNewChip
(
memberViewModel
)
updateToolBar
()
search_view
.
setText
(
""
)
}
private
var
linearLayoutManager
=
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
)
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidInjection
.
inject
(
this
)
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_add_members
)
setUpToolBar
()
setUpToolBar
()
setUpRecyclerView
()
observableFromSearchView
(
search_view
)
observableFromSearchView
(
search_view
)
.
debounce
(
300
,
TimeUnit
.
MILLISECONDS
)
.
debounce
(
300
,
TimeUnit
.
MILLISECONDS
)
.
filter
{
item
->
item
.
length
>
1
}
.
filter
{
item
->
item
.
length
>
1
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
query
->
.
subscribe
{
query
->
{
run
{
//search for elements on the basis of query obtained and also add a function in
adapter
.
reAllocateArrayList
()
// login presenter
presenter
.
queryUsersFromRegex
(
query
)
}
}
}
}
}
private
fun
addNewChip
(
memberViewModel
:
MemberViewModel
)
{
val
memberChip
=
Chip
(
this
)
memberChip
.
chipText
=
memberViewModel
.
username
memberChip
.
isCloseIconEnabled
=
true
memberChip
.
setChipBackgroundColorResource
(
R
.
color
.
icon_grey
)
memberChip
.
setOnCloseIconClickListener
{
view
->
members_chips
.
removeView
(
view
)
membersToAdd
.
remove
((
view
as
Chip
).
chipText
.
toString
())
updateToolBar
()
}
members_chips
.
addView
(
memberChip
)
memberViewModel
.
username
?.
let
{
membersToAdd
.
add
(
it
)
}
Toast
.
makeText
(
this
,
membersToAdd
.
size
.
toString
(),
Toast
.
LENGTH_SHORT
).
show
()
}
private
fun
updateToolBar
()
{
toolbar_title
.
text
=
getString
(
R
.
string
.
title_add_members
,
membersToAdd
.
size
)
}
override
fun
showMembers
(
dataSet
:
List
<
MemberViewModel
>,
total
:
Long
)
{
if
(
adapter
.
itemCount
==
0
)
{
adapter
.
prependData
(
dataSet
)
// if (dataSet.size >= 59) { // TODO Check why the API retorns the specified count -1
// search_results.addOnScrollListener(object :
// EndlessRecyclerViewScrollListener(linearLayoutManager) {
// override fun onLoadMore(
// page: Int,
// totalItemsCount: Int,
// recyclerView: RecyclerView?
// ) {
// presenter.loadChatRoomsMembers(chatRoomId, chatRoomType, page * 60L)
// }
// })
// }
}
else
{
adapter
.
appendData
(
dataSet
)
}
}
}
override
fun
showLoading
()
{
progress_bar
.
setVisible
(
true
)
}
override
fun
hideLoading
()
{
progress_bar
.
setVisible
(
false
)
}
override
fun
showMessage
(
resId
:
Int
)
{
showToast
(
resId
)
}
override
fun
showMessage
(
message
:
String
)
{
showToast
(
message
)
}
override
fun
showGenericErrorMessage
()
{
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
}
private
fun
setUpToolBar
()
{
private
fun
setUpToolBar
()
{
toolbar_title
.
text
=
getString
(
R
.
string
.
title_add_members
)
setSupportActionBar
(
toolbar
)
toolbar_title
.
text
=
getString
(
R
.
string
.
title_add_members
,
0
)
toolbar_action_text
.
text
=
getString
(
R
.
string
.
action_select_members
)
toolbar_action_text
.
text
=
getString
(
R
.
string
.
action_select_members
)
supportActionBar
?.
setDisplayHomeAsUpEnabled
(
true
)
supportActionBar
?.
setDisplayHomeAsUpEnabled
(
true
)
RxTextView
.
textChanges
(
channel_name_edit_text
).
subscribe
{
text
->
toolbar_action_text
.
isEnabled
=
text
.
isNotEmpty
()
if
(
text
.
isEmpty
())
toolbar_action_text
.
alpha
=
0.8f
else
toolbar_action_text
.
alpha
=
1.0f
}
}
}
private
fun
observableFromSearchView
(
searchView
:
SearchView
):
Observable
<
String
>
{
private
fun
setUpRecyclerView
()
{
val
observableSubject
:
BehaviorSubject
<
String
>
=
BehaviorSubject
.
create
()
search_results
.
layoutManager
=
linearLayoutManager
searchView
.
setOnQueryTextListener
(
object
:
SearchView
.
OnQueryTextListener
{
search_results
.
adapter
=
adapter
search_results
.
addItemDecoration
(
DividerItemDecoration
(
this
))
override
fun
onQueryTextSubmit
(
query
:
String
):
Boolean
{
}
observableSubject
.
onComplete
()
return
true
}
override
fun
onQueryTextChange
(
newText
:
String
):
Boolean
{
private
fun
observableFromSearchView
(
searchView
:
EditText
):
Observable
<
String
>
{
if
(!
newText
.
isEmpty
())
{
val
observableSubject
:
BehaviorSubject
<
String
>
=
BehaviorSubject
.
create
()
observableSubject
.
onNext
(
newText
)
RxTextView
.
textChanges
(
searchView
).
subscribe
{
text
->
}
if
(
text
.
isNotBlank
())
{
return
true
observableSubject
.
onNext
(
text
.
toString
())
}
}
}
)
}
return
observableSubject
return
observableSubject
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/createChannel/ui/CreateNewChannelActivity.kt
View file @
7435abb5
package
chat.rocket.android.createChannel.ui
package
chat.rocket.android.createChannel.ui
import
android.content.Intent
import
android.graphics.drawable.GradientDrawable
import
android.graphics.drawable.GradientDrawable
import
android.os.Bundle
import
android.os.Bundle
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
import
android.view.MenuItem
import
android.view.MenuItem
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.createChannel.addMembers.ui.AddMembersActivity
import
chat.rocket.android.createChannel.presentation.CreateNewChannelPresenter
import
chat.rocket.android.createChannel.presentation.CreateNewChannelPresenter
import
chat.rocket.android.createChannel.presentation.CreateNewChannelView
import
chat.rocket.android.createChannel.presentation.CreateNewChannelView
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.setVisible
...
@@ -18,6 +20,10 @@ import javax.inject.Inject
...
@@ -18,6 +20,10 @@ import javax.inject.Inject
class
CreateNewChannelActivity
:
AppCompatActivity
(),
CreateNewChannelView
{
class
CreateNewChannelActivity
:
AppCompatActivity
(),
CreateNewChannelView
{
@Inject
lateinit
var
presenter
:
CreateNewChannelPresenter
private
var
channelType
:
String
=
"public"
override
fun
showLoading
()
{
override
fun
showLoading
()
{
view_loading
.
setVisible
(
true
)
view_loading
.
setVisible
(
true
)
layout_container
.
alpha
=
0.5f
layout_container
.
alpha
=
0.5f
...
@@ -46,10 +52,6 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
...
@@ -46,10 +52,6 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
}
}
@Inject
lateinit
var
presenter
:
CreateNewChannelPresenter
private
var
channelType
:
String
=
"public"
override
fun
onOptionsItemSelected
(
item
:
MenuItem
?):
Boolean
{
override
fun
onOptionsItemSelected
(
item
:
MenuItem
?):
Boolean
{
when
(
item
?.
itemId
)
{
when
(
item
?.
itemId
)
{
android
.
R
.
id
.
home
->
{
android
.
R
.
id
.
home
->
{
...
@@ -94,7 +96,11 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
...
@@ -94,7 +96,11 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
placeholder
.
setImageDrawable
(
getDrawable
(
R
.
drawable
.
ic_hashtag_black
))
placeholder
.
setImageDrawable
(
getDrawable
(
R
.
drawable
.
ic_hashtag_black
))
(
getDrawable
(
R
.
drawable
.
button_border
)
as
GradientDrawable
).
setColor
(
resources
.
getColor
(
R
.
color
.
colorLightTheme
))
(
getDrawable
(
R
.
drawable
.
button_border
)
as
GradientDrawable
).
setColor
(
resources
.
getColor
(
R
.
color
.
colorLightTheme
)
)
(
getDrawable
(
R
.
drawable
.
button_solid
)
as
GradientDrawable
).
setColor
(
resources
.
getColor
(
R
.
color
.
red
))
(
getDrawable
(
R
.
drawable
.
button_solid
)
as
GradientDrawable
).
setColor
(
resources
.
getColor
(
R
.
color
.
red
))
private_channel
.
background
=
getDrawable
(
R
.
drawable
.
button_border
)
private_channel
.
background
=
getDrawable
(
R
.
drawable
.
button_border
)
...
@@ -112,9 +118,16 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
...
@@ -112,9 +118,16 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
placeholder
.
setImageDrawable
(
getDrawable
(
R
.
drawable
.
ic_room_lock
))
placeholder
.
setImageDrawable
(
getDrawable
(
R
.
drawable
.
ic_room_lock
))
(
getDrawable
(
R
.
drawable
.
button_border
)
as
GradientDrawable
).
setColor
(
resources
.
getColor
(
R
.
color
.
red
))
(
getDrawable
(
R
.
drawable
.
button_border
)
as
GradientDrawable
).
setColor
(
resources
.
getColor
(
R
.
color
.
red
)
)
(
getDrawable
(
R
.
drawable
.
button_solid
)
as
GradientDrawable
).
setColor
(
resources
.
getColor
(
R
.
color
.
colorLightTheme
))
(
getDrawable
(
R
.
drawable
.
button_solid
)
as
GradientDrawable
).
setColor
(
resources
.
getColor
(
R
.
color
.
colorLightTheme
))
(
getDrawable
(
R
.
drawable
.
button_solid
)
as
GradientDrawable
).
setStroke
(
1
,
resources
.
getColor
(
R
.
color
.
red
))
(
getDrawable
(
R
.
drawable
.
button_solid
)
as
GradientDrawable
).
setStroke
(
1
,
resources
.
getColor
(
R
.
color
.
red
)
)
private_channel
.
background
=
getDrawable
(
R
.
drawable
.
button_border
)
private_channel
.
background
=
getDrawable
(
R
.
drawable
.
button_border
)
public_channel
.
background
=
getDrawable
(
R
.
drawable
.
button_solid
)
public_channel
.
background
=
getDrawable
(
R
.
drawable
.
button_solid
)
...
@@ -125,8 +138,17 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
...
@@ -125,8 +138,17 @@ class CreateNewChannelActivity : AppCompatActivity(), CreateNewChannelView {
toolbar_action_text
.
setOnClickListener
{
toolbar_action_text
.
setOnClickListener
{
if
(
toolbar_action_text
.
isEnabled
)
{
if
(
toolbar_action_text
.
isEnabled
)
{
presenter
.
createNewChannel
(
roomTypeOf
(
channelType
),
channel_name_edit_text
.
text
.
toString
(),
listOf
(
"aniket03"
),
false
)
presenter
.
createNewChannel
(
roomTypeOf
(
channelType
),
channel_name_edit_text
.
text
.
toString
(),
listOf
(
"aniket03"
),
false
)
}
}
}
}
add_members_view
.
setOnClickListener
{
startActivity
(
Intent
(
this
,
AddMembersActivity
::
class
.
java
))
}
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/dagger/module/ActivityBuilder.kt
View file @
7435abb5
...
@@ -14,6 +14,8 @@ import chat.rocket.android.chatroom.di.FavoriteMessagesFragmentProvider
...
@@ -14,6 +14,8 @@ import chat.rocket.android.chatroom.di.FavoriteMessagesFragmentProvider
import
chat.rocket.android.chatroom.di.PinnedMessagesFragmentProvider
import
chat.rocket.android.chatroom.di.PinnedMessagesFragmentProvider
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.chatrooms.di.ChatRoomsFragmentProvider
import
chat.rocket.android.chatrooms.di.ChatRoomsFragmentProvider
import
chat.rocket.android.createChannel.addMembers.di.AddMembersModule
import
chat.rocket.android.createChannel.addMembers.ui.AddMembersActivity
import
chat.rocket.android.createChannel.di.CreateNewChannelModule
import
chat.rocket.android.createChannel.di.CreateNewChannelModule
import
chat.rocket.android.createChannel.di.CreateNewChannelProvider
import
chat.rocket.android.createChannel.di.CreateNewChannelProvider
import
chat.rocket.android.createChannel.ui.CreateNewChannelActivity
import
chat.rocket.android.createChannel.ui.CreateNewChannelActivity
...
@@ -74,4 +76,8 @@ abstract class ActivityBuilder {
...
@@ -74,4 +76,8 @@ abstract class ActivityBuilder {
@ContributesAndroidInjector
(
modules
=
[
CreateNewChannelModule
::
class
])
@ContributesAndroidInjector
(
modules
=
[
CreateNewChannelModule
::
class
])
abstract
fun
bindCreateNewChannelActivity
():
CreateNewChannelActivity
abstract
fun
bindCreateNewChannelActivity
():
CreateNewChannelActivity
@PerActivity
@ContributesAndroidInjector
(
modules
=
[
AddMembersModule
::
class
])
abstract
fun
bindAddMembersActivity
():
AddMembersActivity
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/helper/EndlessRecyclerViewScrollListener.kt
View file @
7435abb5
...
@@ -45,7 +45,7 @@ abstract class EndlessRecyclerViewScrollListener : RecyclerView.OnScrollListener
...
@@ -45,7 +45,7 @@ abstract class EndlessRecyclerViewScrollListener : RecyclerView.OnScrollListener
// This happens many times a second during a scroll, so be wary of the code you place here.
// This happens many times a second during a scroll, so be wary of the code you place here.
// We are given a few useful parameters to help us work out if we need to load some more data,
// We are given a few useful parameters to help us work out if we need to load some more data,
// but first we check if we are waiting for the previous load to finish.
// but first we check if we are waiting for the previous load to finish.
override
fun
onScrolled
(
view
:
RecyclerView
?
,
dx
:
Int
,
dy
:
Int
)
{
override
fun
onScrolled
(
view
:
RecyclerView
,
dx
:
Int
,
dy
:
Int
)
{
var
lastVisibleItemPosition
=
0
var
lastVisibleItemPosition
=
0
val
totalItemCount
=
layoutManager
.
itemCount
val
totalItemCount
=
layoutManager
.
itemCount
...
...
app/src/main/java/chat/rocket/android/members/adapter/MembersAdapter.kt
View file @
7435abb5
...
@@ -19,6 +19,10 @@ class MembersAdapter(private val listener: (MemberViewModel) -> Unit) : Recycler
...
@@ -19,6 +19,10 @@ class MembersAdapter(private val listener: (MemberViewModel) -> Unit) : Recycler
override
fun
getItemCount
():
Int
=
dataSet
.
size
override
fun
getItemCount
():
Int
=
dataSet
.
size
fun
reAllocateArrayList
(){
this
.
dataSet
=
ArrayList
()
}
fun
prependData
(
dataSet
:
List
<
MemberViewModel
>)
{
fun
prependData
(
dataSet
:
List
<
MemberViewModel
>)
{
this
.
dataSet
=
dataSet
this
.
dataSet
=
dataSet
notifyItemRangeInserted
(
0
,
dataSet
.
size
)
notifyItemRangeInserted
(
0
,
dataSet
.
size
)
...
...
app/src/main/java/chat/rocket/android/widget/autocompletion/ui/PopupRecyclerView.kt
View file @
7435abb5
...
@@ -13,7 +13,7 @@ internal class PopupRecyclerView : RecyclerView {
...
@@ -13,7 +13,7 @@ internal class PopupRecyclerView : RecyclerView {
private
var
displayWidth
:
Int
=
0
private
var
displayWidth
:
Int
=
0
constructor
(
context
:
Context
?)
:
this
(
context
,
null
)
constructor
(
context
:
Context
?)
:
this
(
context
,
null
)
constructor
(
context
:
Context
?,
attrs
:
AttributeSet
?)
:
this
(
context
,
attrs
,
0
)
constructor
(
context
:
Context
?,
attrs
:
AttributeSet
?)
:
this
(
context
,
attrs
,
0
)
constructor
(
context
:
Context
?,
attrs
:
AttributeSet
?,
defStyle
:
Int
)
:
super
(
context
,
attrs
,
defStyle
)
{
constructor
(
context
:
Context
?,
attrs
:
AttributeSet
?,
defStyle
:
Int
)
:
super
(
context
!!
,
attrs
,
defStyle
)
{
val
wm
=
context
!!
.
getSystemService
(
Context
.
WINDOW_SERVICE
)
as
WindowManager
val
wm
=
context
!!
.
getSystemService
(
Context
.
WINDOW_SERVICE
)
as
WindowManager
val
display
=
wm
.
defaultDisplay
val
display
=
wm
.
defaultDisplay
val
size
=
DisplayMetrics
()
val
size
=
DisplayMetrics
()
...
...
app/src/main/res/layout/activity_add_members.xml
View file @
7435abb5
...
@@ -24,18 +24,37 @@
...
@@ -24,18 +24,37 @@
android:id=
"@+id/members_chips"
android:id=
"@+id/members_chips"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:chipSpacing=
"2dp"
app:layout_constraintTop_toTopOf=
"parent"
>
app:layout_constraintStart_toStartOf=
"parent"
android:layout_margin=
"8dp"
app:chipSpacing=
"3dp"
style=
"@style/Widget.MaterialComponents.Chip.Entry"
>
</android.support.design.chip.ChipGroup>
</android.support.design.chip.ChipGroup>
<SearchView
<com.wang.avi.AVLoadingIndicatorView
android:id=
"@+id/progress_bar"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
app:indicatorColor=
"@color/colorPrimary"
app:indicatorName=
"BallPulseIndicator"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<EditText
android:id=
"@+id/search_view"
android:id=
"@+id/search_view"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/members_chips"
android:paddingTop=
"6dp"
android:layout_margin=
"8dp"
android:paddingBottom=
"6dp"
android:backgroundTint=
"@color/colorLightTheme"
android:paddingStart=
"8dp"
android:hint=
"@string/msg_search"
/>
android:paddingEnd=
"8dp"
android:backgroundTint=
"@color/default_background"
android:hint=
"@string/msg_search"
app:layout_constraintTop_toBottomOf=
"@id/members_chips"
/>
<View
<View
android:id=
"@+id/separator_1"
android:id=
"@+id/separator_1"
...
...
app/src/main/res/layout/activity_create_new_channel.xml
View file @
7435abb5
...
@@ -146,7 +146,8 @@
...
@@ -146,7 +146,8 @@
android:id=
"@+id/add_members_view"
android:id=
"@+id/add_members_view"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:paddingTop=
"8dp"
android:paddingBottom=
"8dp"
android:background=
"?attr/selectableItemBackground"
android:background=
"?attr/selectableItemBackground"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
@@ -177,7 +178,6 @@
...
@@ -177,7 +178,6 @@
android:id=
"@+id/separator_3"
android:id=
"@+id/separator_3"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"0.5dp"
android:layout_height=
"0.5dp"
android:layout_marginTop=
"8dp"
android:background=
"@color/colorDividerMessageComposer"
android:background=
"@color/colorDividerMessageComposer"
app:layout_constraintTop_toBottomOf=
"@id/add_members_view"
/>
app:layout_constraintTop_toBottomOf=
"@id/add_members_view"
/>
...
...
app/src/main/res/values/strings.xml
View file @
7435abb5
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<string
name=
"title_password"
>
Change Password
</string>
<string
name=
"title_password"
>
Change Password
</string>
<string
name=
"title_update_profile"
>
Update profile
</string>
<string
name=
"title_update_profile"
>
Update profile
</string>
<string
name=
"title_create_new_channel"
>
Create New Channel
</string>
<string
name=
"title_create_new_channel"
>
Create New Channel
</string>
<string
name=
"title_add_members"
>
Invite Members
</string>
<string
name=
"title_add_members"
>
Invite Members
(%d)
</string>
<string
name=
"title_about"
>
About
</string>
<string
name=
"title_about"
>
About
</string>
<!-- Actions -->
<!-- Actions -->
...
...
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