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
67ff3d03
Commit
67ff3d03
authored
Feb 13, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Light code formatting.
parent
cfffc807
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
243 additions
and
313 deletions
+243
-313
ContactList.java
app/src/main/java/com/xabber/android/ui/ContactList.java
+8
-19
ContactListFragment.java
.../main/java/com/xabber/android/ui/ContactListFragment.java
+41
-66
BaseContactAdapter.java
...ava/com/xabber/android/ui/adapter/BaseContactAdapter.java
+9
-14
BaseContactInflater.java
...va/com/xabber/android/ui/adapter/BaseContactInflater.java
+12
-18
ContactListAdapter.java
...ava/com/xabber/android/ui/adapter/ContactListAdapter.java
+105
-110
GroupedContactAdapter.java
.../com/xabber/android/ui/adapter/GroupedContactAdapter.java
+67
-84
SmoothContactAdapter.java
...a/com/xabber/android/ui/adapter/SmoothContactAdapter.java
+1
-2
No files found.
app/src/main/java/com/xabber/android/ui/ContactList.java
View file @
67ff3d03
...
...
@@ -45,7 +45,6 @@ import com.xabber.android.data.NetworkException;
import
com.xabber.android.data.SettingsManager
;
import
com.xabber.android.data.account.AccountManager
;
import
com.xabber.android.data.account.OnAccountChangedListener
;
import
com.xabber.android.data.account.StatusMode
;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.extension.avatar.AvatarManager
;
import
com.xabber.android.data.extension.muc.MUCManager
;
...
...
@@ -76,9 +75,8 @@ import java.util.Collection;
*
* @author alexander.ivanov
*/
public
class
ContactList
extends
ManagedActivity
implements
OnAccountChangedListener
,
View
.
OnClickListener
,
OnChoosedListener
,
OnContactClickListener
{
public
class
ContactList
extends
ManagedActivity
implements
OnAccountChangedListener
,
View
.
OnClickListener
,
OnChoosedListener
,
OnContactClickListener
{
/**
* Select contact to be invited to the room was requested.
...
...
@@ -121,6 +119,7 @@ public class ContactList extends ManagedActivity implements
ActivityManager
.
getInstance
().
startNewTask
(
this
);
}
super
.
onCreate
(
savedInstanceState
);
if
(
isFinishing
())
{
return
;
}
...
...
@@ -233,7 +232,6 @@ public class ContactList extends ManagedActivity implements
@Override
protected
void
onResume
()
{
super
.
onResume
();
updateStatusBar
();
rebuildAccountToggle
();
Application
.
getInstance
().
addUIListener
(
OnAccountChangedListener
.
class
,
this
);
...
...
@@ -281,9 +279,9 @@ public class ContactList extends ManagedActivity implements
}
}
}
if
(
Application
.
getInstance
().
doNotify
())
{
if
(
SettingsManager
.
bootCount
()
>
2
&&
!
SettingsManager
.
connectionStartAtBoot
()
if
(
SettingsManager
.
bootCount
()
>
2
&&
!
SettingsManager
.
connectionStartAtBoot
()
&&
!
SettingsManager
.
startAtBootSuggested
())
{
StartAtBootDialogFragment
.
newInstance
().
show
(
getFragmentManager
(),
"START_AT_BOOT"
);
}
...
...
@@ -458,8 +456,9 @@ public class ContactList extends ManagedActivity implements
break
;
default
:
String
account
=
accountToggleAdapter
.
getItemForView
(
view
);
if
(
account
==
null
)
// Check for tap on account in the title
if
(
account
==
null
)
{
// Check for tap on account in the title
break
;
}
if
(!
SettingsManager
.
contactsShowAccounts
())
{
if
(
AccountManager
.
getInstance
().
getAccounts
().
size
()
<
2
)
{
getContactListFragment
().
scrollUp
();
...
...
@@ -538,7 +537,6 @@ public class ContactList extends ManagedActivity implements
}
private
void
rebuildAccountToggle
()
{
updateStatusBar
();
accountToggleAdapter
.
rebuild
();
if
(
SettingsManager
.
contactsShowPanel
()
&&
accountToggleAdapter
.
getCount
()
>
0
)
{
actionBarView
.
setVisibility
(
View
.
VISIBLE
);
...
...
@@ -547,14 +545,6 @@ public class ContactList extends ManagedActivity implements
}
}
private
void
updateStatusBar
()
{
String
statusText
=
SettingsManager
.
statusText
();
StatusMode
statusMode
=
SettingsManager
.
statusMode
();
if
(
""
.
equals
(
statusText
))
{
statusText
=
getString
(
statusMode
.
getStringID
());
}
}
public
static
Intent
createPersistentIntent
(
Context
context
)
{
Intent
intent
=
new
Intent
(
context
,
ContactList
.
class
);
intent
.
setAction
(
"android.intent.action.MAIN"
);
...
...
@@ -567,8 +557,7 @@ public class ContactList extends ManagedActivity implements
return
new
Intent
(
context
,
ContactList
.
class
);
}
public
static
Intent
createRoomInviteIntent
(
Context
context
,
String
account
,
String
room
)
{
public
static
Intent
createRoomInviteIntent
(
Context
context
,
String
account
,
String
room
)
{
Intent
intent
=
new
EntityIntentBuilder
(
context
,
ContactList
.
class
)
.
setAccount
(
account
).
setUser
(
room
).
build
();
intent
.
setAction
(
ACTION_ROOM_INVITE
);
...
...
app/src/main/java/com/xabber/android/ui/ContactListFragment.java
View file @
67ff3d03
This diff is collapsed.
Click to expand it.
app/src/main/java/com/xabber/android/ui/adapter/BaseContactAdapter.java
View file @
67ff3d03
...
...
@@ -14,9 +14,6 @@
*/
package
com
.
xabber
.
android
.
ui
.
adapter
;
import
java.util.ArrayList
;
import
java.util.Locale
;
import
android.app.Activity
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -27,6 +24,9 @@ import android.widget.Filterable;
import
com.xabber.android.data.entity.BaseEntity
;
import
com.xabber.android.data.roster.AbstractContact
;
import
java.util.ArrayList
;
import
java.util.Locale
;
/**
* Base adapter for the list of contacts.
*
...
...
@@ -62,20 +62,13 @@ public abstract class BaseContactAdapter<Inflater extends BaseContactInflater>
public
BaseContactAdapter
(
Activity
activity
,
Inflater
inflater
)
{
this
.
activity
=
activity
;
this
.
locale
=
Locale
.
getDefault
();
this
.
baseEntities
=
new
ArrayList
<
BaseEntity
>();
this
.
baseEntities
=
new
ArrayList
<>();
this
.
inflater
=
inflater
;
inflater
.
setAdapter
(
this
);
contactFilter
=
null
;
filterString
=
null
;
}
/**
* @return View inflater.
*/
public
Inflater
getInflater
()
{
return
inflater
;
}
@Override
public
void
onChange
()
{
notifyDataSetChanged
();
...
...
@@ -111,8 +104,9 @@ public abstract class BaseContactAdapter<Inflater extends BaseContactInflater>
@Override
public
Filter
getFilter
()
{
if
(
contactFilter
==
null
)
if
(
contactFilter
==
null
)
{
contactFilter
=
new
ContactFilter
();
}
return
contactFilter
;
}
...
...
@@ -126,10 +120,11 @@ public abstract class BaseContactAdapter<Inflater extends BaseContactInflater>
@Override
protected
void
publishResults
(
CharSequence
constraint
,
FilterResults
results
)
{
if
(
constraint
==
null
||
constraint
.
length
()
==
0
)
if
(
constraint
==
null
||
constraint
.
length
()
==
0
)
{
filterString
=
null
;
else
}
else
{
filterString
=
constraint
.
toString
().
toLowerCase
(
locale
);
}
onChange
();
}
...
...
app/src/main/java/com/xabber/android/ui/adapter/BaseContactInflater.java
View file @
67ff3d03
...
...
@@ -59,14 +59,11 @@ public abstract class BaseContactInflater {
public
BaseContactInflater
(
Activity
activity
)
{
this
.
activity
=
activity
;
layoutInflater
=
(
LayoutInflater
)
activity
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
avatarInflaterHelper
=
AbstractAvatarInflaterHelper
.
createAbstractContactInflaterHelper
();
Bitmap
bitmap
=
BitmapFactory
.
decodeResource
(
activity
.
getResources
(),
R
.
drawable
.
shadow
);
shadowDrawable
=
new
BitmapDrawable
(
bitmap
);
layoutInflater
=
(
LayoutInflater
)
activity
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
avatarInflaterHelper
=
AbstractAvatarInflaterHelper
.
createAbstractContactInflaterHelper
();
Bitmap
bitmap
=
BitmapFactory
.
decodeResource
(
activity
.
getResources
(),
R
.
drawable
.
shadow
);
shadowDrawable
=
new
BitmapDrawable
(
activity
.
getResources
(),
bitmap
);
shadowDrawable
.
setTileModeXY
(
TileMode
.
REPEAT
,
TileMode
.
REPEAT
);
}
...
...
@@ -115,19 +112,18 @@ public abstract class BaseContactInflater {
*/
public
void
getView
(
View
view
,
AbstractContact
abstractContact
)
{
final
ViewHolder
viewHolder
=
(
ViewHolder
)
view
.
getTag
();
if
(
abstractContact
.
isConnected
())
if
(
abstractContact
.
isConnected
())
{
viewHolder
.
shadow
.
setVisibility
(
View
.
GONE
);
else
}
else
{
viewHolder
.
shadow
.
setVisibility
(
View
.
VISIBLE
);
}
viewHolder
.
color
.
setImageLevel
(
abstractContact
.
getColorLevel
());
if
(
SettingsManager
.
contactsShowAvatars
())
{
viewHolder
.
avatar
.
setVisibility
(
View
.
VISIBLE
);
viewHolder
.
avatar
.
setImageDrawable
(
abstractContact
.
getAvatarForContactList
());
avatarInflaterHelper
.
updateAvatar
(
viewHolder
.
avatar
,
abstractContact
);
viewHolder
.
avatar
.
setImageDrawable
(
abstractContact
.
getAvatarForContactList
());
avatarInflaterHelper
.
updateAvatar
(
viewHolder
.
avatar
,
abstractContact
);
((
RelativeLayout
.
LayoutParams
)
viewHolder
.
panel
.
getLayoutParams
())
.
addRule
(
RelativeLayout
.
RIGHT_OF
,
R
.
id
.
avatar
);
}
else
{
...
...
@@ -140,14 +136,12 @@ public abstract class BaseContactInflater {
final
String
statusText
=
getStatusText
(
abstractContact
);
if
(
""
.
equals
(
statusText
))
{
viewHolder
.
name
.
getLayoutParams
().
height
=
activity
.
getResources
()
.
getDimensionPixelSize
(
R
.
dimen
.
contact_name_height_hide_status
);
.
getDimensionPixelSize
(
R
.
dimen
.
contact_name_height_hide_status
);
viewHolder
.
name
.
setGravity
(
Gravity
.
CENTER_VERTICAL
);
viewHolder
.
status
.
setVisibility
(
View
.
GONE
);
}
else
{
viewHolder
.
name
.
getLayoutParams
().
height
=
activity
.
getResources
()
.
getDimensionPixelSize
(
R
.
dimen
.
contact_name_height_show_status
);
.
getDimensionPixelSize
(
R
.
dimen
.
contact_name_height_show_status
);
viewHolder
.
name
.
setGravity
(
Gravity
.
BOTTOM
);
viewHolder
.
status
.
setText
(
statusText
);
viewHolder
.
status
.
setVisibility
(
View
.
VISIBLE
);
...
...
app/src/main/java/com/xabber/android/ui/adapter/ContactListAdapter.java
View file @
67ff3d03
This diff is collapsed.
Click to expand it.
app/src/main/java/com/xabber/android/ui/adapter/GroupedContactAdapter.java
View file @
67ff3d03
This diff is collapsed.
Click to expand it.
app/src/main/java/com/xabber/android/ui/adapter/SmoothContactAdapter.java
View file @
67ff3d03
...
...
@@ -36,8 +36,7 @@ public abstract class SmoothContactAdapter<Inflater extends BaseContactInflater>
*/
ListView
listView
;
public
SmoothContactAdapter
(
Activity
activity
,
ListView
listView
,
Inflater
inflater
)
{
public
SmoothContactAdapter
(
Activity
activity
,
ListView
listView
,
Inflater
inflater
)
{
super
(
activity
,
inflater
);
this
.
listView
=
listView
;
}
...
...
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