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
b2f3ef49
Commit
b2f3ef49
authored
Jan 12, 2017
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor how to set color/style
parent
02b86365
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
18 deletions
+28
-18
activity_main.xml
app/src/main/res/layout-w720dp/activity_main.xml
+1
-2
activity_main.xml
app/src/main/res/layout/activity_main.xml
+1
-8
colors.xml
app/src/main/res/values/colors.xml
+0
-2
room_styles.xml
app/src/main/res/values/room_styles.xml
+12
-0
RoomToolbar.java
...src/main/java/chat/rocket/android/widget/RoomToolbar.java
+12
-3
room_toolbar.xml
...chat-android-widgets/src/main/res/layout/room_toolbar.xml
+2
-2
room_toolbar_attrs.xml
...ndroid-widgets/src/main/res/values/room_toolbar_attrs.xml
+0
-1
No files found.
app/src/main/res/layout-w720dp/activity_main.xml
View file @
b2f3ef49
...
@@ -18,10 +18,9 @@
...
@@ -18,10 +18,9 @@
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"
a
ndroid:background=
"@color/white
"
a
pp:theme=
"@style/Widget.RocketChat.RoomToolbar
"
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 @
b2f3ef49
...
@@ -19,17 +19,10 @@
...
@@ -19,17 +19,10 @@
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"
app:titleText=
"@string/app_name"
app:titleText=
"@string/app_name"
app:titleTextColor=
"@color/titleTextColor"
app:titleDrawablePadding=
"@dimen/margin_8"
app:titleDrawablePadding=
"@dimen/margin_8"
app:theme=
"@style/Widget.RocketChat.RoomToolbar"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
/>
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
android:layout_below=
"@+id/button_menu"
android:background=
"@color/borderColor"
/>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
<FrameLayout
...
...
app/src/main/res/values/colors.xml
View file @
b2f3ef49
...
@@ -7,7 +7,5 @@
...
@@ -7,7 +7,5 @@
<color
name=
"colorAccentDark"
>
#FF287DD7
</color>
<color
name=
"colorAccentDark"
>
#FF287DD7
</color>
<color
name=
"colorAccent_a40"
>
#662D91FA
</color>
<color
name=
"colorAccent_a40"
>
#662D91FA
</color>
<color
name=
"textColorLink"
>
#008ce3
</color>
<color
name=
"textColorLink"
>
#008ce3
</color>
<color
name=
"titleTextColor"
>
#444444
</color>
<color
name=
"borderColor"
>
#eaeaea
</color>
<color
name=
"white"
>
#FFFEFEFF
</color>
<color
name=
"white"
>
#FFFEFEFF
</color>
</resources>
</resources>
app/src/main/res/values/room_styles.xml
0 → 100644
View file @
b2f3ef49
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name=
"Widget.RocketChat.RoomToolbar"
parent=
"Widget.AppCompat.Toolbar"
>
<item
name=
"titleTextAppearance"
>
@style/TextAppearance.Widget.RocketChat.RoomToolbar.Title
</item>
<item
name=
"android:background"
>
@color/white
</item>
</style>
<style
name=
"TextAppearance.Widget.RocketChat.RoomToolbar.Title"
parent=
"TextAppearance.Widget.AppCompat.Toolbar.Title"
>
<item
name=
"android:textColor"
>
#444444
</item>
</style>
</resources>
\ No newline at end of file
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/RoomToolbar.java
View file @
b2f3ef49
...
@@ -2,12 +2,12 @@ package chat.rocket.android.widget;
...
@@ -2,12 +2,12 @@ package chat.rocket.android.widget;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.res.TypedArray
;
import
android.content.res.TypedArray
;
import
android.graphics.Color
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.support.annotation.DrawableRes
;
import
android.support.annotation.DrawableRes
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.Nullable
;
import
android.support.annotation.StringRes
;
import
android.support.annotation.StringRes
;
import
android.support.graphics.drawable.VectorDrawableCompat
;
import
android.support.graphics.drawable.VectorDrawableCompat
;
import
android.support.v4.widget.TextViewCompat
;
import
android.support.v7.widget.Toolbar
;
import
android.support.v7.widget.Toolbar
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.view.View
;
import
android.view.View
;
...
@@ -41,6 +41,17 @@ public class RoomToolbar extends Toolbar {
...
@@ -41,6 +41,17 @@ public class RoomToolbar extends Toolbar {
return
;
return
;
}
}
TypedArray
typedArrayBase
=
context
.
getTheme
().
obtainStyledAttributes
(
new
int
[]{
R
.
attr
.
titleTextAppearance
});
try
{
TextViewCompat
.
setTextAppearance
(
titleTextView
,
typedArrayBase
.
getResourceId
(
0
,
android
.
support
.
v7
.
appcompat
.
R
.
style
.
TextAppearance_Widget_AppCompat_Toolbar_Title
));
}
finally
{
typedArrayBase
.
recycle
();
}
TypedArray
typedArray
=
context
.
getTheme
().
obtainStyledAttributes
(
TypedArray
typedArray
=
context
.
getTheme
().
obtainStyledAttributes
(
attrs
,
attrs
,
R
.
styleable
.
RoomToolbar
,
R
.
styleable
.
RoomToolbar
,
...
@@ -48,8 +59,6 @@ public class RoomToolbar extends Toolbar {
...
@@ -48,8 +59,6 @@ public class RoomToolbar extends Toolbar {
try
{
try
{
titleTextView
.
setText
(
typedArray
.
getText
(
R
.
styleable
.
RoomToolbar_titleText
));
titleTextView
.
setText
(
typedArray
.
getText
(
R
.
styleable
.
RoomToolbar_titleText
));
titleTextView
.
setTextColor
(
typedArray
.
getColor
(
R
.
styleable
.
RoomToolbar_titleTextColor
,
Color
.
BLACK
));
titleTextView
.
setCompoundDrawablePadding
(
titleTextView
.
setCompoundDrawablePadding
(
typedArray
.
getLayoutDimension
(
R
.
styleable
.
RoomToolbar_titleDrawablePadding
,
0
));
typedArray
.
getLayoutDimension
(
R
.
styleable
.
RoomToolbar_titleDrawablePadding
,
0
));
}
finally
{
}
finally
{
...
...
rocket-chat-android-widgets/src/main/res/layout/room_toolbar.xml
View file @
b2f3ef49
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<TextView
<TextView
android:id=
"@+id/toolbar_title"
android:id=
"@+id/toolbar_title"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_cont
ent"
android:layout_height=
"
match_par
ent"
style=
"@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
/>
android:gravity=
"center_vertical"
/>
</merge>
</merge>
\ No newline at end of file
rocket-chat-android-widgets/src/main/res/values/room_toolbar_attrs.xml
View file @
b2f3ef49
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
<resources>
<resources>
<declare-styleable
name=
"RoomToolbar"
>
<declare-styleable
name=
"RoomToolbar"
>
<attr
name=
"titleText"
format=
"string"
/>
<attr
name=
"titleText"
format=
"string"
/>
<attr
name=
"titleTextColor"
format=
"color"
/>
<attr
name=
"titleDrawablePadding"
format=
"dimension"
/>
<attr
name=
"titleDrawablePadding"
format=
"dimension"
/>
</declare-styleable>
</declare-styleable>
</resources>
</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