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
35eb28ca
Commit
35eb28ca
authored
Sep 06, 2017
by
Rafael Kellermann Streit
Committed by
GitHub
Sep 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into local-spotlight
parents
6c48f18d
ef6cf99d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
103 deletions
+92
-103
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+0
-52
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+47
-2
SidebarMainFragment.java
.../rocket/android/fragment/sidebar/SidebarMainFragment.java
+4
-0
MessageFormManager.java
...ket/android/layouthelper/chatroom/MessageFormManager.java
+0
-49
MessageFormManager.kt
...ocket/android/layouthelper/chatroom/MessageFormManager.kt
+41
-0
No files found.
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
35eb28ca
...
...
@@ -4,7 +4,6 @@ import android.os.Bundle;
import
android.support.annotation.Nullable
;
import
android.support.design.widget.Snackbar
;
import
android.support.v4.widget.SlidingPaneLayout
;
import
android.view.View
;
import
chat.rocket.android.LaunchUtil
;
import
chat.rocket.android.R
;
...
...
@@ -43,7 +42,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
...
...
@@ -63,48 +61,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
);
pane
.
setPanelSlideListener
(
new
SlidingPaneLayout
.
SimplePanelSlideListener
()
{
@Override
public
void
onPanelClosed
(
View
panel
)
{
super
.
onPanelClosed
(
panel
);
if
(
subPane
!=
null
)
{
subPane
.
closePane
();
}
}
});
toolbar
.
setNavigationOnClickListener
(
view
->
{
if
(
pane
.
isSlideable
()
&&
!
pane
.
isOpen
())
{
pane
.
openPane
();
}
});
//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
();
}
});
}
private
boolean
closeSidebarIfNeeded
()
{
// REMARK: Tablet UI doesn't have SlidingPane!
...
...
@@ -156,14 +112,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/RoomFragment.java
View file @
35eb28ca
...
...
@@ -21,6 +21,8 @@ import android.support.v7.widget.LinearLayoutManager;
import
android.support.v7.widget.RecyclerView
;
import
android.view.View
;
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
;
...
...
@@ -125,6 +127,9 @@ public class RoomFragment extends AbstractChatRoomFragment implements
private
Message
edittingMessage
=
null
;
private
SlidingPaneLayout
pane
;
private
SidebarMainFragment
sidebarFragment
;
public
RoomFragment
()
{}
/**
...
...
@@ -189,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
);
...
...
@@ -235,6 +241,7 @@ public class RoomFragment extends AbstractChatRoomFragment implements
}
};
setupSidebar
();
setupSideMenu
();
setupMessageComposer
();
setupMessageActions
();
...
...
@@ -305,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
())
...
...
@@ -325,6 +331,45 @@ 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
=
rootView
.
findViewById
(
R
.
id
.
drawer_layout
);
if
(
drawerLayout
!=
null
&&
drawerLayout
.
isDrawerOpen
(
GravityCompat
.
END
))
{
...
...
@@ -606,4 +651,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/SidebarMainFragment.java
View file @
35eb28ca
...
...
@@ -296,6 +296,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
())
{
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageFormManager.java
deleted
100644 → 0
View file @
6c48f18d
package
chat
.
rocket
.
android
.
layouthelper
.
chatroom
;
import
chat.rocket.android.widget.message.MessageFormLayout
;
/**
* Handles 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
onMessageSend
()
{
clearComposingText
();
}
public
void
setEditMessage
(
String
message
)
{
clearComposingText
();
messageFormLayout
.
setText
(
message
);
}
public
void
clearComposingText
()
{
messageFormLayout
.
setText
(
""
);
}
private
void
sendMessage
(
String
message
)
{
if
(
sendMessageCallback
==
null
)
{
return
;
}
sendMessageCallback
.
onSubmitText
(
message
);
}
public
interface
SendMessageCallback
{
void
onSubmitText
(
String
messageText
);
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageFormManager.kt
0 → 100644
View file @
35eb28ca
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
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