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
bfb1cbf9
Commit
bfb1cbf9
authored
Apr 28, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ContactListDrawerFragment layout changed, header and divider added.
parent
cc7a39e8
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
86 additions
and
10 deletions
+86
-10
ContactListDrawerFragment.java
...java/com/xabber/android/ui/ContactListDrawerFragment.java
+23
-3
NavigationDrawerAccountAdapter.java
...er/android/ui/adapter/NavigationDrawerAccountAdapter.java
+1
-1
contact_list_drawer.xml
app/src/main/res/layout/contact_list_drawer.xml
+23
-6
contact_list_drawer_account_item.xml
app/src/main/res/layout/contact_list_drawer_account_item.xml
+0
-0
contact_list_drawer_footer.xml
app/src/main/res/layout/contact_list_drawer_footer.xml
+20
-0
contact_list_drawer_header.xml
app/src/main/res/layout/contact_list_drawer_header.xml
+15
-0
contact_list.xml
app/src/main/res/values-ru/contact_list.xml
+2
-0
contact_list.xml
app/src/main/res/values/contact_list.xml
+2
-0
No files found.
app/src/main/java/com/xabber/android/ui/ContactListDrawerFragment.java
View file @
bfb1cbf9
...
...
@@ -23,6 +23,9 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
ContactListDrawerListener
listener
;
private
NavigationDrawerAccountAdapter
adapter
;
private
ListView
listView
;
private
View
divider
;
private
View
headerTitle
;
@Override
public
void
onAttach
(
Activity
activity
)
{
...
...
@@ -36,12 +39,19 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
View
view
=
inflater
.
inflate
(
R
.
layout
.
contact_list_drawer
,
container
,
false
);
ListView
listView
=
(
ListView
)
view
.
findViewById
(
R
.
id
.
drawer_account_list
);
listView
=
(
ListView
)
view
.
findViewById
(
R
.
id
.
drawer_account_list
);
View
footerView
=
((
LayoutInflater
)
getActivity
().
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
))
.
inflate
(
R
.
layout
.
contact_list_drawer_footer
,
null
,
false
);
.
inflate
(
R
.
layout
.
contact_list_drawer_footer
,
listView
,
false
);
listView
.
addFooterView
(
footerView
);
View
headerView
=
((
LayoutInflater
)
getActivity
().
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
))
.
inflate
(
R
.
layout
.
contact_list_drawer_header
,
listView
,
false
);
headerTitle
=
headerView
.
findViewById
(
R
.
id
.
drawer_header_title
);
listView
.
addHeaderView
(
headerView
);
adapter
=
new
NavigationDrawerAccountAdapter
(
getActivity
());
listView
.
setAdapter
(
adapter
);
listView
.
setOnItemClickListener
(
this
);
...
...
@@ -50,6 +60,8 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
footerView
.
findViewById
(
R
.
id
.
drawer_action_about
).
setOnClickListener
(
this
);
footerView
.
findViewById
(
R
.
id
.
drawer_action_exit
).
setOnClickListener
(
this
);
divider
=
footerView
.
findViewById
(
R
.
id
.
drawer_divider
);
return
view
;
}
...
...
@@ -58,6 +70,14 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
super
.
onResume
();
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
adapter
.
onChange
();
if
(
adapter
.
getCount
()
==
0
)
{
headerTitle
.
setVisibility
(
View
.
GONE
);
divider
.
setVisibility
(
View
.
GONE
);
}
else
{
headerTitle
.
setVisibility
(
View
.
VISIBLE
);
divider
.
setVisibility
(
View
.
VISIBLE
);
}
}
@Override
...
...
@@ -84,7 +104,7 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
listener
.
onAccountSelected
(
adapter
.
getItem
(
position
));
listener
.
onAccountSelected
(
(
String
)
listView
.
getItemAtPosition
(
position
));
}
interface
ContactListDrawerListener
{
...
...
app/src/main/java/com/xabber/android/ui/adapter/NavigationDrawerAccountAdapter.java
View file @
bfb1cbf9
...
...
@@ -33,7 +33,7 @@ public class NavigationDrawerAccountAdapter extends BaseListEditorAdapter<String
View
view
;
AccountManager
accountManager
=
AccountManager
.
getInstance
();
if
(
convertView
==
null
)
{
view
=
getActivity
().
getLayoutInflater
().
inflate
(
R
.
layout
.
navigation
_drawer_account_item
,
parent
,
false
);
view
=
getActivity
().
getLayoutInflater
().
inflate
(
R
.
layout
.
contact_list
_drawer_account_item
,
parent
,
false
);
}
else
{
view
=
convertView
;
}
...
...
app/src/main/res/layout/contact_list_drawer.xml
View file @
bfb1cbf9
...
...
@@ -11,17 +11,34 @@
android:layout_height=
"170dp"
android:background=
"@color/grey_300"
>
<
ImageView
android:layout_width=
"
wrap_cont
ent"
<
LinearLayout
android:layout_width=
"
match_par
ent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"8dp"
android:layout_marginTop=
"16dp"
android:src=
"@drawable/ic_connect"
/>
android:layout_marginTop=
"16dp"
>
<ImageView
android:id=
"@+id/imageView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"8dp"
android:src=
"@drawable/ic_connect"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:text=
"@string/production_title"
android:textSize=
"32sp"
/>
</LinearLayout>
</RelativeLayout>
<ListView
android:id=
"@+id/drawer_account_list"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
android:divider=
"@null"
android:dividerHeight=
"0dp"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/
navigation
_drawer_account_item.xml
→
app/src/main/res/layout/
contact_list
_drawer_account_item.xml
View file @
bfb1cbf9
File moved
app/src/main/res/layout/contact_list_drawer_footer.xml
View file @
bfb1cbf9
...
...
@@ -6,6 +6,26 @@
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<LinearLayout
android:id=
"@+id/drawer_divider"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<View
android:layout_width=
"match_parent"
android:layout_height=
"8dp"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:background=
"@color/grey_300"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"8dp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/drawer_action_settings"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/contact_list_drawer_header.xml
0 → 100644
View file @
bfb1cbf9
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<TextView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/drawer_header_title"
android:layout_width=
"wrap_content"
android:layout_height=
"48dp"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:text=
"@string/xmpp_accounts"
android:textSize=
"16sp"
/>
</LinearLayout>
app/src/main/res/values-ru/contact_list.xml
View file @
bfb1cbf9
...
...
@@ -114,4 +114,6 @@
<string
name=
"contact_search_hint"
>
Поиск контактов
</string>
<string
name=
"sender_is_you"
>
Вы
</string>
<string
name=
"xmpp_accounts"
>
XMPP accounts
</string>
</resources>
\ No newline at end of file
app/src/main/res/values/contact_list.xml
View file @
bfb1cbf9
...
...
@@ -114,4 +114,6 @@
<string
name=
"contact_search_hint"
>
Search contacts
</string>
<string
name=
"sender_is_you"
>
You
</string>
<string
name=
"xmpp_accounts"
>
XMPP accounts
</string>
</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