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
c038a3df
Commit
c038a3df
authored
Apr 29, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drawer header image added. Title text style changed.
parent
b3215cb0
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
75 additions
and
13 deletions
+75
-13
ContactListDrawerFragment.java
...java/com/xabber/android/ui/ContactListDrawerFragment.java
+17
-9
AccountPainter.java
...ain/java/com/xabber/android/ui/helper/AccountPainter.java
+15
-2
drawer_blue.jpg
app/src/main/res/drawable-xxxhdpi/drawer_blue.jpg
+0
-0
drawer_blue_grey.jpg
app/src/main/res/drawable-xxxhdpi/drawer_blue_grey.jpg
+0
-0
drawer_cyan.jpg
app/src/main/res/drawable-xxxhdpi/drawer_cyan.jpg
+0
-0
drawer_green.jpg
app/src/main/res/drawable-xxxhdpi/drawer_green.jpg
+0
-0
drawer_indigo.jpg
app/src/main/res/drawable-xxxhdpi/drawer_indigo.jpg
+0
-0
drawer_orange.jpg
app/src/main/res/drawable-xxxhdpi/drawer_orange.jpg
+0
-0
drawer_red.jpg
app/src/main/res/drawable-xxxhdpi/drawer_red.jpg
+0
-0
drawer_teal.jpg
app/src/main/res/drawable-xxxhdpi/drawer_teal.jpg
+0
-0
drawer_image.xml
app/src/main/res/drawable/drawer_image.xml
+35
-0
contact_list_drawer.xml
app/src/main/res/layout/contact_list_drawer.xml
+8
-2
No files found.
app/src/main/java/com/xabber/android/ui/ContactListDrawerFragment.java
View file @
c038a3df
...
@@ -15,6 +15,7 @@ import android.widget.ListView;
...
@@ -15,6 +15,7 @@ import android.widget.ListView;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.account.OnAccountChangedListener
;
import
com.xabber.android.data.account.OnAccountChangedListener
;
import
com.xabber.android.ui.adapter.NavigationDrawerAccountAdapter
;
import
com.xabber.android.ui.adapter.NavigationDrawerAccountAdapter
;
import
com.xabber.android.ui.helper.AccountPainter
;
import
com.xabber.androiddev.R
;
import
com.xabber.androiddev.R
;
import
java.util.Collection
;
import
java.util.Collection
;
...
@@ -26,6 +27,7 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
...
@@ -26,6 +27,7 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
private
ListView
listView
;
private
ListView
listView
;
private
View
divider
;
private
View
divider
;
private
View
headerTitle
;
private
View
headerTitle
;
private
View
drawerHeader
;
@Override
@Override
public
void
onAttach
(
Activity
activity
)
{
public
void
onAttach
(
Activity
activity
)
{
...
@@ -38,6 +40,7 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
...
@@ -38,6 +40,7 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
contact_list_drawer
,
container
,
false
);
View
view
=
inflater
.
inflate
(
R
.
layout
.
contact_list_drawer
,
container
,
false
);
drawerHeader
=
view
.
findViewById
(
R
.
id
.
drawer_header
);
listView
=
(
ListView
)
view
.
findViewById
(
R
.
id
.
drawer_account_list
);
listView
=
(
ListView
)
view
.
findViewById
(
R
.
id
.
drawer_account_list
);
...
@@ -69,15 +72,7 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
...
@@ -69,15 +72,7 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
public
void
onResume
()
{
public
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
adapter
.
onChange
();
update
();
if
(
adapter
.
getCount
()
==
0
)
{
headerTitle
.
setVisibility
(
View
.
GONE
);
divider
.
setVisibility
(
View
.
GONE
);
}
else
{
headerTitle
.
setVisibility
(
View
.
VISIBLE
);
divider
.
setVisibility
(
View
.
VISIBLE
);
}
}
}
@Override
@Override
...
@@ -99,7 +94,20 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
...
@@ -99,7 +94,20 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
@Override
@Override
public
void
onAccountsChanged
(
Collection
<
String
>
accounts
)
{
public
void
onAccountsChanged
(
Collection
<
String
>
accounts
)
{
update
();
}
private
void
update
()
{
adapter
.
onChange
();
adapter
.
onChange
();
drawerHeader
.
getBackground
().
setLevel
(
AccountPainter
.
getDefaultAccountColorLevel
());
if
(
adapter
.
getCount
()
==
0
)
{
headerTitle
.
setVisibility
(
View
.
GONE
);
divider
.
setVisibility
(
View
.
GONE
);
}
else
{
headerTitle
.
setVisibility
(
View
.
VISIBLE
);
divider
.
setVisibility
(
View
.
VISIBLE
);
}
}
}
@Override
@Override
...
...
app/src/main/java/com/xabber/android/ui/helper/AccountPainter.java
View file @
c038a3df
...
@@ -40,6 +40,19 @@ public class AccountPainter {
...
@@ -40,6 +40,19 @@ public class AccountPainter {
}
}
}
}
private
static
int
getAccountColorLevel
(
String
account
)
{
return
AccountManager
.
getInstance
().
getColorLevel
(
account
);
}
public
static
int
getDefaultAccountColorLevel
()
{
String
firstAccount
=
getFirstAccount
();
if
(
firstAccount
==
null
)
{
return
5
;
}
else
{
return
getAccountColorLevel
(
firstAccount
);
}
}
private
int
getThemeMainColor
(
Context
context
)
{
private
int
getThemeMainColor
(
Context
context
)
{
TypedArray
a
=
context
.
getTheme
().
obtainStyledAttributes
(
R
.
style
.
Theme
,
new
int
[]{
R
.
attr
.
colorPrimary
});
TypedArray
a
=
context
.
getTheme
().
obtainStyledAttributes
(
R
.
style
.
Theme
,
new
int
[]{
R
.
attr
.
colorPrimary
});
int
attributeResourceId
=
a
.
getResourceId
(
0
,
0
);
int
attributeResourceId
=
a
.
getResourceId
(
0
,
0
);
...
@@ -55,7 +68,7 @@ public class AccountPainter {
...
@@ -55,7 +68,7 @@ public class AccountPainter {
}
}
public
int
getAccountMainColor
(
String
account
)
{
public
int
getAccountMainColor
(
String
account
)
{
return
accountMainColors
[
AccountManager
.
getInstance
().
ge
tColorLevel
(
account
)];
return
accountMainColors
[
getAccoun
tColorLevel
(
account
)];
}
}
public
int
getDefaultMainColor
()
{
public
int
getDefaultMainColor
()
{
...
@@ -68,7 +81,7 @@ public class AccountPainter {
...
@@ -68,7 +81,7 @@ public class AccountPainter {
}
}
public
int
getAccountDarkColor
(
String
account
)
{
public
int
getAccountDarkColor
(
String
account
)
{
return
accountDarkColors
[
AccountManager
.
getInstance
().
ge
tColorLevel
(
account
)];
return
accountDarkColors
[
getAccoun
tColorLevel
(
account
)];
}
}
public
int
getDefaultDarkColor
()
{
public
int
getDefaultDarkColor
()
{
...
...
app/src/main/res/drawable-xxxhdpi/drawer_blue.jpg
0 → 100644
View file @
c038a3df
109 KB
app/src/main/res/drawable-xxxhdpi/drawer_blue_grey.jpg
0 → 100644
View file @
c038a3df
81.5 KB
app/src/main/res/drawable-xxxhdpi/drawer_cyan.jpg
0 → 100644
View file @
c038a3df
56 KB
app/src/main/res/drawable-xxxhdpi/drawer_green.jpg
0 → 100644
View file @
c038a3df
66.4 KB
app/src/main/res/drawable-xxxhdpi/drawer_indigo.jpg
0 → 100644
View file @
c038a3df
53.2 KB
app/src/main/res/drawable-xxxhdpi/drawer_orange.jpg
0 → 100644
View file @
c038a3df
85 KB
app/src/main/res/drawable-xxxhdpi/drawer_red.jpg
0 → 100644
View file @
c038a3df
65.5 KB
app/src/main/res/drawable-xxxhdpi/drawer_teal.jpg
0 → 100644
View file @
c038a3df
71.8 KB
app/src/main/res/drawable/drawer_image.xml
0 → 100644
View file @
c038a3df
<?xml version="1.0" encoding="utf-8"?>
<level-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/drawer_green"
android:maxLevel=
"0"
android:minLevel=
"0"
/>
<item
android:drawable=
"@drawable/drawer_orange"
android:maxLevel=
"1"
android:minLevel=
"1"
/>
<item
android:drawable=
"@drawable/drawer_red"
android:maxLevel=
"2"
android:minLevel=
"2"
/>
<item
android:drawable=
"@drawable/drawer_blue"
android:maxLevel=
"3"
android:minLevel=
"3"
/>
<item
android:drawable=
"@drawable/drawer_indigo"
android:maxLevel=
"4"
android:minLevel=
"4"
/>
<item
android:drawable=
"@drawable/drawer_blue_grey"
android:maxLevel=
"5"
android:minLevel=
"5"
/>
<item
android:drawable=
"@drawable/drawer_cyan"
android:maxLevel=
"6"
android:minLevel=
"6"
/>
<item
android:drawable=
"@drawable/drawer_teal"
android:maxLevel=
"7"
android:minLevel=
"7"
/>
</level-list>
\ No newline at end of file
app/src/main/res/layout/contact_list_drawer.xml
View file @
c038a3df
...
@@ -7,9 +7,10 @@
...
@@ -7,9 +7,10 @@
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<RelativeLayout
<RelativeLayout
android:id=
"@+id/drawer_header"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"170dp"
android:layout_height=
"170dp"
android:background=
"@
color/grey_300
"
>
android:background=
"@
drawable/drawer_image
"
>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
@@ -28,8 +29,13 @@
...
@@ -28,8 +29,13 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:shadowColor=
"@color/grey_700"
android:shadowDx=
"1"
android:shadowDy=
"1"
android:shadowRadius=
"2"
android:text=
"@string/production_title"
android:text=
"@string/production_title"
android:textSize=
"32sp"
/>
android:textColor=
"@color/grey_50"
android:textSize=
"40sp"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
...
...
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