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
c43c00f8
Commit
c43c00f8
authored
Nov 28, 2016
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement sidemenu in the room
parent
f6b9138a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
125 additions
and
14 deletions
+125
-14
build.gradle
app/build.gradle
+1
-0
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+41
-0
fragment_room.xml
app/src/main/res/layout-w720dp/fragment_room.xml
+10
-0
fragment_room.xml
app/src/main/res/layout/fragment_room.xml
+15
-14
fragment_room_main.xml
app/src/main/res/layout/fragment_room_main.xml
+21
-0
room_side_menu.xml
app/src/main/res/layout/room_side_menu.xml
+33
-0
fa_strings.xml
app/src/main/res/values/fa_strings.xml
+4
-0
No files found.
app/build.gradle
View file @
c43c00f8
...
...
@@ -92,6 +92,7 @@ dependencies {
compile
rootProject
.
ext
.
timber
compile
'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile
'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
compile
'com.trello:rxlifecycle:1.0'
compile
'com.trello:rxlifecycle-android:1.0'
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
c43c00f8
...
...
@@ -2,8 +2,13 @@ package chat.rocket.android.fragment.chatroom;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v4.view.GravityCompat
;
import
android.support.v4.widget.DrawerLayout
;
import
android.support.v4.widget.SlidingPaneLayout
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.View
;
import
android.widget.Toast
;
import
chat.rocket.android.R
;
import
chat.rocket.android.helper.LoadMoreScrollListener
;
import
chat.rocket.android.helper.LogcatIfError
;
...
...
@@ -17,7 +22,9 @@ import chat.rocket.android.realm_helper.RealmHelper;
import
chat.rocket.android.realm_helper.RealmObjectObserver
;
import
chat.rocket.android.realm_helper.RealmStore
;
import
chat.rocket.android.service.RocketChatService
;
import
com.jakewharton.rxbinding.support.v4.widget.RxDrawerLayout
;
import
io.realm.Sort
;
import
java.lang.reflect.Field
;
import
org.json.JSONObject
;
import
timber.log.Timber
;
...
...
@@ -96,6 +103,39 @@ public class RoomFragment extends AbstractChatRoomFragment {
}
};
listView
.
addOnScrollListener
(
scrollListener
);
setupSideMenu
();
}
private
void
setupSideMenu
()
{
View
sidemenu
=
rootView
.
findViewById
(
R
.
id
.
room_side_menu
);
sidemenu
.
findViewById
(
R
.
id
.
btn_users
).
setOnClickListener
(
view
->
{
Toast
.
makeText
(
view
.
getContext
(),
"not implemented yet."
,
Toast
.
LENGTH_SHORT
).
show
();
closeSideMenuIfNeeded
();
});
DrawerLayout
drawerLayout
=
(
DrawerLayout
)
rootView
.
findViewById
(
R
.
id
.
drawer_layout
);
SlidingPaneLayout
pane
=
(
SlidingPaneLayout
)
getActivity
().
findViewById
(
R
.
id
.
sliding_pane
);
if
(
drawerLayout
!=
null
&&
pane
!=
null
)
{
RxDrawerLayout
.
drawerOpen
(
drawerLayout
,
GravityCompat
.
END
)
.
compose
(
bindToLifecycle
())
.
subscribe
(
opened
->
{
try
{
Field
fieldSlidable
=
pane
.
getClass
().
getDeclaredField
(
"mCanSlide"
);
fieldSlidable
.
setAccessible
(
true
);
fieldSlidable
.
setBoolean
(
pane
,
!
opened
);
}
catch
(
Exception
exception
)
{
Timber
.
w
(
exception
);
}
});
}
}
private
void
closeSideMenuIfNeeded
()
{
DrawerLayout
drawerLayout
=
(
DrawerLayout
)
rootView
.
findViewById
(
R
.
id
.
drawer_layout
);
if
(
drawerLayout
!=
null
&&
drawerLayout
.
isDrawerOpen
(
GravityCompat
.
END
))
{
drawerLayout
.
closeDrawer
(
GravityCompat
.
END
);
}
}
private
void
onRenderRoom
(
RoomSubscription
roomSubscription
)
{
...
...
@@ -160,6 +200,7 @@ public class RoomFragment extends AbstractChatRoomFragment {
super
.
onResume
();
roomObserver
.
sub
();
procedureObserver
.
sub
();
closeSideMenuIfNeeded
();
}
@Override
public
void
onPause
()
{
...
...
app/src/main/res/layout-w720dp/fragment_room.xml
0 → 100644
View file @
c43c00f8
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<include
layout=
"@layout/fragment_room_main"
/>
<include
layout=
"@layout/room_side_menu"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_room.xml
View file @
c43c00f8
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<android.support.v4.widget.DrawerLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/drawer_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/recyclerview"
<include
layout=
"@layout/fragment_room_main"
/>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fab_compose"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"end|bottom"
android:layout_margin=
"@dimen/margin_16"
/>
</FrameLayout>
\ No newline at end of file
android:layout_gravity=
"end"
android:clickable=
"true"
android:theme=
"@style/AppTheme.Dark"
>
<include
layout=
"@layout/room_side_menu"
/>
</FrameLayout>
</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_room_main.xml
0 → 100644
View file @
c43c00f8
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/recyclerview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<android.support.design.widget.FloatingActionButton
android:id=
"@+id/fab_compose"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"end|bottom"
android:layout_margin=
"@dimen/margin_16"
/>
</FrameLayout>
\ No newline at end of file
app/src/main/res/layout/room_side_menu.xml
0 → 100644
View file @
c43c00f8
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/room_side_menu"
android:layout_width=
"48dp"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:layout_gravity=
"end"
>
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:textSize=
"24dp"
android:text=
"@string/fa_search"
android:enabled=
"false"
/>
<chat.rocket.android.widget.FontAwesomeButton
android:id=
"@+id/btn_users"
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:textSize=
"24dp"
android:text=
"@string/fa_users"
/>
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:textSize=
"24dp"
android:text=
"@string/fa_at"
android:enabled=
"false"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values/fa_strings.xml
View file @
c43c00f8
...
...
@@ -5,4 +5,8 @@
<string
name=
"fa_github"
translatable=
"false"
>

</string>
<string
name=
"fa_plus"
translatable=
"false"
>

</string>
<string
name=
"fa_sign_out"
translatable=
"false"
>

</string>
<string
name=
"fa_search"
translatable=
"false"
>

</string>
<string
name=
"fa_users"
translatable=
"false"
>

</string>
<string
name=
"fa_at"
translatable=
"false"
>

</string>
</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