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
d8f0d912
Commit
d8f0d912
authored
Nov 10, 2016
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement Room list in side bar.
parent
0b467376
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
593 additions
and
48 deletions
+593
-48
build.gradle
app/build.gradle
+4
-0
AbstractFragmentActivity.java
...hat/rocket/android/activity/AbstractFragmentActivity.java
+2
-2
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+54
-0
RoomListManager.java
...rocket/android/layouthelper/chatroom/RoomListManager.java
+77
-0
Room.java
app/src/main/java/chat/rocket/android/model/Room.java
+52
-0
sidebar.xml
app/src/main/res/layout/sidebar.xml
+173
-40
colors.xml
app/src/main/res/values/colors.xml
+0
-2
fa_strings.xml
app/src/main/res/values/fa_strings.xml
+1
-0
styles.xml
app/src/main/res/values/styles.xml
+0
-3
build.gradle
rocket-chat-android-widgets/build.gradle
+1
-1
DividerView.java
...src/main/java/chat/rocket/android/widget/DividerView.java
+53
-0
DownUpToggleView.java
...ain/java/chat/rocket/android/widget/DownUpToggleView.java
+27
-0
RoomListItemView.java
...chat/rocket/android/widget/internal/RoomListItemView.java
+82
-0
down_up_toggle_down.png
...idgets/src/main/res/drawable-hdpi/down_up_toggle_down.png
+0
-0
down_up_toggle_up.png
...-widgets/src/main/res/drawable-hdpi/down_up_toggle_up.png
+0
-0
down_up_toggle_down.png
...idgets/src/main/res/drawable-mdpi/down_up_toggle_down.png
+0
-0
down_up_toggle_up.png
...-widgets/src/main/res/drawable-mdpi/down_up_toggle_up.png
+0
-0
down_up_toggle_down.png
...dgets/src/main/res/drawable-xhdpi/down_up_toggle_down.png
+0
-0
down_up_toggle_up.png
...widgets/src/main/res/drawable-xhdpi/down_up_toggle_up.png
+0
-0
down_up_toggle_down.png
...gets/src/main/res/drawable-xxhdpi/down_up_toggle_down.png
+0
-0
down_up_toggle_up.png
...idgets/src/main/res/drawable-xxhdpi/down_up_toggle_up.png
+0
-0
down_up_toggle.xml
...-android-widgets/src/main/res/drawable/down_up_toggle.xml
+6
-0
room_list_item.xml
...at-android-widgets/src/main/res/layout/room_list_item.xml
+44
-0
colors.xml
rocket-chat-android-widgets/src/main/res/values/colors.xml
+4
-0
divider_view_attrs.xml
...ndroid-widgets/src/main/res/values/divider_view_attrs.xml
+7
-0
fa_strings.xml
...t-chat-android-widgets/src/main/res/values/fa_strings.xml
+6
-0
No files found.
app/build.gradle
View file @
d8f0d912
...
@@ -73,5 +73,9 @@ dependencies {
...
@@ -73,5 +73,9 @@ dependencies {
compile
'com.jakewharton.timber:timber:4.3.1'
compile
'com.jakewharton.timber:timber:4.3.1'
compile
'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile
'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile
'com.trello:rxlifecycle:1.0'
compile
'com.trello:rxlifecycle-android:1.0'
compile
'com.trello:rxlifecycle-components:1.0'
compile
'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile
'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
}
}
app/src/main/java/chat/rocket/android/activity/AbstractFragmentActivity.java
View file @
d8f0d912
...
@@ -3,10 +3,10 @@ package chat.rocket.android.activity;
...
@@ -3,10 +3,10 @@ package chat.rocket.android.activity;
import
android.support.annotation.IdRes
;
import
android.support.annotation.IdRes
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.app.FragmentManager
;
import
android.support.v4.app.FragmentManager
;
import
android.support.v7.app.AppCompatActivity
;
import
chat.rocket.android.helper.OnBackPressListener
;
import
chat.rocket.android.helper.OnBackPressListener
;
import
com.trello.rxlifecycle.components.support.RxAppCompatActivity
;
abstract
class
AbstractFragmentActivity
extends
AppCompatActivity
{
abstract
class
AbstractFragmentActivity
extends
Rx
AppCompatActivity
{
protected
abstract
@IdRes
int
getLayoutContainerForFragment
();
protected
abstract
@IdRes
int
getLayoutContainerForFragment
();
...
...
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
d8f0d912
...
@@ -2,15 +2,27 @@ package chat.rocket.android.activity;
...
@@ -2,15 +2,27 @@ package chat.rocket.android.activity;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.widget.CompoundButton
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
chat.rocket.android.R
;
import
chat.rocket.android.R
;
import
chat.rocket.android.fragment.chatroom.HomeFragment
;
import
chat.rocket.android.fragment.chatroom.HomeFragment
;
import
chat.rocket.android.helper.Avatar
;
import
chat.rocket.android.helper.Avatar
;
import
chat.rocket.android.layouthelper.chatroom.RoomListManager
;
import
chat.rocket.android.model.Room
;
import
com.jakewharton.rxbinding.view.RxView
;
import
com.jakewharton.rxbinding.widget.RxCompoundButton
;
import
io.realm.Realm
;
import
io.realm.RealmResults
;
import
java.util.List
;
import
jp.co.crowdworks.realm_java_helpers.RealmListObserver
;
/**
/**
* Entry-point for Rocket.Chat.Android application.
* Entry-point for Rocket.Chat.Android application.
*/
*/
public
class
MainActivity
extends
AbstractAuthedActivity
{
public
class
MainActivity
extends
AbstractAuthedActivity
{
private
RoomListManager
roomListManager
;
@Override
protected
int
getLayoutContainerForFragment
()
{
@Override
protected
int
getLayoutContainerForFragment
()
{
return
R
.
id
.
activity_main_container
;
return
R
.
id
.
activity_main_container
;
}
}
...
@@ -23,7 +35,49 @@ public class MainActivity extends AbstractAuthedActivity {
...
@@ -23,7 +35,49 @@ public class MainActivity extends AbstractAuthedActivity {
showFragment
(
new
HomeFragment
());
showFragment
(
new
HomeFragment
());
}
}
setupSidebar
();
}
private
void
setupSidebar
()
{
setupUserActionToggle
();
roomListManager
=
new
RoomListManager
(
(
LinearLayout
)
findViewById
(
R
.
id
.
channels_container
),
(
LinearLayout
)
findViewById
(
R
.
id
.
direct_messages_container
));
ImageView
myAvatar
=
(
ImageView
)
findViewById
(
R
.
id
.
img_my_avatar
);
ImageView
myAvatar
=
(
ImageView
)
findViewById
(
R
.
id
.
img_my_avatar
);
new
Avatar
(
"demo.rocket.chat"
,
"John Doe"
).
into
(
myAvatar
);
new
Avatar
(
"demo.rocket.chat"
,
"John Doe"
).
into
(
myAvatar
);
}
}
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_container
)));
}
private
RealmListObserver
<
Room
>
mRoomsObserver
=
new
RealmListObserver
<
Room
>()
{
@Override
protected
RealmResults
<
Room
>
queryItems
(
Realm
realm
)
{
return
realm
.
where
(
Room
.
class
).
findAll
();
}
@Override
protected
void
onCollectionChanged
(
List
<
Room
>
list
)
{
roomListManager
.
setRooms
(
list
);
}
};
@Override
protected
void
onResume
()
{
super
.
onResume
();
mRoomsObserver
.
sub
();
}
@Override
protected
void
onPause
()
{
mRoomsObserver
.
unsub
();
super
.
onPause
();
}
}
}
app/src/main/java/chat/rocket/android/layouthelper/chatroom/RoomListManager.java
0 → 100644
View file @
d8f0d912
package
chat
.
rocket
.
android
.
layouthelper
.
chatroom
;
import
android.view.ViewGroup
;
import
chat.rocket.android.helper.TextUtils
;
import
chat.rocket.android.model.Room
;
import
chat.rocket.android.widget.internal.RoomListItemView
;
import
java.util.List
;
public
class
RoomListManager
{
private
ViewGroup
channelsContainer
;
private
ViewGroup
dmContainer
;
public
RoomListManager
(
ViewGroup
channelsContainer
,
ViewGroup
dmContainer
)
{
this
.
channelsContainer
=
channelsContainer
;
this
.
dmContainer
=
dmContainer
;
}
public
void
setRooms
(
List
<
Room
>
roomList
)
{
for
(
Room
room
:
roomList
)
{
String
name
=
room
.
getName
();
if
(
TextUtils
.
isEmpty
(
name
))
{
continue
;
}
String
type
=
room
.
getT
();
if
(
Room
.
TYPE_CHANNEL
.
equals
(
type
)
||
Room
.
TYPE_PRIVATE
.
equals
(
type
))
{
insertOrUpdateItem
(
channelsContainer
,
room
);
removeItemIfExists
(
dmContainer
,
name
);
}
else
if
(
Room
.
TYPE_DIRECT_MESSAGE
.
equals
(
type
))
{
removeItemIfExists
(
channelsContainer
,
name
);
insertOrUpdateItem
(
dmContainer
,
room
);
}
}
}
private
static
void
insertOrUpdateItem
(
ViewGroup
parent
,
Room
room
)
{
final
String
roomName
=
room
.
getName
();
int
index
;
for
(
index
=
0
;
index
<
parent
.
getChildCount
();
index
++)
{
RoomListItemView
roomListItemView
=
(
RoomListItemView
)
parent
.
getChildAt
(
index
);
final
String
targetRoomName
=
roomListItemView
.
getName
();
if
(
roomName
.
equals
(
targetRoomName
))
{
updateRoomItemView
(
roomListItemView
,
room
);
return
;
}
if
(
roomName
.
compareToIgnoreCase
(
targetRoomName
)
<
0
)
{
break
;
}
}
RoomListItemView
roomListItemView
=
new
RoomListItemView
(
parent
.
getContext
());
updateRoomItemView
(
roomListItemView
,
room
);
if
(
index
==
parent
.
getChildCount
())
{
parent
.
addView
(
roomListItemView
);
}
else
{
parent
.
addView
(
roomListItemView
,
index
);
}
}
private
static
void
updateRoomItemView
(
RoomListItemView
roomListItemView
,
Room
room
)
{
roomListItemView
.
setRoom
(
room
.
getT
(),
room
.
getName
())
.
setAlertCount
(
0
);
// TODO not implemented yet.
}
private
static
void
removeItemIfExists
(
ViewGroup
parent
,
String
roomName
)
{
for
(
int
i
=
0
;
i
<
parent
.
getChildCount
();
i
++)
{
RoomListItemView
roomListItemView
=
(
RoomListItemView
)
parent
.
getChildAt
(
i
);
if
(
roomName
.
equals
(
roomListItemView
.
getName
()))
{
parent
.
removeViewAt
(
i
);
break
;
}
}
}
}
app/src/main/java/chat/rocket/android/model/Room.java
View file @
d8f0d912
...
@@ -8,10 +8,62 @@ import io.realm.annotations.PrimaryKey;
...
@@ -8,10 +8,62 @@ import io.realm.annotations.PrimaryKey;
*/
*/
@SuppressWarnings
({
"PMD.ShortClassName"
,
"PMD.ShortVariable"
,
"PMD.VariableNamingConventions"
})
@SuppressWarnings
({
"PMD.ShortClassName"
,
"PMD.ShortVariable"
,
"PMD.VariableNamingConventions"
})
public
class
Room
extends
RealmObject
{
public
class
Room
extends
RealmObject
{
public
static
final
String
TYPE_CHANNEL
=
"c"
;
public
static
final
String
TYPE_PRIVATE
=
"p"
;
public
static
final
String
TYPE_DIRECT_MESSAGE
=
"d"
;
@PrimaryKey
private
String
_id
;
@PrimaryKey
private
String
_id
;
private
String
serverConfigId
;
private
String
serverConfigId
;
private
String
name
;
private
String
name
;
private
String
t
;
//type { c: channel, d: direct message, p: private }
private
String
t
;
//type { c: channel, d: direct message, p: private }
private
User
u
;
//User who created this room.
private
User
u
;
//User who created this room.
private
String
topic
;
private
String
topic
;
public
String
get_id
()
{
return
_id
;
}
public
void
set_id
(
String
_id
)
{
this
.
_id
=
_id
;
}
public
String
getServerConfigId
()
{
return
serverConfigId
;
}
public
void
setServerConfigId
(
String
serverConfigId
)
{
this
.
serverConfigId
=
serverConfigId
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getT
()
{
return
t
;
}
public
void
setT
(
String
t
)
{
this
.
t
=
t
;
}
public
User
getU
()
{
return
u
;
}
public
void
setU
(
User
u
)
{
this
.
u
=
u
;
}
public
String
getTopic
()
{
return
topic
;
}
public
void
setTopic
(
String
topic
)
{
this
.
topic
=
topic
;
}
}
}
app/src/main/res/layout/sidebar.xml
View file @
d8f0d912
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Relative
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"288dp"
android:layout_width=
"288dp"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_gravity=
"start"
android:layout_gravity=
"start"
android:background=
"?attr/colorPrimary"
android:orientation=
"vertical"
android:theme=
"@style/AppTheme.Dark"
android:theme=
"@style/AppTheme.Dark"
>
>
<LinearLayout
<LinearLayout
android:id=
"@+id/user_info_container"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"?attr/colorPrimaryDark"
android:background=
"?attr/colorPrimaryDark"
android:orientation=
"vertical"
android:foreground=
"?attr/selectableItemBackground"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
android:padding=
"@dimen/margin_16"
android:layout_alignParentTop=
"true"
android:elevation=
"2dp"
>
>
<LinearLayout
<ImageView
android:id=
"@+id/user_info_container"
android:id=
"@+id/img_userstatus"
android:layout_width=
"match_parent"
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"
android:layout_height=
"wrap_content"
android:background=
"?attr/selectableItemBackground"
/>
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
<ImageView
android:padding=
"@dimen/margin_16"
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"
>
>
<ImageView
<TextView
android:id=
"@+id/img_userstatus"
android:id=
"@+id/txt_account_info"
android:layout_width=
"8dp"
android:layout_width=
"match_parent"
android:layout_height=
"8dp"
android:layout_height=
"wrap_content"
android:src=
"@drawable/userstatus_online"
android:layout_gravity=
"center_vertical"
android:text=
"John Doe"
android:textSize=
"14sp"
/>
/>
<Space
</FrameLayout>
android:layout_width=
"@dimen/margin_8"
<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_height=
"wrap_content"
/>
android:layout_marginTop=
"@dimen/margin_16"
android:layout_marginBottom=
"@dimen/margin_8"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"channels"
android:textAppearance=
"@style/TextAppearance.AppCompat.Body1"
android:layout_gravity=
"start|center_vertical"
/>
<ImageView
<chat.rocket.android.widget.FontAwesomeButton
android:id=
"@+id/img_my_avatar"
android:layout_width=
"48dp"
android:layout_width=
"48dp"
android:layout_height=
"32dp"
android:layout_height=
"48dp"
android:text=
"@string/fa_plus"
android:textSize=
"12dp"
android:layout_gravity=
"end|center_vertical"
/>
</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
<FrameLayout
android:layout_width=
"
0px
"
android:layout_width=
"
match_parent
"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/margin_8"
android:layout_marginTop=
"@dimen/margin_16"
android:layout_marginRight=
"@dimen/margin_8"
android:layout_marginBottom=
"@dimen/margin_8"
android:layout_weight=
"1"
>
>
<TextView
<TextView
android:id=
"@+id/txt_account_info"
android:layout_width=
"wrap_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:text=
"direct messages"
android:text=
"John Doe"
android:textAppearance=
"@style/TextAppearance.AppCompat.Body1"
android:textSize=
"14sp"
android:layout_gravity=
"start|center_vertical"
/>
<chat.rocket.android.widget.FontAwesomeButton
android:layout_width=
"48dp"
android:layout_height=
"32dp"
android:text=
"@string/fa_plus"
android:textSize=
"12dp"
android:layout_gravity=
"end|center_vertical"
/>
/>
</FrameLayout>
</FrameLayout>
<
chat.rocket.android.widget.FontAwesomeTextView
<
LinearLayout
android:id=
"@+id/
img_user_action_toggle
"
android:id=
"@+id/
direct_messages_container
"
android:layout_width=
"
wrap_cont
ent"
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:
text=
"@string/fa_chevron_down
"
android:
orientation=
"vertical
"
android:
textSize=
"16dp
"
android:
layout_marginEnd=
"?attr/listPreferredItemPaddingRight
"
/>
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<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/colorPrimaryDark"
android:elevation=
"2dp"
tools:visibility=
"gone"
>
<LinearLayout
android:id=
"@+id/user_action_container"
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>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
d8f0d912
...
@@ -8,7 +8,5 @@
...
@@ -8,7 +8,5 @@
<color
name=
"colorAccent_a40"
>
#662D91FA
</color>
<color
name=
"colorAccent_a40"
>
#662D91FA
</color>
<color
name=
"textColorLink"
>
#008ce3
</color>
<color
name=
"textColorLink"
>
#008ce3
</color>
<color
name=
"divider"
>
#FFEEEEEE
</color>
<color
name=
"white"
>
#FFFEFEFF
</color>
<color
name=
"white"
>
#FFFEFEFF
</color>
</resources>
</resources>
app/src/main/res/values/fa_strings.xml
View file @
d8f0d912
...
@@ -3,4 +3,5 @@
...
@@ -3,4 +3,5 @@
<string
name=
"fa_chevron_down"
translatable=
"false"
>

</string>
<string
name=
"fa_chevron_down"
translatable=
"false"
>

</string>
<string
name=
"fa_twitter"
translatable=
"false"
>

</string>
<string
name=
"fa_twitter"
translatable=
"false"
>

</string>
<string
name=
"fa_github"
translatable=
"false"
>

</string>
<string
name=
"fa_github"
translatable=
"false"
>

</string>
<string
name=
"fa_plus"
translatable=
"false"
>

</string>
</resources>
</resources>
\ No newline at end of file
app/src/main/res/values/styles.xml
View file @
d8f0d912
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
<item
name=
"android:textColorLink"
>
@drawable/selector_text_color_link
</item>
<item
name=
"android:textColorLink"
>
@drawable/selector_text_color_link
</item>
<item
name=
"android:listDivider"
>
@color/divider
</item>
<item
name=
"colorControlActivated"
>
@color/colorAccentDark
</item>
<item
name=
"colorControlActivated"
>
@color/colorAccentDark
</item>
<item
name=
"android:textColorHighlight"
>
@color/colorAccent_a40
</item>
<item
name=
"android:textColorHighlight"
>
@color/colorAccent_a40
</item>
...
@@ -22,7 +21,6 @@
...
@@ -22,7 +21,6 @@
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
<item
name=
"android:textColorLink"
>
@drawable/selector_text_color_link
</item>
<item
name=
"android:textColorLink"
>
@drawable/selector_text_color_link
</item>
<item
name=
"android:listDivider"
>
@color/divider
</item>
<item
name=
"colorControlActivated"
>
@color/colorAccentDark
</item>
<item
name=
"colorControlActivated"
>
@color/colorAccentDark
</item>
<item
name=
"android:textColorHighlight"
>
@color/colorAccent_a40
</item>
<item
name=
"android:textColorHighlight"
>
@color/colorAccent_a40
</item>
...
@@ -37,7 +35,6 @@
...
@@ -37,7 +35,6 @@
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
<item
name=
"android:textColorLink"
>
@drawable/selector_text_color_link
</item>
<item
name=
"android:textColorLink"
>
@drawable/selector_text_color_link
</item>
<item
name=
"android:listDivider"
>
@color/divider
</item>
<item
name=
"colorControlActivated"
>
@color/colorAccentDark
</item>
<item
name=
"colorControlActivated"
>
@color/colorAccentDark
</item>
<item
name=
"android:textColorHighlight"
>
@color/colorAccent_a40
</item>
<item
name=
"android:textColorHighlight"
>
@color/colorAccent_a40
</item>
</style>
</style>
...
...
rocket-chat-android-widgets/build.gradle
View file @
d8f0d912
...
@@ -14,7 +14,7 @@ android {
...
@@ -14,7 +14,7 @@ android {
buildToolsVersion
"25.0.0"
buildToolsVersion
"25.0.0"
defaultConfig
{
defaultConfig
{
minSdkVersion
1
6
minSdkVersion
1
7
targetSdkVersion
25
targetSdkVersion
25
versionCode
1
versionCode
1
versionName
"1"
versionName
"1"
...
...
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/DividerView.java
0 → 100644
View file @
d8f0d912
package
chat
.
rocket
.
android
.
widget
;
import
android.annotation.TargetApi
;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.graphics.Color
;
import
android.support.v4.widget.Space
;
import
android.util.AttributeSet
;
import
android.view.View
;
import
android.widget.FrameLayout
;
/**
* divider.
*/
public
class
DividerView
extends
FrameLayout
{
public
DividerView
(
Context
context
)
{
super
(
context
);
initialize
(
context
,
null
);
}
public
DividerView
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
initialize
(
context
,
attrs
);
}
public
DividerView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
initialize
(
context
,
attrs
);
}
private
void
initialize
(
Context
context
,
AttributeSet
attrs
)
{
int
thickness
=
context
.
getResources
().
getDimensionPixelSize
(
R
.
dimen
.
def_divider_view_thickness
);
if
(
attrs
!=
null
)
{
TypedArray
array
=
context
.
getTheme
().
obtainStyledAttributes
(
attrs
,
R
.
styleable
.
DividerView
,
0
,
0
);
thickness
=
array
.
getDimensionPixelSize
(
R
.
styleable
.
DividerView_thickness
,
thickness
);
array
.
recycle
();
}
int
color
=
Color
.
GRAY
;
TypedArray
array2
=
context
.
getTheme
().
obtainStyledAttributes
(
new
int
[]{
R
.
attr
.
colorControlNormal
});
color
=
array2
.
getColor
(
0
,
color
);
array2
.
recycle
();
setBackgroundColor
(
color
);
setAlpha
(
0.4f
);
setMinimumWidth
(
thickness
);
setMinimumHeight
(
thickness
);
}
}
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/DownUpToggleView.java
0 → 100644
View file @
d8f0d912
package
chat
.
rocket
.
android
.
widget
;
import
android.content.Context
;
import
android.support.v7.widget.AppCompatCheckBox
;
import
android.util.AttributeSet
;
public
class
DownUpToggleView
extends
AppCompatCheckBox
{
public
DownUpToggleView
(
Context
context
)
{
super
(
context
);
initialize
(
context
,
null
);
}
public
DownUpToggleView
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
initialize
(
context
,
attrs
);
}
public
DownUpToggleView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
initialize
(
context
,
attrs
);
}
private
void
initialize
(
Context
context
,
AttributeSet
attrs
)
{
setButtonDrawable
(
R
.
drawable
.
down_up_toggle
);
}
}
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/internal/RoomListItemView.java
0 → 100644
View file @
d8f0d912
package
chat
.
rocket
.
android
.
widget
.
internal
;
import
android.annotation.TargetApi
;
import
android.content.Context
;
import
android.os.Build
;
import
android.util.AttributeSet
;
import
android.view.View
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
chat.rocket.android.widget.R
;
import
java.util.HashMap
;
/**
* Room list-item view used in sidebar.
*/
public
class
RoomListItemView
extends
LinearLayout
{
private
String
name
;
private
static
HashMap
<
String
,
Integer
>
ICON_TABLE
=
new
HashMap
<
String
,
Integer
>(){
{
put
(
"c"
,
R
.
string
.
fa_hashtag
);
put
(
"p"
,
R
.
string
.
fa_lock
);
put
(
"d"
,
R
.
string
.
fa_at
);
}
};
public
RoomListItemView
(
Context
context
)
{
super
(
context
);
initialize
(
context
);
}
public
RoomListItemView
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
initialize
(
context
);
}
public
RoomListItemView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
initialize
(
context
);
}
@TargetApi
(
Build
.
VERSION_CODES
.
LOLLIPOP
)
public
RoomListItemView
(
Context
context
,
AttributeSet
attrs
,
int
defStyleAttr
,
int
defStyleRes
)
{
super
(
context
,
attrs
,
defStyleAttr
,
defStyleRes
);
initialize
(
context
);
}
private
void
initialize
(
Context
context
)
{
setOrientation
(
HORIZONTAL
);
View
.
inflate
(
context
,
R
.
layout
.
room_list_item
,
this
);
}
public
RoomListItemView
setRoom
(
String
type
,
String
name
)
{
if
(
ICON_TABLE
.
containsKey
(
type
))
{
TextView
icon
=
(
TextView
)
findViewById
(
R
.
id
.
icon
);
icon
.
setText
(
ICON_TABLE
.
get
(
type
));
}
TextView
text
=
(
TextView
)
findViewById
(
R
.
id
.
text
);
text
.
setText
(
name
);
this
.
name
=
name
;
return
this
;
}
public
RoomListItemView
setAlertCount
(
int
count
)
{
View
alertCountContainer
=
findViewById
(
R
.
id
.
alert_count_container
);
TextView
alertCount
=
(
TextView
)
findViewById
(
R
.
id
.
alert_count
);
if
(
count
>
0
)
{
alertCount
.
setText
(
Integer
.
toString
(
count
));
alertCountContainer
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
alertCountContainer
.
setVisibility
(
View
.
GONE
);
}
return
this
;
}
public
String
getName
()
{
return
name
;
}
}
rocket-chat-android-widgets/src/main/res/drawable-hdpi/down_up_toggle_down.png
0 → 100644
View file @
d8f0d912
322 Bytes
rocket-chat-android-widgets/src/main/res/drawable-hdpi/down_up_toggle_up.png
0 → 100644
View file @
d8f0d912
320 Bytes
rocket-chat-android-widgets/src/main/res/drawable-mdpi/down_up_toggle_down.png
0 → 100644
View file @
d8f0d912
222 Bytes
rocket-chat-android-widgets/src/main/res/drawable-mdpi/down_up_toggle_up.png
0 → 100644
View file @
d8f0d912
233 Bytes
rocket-chat-android-widgets/src/main/res/drawable-xhdpi/down_up_toggle_down.png
0 → 100644
View file @
d8f0d912
469 Bytes
rocket-chat-android-widgets/src/main/res/drawable-xhdpi/down_up_toggle_up.png
0 → 100644
View file @
d8f0d912
467 Bytes
rocket-chat-android-widgets/src/main/res/drawable-xxhdpi/down_up_toggle_down.png
0 → 100644
View file @
d8f0d912
682 Bytes
rocket-chat-android-widgets/src/main/res/drawable-xxhdpi/down_up_toggle_up.png
0 → 100644
View file @
d8f0d912
721 Bytes
rocket-chat-android-widgets/src/main/res/drawable/down_up_toggle.xml
0 → 100644
View file @
d8f0d912
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_checked=
"false"
android:drawable=
"@drawable/down_up_toggle_down"
/>
<item
android:state_checked=
"true"
android:drawable=
"@drawable/down_up_toggle_up"
/>
<item
android:drawable=
"@drawable/down_up_toggle_down"
/>
<!-- default state -->
</selector>
\ No newline at end of file
rocket-chat-android-widgets/src/main/res/layout/room_list_item.xml
0 → 100644
View file @
d8f0d912
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<FrameLayout
android:layout_width=
"32dp"
android:layout_height=
"?attr/listPreferredItemHeightSmall"
android:layout_marginEnd=
"16dp"
>
<chat.rocket.android.widget.FontAwesomeTextView
android:id=
"@+id/icon"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:textAppearance=
"@style/TextAppearance.AppCompat.Body1"
/>
</FrameLayout>
<TextView
android:id=
"@+id/text"
android:layout_width=
"wrap_content"
android:layout_height=
"?attr/listPreferredItemHeightSmall"
android:layout_weight=
"1"
android:gravity=
"center_vertical"
android:textAppearance=
"@style/TextAppearance.AppCompat.Body2"
/>
<FrameLayout
android:id=
"@+id/alert_count_container"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"8dp"
android:padding=
"8dp"
android:layout_gravity=
"center_vertical"
android:background=
"@color/room_list_item_unread_count_background"
>
<TextView
android:id=
"@+id/alert_count"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"12dp"
android:textAppearance=
"@style/TextAppearance.AppCompat.Body1"
/>
</FrameLayout>
</merge>
\ No newline at end of file
rocket-chat-android-widgets/src/main/res/values/colors.xml
0 → 100644
View file @
d8f0d912
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color
name=
"room_list_item_unread_count_background"
>
#1dce73
</color>
</resources>
\ No newline at end of file
rocket-chat-android-widgets/src/main/res/values/divider_view_attrs.xml
0 → 100644
View file @
d8f0d912
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable
name=
"DividerView"
>
<attr
format=
"dimension"
name=
"thickness"
/>
</declare-styleable>
<dimen
name=
"def_divider_view_thickness"
>
1dp
</dimen>
</resources>
\ No newline at end of file
rocket-chat-android-widgets/src/main/res/values/fa_strings.xml
0 → 100644
View file @
d8f0d912
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string
translatable=
"false"
name=
"fa_hashtag"
>

</string>
<!-- for public rooms -->
<string
translatable=
"false"
name=
"fa_lock"
>

</string>
<!-- for private rooms -->
<string
translatable=
"false"
name=
"fa_at"
>

</string>
<!-- for direct message -->
</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