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
f138d486
Commit
f138d486
authored
Jan 11, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PR based feedback
parent
853b8c8f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
22 deletions
+23
-22
AbstractChatRoomFragment.java
...t/android/fragment/chatroom/AbstractChatRoomFragment.java
+9
-9
activity_main.xml
app/src/main/res/layout-w720dp/activity_main.xml
+2
-1
activity_main.xml
app/src/main/res/layout/activity_main.xml
+1
-1
RoomToolbar.java
...src/main/java/chat/rocket/android/widget/RoomToolbar.java
+10
-10
room_toolbar.xml
...chat-android-widgets/src/main/res/layout/room_toolbar.xml
+0
-0
room_toolbar_attrs.xml
...ndroid-widgets/src/main/res/values/room_toolbar_attrs.xml
+1
-1
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/AbstractChatRoomFragment.java
View file @
f138d486
...
@@ -10,41 +10,41 @@ import android.view.ViewGroup;
...
@@ -10,41 +10,41 @@ import android.view.ViewGroup;
import
chat.rocket.android.R
;
import
chat.rocket.android.R
;
import
chat.rocket.android.fragment.AbstractFragment
;
import
chat.rocket.android.fragment.AbstractFragment
;
import
chat.rocket.android.widget.
Cust
omToolbar
;
import
chat.rocket.android.widget.
Ro
omToolbar
;
abstract
class
AbstractChatRoomFragment
extends
AbstractFragment
{
abstract
class
AbstractChatRoomFragment
extends
AbstractFragment
{
private
CustomToolbar
cust
omToolbar
;
private
RoomToolbar
ro
omToolbar
;
@Nullable
@Nullable
@Override
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
@Nullable
Bundle
savedInstanceState
)
{
customToolbar
=
(
Cust
omToolbar
)
getActivity
().
findViewById
(
R
.
id
.
activity_main_toolbar
);
roomToolbar
=
(
Ro
omToolbar
)
getActivity
().
findViewById
(
R
.
id
.
activity_main_toolbar
);
return
super
.
onCreateView
(
inflater
,
container
,
savedInstanceState
);
return
super
.
onCreateView
(
inflater
,
container
,
savedInstanceState
);
}
}
protected
void
setTitleText
(
@StringRes
int
stringResId
)
{
protected
void
setTitleText
(
@StringRes
int
stringResId
)
{
if
(
cust
omToolbar
==
null
)
{
if
(
ro
omToolbar
==
null
)
{
return
;
return
;
}
}
cust
omToolbar
.
setTitle
(
stringResId
);
ro
omToolbar
.
setTitle
(
stringResId
);
}
}
protected
void
setTitleText
(
CharSequence
title
)
{
protected
void
setTitleText
(
CharSequence
title
)
{
if
(
cust
omToolbar
==
null
)
{
if
(
ro
omToolbar
==
null
)
{
return
;
return
;
}
}
cust
omToolbar
.
setTitle
(
title
);
ro
omToolbar
.
setTitle
(
title
);
}
}
protected
void
setTitleDrawableLeft
(
@DrawableRes
int
drawableResId
)
{
protected
void
setTitleDrawableLeft
(
@DrawableRes
int
drawableResId
)
{
if
(
cust
omToolbar
==
null
)
{
if
(
ro
omToolbar
==
null
)
{
return
;
return
;
}
}
customToolbar
.
setTitleDrawableLeft
(
drawableResId
);
roomToolbar
.
setRoomIcon
(
drawableResId
);
}
}
}
}
app/src/main/res/layout-w720dp/activity_main.xml
View file @
f138d486
...
@@ -14,13 +14,14 @@
...
@@ -14,13 +14,14 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
>
<chat.rocket.android.widget.
Cust
omToolbar
<chat.rocket.android.widget.
Ro
omToolbar
android:id=
"@+id/activity_main_toolbar"
android:id=
"@+id/activity_main_toolbar"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
android:background=
"@color/white"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
app:titleText=
"@string/app_name"
app:titleText=
"@string/app_name"
app:titleTextColor=
"@color/titleTextColor"
app:titleDrawablePadding=
"@dimen/margin_8"
/>
app:titleDrawablePadding=
"@dimen/margin_8"
/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.AppBarLayout>
...
...
app/src/main/res/layout/activity_main.xml
View file @
f138d486
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
>
<chat.rocket.android.widget.
Cust
omToolbar
<chat.rocket.android.widget.
Ro
omToolbar
android:id=
"@+id/activity_main_toolbar"
android:id=
"@+id/activity_main_toolbar"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/
Cust
omToolbar.java
→
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/
Ro
omToolbar.java
View file @
f138d486
...
@@ -13,27 +13,27 @@ import android.util.AttributeSet;
...
@@ -13,27 +13,27 @@ import android.util.AttributeSet;
import
android.view.View
;
import
android.view.View
;
import
android.widget.TextView
;
import
android.widget.TextView
;
public
class
Cust
omToolbar
extends
Toolbar
{
public
class
Ro
omToolbar
extends
Toolbar
{
private
TextView
titleTextView
;
private
TextView
titleTextView
;
public
Cust
omToolbar
(
Context
context
)
{
public
Ro
omToolbar
(
Context
context
)
{
super
(
context
);
super
(
context
);
initialize
(
context
,
null
);
initialize
(
context
,
null
);
}
}
public
Cust
omToolbar
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
public
Ro
omToolbar
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
super
(
context
,
attrs
);
initialize
(
context
,
attrs
);
initialize
(
context
,
attrs
);
}
}
public
Cust
omToolbar
(
Context
context
,
@Nullable
AttributeSet
attrs
,
int
defStyleAttr
)
{
public
Ro
omToolbar
(
Context
context
,
@Nullable
AttributeSet
attrs
,
int
defStyleAttr
)
{
super
(
context
,
attrs
,
defStyleAttr
);
super
(
context
,
attrs
,
defStyleAttr
);
initialize
(
context
,
attrs
);
initialize
(
context
,
attrs
);
}
}
private
void
initialize
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
private
void
initialize
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
View
.
inflate
(
context
,
R
.
layout
.
cust
om_toolbar
,
this
);
View
.
inflate
(
context
,
R
.
layout
.
ro
om_toolbar
,
this
);
titleTextView
=
(
TextView
)
findViewById
(
R
.
id
.
toolbar_title
);
titleTextView
=
(
TextView
)
findViewById
(
R
.
id
.
toolbar_title
);
...
@@ -43,15 +43,15 @@ public class CustomToolbar extends Toolbar {
...
@@ -43,15 +43,15 @@ public class CustomToolbar extends Toolbar {
TypedArray
typedArray
=
context
.
getTheme
().
obtainStyledAttributes
(
TypedArray
typedArray
=
context
.
getTheme
().
obtainStyledAttributes
(
attrs
,
attrs
,
R
.
styleable
.
Cust
omToolbar
,
R
.
styleable
.
Ro
omToolbar
,
0
,
0
);
0
,
0
);
try
{
try
{
titleTextView
.
setText
(
typedArray
.
getText
(
R
.
styleable
.
Cust
omToolbar_titleText
));
titleTextView
.
setText
(
typedArray
.
getText
(
R
.
styleable
.
Ro
omToolbar_titleText
));
titleTextView
titleTextView
.
setTextColor
(
typedArray
.
getColor
(
R
.
styleable
.
Cust
omToolbar_titleTextColor
,
Color
.
BLACK
));
.
setTextColor
(
typedArray
.
getColor
(
R
.
styleable
.
Ro
omToolbar_titleTextColor
,
Color
.
BLACK
));
titleTextView
.
setCompoundDrawablePadding
(
titleTextView
.
setCompoundDrawablePadding
(
typedArray
.
getLayoutDimension
(
R
.
styleable
.
Cust
omToolbar_titleDrawablePadding
,
0
));
typedArray
.
getLayoutDimension
(
R
.
styleable
.
Ro
omToolbar_titleDrawablePadding
,
0
));
}
finally
{
}
finally
{
typedArray
.
recycle
();
typedArray
.
recycle
();
}
}
...
@@ -75,7 +75,7 @@ public class CustomToolbar extends Toolbar {
...
@@ -75,7 +75,7 @@ public class CustomToolbar extends Toolbar {
super
.
setTitle
(
title
);
super
.
setTitle
(
title
);
}
}
public
void
set
TitleDrawableLeft
(
@DrawableRes
int
drawableResId
)
{
public
void
set
RoomIcon
(
@DrawableRes
int
drawableResId
)
{
if
(
titleTextView
==
null
)
{
if
(
titleTextView
==
null
)
{
return
;
return
;
}
}
...
...
rocket-chat-android-widgets/src/main/res/layout/
cust
om_toolbar.xml
→
rocket-chat-android-widgets/src/main/res/layout/
ro
om_toolbar.xml
View file @
f138d486
File moved
rocket-chat-android-widgets/src/main/res/values/
cust
om_toolbar_attrs.xml
→
rocket-chat-android-widgets/src/main/res/values/
ro
om_toolbar_attrs.xml
View file @
f138d486
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<declare-styleable
name=
"
Cust
omToolbar"
>
<declare-styleable
name=
"
Ro
omToolbar"
>
<attr
name=
"titleText"
format=
"string"
/>
<attr
name=
"titleText"
format=
"string"
/>
<attr
name=
"titleTextColor"
format=
"color"
/>
<attr
name=
"titleTextColor"
format=
"color"
/>
<attr
name=
"titleDrawablePadding"
format=
"dimension"
/>
<attr
name=
"titleDrawablePadding"
format=
"dimension"
/>
...
...
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