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
d5c994f2
Commit
d5c994f2
authored
Nov 20, 2016
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-implement the room list in sidebar with Fragment.
parent
cc2fe430
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
480 additions
and
271 deletions
+480
-271
RocketChatCache.java
app/src/main/java/chat/rocket/android/RocketChatCache.java
+1
-0
AbstractAuthedActivity.java
.../chat/rocket/android/activity/AbstractAuthedActivity.java
+33
-11
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+18
-37
MethodCallHelper.java
...c/main/java/chat/rocket/android/api/MethodCallHelper.java
+1
-0
AbstractFragment.java
...n/java/chat/rocket/android/fragment/AbstractFragment.java
+2
-2
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+4
-5
SidebarMainFragment.java
.../rocket/android/fragment/sidebar/SidebarMainFragment.java
+102
-0
SessionObserver.java
...chat/rocket/android/service/observer/SessionObserver.java
+3
-8
fragment_sidebar_main.xml
app/src/main/res/layout/fragment_sidebar_main.xml
+299
-0
sidebar.xml
app/src/main/res/layout/sidebar.xml
+5
-208
fa_strings.xml
app/src/main/res/values/fa_strings.xml
+1
-0
sidebar_styles.xml
app/src/main/res/values/sidebar_styles.xml
+11
-0
No files found.
app/src/main/java/chat/rocket/android/RocketChatCache.java
View file @
d5c994f2
...
...
@@ -8,6 +8,7 @@ import android.content.SharedPreferences;
*/
public
class
RocketChatCache
{
public
static
final
String
KEY_SELECTED_SERVER_CONFIG_ID
=
"selectedServerConfigId"
;
public
static
final
String
KEY_SELECTED_ROOM_ID
=
"selectedRoomId"
;
/**
* get SharedPreference instance for RocketChat application cache.
...
...
app/src/main/java/chat/rocket/android/activity/AbstractAuthedActivity.java
View file @
d5c994f2
package
chat
.
rocket
.
android
.
activity
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
chat.rocket.android.LaunchUtil
;
import
chat.rocket.android.RocketChatCache
;
import
chat.rocket.android.model.ServerConfig
;
...
...
@@ -22,11 +20,14 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
});
protected
String
serverConfigId
;
protected
String
roomId
;
SharedPreferences
.
OnSharedPreferenceChangeListener
preferenceChangeListener
=
(
sharedPreferences
,
key
)
->
{
if
(
RocketChatCache
.
KEY_SELECTED_SERVER_CONFIG_ID
.
equals
(
key
))
{
updateServerConfigIdIfNeeded
(
sharedPreferences
);
}
else
if
(
RocketChatCache
.
KEY_SELECTED_ROOM_ID
.
equals
(
key
))
{
updateRoomIdIfNeeded
(
sharedPreferences
);
}
};
...
...
@@ -34,26 +35,46 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
String
newServerConfigId
=
prefs
.
getString
(
RocketChatCache
.
KEY_SELECTED_SERVER_CONFIG_ID
,
null
);
if
(
serverConfigId
==
null
)
{
if
(
newServerConfigId
!=
null
)
{
serverConfigId
=
newServerConfigId
;
onServerConfigIdUpdated
();
updateServerConfigId
(
newServerConfigId
);
}
}
else
{
if
(!
serverConfigId
.
equals
(
newServerConfigId
))
{
serverConfigId
=
newServerConfigId
;
onServerConfigIdUpdated
();
updateServerConfigId
(
newServerConfigId
);
}
}
}
protected
void
onServerConfigIdUpdated
()
{}
private
void
updateServerConfigId
(
String
serverConfigId
)
{
this
.
serverConfigId
=
serverConfigId
;
onServerConfigIdUpdated
();
}
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
private
void
updateRoomIdIfNeeded
(
SharedPreferences
prefs
)
{
String
newRoomId
=
prefs
.
getString
(
RocketChatCache
.
KEY_SELECTED_ROOM_ID
,
null
);
if
(
roomId
==
null
)
{
if
(
newRoomId
!=
null
)
{
updateRoomId
(
newRoomId
);
}
}
else
{
if
(!
roomId
.
equals
(
newRoomId
))
{
updateRoomId
(
newRoomId
);
}
}
}
SharedPreferences
prefs
=
RocketChatCache
.
get
(
this
);
updateServerConfigIdIfNeeded
(
prefs
);
private
void
updateRoomId
(
String
roomId
)
{
this
.
roomId
=
roomId
;
onRoomIdUpdated
();
}
protected
void
onServerConfigIdUpdated
()
{
RocketChatCache
.
get
(
this
).
edit
()
.
remove
(
RocketChatCache
.
KEY_SELECTED_ROOM_ID
)
.
apply
();
}
protected
void
onRoomIdUpdated
()
{}
@Override
protected
void
onResume
()
{
super
.
onResume
();
RocketChatService
.
keepalive
(
this
);
...
...
@@ -61,6 +82,7 @@ abstract class AbstractAuthedActivity extends AbstractFragmentActivity {
SharedPreferences
prefs
=
RocketChatCache
.
get
(
this
);
updateServerConfigIdIfNeeded
(
prefs
);
updateRoomIdIfNeeded
(
prefs
);
prefs
.
registerOnSharedPreferenceChangeListener
(
preferenceChangeListener
);
}
...
...
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
d5c994f2
...
...
@@ -4,27 +4,21 @@ import android.os.Bundle;
import
android.support.annotation.Nullable
;
import
android.support.v4.widget.SlidingPaneLayout
;
import
android.view.View
;
import
android.widget.CompoundButton
;
import
android.widget.LinearLayout
;
import
chat.rocket.android.LaunchUtil
;
import
chat.rocket.android.R
;
import
chat.rocket.android.fragment.chatroom.HomeFragment
;
import
chat.rocket.android.fragment.chatroom.RoomFragment
;
import
chat.rocket.android.fragment.sidebar.SidebarMainFragment
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.layouthelper.chatroom.RoomListManager
;
import
chat.rocket.android.model.internal.Session
;
import
chat.rocket.android.realm_helper.RealmHelper
;
import
chat.rocket.android.realm_helper.RealmStore
;
import
com.jakewharton.rxbinding.view.RxView
;
import
com.jakewharton.rxbinding.widget.RxCompoundButton
;
import
hugo.weaving.DebugLog
;
/**
* Entry-point for Rocket.Chat.Android application.
*/
public
class
MainActivity
extends
AbstractAuthedActivity
{
private
RoomListManager
roomListManager
;
@Override
protected
int
getLayoutContainerForFragment
()
{
return
R
.
id
.
activity_main_container
;
}
...
...
@@ -34,24 +28,10 @@ public class MainActivity extends AbstractAuthedActivity {
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
if
(
savedInstanceState
==
null
)
{
showFragment
(
new
HomeFragment
());
}
setupSidebar
();
}
private
void
setupSidebar
()
{
setupUserActionToggle
();
roomListManager
=
new
RoomListManager
(
(
LinearLayout
)
findViewById
(
R
.
id
.
channels_container
),
(
LinearLayout
)
findViewById
(
R
.
id
.
direct_messages_container
));
roomListManager
.
setOnItemClickListener
(
view
->
{
showRoomFragment
(
view
.
getRoomId
());
closeSidebarIfNeeded
();
});
SlidingPaneLayout
pane
=
(
SlidingPaneLayout
)
findViewById
(
R
.
id
.
sliding_pane
);
if
(
pane
!=
null
)
{
final
SlidingPaneLayout
subPane
=
(
SlidingPaneLayout
)
findViewById
(
R
.
id
.
sub_sliding_pane
);
...
...
@@ -74,26 +54,14 @@ public class MainActivity extends AbstractAuthedActivity {
}
}
private
void
setupUserActionToggle
()
{
final
CompoundButton
toggleUserAction
=
((
CompoundButton
)
findViewById
(
R
.
id
.
toggle_user_action
));
toggleUserAction
.
setFocusableInTouchMode
(
false
);
findViewById
(
R
.
id
.
user_info_container
).
setOnClickListener
(
view
->
{
toggleUserAction
.
toggle
();
});
RxCompoundButton
.
checkedChanges
(
toggleUserAction
)
.
compose
(
bindToLifecycle
())
.
subscribe
(
RxView
.
visibility
(
findViewById
(
R
.
id
.
user_action_outer_container
)));
}
private
void
showRoomFragment
(
String
roomId
)
{
showFragment
(
RoomFragment
.
create
(
serverConfigId
,
roomId
));
}
@DebugLog
@Override
protected
void
onServerConfigIdUpdated
()
{
super
.
onServerConfigIdUpdated
();
getSupportFragmentManager
().
beginTransaction
()
.
replace
(
R
.
id
.
sidebar_fragment_container
,
SidebarMainFragment
.
create
(
serverConfigId
))
.
commit
();
if
(
serverConfigId
==
null
)
{
return
;
}
...
...
@@ -115,4 +83,17 @@ public class MainActivity extends AbstractAuthedActivity {
LaunchUtil
.
showServerConfigActivity
(
this
,
serverConfigId
);
}
}
@Override
protected
void
onRoomIdUpdated
()
{
super
.
onRoomIdUpdated
();
if
(
roomId
!=
null
)
{
showFragment
(
RoomFragment
.
create
(
serverConfigId
,
roomId
));
closeSidebarIfNeeded
();
}
else
{
showFragment
(
new
HomeFragment
());
}
}
}
app/src/main/java/chat/rocket/android/api/MethodCallHelper.java
View file @
d5c994f2
...
...
@@ -181,6 +181,7 @@ public class MethodCallHelper {
}
return
realmHelper
.
executeTransaction
(
realm
->
{
realm
.
delete
(
RoomSubscription
.
class
);
realm
.
createOrUpdateAllFromJson
(
RoomSubscription
.
class
,
result
);
return
null
;
...
...
app/src/main/java/chat/rocket/android/fragment/AbstractFragment.java
View file @
d5c994f2
...
...
@@ -3,15 +3,15 @@ package chat.rocket.android.fragment;
import
android.os.Bundle
;
import
android.support.annotation.LayoutRes
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.Fragment
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
com.trello.rxlifecycle.components.support.RxFragment
;
/**
* Fragment base class for this Application.
*/
public
abstract
class
AbstractFragment
extends
Fragment
{
public
abstract
class
AbstractFragment
extends
Rx
Fragment
{
protected
View
rootView
;
protected
abstract
@LayoutRes
int
getLayout
();
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
d5c994f2
...
...
@@ -19,6 +19,7 @@ public class RoomFragment extends AbstractChatRoomFragment {
private
RealmHelper
realmHelper
;
private
String
roomId
;
private
RealmObjectObserver
<
RoomSubscription
>
roomObserver
;
/**
* create fragment with roomId.
...
...
@@ -41,6 +42,9 @@ public class RoomFragment extends AbstractChatRoomFragment {
Bundle
args
=
getArguments
();
realmHelper
=
RealmStore
.
get
(
args
.
getString
(
"serverConfigId"
));
roomId
=
args
.
getString
(
"roomId"
);
roomObserver
=
realmHelper
.
createObjectObserver
(
realm
->
realm
.
where
(
RoomSubscription
.
class
).
equalTo
(
"rid"
,
roomId
))
.
setOnUpdateListener
(
this
::
onRenderRoom
);
}
@Override
protected
int
getLayout
()
{
...
...
@@ -60,11 +64,6 @@ public class RoomFragment extends AbstractChatRoomFragment {
}).
continueWith
(
new
LogcatIfError
());
}
private
RealmObjectObserver
<
RoomSubscription
>
roomObserver
=
realmHelper
.
createObjectObserver
(
realm
->
realm
.
where
(
RoomSubscription
.
class
).
equalTo
(
"rid"
,
roomId
))
.
setOnUpdateListener
(
this
::
onRenderRoom
);
private
void
onRenderRoom
(
RoomSubscription
roomSubscription
)
{
activityToolbar
.
setTitle
(
roomSubscription
.
getName
());
}
...
...
app/src/main/java/chat/rocket/android/fragment/sidebar/SidebarMainFragment.java
0 → 100644
View file @
d5c994f2
package
chat
.
rocket
.
android
.
fragment
.
sidebar
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.widget.CompoundButton
;
import
android.widget.LinearLayout
;
import
chat.rocket.android.R
;
import
chat.rocket.android.RocketChatCache
;
import
chat.rocket.android.fragment.AbstractFragment
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.layouthelper.chatroom.RoomListManager
;
import
chat.rocket.android.model.ddp.RoomSubscription
;
import
chat.rocket.android.realm_helper.RealmHelper
;
import
chat.rocket.android.realm_helper.RealmListObserver
;
import
chat.rocket.android.realm_helper.RealmStore
;
import
com.jakewharton.rxbinding.view.RxView
;
import
com.jakewharton.rxbinding.widget.RxCompoundButton
;
public
class
SidebarMainFragment
extends
AbstractFragment
{
private
String
serverConfigId
;
private
RoomListManager
roomListManager
;
private
RealmListObserver
<
RoomSubscription
>
roomsObserver
;
public
SidebarMainFragment
()
{
}
public
static
SidebarMainFragment
create
(
String
serverConfigId
)
{
Bundle
args
=
new
Bundle
();
args
.
putString
(
"serverConfigId"
,
serverConfigId
);
SidebarMainFragment
fragment
=
new
SidebarMainFragment
();
fragment
.
setArguments
(
args
);
return
fragment
;
}
@Override
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
Bundle
args
=
getArguments
();
serverConfigId
=
args
==
null
?
null
:
args
.
getString
(
"serverConfigId"
);
if
(!
TextUtils
.
isEmpty
(
serverConfigId
))
{
RealmHelper
realmHelper
=
RealmStore
.
get
(
serverConfigId
);
if
(
realmHelper
!=
null
)
{
roomsObserver
=
realmHelper
.
createListObserver
(
realm
->
realm
.
where
(
RoomSubscription
.
class
).
findAll
())
.
setOnUpdateListener
(
list
->
roomListManager
.
setRooms
(
list
));
}
}
}
@Override
protected
int
getLayout
()
{
if
(
serverConfigId
==
null
)
{
return
R
.
layout
.
simple_screen
;
}
else
{
return
R
.
layout
.
fragment_sidebar_main
;
}
}
@Override
protected
void
onSetupView
()
{
if
(
serverConfigId
==
null
)
{
return
;
}
setupUserActionToggle
();
roomListManager
=
new
RoomListManager
(
(
LinearLayout
)
rootView
.
findViewById
(
R
.
id
.
channels_container
),
(
LinearLayout
)
rootView
.
findViewById
(
R
.
id
.
direct_messages_container
));
roomListManager
.
setOnItemClickListener
(
view
->
{
RocketChatCache
.
get
(
view
.
getContext
()).
edit
()
.
putString
(
RocketChatCache
.
KEY_SELECTED_ROOM_ID
,
view
.
getRoomId
())
.
apply
();
});
}
private
void
setupUserActionToggle
()
{
final
CompoundButton
toggleUserAction
=
((
CompoundButton
)
rootView
.
findViewById
(
R
.
id
.
toggle_user_action
));
toggleUserAction
.
setFocusableInTouchMode
(
false
);
rootView
.
findViewById
(
R
.
id
.
user_info_container
).
setOnClickListener
(
view
->
{
toggleUserAction
.
toggle
();
});
RxCompoundButton
.
checkedChanges
(
toggleUserAction
)
.
compose
(
bindToLifecycle
())
.
subscribe
(
RxView
.
visibility
(
rootView
.
findViewById
(
R
.
id
.
user_action_outer_container
)));
}
@Override
public
void
onResume
()
{
super
.
onResume
();
if
(
roomsObserver
!=
null
)
{
roomsObserver
.
sub
();
}
}
@Override
public
void
onPause
()
{
if
(
roomsObserver
!=
null
)
{
roomsObserver
.
unsub
();
}
super
.
onPause
();
}
}
app/src/main/java/chat/rocket/android/service/observer/SessionObserver.java
View file @
d5c994f2
package
chat
.
rocket
.
android
.
service
.
observer
;
import
android.content.Context
;
import
chat.rocket.android.
helper.LogcatIfErro
r
;
import
chat.rocket.android.
api.DDPClientWrape
r
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.
model.ddp.RoomSubscription
;
import
chat.rocket.android.
helper.LogcatIfError
;
import
chat.rocket.android.model.internal.Session
;
import
chat.rocket.android.realm_helper.RealmHelper
;
import
chat.rocket.android.api.DDPClientWraper
;
import
hugo.weaving.DebugLog
;
import
io.realm.Realm
;
import
io.realm.RealmResults
;
...
...
@@ -56,11 +55,7 @@ public class SessionObserver extends AbstractModelObserver<Session> {
}
@DebugLog
private
void
onLogin
()
{
realmHelper
.
executeTransaction
(
realm
->
{
realm
.
delete
(
RoomSubscription
.
class
);
return
null
;
}).
onSuccessTask
(
_task
->
methodCall
.
getRooms
())
.
continueWith
(
new
LogcatIfError
());
methodCall
.
getRooms
().
continueWith
(
new
LogcatIfError
());
}
...
...
app/src/main/res/layout/fragment_sidebar_main.xml
0 → 100644
View file @
d5c994f2
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:tools=
"http://schemas.android.com/tools"
android:theme=
"@style/AppTheme.Dark"
>
<LinearLayout
android:id=
"@+id/user_info_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"?attr/colorPrimaryDark"
android:foreground=
"?attr/selectableItemBackground"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
android:padding=
"@dimen/margin_16"
android:layout_alignParentTop=
"true"
android:elevation=
"2dp"
>
<ImageView
android:id=
"@+id/img_userstatus"
android:layout_width=
"8dp"
android:layout_height=
"8dp"
android:src=
"@drawable/userstatus_online"
/>
<Space
android:layout_width=
"@dimen/margin_8"
android:layout_height=
"wrap_content"
/>
<ImageView
android:id=
"@+id/img_my_avatar"
android:layout_width=
"48dp"
android:layout_height=
"48dp"
/>
<FrameLayout
android:layout_width=
"0px"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/margin_8"
android:layout_marginRight=
"@dimen/margin_8"
android:layout_weight=
"1"
>
<TextView
android:id=
"@+id/txt_account_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:text=
"John Doe"
android:textSize=
"14sp"
/>
</FrameLayout>
<chat.rocket.android.widget.DownUpToggleView
android:id=
"@+id/toggle_user_action"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/user_info_container"
android:background=
"?attr/colorPrimary"
android:layout_alignParentBottom=
"true"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingStart=
"?attr/listPreferredItemPaddingLeft"
android:orientation=
"vertical"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/margin_8"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"CHANNELS"
android:textAppearance=
"@style/TextAppearance.AppCompat.Body2"
android:textStyle=
"bold"
android:alpha=
"0.62"
android:layout_gravity=
"start|center_vertical"
/>
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:text=
"@string/fa_plus"
android:textSize=
"12dp"
android:layout_gravity=
"end|center_vertical"
style=
"@style/Widget.AppCompat.Button.Borderless"
/>
</FrameLayout>
<LinearLayout
android:id=
"@+id/channels_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginEnd=
"?attr/listPreferredItemPaddingRight"
/>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/margin_8"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"DIRECT MESSAGES"
android:textAppearance=
"@style/TextAppearance.AppCompat.Body2"
android:textStyle=
"bold"
android:alpha=
"0.62"
android:layout_gravity=
"start|center_vertical"
/>
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:text=
"@string/fa_plus"
android:textSize=
"12dp"
style=
"@style/Widget.AppCompat.Button.Borderless"
android:layout_gravity=
"end|center_vertical"
/>
</FrameLayout>
<LinearLayout
android:id=
"@+id/direct_messages_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginEnd=
"?attr/listPreferredItemPaddingRight"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.v4.widget.NestedScrollView
android:id=
"@+id/user_action_outer_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/user_info_container"
android:layout_alignParentBottom=
"true"
android:background=
"?attr/colorPrimaryDark"
android:elevation=
"2dp"
android:visibility=
"gone"
tools:visibility=
"visible"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<LinearLayout
android:id=
"@+id/btn_status_online"
android:orientation=
"horizontal"
style=
"@style/sidebar_list_item"
>
<FrameLayout
android:layout_width=
"48dp"
android:layout_height=
"match_parent"
>
<ImageView
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:src=
"@drawable/userstatus_online"
android:layout_gravity=
"center"
/>
</FrameLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Online"
android:textAppearance=
"?attr/textAppearanceListItemSmall"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/btn_status_away"
android:orientation=
"horizontal"
style=
"@style/sidebar_list_item"
>
<FrameLayout
android:layout_width=
"48dp"
android:layout_height=
"match_parent"
>
<ImageView
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:src=
"@drawable/userstatus_away"
android:layout_gravity=
"center"
/>
</FrameLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Away"
android:textAppearance=
"?attr/textAppearanceListItemSmall"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/btn_status_busy"
android:orientation=
"horizontal"
style=
"@style/sidebar_list_item"
>
<FrameLayout
android:layout_width=
"48dp"
android:layout_height=
"match_parent"
>
<ImageView
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:src=
"@drawable/userstatus_busy"
android:layout_gravity=
"center"
/>
</FrameLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Busy"
android:textAppearance=
"?attr/textAppearanceListItemSmall"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/btn_status_invisible"
android:orientation=
"horizontal"
style=
"@style/sidebar_list_item"
>
<FrameLayout
android:layout_width=
"48dp"
android:layout_height=
"match_parent"
>
<ImageView
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:src=
"@drawable/userstatus_offline"
android:layout_gravity=
"center"
/>
</FrameLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Invisible"
android:textAppearance=
"?attr/textAppearanceListItemSmall"
/>
</LinearLayout>
<chat.rocket.android.widget.DividerView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<LinearLayout
android:id=
"@+id/btn_logout"
android:orientation=
"horizontal"
style=
"@style/sidebar_list_item"
>
<FrameLayout
android:layout_width=
"48dp"
android:layout_height=
"match_parent"
>
<chat.rocket.android.widget.FontAwesomeTextView
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:textSize=
"14dp"
android:text=
"@string/fa_sign_out"
android:layout_gravity=
"center"
android:gravity=
"center"
/>
</FrameLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Logout"
android:textAppearance=
"?attr/textAppearanceListItemSmall"
/>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/sidebar.xml
View file @
d5c994f2
...
...
@@ -2,8 +2,6 @@
<android.support.v4.widget.SlidingPaneLayout
android:id=
"@+id/sub_sliding_pane"
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_gravity=
"start"
android:layout_width=
"280dp"
android:layout_height=
"match_parent"
...
...
@@ -38,211 +36,10 @@
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<RelativeLayout
android:layout_width=
"288dp"
android:layout_height=
"match_parent"
>
<LinearLayout
android:id=
"@+id/user_info_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"?attr/colorPrimaryDark"
android:foreground=
"?attr/selectableItemBackground"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
android:padding=
"@dimen/margin_16"
android:layout_alignParentTop=
"true"
android:elevation=
"2dp"
>
<ImageView
android:id=
"@+id/img_userstatus"
android:layout_width=
"8dp"
android:layout_height=
"8dp"
android:src=
"@drawable/userstatus_online"
/>
<Space
android:layout_width=
"@dimen/margin_8"
android:layout_height=
"wrap_content"
/>
<ImageView
android:id=
"@+id/img_my_avatar"
android:layout_width=
"48dp"
android:layout_height=
"48dp"
/>
<FrameLayout
android:layout_width=
"0px"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/margin_8"
android:layout_marginRight=
"@dimen/margin_8"
android:layout_weight=
"1"
>
<TextView
android:id=
"@+id/txt_account_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:text=
"John Doe"
android:textSize=
"14sp"
/>
</FrameLayout>
<chat.rocket.android.widget.DownUpToggleView
android:id=
"@+id/toggle_user_action"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/user_info_container"
android:background=
"?attr/colorPrimary"
android:layout_alignParentBottom=
"true"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingStart=
"?attr/listPreferredItemPaddingLeft"
android:orientation=
"vertical"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/margin_8"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"CHANNELS"
android:textAppearance=
"@style/TextAppearance.AppCompat.Body2"
android:textStyle=
"bold"
android:alpha=
"0.62"
android:layout_gravity=
"start|center_vertical"
/>
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:text=
"@string/fa_plus"
android:textSize=
"12dp"
android:layout_gravity=
"end|center_vertical"
style=
"@style/Widget.AppCompat.Button.Borderless"
/>
</FrameLayout>
<LinearLayout
android:id=
"@+id/channels_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginEnd=
"?attr/listPreferredItemPaddingRight"
/>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/margin_8"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"DIRECT MESSAGES"
android:textAppearance=
"@style/TextAppearance.AppCompat.Body2"
android:textStyle=
"bold"
android:alpha=
"0.62"
android:layout_gravity=
"start|center_vertical"
/>
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width=
"48dp"
android:layout_height=
"48dp"
android:text=
"@string/fa_plus"
android:textSize=
"12dp"
style=
"@style/Widget.AppCompat.Button.Borderless"
android:layout_gravity=
"end|center_vertical"
/>
</FrameLayout>
<LinearLayout
android:id=
"@+id/direct_messages_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginEnd=
"?attr/listPreferredItemPaddingRight"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<FrameLayout
android:id=
"@+id/sidebar_fragment_container"
android:layout_width=
"280dp"
android:layout_height=
"match_parent"
/>
<android.support.v4.widget.NestedScrollView
android:id=
"@+id/user_action_outer_container"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/user_info_container"
android:layout_alignParentBottom=
"true"
android:background=
"?attr/colorPrimaryDark"
android:elevation=
"2dp"
android:visibility=
"gone"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"?attr/listPreferredItemHeightSmall"
android:paddingStart=
"?attr/listPreferredItemPaddingLeft"
android:paddingEnd=
"?attr/listPreferredItemPaddingRight"
android:gravity=
"center_vertical"
android:text=
"Online"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"?attr/listPreferredItemHeightSmall"
android:paddingStart=
"?attr/listPreferredItemPaddingLeft"
android:paddingEnd=
"?attr/listPreferredItemPaddingRight"
android:gravity=
"center_vertical"
android:text=
"Away"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"?attr/listPreferredItemHeightSmall"
android:paddingStart=
"?attr/listPreferredItemPaddingLeft"
android:paddingEnd=
"?attr/listPreferredItemPaddingRight"
android:gravity=
"center_vertical"
android:text=
"Busy"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"?attr/listPreferredItemHeightSmall"
android:paddingStart=
"?attr/listPreferredItemPaddingLeft"
android:paddingEnd=
"?attr/listPreferredItemPaddingRight"
android:gravity=
"center_vertical"
android:text=
"Invisible"
/>
<chat.rocket.android.widget.DividerView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"?attr/listPreferredItemHeightSmall"
android:paddingStart=
"?attr/listPreferredItemPaddingLeft"
android:paddingEnd=
"?attr/listPreferredItemPaddingRight"
android:gravity=
"center_vertical"
android:text=
"Logout"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
</android.support.v4.widget.SlidingPaneLayout>
\ No newline at end of file
app/src/main/res/values/fa_strings.xml
View file @
d5c994f2
...
...
@@ -4,4 +4,5 @@
<string
name=
"fa_twitter"
translatable=
"false"
>

</string>
<string
name=
"fa_github"
translatable=
"false"
>

</string>
<string
name=
"fa_plus"
translatable=
"false"
>

</string>
<string
name=
"fa_sign_out"
translatable=
"false"
>

</string>
</resources>
\ No newline at end of file
app/src/main/res/values/sidebar_styles.xml
0 → 100644
View file @
d5c994f2
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name=
"sidebar_list_item"
>
<item
name=
"android:layout_width"
>
match_parent
</item>
<item
name=
"android:layout_height"
>
?attr/listPreferredItemHeight
</item>
<item
name=
"android:paddingStart"
>
?attr/listPreferredItemPaddingLeft
</item>
<item
name=
"android:paddingEnd"
>
?attr/listPreferredItemPaddingRight
</item>
<item
name=
"android:gravity"
>
center_vertical
</item>
<item
name=
"android:background"
>
?attr/selectableItemBackground
</item>
</style>
</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