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
b4d7e6ef
Commit
b4d7e6ef
authored
Sep 08, 2017
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/push-fail-using-gateway' into feature/multi-server
parents
027e6594
e493e05a
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
304 additions
and
183 deletions
+304
-183
build.gradle
app/build.gradle
+2
-2
google-services.json
app/google-services.json
+9
-22
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+0
-65
AbstractChatRoomFragment.java
...t/android/fragment/chatroom/AbstractChatRoomFragment.java
+4
-0
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+54
-6
SidebarMainContract.java
.../rocket/android/fragment/sidebar/SidebarMainContract.java
+5
-1
SidebarMainFragment.java
.../rocket/android/fragment/sidebar/SidebarMainFragment.java
+70
-26
SidebarMainPresenter.java
...rocket/android/fragment/sidebar/SidebarMainPresenter.java
+5
-0
MessageFormManager.java
...ket/android/layouthelper/chatroom/MessageFormManager.java
+0
-53
MessageFormManager.kt
...ocket/android/layouthelper/chatroom/MessageFormManager.kt
+41
-0
ChannelRoomListHeader.java
...layouthelper/chatroom/roomlist/ChannelRoomListHeader.java
+10
-2
DirectMessageRoomListHeader.java
...helper/chatroom/roomlist/DirectMessageRoomListHeader.java
+9
-2
FavoriteRoomListHeader.java
...ayouthelper/chatroom/roomlist/FavoriteRoomListHeader.java
+1
-1
LivechatRoomListHeader.java
...ayouthelper/chatroom/roomlist/LivechatRoomListHeader.java
+42
-0
RoomListItemViewHolder.java
...ayouthelper/chatroom/roomlist/RoomListItemViewHolder.java
+3
-0
fragment_sidebar_main.xml
app/src/main/res/layout/fragment_sidebar_main.xml
+12
-2
apis_keys.xml
app/src/main/res/values/apis_keys.xml
+1
-1
strings.xml
app/src/main/res/values/strings.xml
+2
-0
RoomToolbar.java
...src/main/java/chat/rocket/android/widget/RoomToolbar.java
+8
-0
RoomListItemView.kt
...a/chat/rocket/android/widget/internal/RoomListItemView.kt
+8
-0
ic_livechat_white_24dp.xml
...-widgets/src/main/res/drawable/ic_livechat_white_24dp.xml
+11
-0
room_list_item.xml
...at-android-widgets/src/main/res/layout/room_list_item.xml
+2
-0
Room.java
...chat-core/src/main/java/chat/rocket/core/models/Room.java
+5
-0
No files found.
app/build.gradle
View file @
b4d7e6ef
...
...
@@ -45,7 +45,7 @@ android {
applicationId
"chat.rocket.android"
minSdkVersion
16
targetSdkVersion
rootProject
.
ext
.
targetSdkVersion
versionCode
3
4
versionCode
3
5
versionName
"1.0.18"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
vectorDrawables
.
useSupportLibrary
=
true
...
...
@@ -183,4 +183,4 @@ dependencies {
testCompile
"org.jetbrains.kotlin:kotlin-test-junit:$rootProject.ext.kotlinVersion"
}
apply
plugin:
'com.google.gms.google-services'
\ No newline at end of file
apply
plugin:
'com.google.gms.google-services'
app/google-services.json
View file @
b4d7e6ef
{
"project_info"
:
{
"project_number"
:
"
361979207101
"
,
"firebase_url"
:
"https://rocketchat
android-92e1
e.firebaseio.com"
,
"project_id"
:
"rocketchat
android-92e1
e"
,
"storage_bucket"
:
"rocketchat
android-92e1
e.appspot.com"
"project_number"
:
"
1020987621558
"
,
"firebase_url"
:
"https://rocketchat
nativ
e.firebaseio.com"
,
"project_id"
:
"rocketchat
nativ
e"
,
"storage_bucket"
:
"rocketchat
nativ
e.appspot.com"
},
"client"
:
[
{
"client_info"
:
{
"mobilesdk_app_id"
:
"1:
361979207101
:android:16da2e50aff9f0c9"
,
"mobilesdk_app_id"
:
"1:
1020987621558
:android:16da2e50aff9f0c9"
,
"android_client_info"
:
{
"package_name"
:
"chat.rocket.android"
}
},
"oauth_client"
:
[
{
"client_id"
:
"361979207101-68jt4s85vqfidsgtb0jircio1s4l0la6.apps.googleusercontent.com"
,
"client_type"
:
1
,
"android_info"
:
{
"package_name"
:
"chat.rocket.android"
,
"certificate_hash"
:
"5540F34145397BBDE62DEE1433BE7FF9D991D5A2"
}
},
{
"client_id"
:
"361979207101-tvvl8a3s98vd933svlepieo81mul17da.apps.googleusercontent.com"
,
"client_id"
:
"1020987621558-trk61fjrahho0ujtjap095p1jmi48pfq.apps.googleusercontent.com"
,
"client_type"
:
3
}
],
"api_key"
:
[
{
"current_key"
:
"AIzaSy
CjInoCWiVXbC02aKgBPeH3EqiHGt6vGyE
"
"current_key"
:
"AIzaSy
Dc7VYUdU6kRkoRTToiCn1rh-W0wJvhLWk
"
}
],
"services"
:
{
...
...
@@ -37,13 +29,8 @@
"status"
:
1
},
"appinvite_service"
:
{
"status"
:
2
,
"other_platform_oauth_client"
:
[
{
"client_id"
:
"361979207101-tvvl8a3s98vd933svlepieo81mul17da.apps.googleusercontent.com"
,
"client_type"
:
3
}
]
"status"
:
1
,
"other_platform_oauth_client"
:
[]
},
"ads_service"
:
{
"status"
:
2
...
...
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
b4d7e6ef
...
...
@@ -2,16 +2,13 @@ package chat.rocket.android.activity;
import
android.content.Intent
;
import
android.graphics.Typeface
;
import
android.graphics.drawable.Drawable
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.design.widget.Snackbar
;
import
android.support.v4.content.ContextCompat
;
import
android.support.v4.graphics.drawable.DrawableCompat
;
import
android.support.v4.widget.SlidingPaneLayout
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
...
...
@@ -29,7 +26,6 @@ import chat.rocket.android.fragment.sidebar.SidebarMainFragment;
import
chat.rocket.android.helper.KeyboardHelper
;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.android.widget.RoomToolbar
;
import
chat.rocket.android.widget.helper.AvatarHelper
;
import
chat.rocket.android.widget.helper.FrescoHelper
;
import
chat.rocket.core.interactors.CanCreateRoomInteractor
;
import
chat.rocket.core.interactors.RoomInteractor
;
...
...
@@ -61,7 +57,6 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
setContentView
(
R
.
layout
.
activity_main
);
toolbar
=
(
RoomToolbar
)
findViewById
(
R
.
id
.
activity_main_toolbar
);
statusTicker
=
new
StatusTicker
();
setupSidebar
();
}
@Override
...
...
@@ -82,58 +77,6 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
super
.
onPause
();
}
private
void
setupSidebar
()
{
SlidingPaneLayout
pane
=
(
SlidingPaneLayout
)
findViewById
(
R
.
id
.
sliding_pane
);
if
(
pane
==
null
)
{
return
;
}
final
SlidingPaneLayout
subPane
=
(
SlidingPaneLayout
)
findViewById
(
R
.
id
.
sub_sliding_pane
);
if
(
subPane
!=
null
)
{
View
addServerButton
=
subPane
.
findViewById
(
R
.
id
.
btn_add_server
);
pane
.
setPanelSlideListener
(
new
SlidingPaneLayout
.
SimplePanelSlideListener
()
{
@Override
public
void
onPanelClosed
(
View
panel
)
{
super
.
onPanelClosed
(
panel
);
subPane
.
closePane
();
}
});
addServerButton
.
setOnClickListener
(
view
->
showAddServerActivity
());
}
toolbar
.
setNavigationOnClickListener
(
view
->
{
if
(
pane
.
isSlideable
()
&&
!
pane
.
isOpen
())
{
pane
.
openPane
();
if
(
subPane
!=
null
)
{
subPane
.
closePane
();
}
}
});
//ref: ActionBarDrawerToggle#setProgress
pane
.
setPanelSlideListener
(
new
SlidingPaneLayout
.
PanelSlideListener
()
{
@Override
public
void
onPanelSlide
(
View
panel
,
float
slideOffset
)
{
toolbar
.
setNavigationIconProgress
(
slideOffset
);
}
@Override
public
void
onPanelOpened
(
View
panel
)
{
toolbar
.
setNavigationIconVerticalMirror
(
true
);
}
@Override
public
void
onPanelClosed
(
View
panel
)
{
toolbar
.
setNavigationIconVerticalMirror
(
false
);
closeUserActionContainer
();
if
(
subPane
!=
null
)
{
subPane
.
closePane
();
}
}
});
}
private
void
showAddServerActivity
()
{
Intent
intent
=
new
Intent
(
this
,
AddServerActivity
.
class
);
intent
.
putExtra
(
AddServerActivity
.
EXTRA_FINISH_ON_BACK_PRESS
,
true
);
...
...
@@ -193,14 +136,6 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
.
commit
();
}
private
void
closeUserActionContainer
()
{
SidebarMainFragment
sidebarFragment
=
(
SidebarMainFragment
)
getSupportFragmentManager
()
.
findFragmentById
(
R
.
id
.
sidebar_fragment_container
);
if
(
sidebarFragment
!=
null
)
{
sidebarFragment
.
closeUserActionContainer
();
}
}
@Override
protected
void
onRoomIdUpdated
()
{
super
.
onRoomIdUpdated
();
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/AbstractChatRoomFragment.java
View file @
b4d7e6ef
...
...
@@ -33,6 +33,10 @@ abstract class AbstractChatRoomFragment extends AbstractFragment {
roomToolbar
.
showPublicChannelIcon
();
}
protected
void
showToolbarLivechatChannelIcon
()
{
roomToolbar
.
showLivechatChannelIcon
();
}
protected
void
showToolbarUserStatuslIcon
(
@Nullable
String
status
)
{
if
(
status
==
null
)
{
roomToolbar
.
showUserStatusIcon
(
RoomToolbar
.
STATUS_OFFLINE
);
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
b4d7e6ef
...
...
@@ -20,8 +20,9 @@ import android.support.v7.app.AlertDialog;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
chat.rocket.android.fragment.sidebar.SidebarMainFragment
;
import
chat.rocket.android.widget.RoomToolbar
;
import
chat.rocket.core.models.User
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
...
...
@@ -126,6 +127,9 @@ public class RoomFragment extends AbstractChatRoomFragment implements
private
Message
edittingMessage
=
null
;
private
SlidingPaneLayout
pane
;
private
SidebarMainFragment
sidebarFragment
;
public
RoomFragment
()
{}
/**
...
...
@@ -190,6 +194,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
@Override
protected
void
onSetupView
()
{
pane
=
getActivity
().
findViewById
(
R
.
id
.
sliding_pane
);
messageRecyclerView
=
rootView
.
findViewById
(
R
.
id
.
messageRecyclerView
);
messageListAdapter
=
new
MessageListAdapter
(
getContext
(),
hostname
);
...
...
@@ -236,6 +241,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
}
};
setupSidebar
();
setupSideMenu
();
setupMessageComposer
();
setupMessageActions
();
...
...
@@ -306,7 +312,6 @@ public class RoomFragment extends AbstractChatRoomFragment implements
});
DrawerLayout
drawerLayout
=
rootView
.
findViewById
(
R
.
id
.
drawer_layout
);
SlidingPaneLayout
pane
=
getActivity
().
findViewById
(
R
.
id
.
sliding_pane
);
if
(
drawerLayout
!=
null
&&
pane
!=
null
)
{
compositeDisposable
.
add
(
RxDrawerLayout
.
drawerOpen
(
drawerLayout
,
GravityCompat
.
END
)
.
compose
(
bindToLifecycle
())
...
...
@@ -326,8 +331,47 @@ public class RoomFragment extends AbstractChatRoomFragment implements
}
}
private
void
setupSidebar
()
{
SlidingPaneLayout
subPane
=
getActivity
().
findViewById
(
R
.
id
.
sub_sliding_pane
);
RoomToolbar
toolbar
=
getActivity
().
findViewById
(
R
.
id
.
activity_main_toolbar
);
sidebarFragment
=
(
SidebarMainFragment
)
getActivity
().
getSupportFragmentManager
().
findFragmentById
(
R
.
id
.
sidebar_fragment_container
);
pane
.
setPanelSlideListener
(
new
SlidingPaneLayout
.
PanelSlideListener
()
{
@Override
public
void
onPanelSlide
(
View
view
,
float
v
)
{
messageFormManager
.
enableComposingText
(
false
);
sidebarFragment
.
clearSearchViewFocus
();
//Ref: ActionBarDrawerToggle#setProgress
toolbar
.
setNavigationIconProgress
(
v
);
}
@Override
public
void
onPanelOpened
(
View
view
)
{
toolbar
.
setNavigationIconVerticalMirror
(
true
);
}
@Override
public
void
onPanelClosed
(
View
view
)
{
messageFormManager
.
enableComposingText
(
true
);
toolbar
.
setNavigationIconVerticalMirror
(
false
);
subPane
.
closePane
();
closeUserActionContainer
();
}
});
toolbar
.
setNavigationOnClickListener
(
view
->
{
if
(
pane
.
isSlideable
()
&&
!
pane
.
isOpen
())
{
pane
.
openPane
();
}
});
}
public
void
closeUserActionContainer
()
{
sidebarFragment
.
closeUserActionContainer
();
}
private
boolean
closeSideMenuIfNeeded
()
{
DrawerLayout
drawerLayout
=
(
DrawerLayout
)
rootView
.
findViewById
(
R
.
id
.
drawer_layout
);
DrawerLayout
drawerLayout
=
rootView
.
findViewById
(
R
.
id
.
drawer_layout
);
if
(
drawerLayout
!=
null
&&
drawerLayout
.
isDrawerOpen
(
GravityCompat
.
END
))
{
drawerLayout
.
closeDrawer
(
GravityCompat
.
END
);
return
true
;
...
...
@@ -336,12 +380,12 @@ public class RoomFragment extends AbstractChatRoomFragment implements
}
private
void
setupMessageComposer
()
{
final
MessageFormLayout
messageFormLayout
=
(
MessageFormLayout
)
rootView
.
findViewById
(
R
.
id
.
messageComposer
);
final
MessageFormLayout
messageFormLayout
=
rootView
.
findViewById
(
R
.
id
.
messageComposer
);
messageFormManager
=
new
MessageFormManager
(
messageFormLayout
,
this
::
showExtraActionSelectionDialog
);
messageFormManager
.
setSendMessageCallback
(
this
::
sendMessage
);
messageFormLayout
.
setEditTextCommitContentListener
(
this
::
onCommitContent
);
autocompleteManager
=
new
AutocompleteManager
(
(
ViewGroup
)
rootView
.
findViewById
(
R
.
id
.
messageListRelativeLayout
));
autocompleteManager
=
new
AutocompleteManager
(
rootView
.
findViewById
(
R
.
id
.
messageListRelativeLayout
));
autocompleteManager
.
registerSource
(
new
ChannelSource
(
...
...
@@ -542,6 +586,10 @@ public class RoomFragment extends AbstractChatRoomFragment implements
if
(
room
.
isPrivate
())
{
showToolbarPrivateChannelIcon
();
}
if
(
room
.
isLivechat
())
{
showToolbarLivechatChannelIcon
();
}
}
@Override
...
...
@@ -607,4 +655,4 @@ public class RoomFragment extends AbstractChatRoomFragment implements
edittingMessage
=
message
;
messageFormManager
.
setEditMessage
(
message
.
getMessage
());
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainContract.java
View file @
b4d7e6ef
...
...
@@ -19,6 +19,8 @@ public interface SidebarMainContract {
void
showRoomSidebarList
(
@NonNull
List
<
RoomSidebar
>
roomSidebarList
);
void
filterRoomSidebarList
(
CharSequence
term
);
void
show
(
User
user
);
}
...
...
@@ -30,6 +32,8 @@ public interface SidebarMainContract {
Flowable
<
List
<
Spotlight
>>
searchSpotlight
(
String
term
);
void
disposeSubscriptions
();
void
onUserOnline
();
void
onUserAway
();
...
...
@@ -40,4 +44,4 @@ public interface SidebarMainContract {
void
onLogout
();
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainFragment.java
View file @
b4d7e6ef
...
...
@@ -24,6 +24,7 @@ import chat.rocket.android.helper.Logger;
import
chat.rocket.android.layouthelper.chatroom.roomlist.ChannelRoomListHeader
;
import
chat.rocket.android.layouthelper.chatroom.roomlist.DirectMessageRoomListHeader
;
import
chat.rocket.android.layouthelper.chatroom.roomlist.FavoriteRoomListHeader
;
import
chat.rocket.android.layouthelper.chatroom.roomlist.LivechatRoomListHeader
;
import
chat.rocket.android.layouthelper.chatroom.roomlist.RoomListAdapter
;
import
chat.rocket.android.layouthelper.chatroom.roomlist.RoomListHeader
;
import
chat.rocket.android.layouthelper.chatroom.roomlist.UnreadRoomListHeader
;
...
...
@@ -40,17 +41,18 @@ import chat.rocket.persistence.realm.repositories.RealmSpotlightRepository;
import
chat.rocket.persistence.realm.repositories.RealmUserRepository
;
import
com.jakewharton.rxbinding2.support.v7.widget.RxSearchView
;
import
com.jakewharton.rxbinding2.widget.RxCompoundButton
;
import
io.reactivex.Observable
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
public
class
SidebarMainFragment
extends
AbstractFragment
implements
SidebarMainContract
.
View
{
private
SidebarMainContract
.
Presenter
presenter
;
private
RoomListAdapter
adapter
;
private
RecyclerView
recyclerView
;
private
SearchView
searchView
;
private
TextView
loadMoreResultsText
;
private
List
<
RoomSidebar
>
roomSidebarList
;
private
String
hostname
;
private
static
final
String
HOSTNAME
=
"hostname"
;
...
...
@@ -137,24 +139,66 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
}
});
RecyclerView
recyclerView
=
rootView
.
findViewById
(
R
.
id
.
room_list_container
);
recyclerView
=
rootView
.
findViewById
(
R
.
id
.
room_list_container
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
false
));
recyclerView
.
setAdapter
(
adapter
);
loadMoreResultsText
=
rootView
.
findViewById
(
R
.
id
.
text_load_more_results
);
RxSearchView
.
queryTextChanges
(
searchView
)
.
compose
(
bindToLifecycle
())
.
debounce
(
100
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
switchMap
(
charSequence
->
{
if
(
charSequence
.
length
()
==
0
)
{
adapter
.
setMode
(
RoomListAdapter
.
MODE_ROOM
);
return
Observable
.
just
(
Collections
.<
Spotlight
>
emptyList
());
}
else
{
adapter
.
setMode
(
RoomListAdapter
.
MODE_SPOTLIGHT
);
return
presenter
.
searchSpotlight
(
charSequence
.
toString
()).
toObservable
();
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
charSequence
->
{
adapter
.
setMode
(
RoomListAdapter
.
MODE_ROOM
);
if
(
charSequence
.
length
()
==
0
)
{
loadMoreResultsText
.
setVisibility
(
View
.
GONE
);
presenter
.
bindView
(
this
);
recyclerView
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
presenter
.
disposeSubscriptions
();
filterRoomSidebarList
(
charSequence
);
}
});
loadMoreResultsText
.
setOnClickListener
(
view
->
loadMoreResults
());
}
@Override
public
void
showRoomSidebarList
(
@NonNull
List
<
RoomSidebar
>
roomSidebarList
)
{
this
.
roomSidebarList
=
roomSidebarList
;
adapter
.
setRoomSidebarList
(
roomSidebarList
);
}
@Override
public
void
filterRoomSidebarList
(
CharSequence
term
)
{
List
<
RoomSidebar
>
filteredRoomSidebarList
=
new
ArrayList
<>();
for
(
RoomSidebar
roomSidebar:
roomSidebarList
)
{
if
(
roomSidebar
.
getRoomName
().
contains
(
term
))
{
filteredRoomSidebarList
.
add
(
roomSidebar
);
}
})
.
subscribe
(
this
::
showSearchSuggestions
,
Logger:
:
report
);
}
if
(
filteredRoomSidebarList
.
isEmpty
())
{
recyclerView
.
setVisibility
(
View
.
GONE
);
}
else
{
recyclerView
.
setVisibility
(
View
.
VISIBLE
);
adapter
.
setRoomSidebarList
(
filteredRoomSidebarList
);
}
loadMoreResultsText
.
setVisibility
(
View
.
VISIBLE
);
}
private
void
loadMoreResults
()
{
presenter
.
searchSpotlight
(
searchView
.
getQuery
().
toString
())
.
toObservable
()
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
this
::
showSearchSuggestions
);
}
private
void
showSearchSuggestions
(
List
<
Spotlight
>
spotlightList
)
{
loadMoreResultsText
.
setVisibility
(
View
.
GONE
);
adapter
.
setMode
(
RoomListAdapter
.
MODE_SPOTLIGHT
);
adapter
.
setSpotlightList
(
spotlightList
);
recyclerView
.
setVisibility
(
View
.
VISIBLE
);
}
@SuppressLint
(
"RxLeakedSubscription"
)
...
...
@@ -187,15 +231,10 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
rootView
.
setVisibility
(
View
.
INVISIBLE
);
}
@Override
public
void
showRoomSidebarList
(
@NonNull
List
<
RoomSidebar
>
roomSidebarList
)
{
adapter
.
setRoomSidebarList
(
roomSidebarList
);
}
@Override
public
void
show
(
User
user
)
{
onRenderCurrentUser
(
user
);
updateRoomListMode
(
user
);
updateRoomListMode
();
}
private
void
setupUserStatusButtons
()
{
...
...
@@ -226,7 +265,7 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
}
}
private
void
updateRoomListMode
(
User
user
)
{
private
void
updateRoomListMode
()
{
final
List
<
RoomListHeader
>
roomListHeaders
=
new
ArrayList
<>();
roomListHeaders
.
add
(
new
UnreadRoomListHeader
(
...
...
@@ -237,6 +276,10 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
getString
(
R
.
string
.
fragment_sidebar_main_favorite_title
)
));
roomListHeaders
.
add
(
new
LivechatRoomListHeader
(
getString
(
R
.
string
.
fragment_sidebar_main_livechat_title
)
));
roomListHeaders
.
add
(
new
ChannelRoomListHeader
(
getString
(
R
.
string
.
fragment_sidebar_main_channels_title
),
()
->
showAddRoomDialog
(
AddChannelDialogFragment
.
create
(
hostname
))
...
...
@@ -258,6 +301,10 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
});
}
public
void
clearSearchViewFocus
()
{
searchView
.
clearFocus
();
}
public
void
closeUserActionContainer
()
{
final
CompoundButton
toggleUserAction
=
rootView
.
findViewById
(
R
.
id
.
toggle_user_action
);
if
(
toggleUserAction
!=
null
&&
toggleUserAction
.
isChecked
())
{
...
...
@@ -274,7 +321,4 @@ public class SidebarMainFragment extends AbstractFragment implements SidebarMain
dialog
.
show
(
getFragmentManager
(),
"AbstractAddRoomDialogFragment"
);
}
private
void
showSearchSuggestions
(
List
<
Spotlight
>
spotlightList
)
{
adapter
.
setSpotlightList
(
spotlightList
);
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainPresenter.java
View file @
b4d7e6ef
...
...
@@ -135,6 +135,11 @@ public class SidebarMainPresenter extends BasePresenter<SidebarMainContract.View
methodCallHelper
.
logout
().
continueWith
(
new
LogIfError
());
}
@Override
public
void
disposeSubscriptions
()
{
clearSubscriptions
();
}
private
void
subscribeToRooms
()
{
final
Disposable
subscription
=
roomInteractor
.
getOpenRooms
()
.
distinctUntilChanged
()
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageFormManager.java
deleted
100644 → 0
View file @
027e6594
package
chat
.
rocket
.
android
.
layouthelper
.
chatroom
;
import
chat.rocket.android.widget.message.MessageFormLayout
;
/**
* handling MessageForm.
*/
public
class
MessageFormManager
{
private
final
MessageFormLayout
messageFormLayout
;
private
SendMessageCallback
sendMessageCallback
;
public
MessageFormManager
(
MessageFormLayout
messageFormLayout
,
MessageFormLayout
.
ExtraActionSelectionClickListener
callback
)
{
this
.
messageFormLayout
=
messageFormLayout
;
init
(
callback
);
}
private
void
init
(
MessageFormLayout
.
ExtraActionSelectionClickListener
listener
)
{
messageFormLayout
.
setExtraActionSelectionClickListener
(
listener
);
messageFormLayout
.
setSubmitTextListener
(
this
::
sendMessage
);
}
public
void
setSendMessageCallback
(
SendMessageCallback
sendMessageCallback
)
{
this
.
sendMessageCallback
=
sendMessageCallback
;
}
public
void
clearComposingText
()
{
messageFormLayout
.
setText
(
""
);
}
public
void
onMessageSend
()
{
clearComposingText
();
messageFormLayout
.
setEnabled
(
true
);
}
public
void
setEditMessage
(
String
message
)
{
clearComposingText
();
messageFormLayout
.
setText
(
message
);
}
private
void
sendMessage
(
String
message
)
{
if
(
sendMessageCallback
==
null
)
{
return
;
}
messageFormLayout
.
setEnabled
(
false
);
sendMessageCallback
.
onSubmitText
(
message
);
}
public
interface
SendMessageCallback
{
void
onSubmitText
(
String
messageText
);
}
}
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageFormManager.kt
0 → 100644
View file @
b4d7e6ef
package
chat.rocket.android.layouthelper.chatroom
import
chat.rocket.android.widget.message.MessageFormLayout
class
MessageFormManager
(
private
val
messageFormLayout
:
MessageFormLayout
,
val
callback
:
MessageFormLayout
.
ExtraActionSelectionClickListener
)
{
private
var
sendMessageCallback
:
SendMessageCallback
?
=
null
init
{
messageFormLayout
.
setExtraActionSelectionClickListener
(
callback
)
messageFormLayout
.
setSubmitTextListener
(
this
::
sendMessage
)
}
fun
setSendMessageCallback
(
sendMessageCallback
:
SendMessageCallback
)
{
this
.
sendMessageCallback
=
sendMessageCallback
}
fun
onMessageSend
()
{
clearComposingText
()
}
fun
setEditMessage
(
message
:
String
)
{
clearComposingText
()
messageFormLayout
.
setText
(
message
)
}
fun
clearComposingText
()
{
messageFormLayout
.
setText
(
""
)
}
fun
enableComposingText
(
enable
:
Boolean
)
{
messageFormLayout
.
isEnabled
=
enable
}
private
fun
sendMessage
(
message
:
String
)
{
sendMessageCallback
?.
onSubmitText
(
message
)
}
interface
SendMessageCallback
{
fun
onSubmitText
(
messageText
:
String
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/layouthelper/chatroom/roomlist/ChannelRoomListHeader.java
View file @
b4d7e6ef
...
...
@@ -28,11 +28,19 @@ public class ChannelRoomListHeader implements RoomListHeader {
@Override
public
boolean
shouldShow
(
@NonNull
List
<
RoomSidebar
>
roomSidebarList
)
{
return
true
;
for
(
RoomSidebar
roomSidebar:
roomSidebarList
)
{
if
((
roomSidebar
.
getType
().
equals
(
Room
.
TYPE_CHANNEL
)
||
roomSidebar
.
getType
().
equals
(
Room
.
TYPE_PRIVATE
))
&&
!
roomSidebar
.
isAlert
()
&&
!
roomSidebar
.
isFavorite
())
{
return
true
;
}
}
return
false
;
}
@Override
public
ClickListener
getClickListener
()
{
return
clickListener
;
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/layouthelper/chatroom/roomlist/DirectMessageRoomListHeader.java
View file @
b4d7e6ef
...
...
@@ -28,11 +28,18 @@ public class DirectMessageRoomListHeader implements RoomListHeader {
@Override
public
boolean
shouldShow
(
@NonNull
List
<
RoomSidebar
>
roomSidebarList
)
{
return
true
;
for
(
RoomSidebar
roomSidebar:
roomSidebarList
)
{
if
(
roomSidebar
.
getType
().
equals
(
Room
.
TYPE_DIRECT_MESSAGE
)
&&
!
roomSidebar
.
isAlert
()
&&
!
roomSidebar
.
isFavorite
())
{
return
true
;
}
}
return
false
;
}
@Override
public
ClickListener
getClickListener
()
{
return
clickListener
;
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/layouthelper/chatroom/roomlist/FavoriteRoomListHeader.java
View file @
b4d7e6ef
...
...
@@ -26,7 +26,7 @@ public class FavoriteRoomListHeader implements RoomListHeader {
@Override
public
boolean
shouldShow
(
@NonNull
List
<
RoomSidebar
>
roomSidebarList
)
{
for
(
RoomSidebar
roomSidebar:
roomSidebarList
)
{
if
(
roomSidebar
.
isFavorite
())
{
if
(
roomSidebar
.
isFavorite
()
&&
!
roomSidebar
.
isAlert
()
)
{
return
true
;
}
}
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/roomlist/LivechatRoomListHeader.java
0 → 100644
View file @
b4d7e6ef
package
chat
.
rocket
.
android
.
layouthelper
.
chatroom
.
roomlist
;
import
android.support.annotation.NonNull
;
import
java.util.List
;
import
chat.rocket.core.models.Room
;
import
chat.rocket.core.models.RoomSidebar
;
public
class
LivechatRoomListHeader
implements
RoomListHeader
{
private
final
String
title
;
public
LivechatRoomListHeader
(
String
title
)
{
this
.
title
=
title
;
}
@Override
public
String
getTitle
()
{
return
title
;
}
@Override
public
boolean
owns
(
RoomSidebar
roomSidebar
)
{
return
Room
.
TYPE_LIVECHAT
.
equals
(
roomSidebar
.
getType
());
}
@Override
public
boolean
shouldShow
(
@NonNull
List
<
RoomSidebar
>
roomSidebarList
)
{
for
(
RoomSidebar
roomSidebar:
roomSidebarList
)
{
if
(
owns
(
roomSidebar
))
{
return
true
;
}
}
return
false
;
}
@Override
public
ClickListener
getClickListener
()
{
return
null
;
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/layouthelper/chatroom/roomlist/RoomListItemViewHolder.java
View file @
b4d7e6ef
...
...
@@ -95,6 +95,9 @@ public class RoomListItemViewHolder extends RecyclerView.ViewHolder {
case
Room
.
TYPE_PRIVATE
:
itemView
.
showPrivateChannelIcon
();
break
;
case
Room
.
TYPE_LIVECHAT
:
itemView
.
showLivechatChannelIcon
();
break
;
default
:
throw
new
AssertionError
(
"Room type doesn't satisfies the method documentation. Room type is:"
+
roomType
);
}
...
...
app/src/main/res/layout/fragment_sidebar_main.xml
View file @
b4d7e6ef
...
...
@@ -5,6 +5,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:theme=
"@style/AppTheme.Dark"
android:background=
"?attr/colorPrimary"
tools:context=
"chat.rocket.android.fragment.sidebar.SidebarMainFragment"
>
<LinearLayout
...
...
@@ -82,9 +83,18 @@
android:id=
"@+id/room_list_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/search_box"
android:layout_above=
"@+id/text_load_more_results"
android:layout_below=
"@+id/search_box"
/>
<TextView
android:id=
"@+id/text_load_more_results"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:gravity=
"center"
android:layout_alignParentBottom=
"true"
android:background=
"?attr/colorPrimary"
/>
android:text=
"@string/spotlight_load_more_results"
android:background=
"?attr/colorPrimary"
android:visibility=
"gone"
/>
<android.support.v4.widget.NestedScrollView
android:id=
"@+id/user_action_outer_container"
...
...
app/src/main/res/values/apis_keys.xml
View file @
b4d7e6ef
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string
name=
"gcm_sender_id"
>
YOUR-SENDER-ID
</string>
<string
name=
"gcm_sender_id"
>
673693445664
</string>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
b4d7e6ef
...
...
@@ -3,6 +3,7 @@
<string
name=
"fragment_sidebar_main_favorite_title"
>
FAVORITES
</string>
<string
name=
"fragment_sidebar_main_channels_title"
>
CHANNELS
</string>
<string
name=
"fragment_sidebar_main_direct_messages_title"
>
DIRECT MESSAGES
</string>
<string
name=
"fragment_sidebar_main_livechat_title"
>
LIVECHAT
</string>
<string
name=
"user_status_online"
>
Online
</string>
<string
name=
"user_status_away"
>
Away
</string>
<string
name=
"user_status_busy"
>
Busy
</string>
...
...
@@ -63,6 +64,7 @@
<string
name=
"open_your_authentication_app_and_enter_the_code"
>
Open your authentication app and enter the code
</string>
<string
name=
"two_factor_code"
>
Two-factor code
</string>
<string
name=
"spotlight_search"
>
Search
</string>
<string
name=
"spotlight_load_more_results"
>
Load more results
</string>
<string
name=
"edit_message"
>
Edit message
</string>
<string
name=
"message_options_no_message_info"
>
Ooops. Something\'s up!
</string>
<string
name=
"message_options_no_permissions_info"
>
You have no permissions
</string>
...
...
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/RoomToolbar.java
View file @
b4d7e6ef
...
...
@@ -29,6 +29,7 @@ public class RoomToolbar extends Toolbar {
private
Drawable
privateChannelDrawable
;
private
Drawable
publicChannelDrawable
;
private
Drawable
livechatChannelDrawable
;
private
Drawable
userStatusDrawable
;
private
DrawerArrowDrawable
drawerArrowDrawable
;
...
...
@@ -63,6 +64,7 @@ public class RoomToolbar extends Toolbar {
privateChannelDrawable
=
VectorDrawableCompat
.
create
(
getResources
(),
R
.
drawable
.
ic_lock_white_24dp
,
null
);
publicChannelDrawable
=
VectorDrawableCompat
.
create
(
getResources
(),
R
.
drawable
.
ic_hashtag_white_24dp
,
null
);
livechatChannelDrawable
=
VectorDrawableCompat
.
create
(
getResources
(),
R
.
drawable
.
ic_livechat_white_24dp
,
null
);
userStatusDrawable
=
VectorDrawableCompat
.
create
(
getResources
(),
R
.
drawable
.
ic_user_status_black_24dp
,
null
);
}
...
...
@@ -102,6 +104,12 @@ public class RoomToolbar extends Toolbar {
roomTypeImage
.
setVisibility
(
VISIBLE
);
}
public
void
showLivechatChannelIcon
()
{
roomTypeImage
.
setImageDrawable
(
livechatChannelDrawable
);
userStatusImage
.
setVisibility
(
GONE
);
roomTypeImage
.
setVisibility
(
VISIBLE
);
}
public
void
showUserStatusIcon
(
int
status
)
{
DrawableHelper
.
INSTANCE
.
wrapDrawable
(
userStatusDrawable
);
...
...
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/internal/RoomListItemView.kt
View file @
b4d7e6ef
...
...
@@ -29,6 +29,7 @@ class RoomListItemView : FrameLayout {
lateinit
private
var
alertCountText
:
TextView
lateinit
private
var
privateChannelDrawable
:
Drawable
lateinit
private
var
publicChannelDrawable
:
Drawable
lateinit
private
var
livechatChannelDrawable
:
Drawable
lateinit
private
var
userStatusDrawable
:
Drawable
constructor
(
context
:
Context
)
:
super
(
context
)
{
...
...
@@ -67,6 +68,7 @@ class RoomListItemView : FrameLayout {
privateChannelDrawable
=
VectorDrawableCompat
.
create
(
resources
,
R
.
drawable
.
ic_lock_white_24dp
,
null
)
!!
publicChannelDrawable
=
VectorDrawableCompat
.
create
(
resources
,
R
.
drawable
.
ic_hashtag_white_24dp
,
null
)
!!
livechatChannelDrawable
=
VectorDrawableCompat
.
create
(
resources
,
R
.
drawable
.
ic_livechat_white_24dp
,
null
)
!!
userStatusDrawable
=
VectorDrawableCompat
.
create
(
resources
,
R
.
drawable
.
ic_user_status_black_24dp
,
null
)
!!
}
...
...
@@ -103,6 +105,12 @@ class RoomListItemView : FrameLayout {
roomTypeImage
.
visibility
=
View
.
VISIBLE
}
fun
showLivechatChannelIcon
()
{
roomTypeImage
.
setImageDrawable
(
livechatChannelDrawable
)
userStatusImage
.
visibility
=
View
.
GONE
roomTypeImage
.
visibility
=
View
.
VISIBLE
}
fun
showOnlineUserStatusIcon
()
{
prepareDrawableAndShow
(
R
.
color
.
color_user_status_online
)
}
...
...
rocket-chat-android-widgets/src/main/res/drawable/ic_livechat_white_24dp.xml
0 → 100644
View file @
b4d7e6ef
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportHeight=
"24"
android:viewportWidth=
"24"
>
<path
android:fillColor=
"#FFFFFFFF"
android:pathData=
"M 15.274 6.595 C 14.884 4.095 12.724 2.234 10.029 2.234 C 7.049 2.234 4.715 4.506 4.715 7.407 L 4.715 7.669 C 4.714 7.685 4.71 7.701 4.71 7.719 L 4.71 12.84 C 3.363 12.746 2.317 11.627 2.313 10.277 C 2.313 9.344 2.819 8.484 3.634 8.03 C 3.898 7.871 3.988 7.531 3.838 7.262 C 3.688 6.993 3.352 6.891 3.078 7.031 C 1.9 7.687 1.17 8.929 1.17 10.277 C 1.172 12.327 2.834 13.989 4.884 13.991 C 5.011 13.991 5.14 13.981 5.269 13.968 L 5.281 13.968 C 5.3 13.968 5.317 13.965 5.335 13.964 L 5.339 13.964 C 5.631 13.935 5.853 13.69 5.853 13.397 L 5.853 8.344 C 5.855 8.327 5.858 8.311 5.858 8.294 L 5.858 7.407 C 5.858 5.109 7.651 3.377 10.029 3.377 C 12.407 3.377 14.2 5.108 14.2 7.406 L 14.2 7.643 C 14.197 7.667 14.193 7.692 14.193 7.718 L 14.193 13.237 C 14.192 13.252 14.189 13.267 14.189 13.281 L 14.189 14.567 C 14.189 15.445 13.575 16.058 12.697 16.058 L 11.927 16.058 L 11.911 16.06 C 11.692 15.484 11.14 15.102 10.523 15.1 L 9.543 15.1 C 8.72 15.102 8.054 15.768 8.053 16.591 C 8.053 17.414 8.721 18.081 9.543 18.082 L 10.523 18.082 C 11.129 18.082 11.649 17.717 11.883 17.196 C 11.898 17.198 11.912 17.202 11.928 17.202 L 12.698 17.202 C 14.224 17.202 15.331 16.093 15.331 14.567 L 15.331 14.008 C 17.312 13.916 18.872 12.285 18.875 10.302 C 18.872 8.297 17.278 6.656 15.274 6.594 Z M 10.523 16.94 L 9.543 16.94 C 9.352 16.937 9.199 16.783 9.196 16.592 C 9.196 16.403 9.356 16.244 9.544 16.244 L 10.523 16.244 C 10.711 16.244 10.871 16.404 10.871 16.592 C 10.871 16.781 10.711 16.94 10.523 16.94 Z M 15.336 12.866 L 15.336 8.369 C 15.339 8.344 15.343 8.319 15.343 8.294 L 15.343 7.741 C 16.688 7.836 17.731 8.955 17.733 10.303 C 17.733 11.663 16.673 12.776 15.336 12.866 Z"
/>
</vector>
\ No newline at end of file
rocket-chat-android-widgets/src/main/res/layout/room_list_item.xml
View file @
b4d7e6ef
...
...
@@ -34,6 +34,8 @@
android:layout_marginLeft=
"16dp"
android:layout_marginEnd=
"16dp"
android:layout_marginRight=
"16dp"
android:maxLines=
"1"
android:ellipsize=
"end"
android:gravity=
"center_vertical"
android:textAppearance=
"@style/TextAppearance.AppCompat.Body2"
/>
...
...
rocket-chat-core/src/main/java/chat/rocket/core/models/Room.java
View file @
b4d7e6ef
...
...
@@ -8,6 +8,7 @@ public abstract class Room {
public
static
final
String
TYPE_CHANNEL
=
"c"
;
public
static
final
String
TYPE_PRIVATE
=
"p"
;
public
static
final
String
TYPE_DIRECT_MESSAGE
=
"d"
;
public
static
final
String
TYPE_LIVECHAT
=
"l"
;
public
abstract
String
getId
();
...
...
@@ -41,6 +42,10 @@ public abstract class Room {
return
TYPE_DIRECT_MESSAGE
.
equals
(
getType
());
}
public
boolean
isLivechat
()
{
return
TYPE_LIVECHAT
.
equals
(
getType
());
}
public
static
Builder
builder
()
{
return
new
AutoValue_Room
.
Builder
();
}
...
...
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