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
68bebc48
Commit
68bebc48
authored
Apr 27, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Navigation drawer: account list added.
parent
63404961
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
145 additions
and
91 deletions
+145
-91
ContactList.java
app/src/main/java/com/xabber/android/ui/ContactList.java
+7
-0
ContactListDrawerFragment.java
...java/com/xabber/android/ui/ContactListDrawerFragment.java
+49
-7
ManagedListActivity.java
...ava/com/xabber/android/ui/helper/ManagedListActivity.java
+2
-2
contact_list_drawer.xml
app/src/main/res/layout/contact_list_drawer.xml
+3
-82
contact_list_drawer_footer.xml
app/src/main/res/layout/contact_list_drawer_footer.xml
+84
-0
No files found.
app/src/main/java/com/xabber/android/ui/ContactList.java
View file @
68bebc48
...
...
@@ -65,6 +65,7 @@ import com.xabber.android.ui.dialog.StartAtBootDialogFragment;
import
com.xabber.android.ui.helper.BarPainter
;
import
com.xabber.android.ui.helper.ManagedActivity
;
import
com.xabber.android.ui.preferences.AboutViewer
;
import
com.xabber.android.ui.preferences.AccountEditor
;
import
com.xabber.android.ui.preferences.PreferenceEditor
;
import
com.xabber.androiddev.R
;
import
com.xabber.xmpp.address.Jid
;
...
...
@@ -593,4 +594,10 @@ public class ContactList extends ManagedActivity implements OnAccountChangedList
}
}
@Override
public
void
onAccountSelected
(
String
account
)
{
drawerLayout
.
closeDrawers
();
startActivity
(
AccountEditor
.
createIntent
(
this
,
account
));
}
}
app/src/main/java/com/xabber/android/ui/ContactListDrawerFragment.java
View file @
68bebc48
...
...
@@ -2,36 +2,67 @@ package com.xabber.android.ui;
import
android.app.Activity
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v4.app.Fragment
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.AdapterView
;
import
android.widget.ListView
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.account.OnAccountChangedListener
;
import
com.xabber.android.ui.adapter.AccountListAdapter
;
import
com.xabber.androiddev.R
;
public
class
ContactListDrawerFragment
extends
Fragment
implements
View
.
OnClickListener
{
import
java.util.Collection
;
public
class
ContactListDrawerFragment
extends
Fragment
implements
View
.
OnClickListener
,
OnAccountChangedListener
,
AdapterView
.
OnItemClickListener
{
ContactListDrawerListener
listener
;
private
AccountListAdapter
adapter
;
@Override
public
void
onAttach
(
Activity
activity
)
{
super
.
onAttach
(
activity
);
listener
=
(
ContactListDrawerListener
)
activity
;
}
@Nullable
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
contact_list_drawer
,
container
,
false
);
view
.
findViewById
(
R
.
id
.
drawer_action_settings
).
setOnClickListener
(
this
);
view
.
findViewById
(
R
.
id
.
drawer_action_about
).
setOnClickListener
(
this
);
view
.
findViewById
(
R
.
id
.
drawer_action_exit
).
setOnClickListener
(
this
);
ListView
listView
=
(
ListView
)
view
.
findViewById
(
R
.
id
.
drawer_account_list
);
adapter
=
new
AccountListAdapter
(
getActivity
());
listView
.
setAdapter
(
adapter
);
listView
.
setOnItemClickListener
(
this
);
View
footerView
=
((
LayoutInflater
)
getActivity
().
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
))
.
inflate
(
R
.
layout
.
contact_list_drawer_footer
,
null
,
false
);
listView
.
addFooterView
(
footerView
);
footerView
.
findViewById
(
R
.
id
.
drawer_action_settings
).
setOnClickListener
(
this
);
footerView
.
findViewById
(
R
.
id
.
drawer_action_about
).
setOnClickListener
(
this
);
footerView
.
findViewById
(
R
.
id
.
drawer_action_exit
).
setOnClickListener
(
this
);
return
view
;
}
@Override
public
void
onResume
()
{
super
.
onResume
();
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
adapter
.
onChange
();
}
@Override
public
void
on
Attach
(
Activity
activity
)
{
super
.
on
Attach
(
activity
);
listener
=
(
ContactListDrawerListener
)
activity
;
public
void
on
Pause
(
)
{
super
.
on
Pause
(
);
Application
.
getInstance
().
removeUIListener
(
OnAccountChangedListener
.
class
,
this
)
;
}
@Override
...
...
@@ -43,10 +74,21 @@ public class ContactListDrawerFragment extends Fragment implements View.OnClickL
@Override
public
void
onClick
(
View
v
)
{
listener
.
onContactListDrawerListener
(
v
.
getId
());
}
@Override
public
void
onAccountsChanged
(
Collection
<
String
>
accounts
)
{
adapter
.
onChange
();
}
@Override
public
void
onItemClick
(
AdapterView
<?>
parent
,
View
view
,
int
position
,
long
id
)
{
listener
.
onAccountSelected
(
adapter
.
getItem
(
position
));
}
interface
ContactListDrawerListener
{
void
onContactListDrawerListener
(
int
viewId
);
void
onAccountSelected
(
String
account
);
}
}
app/src/main/java/com/xabber/android/ui/helper/ManagedListActivity.java
View file @
68bebc48
...
...
@@ -16,7 +16,7 @@ package com.xabber.android.ui.helper;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.v7.app.A
ctionBar
Activity
;
import
android.support.v7.app.A
ppCompat
Activity
;
import
android.widget.ListAdapter
;
import
android.widget.ListView
;
...
...
@@ -29,7 +29,7 @@ import com.xabber.android.data.ActivityManager;
*
* @author alexander.ivanov
*/
public
abstract
class
ManagedListActivity
extends
A
ctionBar
Activity
{
public
abstract
class
ManagedListActivity
extends
A
ppCompat
Activity
{
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
app/src/main/res/layout/contact_list_drawer.xml
View file @
68bebc48
...
...
@@ -20,87 +20,8 @@
</RelativeLayout>
<LinearLayout
<ListView
android:id=
"@+id/drawer_account_list"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<LinearLayout
android:id=
"@+id/drawer_action_settings"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"@drawable/drawer_touch"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/ic_settings_grey600_24dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"32dp"
android:text=
"@string/preference_editor"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textColor=
"@android:color/black"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/drawer_action_about"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"@drawable/drawer_touch"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/ic_help_circle_grey600_24dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"32dp"
android:text=
"@string/preference_about"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textColor=
"@android:color/black"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/drawer_action_exit"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"@drawable/drawer_touch"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/ic_exit_grey600_24dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"32dp"
android:text=
"@string/exit"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textColor=
"@android:color/black"
/>
</LinearLayout>
</LinearLayout>
android:layout_height=
"wrap_content"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/contact_list_drawer_footer.xml
0 → 100644
View file @
68bebc48
<?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=
"match_parent"
android:orientation=
"vertical"
>
<LinearLayout
android:id=
"@+id/drawer_action_settings"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"@drawable/drawer_touch"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/ic_settings_grey600_24dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"32dp"
android:text=
"@string/preference_editor"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textColor=
"@android:color/black"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/drawer_action_about"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"@drawable/drawer_touch"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/ic_help_circle_grey600_24dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"32dp"
android:text=
"@string/preference_about"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textColor=
"@android:color/black"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/drawer_action_exit"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"@drawable/drawer_touch"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/ic_exit_grey600_24dp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"32dp"
android:text=
"@string/exit"
android:textAppearance=
"?android:attr/textAppearanceMedium"
android:textColor=
"@android:color/black"
/>
</LinearLayout>
</LinearLayout>
\ 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