Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-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
xabber-android
Commits
b0ac3a7d
Commit
b0ac3a7d
authored
May 29, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chat and Recent chats fragments toolbar color set brighter in tablet mode. AccountPainter modified.
parent
0accf923
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
2 deletions
+44
-2
ChatViewerFragment.java
...c/main/java/com/xabber/android/ui/ChatViewerFragment.java
+11
-1
RecentChatFragment.java
...c/main/java/com/xabber/android/ui/RecentChatFragment.java
+11
-1
AccountPainter.java
...ain/java/com/xabber/android/ui/helper/AccountPainter.java
+22
-0
No files found.
app/src/main/java/com/xabber/android/ui/ChatViewerFragment.java
View file @
b0ac3a7d
...
...
@@ -372,7 +372,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
public
void
updateChat
()
{
ContactTitleInflater
.
updateTitle
(
contactTitleView
,
getActivity
(),
abstractContact
);
toolbar
.
setBackgroundColor
(
accountPainter
.
getAccountMainColor
(
account
)
);
setToolbarColor
(
);
int
itemCountBeforeUpdate
=
chatMessageAdapter
.
getItemCount
();
chatMessageAdapter
.
onChange
();
scrollChat
(
itemCountBeforeUpdate
);
...
...
@@ -380,6 +380,16 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
updateSecurityButton
();
}
private
void
setToolbarColor
()
{
int
toolbarColor
;
if
(
getResources
().
getBoolean
(
R
.
bool
.
tablet_mode
))
{
toolbarColor
=
accountPainter
.
getAccountLightColor
(
account
);
}
else
{
toolbarColor
=
accountPainter
.
getAccountMainColor
(
account
);
}
toolbar
.
setBackgroundColor
(
toolbarColor
);
}
private
void
scrollChat
(
int
itemCountBeforeUpdate
)
{
int
lastVisibleItemPosition
=
layoutManager
.
findLastVisibleItemPosition
();
if
(
lastVisibleItemPosition
==
-
1
||
lastVisibleItemPosition
==
(
itemCountBeforeUpdate
-
1
))
{
...
...
app/src/main/java/com/xabber/android/ui/RecentChatFragment.java
View file @
b0ac3a7d
...
...
@@ -89,7 +89,17 @@ public class RecentChatFragment extends ListFragment implements Toolbar.OnMenuIt
if
(
null
!=
listener
.
getChatScroller
())
{
listener
.
getChatScroller
().
registerRecentChatsList
(
this
);
}
toolbar
.
setBackgroundColor
(
accountPainter
.
getDefaultMainColor
());
setToolbarColor
();
}
private
void
setToolbarColor
()
{
int
toolbarColor
;
if
(
getResources
().
getBoolean
(
R
.
bool
.
tablet_mode
))
{
toolbarColor
=
accountPainter
.
getDefaultLightColor
();
}
else
{
toolbarColor
=
accountPainter
.
getDefaultMainColor
();
}
toolbar
.
setBackgroundColor
(
toolbarColor
);
}
@Override
...
...
app/src/main/java/com/xabber/android/ui/helper/AccountPainter.java
View file @
b0ac3a7d
...
...
@@ -19,12 +19,18 @@ public class AccountPainter {
private
int
[]
accountDarkColors
;
private
int
[]
accountDarkestColors
;
private
int
[]
accountLightColors
;
private
int
[]
accountLightestColors
;
public
AccountPainter
(
Context
context
)
{
accountMainColors
=
context
.
getResources
().
getIntArray
(
R
.
array
.
account_action_bar
);
accountDarkColors
=
context
.
getResources
().
getIntArray
(
R
.
array
.
account_status_bar
);
accountDarkestColors
=
context
.
getResources
().
getIntArray
(
R
.
array
.
account_900
);
accountLightColors
=
context
.
getResources
().
getIntArray
(
R
.
array
.
account_200
);
accountLightestColors
=
context
.
getResources
().
getIntArray
(
R
.
array
.
account_50
);
accountColorNames
=
context
.
getResources
().
getStringArray
(
R
.
array
.
account_color_names
);
themeMainColor
=
getThemeMainColor
(
context
);
...
...
@@ -82,6 +88,15 @@ public class AccountPainter {
}
}
public
int
getDefaultLightColor
()
{
String
firstAccount
=
getFirstAccount
();
if
(
firstAccount
==
null
)
{
return
themeMainColor
;
}
else
{
return
getAccountLightColor
(
firstAccount
);
}
}
public
int
getAccountDarkColor
(
String
account
)
{
return
accountDarkColors
[
getAccountColorLevel
(
account
)];
}
...
...
@@ -90,6 +105,13 @@ public class AccountPainter {
return
accountDarkestColors
[
getAccountColorLevel
(
account
)];
}
public
int
getAccountLightColor
(
String
account
)
{
return
accountLightColors
[
getAccountColorLevel
(
account
)];
}
public
int
getAccountLightestColor
(
String
account
)
{
return
accountLightestColors
[
getAccountColorLevel
(
account
)];
}
public
int
getDefaultDarkColor
()
{
String
firstAccount
=
getFirstAccount
();
...
...
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