Commit 23d2b953 authored by Grigory Fedorov's avatar Grigory Fedorov

Merge branch 'feature/contact_list_action_bar' into develop

parents ebcde01b 599d9bf9
...@@ -13,8 +13,8 @@ android { ...@@ -13,8 +13,8 @@ android {
applicationId "com.xabber.androiddev" applicationId "com.xabber.androiddev"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 21 targetSdkVersion 21
versionCode 116 versionCode 117
versionName '0.10.19' versionName '0.10.20'
} }
sourceSets { sourceSets {
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
android:theme="@style/Theme" android:theme="@style/Theme"
android:allowBackup="true"> android:allowBackup="true">
<activity <activity
android:label="@string/application_name" android:label="@string/production_title"
android:name="com.xabber.android.ui.ContactList" android:name="com.xabber.android.ui.ContactList"
android:launchMode="singleTop" android:launchMode="singleTop"
> >
...@@ -220,7 +220,6 @@ ...@@ -220,7 +220,6 @@
<activity <activity
android:label="@string/contact_viewer" android:label="@string/contact_viewer"
android:name="com.xabber.android.ui.preferences.ContactViewer" android:name="com.xabber.android.ui.preferences.ContactViewer"
android:icon="@drawable/ic_information"
android:parentActivityName="com.xabber.android.ui.ContactList" android:parentActivityName="com.xabber.android.ui.ContactList"
> >
<!-- Parent activity meta-data to support 4.0 and lower --> <!-- Parent activity meta-data to support 4.0 and lower -->
...@@ -388,10 +387,6 @@ ...@@ -388,10 +387,6 @@
android:name="android.content.SyncAdapter" android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter" android:resource="@xml/syncadapter"
/> />
<meta-data
android:name="android.provider.CONTACTS_STRUCTURE"
android:resource="@xml/contacts_structure"
/>
</service> </service>
<service <service
android:name="com.xabber.android.service.AccountAuthenticatorService" android:name="com.xabber.android.service.AccountAuthenticatorService"
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
*/ */
package com.xabber.android.ui; package com.xabber.android.ui;
import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
...@@ -372,11 +371,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener ...@@ -372,11 +371,6 @@ public class ChatViewer extends ManagedActivity implements OnChatChangedListener
insertExtraText(); insertExtraText();
updateRegisteredChats(); updateRegisteredChats();
Fragment currentFragment = chatViewerAdapter.getCurrentFragment();
if (currentFragment instanceof ChatViewerFragment) {
((ChatViewerFragment)currentFragment).setInputFocus();
}
} }
private void insertExtraText() { private void insertExtraText() {
......
...@@ -613,14 +613,6 @@ public class ChatViewerFragment extends Fragment { ...@@ -613,14 +613,6 @@ public class ChatViewerFragment extends Fragment {
return this.account.equals(account) && this.user.equals(user); return this.account.equals(account) && this.user.equals(user);
} }
public void setInputFocus() {
inputView.requestFocus();
if (getActivity() != null) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(inputView.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
}
}
public void setInputText(String text) { public void setInputText(String text) {
insertText(text); insertText(text);
} }
......
...@@ -26,12 +26,15 @@ import android.os.Bundle; ...@@ -26,12 +26,15 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.ActionBar;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;
import android.widget.SearchView; import android.widget.SearchView;
import android.widget.Toast; import android.widget.Toast;
...@@ -41,6 +44,7 @@ import com.xabber.android.data.LogManager; ...@@ -41,6 +44,7 @@ import com.xabber.android.data.LogManager;
import com.xabber.android.data.NetworkException; import com.xabber.android.data.NetworkException;
import com.xabber.android.data.SettingsManager; import com.xabber.android.data.SettingsManager;
import com.xabber.android.data.account.AccountManager; import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.account.OnAccountChangedListener;
import com.xabber.android.data.entity.BaseEntity; import com.xabber.android.data.entity.BaseEntity;
import com.xabber.android.data.extension.avatar.AvatarManager; import com.xabber.android.data.extension.avatar.AvatarManager;
import com.xabber.android.data.extension.muc.MUCManager; import com.xabber.android.data.extension.muc.MUCManager;
...@@ -52,6 +56,7 @@ import com.xabber.android.data.roster.AbstractContact; ...@@ -52,6 +56,7 @@ import com.xabber.android.data.roster.AbstractContact;
import com.xabber.android.data.roster.RosterContact; import com.xabber.android.data.roster.RosterContact;
import com.xabber.android.data.roster.RosterManager; import com.xabber.android.data.roster.RosterManager;
import com.xabber.android.ui.ContactListFragment.OnContactClickListener; import com.xabber.android.ui.ContactListFragment.OnContactClickListener;
import com.xabber.android.ui.adapter.AccountToggleAdapter;
import com.xabber.android.ui.dialog.AccountChooseDialogFragment; import com.xabber.android.ui.dialog.AccountChooseDialogFragment;
import com.xabber.android.ui.dialog.AccountChooseDialogFragment.OnChoosedListener; import com.xabber.android.ui.dialog.AccountChooseDialogFragment.OnChoosedListener;
import com.xabber.android.ui.dialog.ContactIntegrationDialogFragment; import com.xabber.android.ui.dialog.ContactIntegrationDialogFragment;
...@@ -70,7 +75,8 @@ import java.util.Collection; ...@@ -70,7 +75,8 @@ import java.util.Collection;
* *
* @author alexander.ivanov * @author alexander.ivanov
*/ */
public class ContactList extends ManagedActivity implements OnChoosedListener, OnContactClickListener { public class ContactList extends ManagedActivity implements OnAccountChangedListener,
View.OnClickListener, OnChoosedListener, OnContactClickListener {
/** /**
* Select contact to be invited to the room was requested. * Select contact to be invited to the room was requested.
...@@ -86,6 +92,11 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -86,6 +92,11 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
private static final String CONTACT_LIST_TAG = "CONTACT_LIST"; private static final String CONTACT_LIST_TAG = "CONTACT_LIST";
/**
* Adapter for account list.
*/
private AccountToggleAdapter accountToggleAdapter;
/** /**
* Current action. * Current action.
*/ */
...@@ -95,22 +106,40 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -95,22 +106,40 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
* Dialog related values. * Dialog related values.
*/ */
private String sendText; private String sendText;
private SearchView searchView; private SearchView searchView;
private View actionBarView;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
if (Intent.ACTION_VIEW.equals(getIntent().getAction()) if (Intent.ACTION_VIEW.equals(getIntent().getAction())
|| Intent.ACTION_SEND.equals(getIntent().getAction()) || Intent.ACTION_SEND.equals(getIntent().getAction())
|| Intent.ACTION_SENDTO.equals(getIntent().getAction()) || Intent.ACTION_SENDTO.equals(getIntent().getAction())
|| Intent.ACTION_CREATE_SHORTCUT || Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())) {
.equals(getIntent().getAction()))
ActivityManager.getInstance().startNewTask(this); ActivityManager.getInstance().startNewTask(this);
}
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (isFinishing())
if (isFinishing()) {
return; return;
}
setContentView(R.layout.contact_list); setContentView(R.layout.contact_list);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
actionBarView = LayoutInflater.from(this).inflate(R.layout.contact_list_action_bar, null);
actionBarView.setOnClickListener(this);
actionBar.setCustomView(actionBarView, new ActionBar.LayoutParams(
ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT));
accountToggleAdapter = new AccountToggleAdapter(this, this,
(LinearLayout) actionBarView.findViewById(R.id.account_list));
if (savedInstanceState != null) { if (savedInstanceState != null) {
sendText = savedInstanceState.getString(SAVED_SEND_TEXT); sendText = savedInstanceState.getString(SAVED_SEND_TEXT);
...@@ -150,29 +179,33 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -150,29 +179,33 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
*/ */
private void openChat(String user, String text) { private void openChat(String user, String text) {
String bareAddress = Jid.getBareAddress(user); String bareAddress = Jid.getBareAddress(user);
ArrayList<BaseEntity> entities = new ArrayList<BaseEntity>(); ArrayList<BaseEntity> entities = new ArrayList<>();
for (AbstractChat check : MessageManager.getInstance().getChats()) for (AbstractChat check : MessageManager.getInstance().getChats()) {
if (check.isActive() && check.getUser().equals(bareAddress)) if (check.isActive() && check.getUser().equals(bareAddress)) {
entities.add(check); entities.add(check);
}
}
if (entities.size() == 1) { if (entities.size() == 1) {
openChat(entities.get(0), text); openChat(entities.get(0), text);
return; return;
} }
entities.clear(); entities.clear();
for (RosterContact check : RosterManager.getInstance().getContacts()) for (RosterContact check : RosterManager.getInstance().getContacts()) {
if (check.isEnabled() && check.getUser().equals(bareAddress)) if (check.isEnabled() && check.getUser().equals(bareAddress)) {
entities.add(check); entities.add(check);
}
}
if (entities.size() == 1) { if (entities.size() == 1) {
openChat(entities.get(0), text); openChat(entities.get(0), text);
return; return;
} }
Collection<String> accounts = AccountManager.getInstance() Collection<String> accounts = AccountManager.getInstance()
.getAccounts(); .getAccounts();
if (accounts.isEmpty()) if (accounts.isEmpty()) {
return; return;
}
if (accounts.size() == 1) { if (accounts.size() == 1) {
openChat(new BaseEntity(accounts.iterator().next(), bareAddress), openChat(new BaseEntity(accounts.iterator().next(), bareAddress), text);
text);
return; return;
} }
AccountChooseDialogFragment.newInstance(bareAddress, text) AccountChooseDialogFragment.newInstance(bareAddress, text)
...@@ -186,27 +219,31 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -186,27 +219,31 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
* @param text can be <code>null</code>. * @param text can be <code>null</code>.
*/ */
private void openChat(BaseEntity baseEntity, String text) { private void openChat(BaseEntity baseEntity, String text) {
if (text == null) if (text == null) {
startActivity(ChatViewer.createSendIntent(this, startActivity(ChatViewer.createSendIntent(this,
baseEntity.getAccount(), baseEntity.getUser(), null)); baseEntity.getAccount(), baseEntity.getUser(), null));
else } else {
startActivity(ChatViewer.createSendIntent(this, startActivity(ChatViewer.createSendIntent(this,
baseEntity.getAccount(), baseEntity.getUser(), text)); baseEntity.getAccount(), baseEntity.getUser(), text));
}
finish(); finish();
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
rebuildAccountToggle();
Application.getInstance().addUIListener(OnAccountChangedListener.class, this);
if (action != null) { if (action != null) {
switch (action) { switch (action) {
case ContactList.ACTION_ROOM_INVITE: case ContactList.ACTION_ROOM_INVITE:
case Intent.ACTION_SEND: case Intent.ACTION_SEND:
case Intent.ACTION_CREATE_SHORTCUT: case Intent.ACTION_CREATE_SHORTCUT:
if (Intent.ACTION_SEND.equals(action)) if (Intent.ACTION_SEND.equals(action)) {
sendText = getIntent().getStringExtra(Intent.EXTRA_TEXT); sendText = getIntent().getStringExtra(Intent.EXTRA_TEXT);
Toast.makeText(this, getString(R.string.select_contact), }
Toast.LENGTH_LONG).show(); Toast.makeText(this, getString(R.string.select_contact), Toast.LENGTH_LONG).show();
break; break;
case Intent.ACTION_VIEW: { case Intent.ACTION_VIEW: {
action = null; action = null;
...@@ -221,8 +258,9 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -221,8 +258,9 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
if (xmppUri != null && "message".equals(xmppUri.getQueryType())) { if (xmppUri != null && "message".equals(xmppUri.getQueryType())) {
ArrayList<String> texts = xmppUri.getValues("body"); ArrayList<String> texts = xmppUri.getValues("body");
String text = null; String text = null;
if (texts != null && !texts.isEmpty()) if (texts != null && !texts.isEmpty()) {
text = texts.get(0); text = texts.get(0);
}
openChat(xmppUri.getPath(), text); openChat(xmppUri.getPath(), text);
} }
} }
...@@ -233,25 +271,28 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -233,25 +271,28 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
Uri data = getIntent().getData(); Uri data = getIntent().getData();
if (data != null) { if (data != null) {
String path = data.getPath(); String path = data.getPath();
if (path != null && path.startsWith("/")) if (path != null && path.startsWith("/")) {
openChat(path.substring(1), null); openChat(path.substring(1), null);
}
} }
break; break;
} }
} }
} }
if (Application.getInstance().doNotify()) { if (Application.getInstance().doNotify()) {
if (SettingsManager.bootCount() > 2 if (SettingsManager.bootCount() > 2 && !SettingsManager.connectionStartAtBoot()
&& !SettingsManager.connectionStartAtBoot() && !SettingsManager.startAtBootSuggested()) {
&& !SettingsManager.startAtBootSuggested())
StartAtBootDialogFragment.newInstance().show(getFragmentManager(), "START_AT_BOOT"); StartAtBootDialogFragment.newInstance().show(getFragmentManager(), "START_AT_BOOT");
}
if (!SettingsManager.contactIntegrationSuggested() if (!SettingsManager.contactIntegrationSuggested()
&& Application.getInstance().isContactsSupported()) { && Application.getInstance().isContactsSupported()) {
if (AccountManager.getInstance().getAllAccounts().isEmpty()) if (AccountManager.getInstance().getAllAccounts().isEmpty()) {
SettingsManager.setContactIntegrationSuggested(); SettingsManager.setContactIntegrationSuggested();
else } else {
ContactIntegrationDialogFragment.newInstance().show( ContactIntegrationDialogFragment.newInstance()
getFragmentManager(), "CONTACT_INTEGRATION"); .show(getFragmentManager(), "CONTACT_INTEGRATION");
}
} }
} }
} }
...@@ -260,6 +301,7 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -260,6 +301,7 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
hideKeyboard(); hideKeyboard();
Application.getInstance().removeUIListener(OnAccountChangedListener.class, this);
} }
private void hideKeyboard() { private void hideKeyboard() {
...@@ -277,13 +319,14 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -277,13 +319,14 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
return true; return true;
} }
private void setUpSearchView(Menu menu) { private void setUpSearchView(final Menu menu) {
searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
searchView.setQueryHint("Search contact"); searchView.setQueryHint("Search contact");
searchView.setOnCloseListener(new SearchView.OnCloseListener() { searchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override @Override
public boolean onClose() { public boolean onClose() {
menu.findItem(R.id.action_search).collapseActionView();
return true; return true;
} }
}); });
...@@ -326,11 +369,8 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -326,11 +369,8 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_search: case R.id.action_search:
searchView.setIconified(false); searchView.setIconified(false);
return true; return true;
case R.id.action_change_status: case R.id.action_change_status:
startActivity(StatusEditor.createIntent(this)); startActivity(StatusEditor.createIntent(this));
return true; return true;
...@@ -371,12 +411,10 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -371,12 +411,10 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
} }
private void closeAllChats() { private void closeAllChats() {
for (AbstractChat chat : MessageManager.getInstance() for (AbstractChat chat : MessageManager.getInstance().getActiveChats()) {
.getActiveChats()) { MessageManager.getInstance().closeChat(chat.getAccount(), chat.getUser());
MessageManager.getInstance().closeChat(chat.getAccount(), NotificationManager.getInstance().
chat.getUser()); removeMessageNotification(chat.getAccount(), chat.getUser());
NotificationManager.getInstance().removeMessageNotification(
chat.getAccount(), chat.getUser());
} }
getContactListFragment().getAdapter().onChange(); getContactListFragment().getAdapter().onChange();
} }
...@@ -386,8 +424,7 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -386,8 +424,7 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
} }
@Override @Override
public void onCreateContextMenu(ContextMenu menu, View view, public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, view, menuInfo); super.onCreateContextMenu(menu, view, menuInfo);
} }
...@@ -397,8 +434,7 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -397,8 +434,7 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
switch (id) { switch (id) {
case DIALOG_CLOSE_APPLICATION_ID: case DIALOG_CLOSE_APPLICATION_ID:
ProgressDialog progressDialog = new ProgressDialog(this); ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog progressDialog.setMessage(getString(R.string.application_state_closing));
.setMessage(getString(R.string.application_state_closing));
progressDialog.setOnCancelListener(new OnCancelListener() { progressDialog.setOnCancelListener(new OnCancelListener() {
@Override @Override
public void onCancel(DialogInterface dialog) { public void onCancel(DialogInterface dialog) {
...@@ -412,65 +448,110 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -412,65 +448,110 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
} }
} }
@Override
public void onClick(View view) {
switch (view.getId()) {
case android.R.id.title:
getContactListFragment().scrollUp();
break;
default:
String account = accountToggleAdapter.getItemForView(view);
if (account == null) { // Check for tap on account in the title
break;
}
if (!SettingsManager.contactsShowAccounts()) {
if (AccountManager.getInstance().getAccounts().size() < 2) {
getContactListFragment().scrollUp();
} else {
getContactListFragment().setSelectedAccount(account);
rebuildAccountToggle();
}
} else {
getContactListFragment().scrollTo(account);
}
break;
}
}
@Override @Override
public void onContactClick(AbstractContact abstractContact) { public void onContactClick(AbstractContact abstractContact) {
if (ACTION_ROOM_INVITE.equals(action)) { switch (action) {
action = null; case ACTION_ROOM_INVITE: {
Intent intent = getIntent(); action = null;
String account = getRoomInviteAccount(intent); Intent intent = getIntent();
String user = getRoomInviteUser(intent); String account = getRoomInviteAccount(intent);
if (account != null && user != null) String user = getRoomInviteUser(intent);
try { if (account != null && user != null) {
MUCManager.getInstance().invite(account, user, try {
abstractContact.getUser()); MUCManager.getInstance().invite(account, user, abstractContact.getUser());
} catch (NetworkException e) { } catch (NetworkException e) {
Application.getInstance().onError(e); Application.getInstance().onError(e);
}
} }
finish(); finish();
} else if (Intent.ACTION_SEND.equals(action)) { break;
action = null; }
startActivity(ChatViewer.createSendIntent(this, case Intent.ACTION_SEND:
abstractContact.getAccount(), abstractContact.getUser(), action = null;
sendText)); startActivity(ChatViewer.createSendIntent(this,
finish(); abstractContact.getAccount(), abstractContact.getUser(), sendText));
} else if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) { finish();
Intent intent = new Intent(); break;
intent.putExtra( case Intent.ACTION_CREATE_SHORTCUT: {
Intent.EXTRA_SHORTCUT_INTENT, createShortcut(abstractContact);
ChatViewer.createClearTopIntent(this, finish();
abstractContact.getAccount(), break;
abstractContact.getUser())); }
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, default:
abstractContact.getName()); startActivity(ChatViewer.createIntent(this,
Bitmap bitmap; abstractContact.getAccount(), abstractContact.getUser()));
if (MUCManager.getInstance().hasRoom(abstractContact.getAccount(), break;
abstractContact.getUser())) }
bitmap = AvatarManager.getInstance().getRoomBitmap( }
abstractContact.getUser());
else private void createShortcut(AbstractContact abstractContact) {
bitmap = AvatarManager.getInstance().getUserBitmap( Intent intent = new Intent();
abstractContact.getUser()); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, ChatViewer.createClearTopIntent(this,
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, AvatarManager abstractContact.getAccount(), abstractContact.getUser()));
.getInstance().createShortcutBitmap(bitmap)); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, abstractContact.getName());
setResult(RESULT_OK, intent); Bitmap bitmap;
finish(); if (MUCManager.getInstance().hasRoom(abstractContact.getAccount(),
abstractContact.getUser())) {
bitmap = AvatarManager.getInstance().getRoomBitmap(abstractContact.getUser());
} else { } else {
startActivity(ChatViewer.createIntent(this, bitmap = AvatarManager.getInstance().getUserBitmap(abstractContact.getUser());
abstractContact.getAccount(), abstractContact.getUser()));
} }
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON,
AvatarManager.getInstance().createShortcutBitmap(bitmap));
setResult(RESULT_OK, intent);
} }
@Override @Override
public void onChoosed(String account, String user, String text) { public void onAccountsChanged(Collection<String> accounts) {
accountToggleAdapter.onChange();
}
@Override
public void onChoose(String account, String user, String text) {
openChat(new BaseEntity(account, user), text); openChat(new BaseEntity(account, user), text);
} }
private void rebuildAccountToggle() {
accountToggleAdapter.rebuild();
if (SettingsManager.contactsShowPanel() && accountToggleAdapter.getCount() > 0) {
getSupportActionBar().setDisplayShowTitleEnabled(false);
actionBarView.setVisibility(View.VISIBLE);
} else {
actionBarView.setVisibility(View.GONE);
getSupportActionBar().setDisplayShowTitleEnabled(true);
}
}
public static Intent createPersistentIntent(Context context) { public static Intent createPersistentIntent(Context context) {
Intent intent = new Intent(context, ContactList.class); Intent intent = new Intent(context, ContactList.class);
intent.setAction("android.intent.action.MAIN"); intent.setAction("android.intent.action.MAIN");
intent.addCategory("android.intent.category.LAUNCHER"); intent.addCategory("android.intent.category.LAUNCHER");
intent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED intent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK);
| Intent.FLAG_ACTIVITY_NEW_TASK);
return intent; return intent;
} }
...@@ -478,8 +559,7 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O ...@@ -478,8 +559,7 @@ public class ContactList extends ManagedActivity implements OnChoosedListener, O
return new Intent(context, ContactList.class); return new Intent(context, ContactList.class);
} }
public static Intent createRoomInviteIntent(Context context, public static Intent createRoomInviteIntent(Context context, String account, String room) {
String account, String room) {
Intent intent = new EntityIntentBuilder(context, ContactList.class) Intent intent = new EntityIntentBuilder(context, ContactList.class)
.setAccount(account).setUser(room).build(); .setAccount(account).setUser(room).build();
intent.setAction(ACTION_ROOM_INVITE); intent.setAction(ACTION_ROOM_INVITE);
......
...@@ -43,9 +43,8 @@ import com.xabber.androiddev.R; ...@@ -43,9 +43,8 @@ import com.xabber.androiddev.R;
import java.util.Collection; import java.util.Collection;
public class ContactListFragment extends Fragment implements public class ContactListFragment extends Fragment implements OnAccountChangedListener,
OnAccountChangedListener, OnContactChangedListener, OnContactChangedListener, OnChatChangedListener, OnItemClickListener,
OnChatChangedListener, OnItemClickListener,
OnContactListChangedListener { OnContactListChangedListener {
private ContactListAdapter adapter; private ContactListAdapter adapter;
...@@ -85,8 +84,7 @@ public class ContactListFragment extends Fragment implements ...@@ -85,8 +84,7 @@ public class ContactListFragment extends Fragment implements
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.contact_list_fragment, container, View view = inflater.inflate(R.layout.contact_list_fragment, container, false);
false);
listView = (ListView) view.findViewById(android.R.id.list); listView = (ListView) view.findViewById(android.R.id.list);
listView.setOnItemClickListener(this); listView.setOnItemClickListener(this);
listView.setItemsCanFocus(true); listView.setItemsCanFocus(true);
...@@ -98,20 +96,16 @@ public class ContactListFragment extends Fragment implements ...@@ -98,20 +96,16 @@ public class ContactListFragment extends Fragment implements
disconnectedView = infoView.findViewById(R.id.disconnected); disconnectedView = infoView.findViewById(R.id.disconnected);
textView = (TextView) infoView.findViewById(R.id.text); textView = (TextView) infoView.findViewById(R.id.text);
buttonView = (Button) infoView.findViewById(R.id.button); buttonView = (Button) infoView.findViewById(R.id.button);
animation = AnimationUtils.loadAnimation(getActivity(), animation = AnimationUtils.loadAnimation(getActivity(), R.anim.connection);
R.anim.connection);
return view; return view;
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
Application.getInstance().addUIListener(OnAccountChangedListener.class, Application.getInstance().addUIListener(OnAccountChangedListener.class, this);
this); Application.getInstance().addUIListener(OnContactChangedListener.class, this);
Application.getInstance().addUIListener(OnContactChangedListener.class, Application.getInstance().addUIListener(OnChatChangedListener.class, this);
this);
Application.getInstance().addUIListener(OnChatChangedListener.class,
this);
adapter.onChange(); adapter.onChange();
} }
...@@ -122,38 +116,35 @@ public class ContactListFragment extends Fragment implements ...@@ -122,38 +116,35 @@ public class ContactListFragment extends Fragment implements
} }
@Override @Override
public void onCreateContextMenu(ContextMenu menu, View view, public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
ContextMenuInfo menuInfo) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
BaseEntity baseEntity = (BaseEntity) listView BaseEntity baseEntity = (BaseEntity) listView.getItemAtPosition(info.position);
.getItemAtPosition(info.position);
if (baseEntity instanceof AbstractContact) { if (baseEntity instanceof AbstractContact) {
ContextMenuHelper.createContactContextMenu(getActivity(), adapter, ContextMenuHelper.createContactContextMenu(
(AbstractContact) baseEntity, menu); getActivity(), adapter, (AbstractContact) baseEntity, menu);
} else if (baseEntity instanceof AccountConfiguration) { } else if (baseEntity instanceof AccountConfiguration) {
ContextMenuHelper.createAccountContextMenu(getActivity(), adapter, ContextMenuHelper.createAccountContextMenu(
baseEntity.getAccount(), menu); getActivity(), adapter, baseEntity.getAccount(), menu);
} else if (baseEntity instanceof GroupConfiguration) { } else if (baseEntity instanceof GroupConfiguration) {
ContextMenuHelper.createGroupContextMenu(getActivity(), adapter, ContextMenuHelper.createGroupContextMenu(getActivity(), adapter,
baseEntity.getAccount(), baseEntity.getUser(), menu); baseEntity.getAccount(), baseEntity.getUser(), menu);
} else } else {
throw new IllegalStateException(); throw new IllegalStateException();
}
} }
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
long id) {
Object object = parent.getAdapter().getItem(position); Object object = parent.getAdapter().getItem(position);
if (object instanceof AbstractContact) { if (object instanceof AbstractContact) {
((OnContactClickListener) getActivity()) ((OnContactClickListener) getActivity()).onContactClick((AbstractContact) object);
.onContactClick((AbstractContact) object);
} else if (object instanceof GroupConfiguration) { } else if (object instanceof GroupConfiguration) {
GroupConfiguration groupConfiguration = (GroupConfiguration) object; GroupConfiguration groupConfiguration = (GroupConfiguration) object;
adapter.setExpanded(groupConfiguration.getAccount(), adapter.setExpanded(groupConfiguration.getAccount(), groupConfiguration.getUser(),
groupConfiguration.getUser(),
!groupConfiguration.isExpanded()); !groupConfiguration.isExpanded());
} else } else {
throw new IllegalStateException(); throw new IllegalStateException();
}
} }
@Override @Override
...@@ -168,14 +159,14 @@ public class ContactListFragment extends Fragment implements ...@@ -168,14 +159,14 @@ public class ContactListFragment extends Fragment implements
@Override @Override
public void onChatChanged(String account, String user, boolean incoming) { public void onChatChanged(String account, String user, boolean incoming) {
if (incoming) if (incoming) {
adapter.refreshRequest(); adapter.refreshRequest();
}
} }
@Override @Override
public void onContactListChanged(CommonState commonState, public void onContactListChanged(CommonState commonState, boolean hasContacts,
boolean hasContacts, boolean hasVisibleContacts, boolean hasVisibleContacts, boolean isFilterEnabled) {
boolean isFilterEnabled) {
if (hasVisibleContacts) { if (hasVisibleContacts) {
infoView.setVisibility(View.GONE); infoView.setVisibility(View.GONE);
disconnectedView.clearAnimation(); disconnectedView.clearAnimation();
...@@ -187,13 +178,13 @@ public class ContactListFragment extends Fragment implements ...@@ -187,13 +178,13 @@ public class ContactListFragment extends Fragment implements
final ContactListState state; final ContactListState state;
final OnClickListener listener; final OnClickListener listener;
if (isFilterEnabled) { if (isFilterEnabled) {
if (commonState == CommonState.online) if (commonState == CommonState.online) {
state = ContactListState.online; state = ContactListState.online;
else if (commonState == CommonState.roster } else if (commonState == CommonState.roster || commonState == CommonState.connecting) {
|| commonState == CommonState.connecting)
state = ContactListState.connecting; state = ContactListState.connecting;
else } else {
state = ContactListState.offline; state = ContactListState.offline;
}
text = R.string.application_state_no_online; text = R.string.application_state_no_online;
button = 0; button = 0;
listener = null; listener = null;
...@@ -202,25 +193,21 @@ public class ContactListFragment extends Fragment implements ...@@ -202,25 +193,21 @@ public class ContactListFragment extends Fragment implements
text = R.string.application_state_no_online; text = R.string.application_state_no_online;
button = R.string.application_action_no_online; button = R.string.application_action_no_online;
listener = new OnClickListener() { listener = new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
SettingsManager.setContactsShowOffline(true); SettingsManager.setContactsShowOffline(true);
adapter.onChange(); adapter.onChange();
} }
}; };
} else if (commonState == CommonState.online) { } else if (commonState == CommonState.online) {
state = ContactListState.online; state = ContactListState.online;
text = R.string.application_state_no_contacts; text = R.string.application_state_no_contacts;
button = R.string.application_action_no_contacts; button = R.string.application_action_no_contacts;
listener = new OnClickListener() { listener = new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
startActivity(ContactAdd.createIntent(getActivity())); startActivity(ContactAdd.createIntent(getActivity()));
} }
}; };
} else if (commonState == CommonState.roster) { } else if (commonState == CommonState.roster) {
state = ContactListState.connecting; state = ContactListState.connecting;
...@@ -237,49 +224,41 @@ public class ContactListFragment extends Fragment implements ...@@ -237,49 +224,41 @@ public class ContactListFragment extends Fragment implements
text = R.string.application_state_waiting; text = R.string.application_state_waiting;
button = R.string.application_action_waiting; button = R.string.application_action_waiting;
listener = new OnClickListener() { listener = new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
ConnectionManager.getInstance().updateConnections(true); ConnectionManager.getInstance().updateConnections(true);
} }
}; };
} else if (commonState == CommonState.offline) { } else if (commonState == CommonState.offline) {
state = ContactListState.offline; state = ContactListState.offline;
text = R.string.application_state_offline; text = R.string.application_state_offline;
button = R.string.application_action_offline; button = R.string.application_action_offline;
listener = new OnClickListener() { listener = new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
AccountManager.getInstance().setStatus( AccountManager.getInstance().setStatus(
StatusMode.available, null); StatusMode.available, null);
} }
}; };
} else if (commonState == CommonState.disabled) { } else if (commonState == CommonState.disabled) {
state = ContactListState.offline; state = ContactListState.offline;
text = R.string.application_state_disabled; text = R.string.application_state_disabled;
button = R.string.application_action_disabled; button = R.string.application_action_disabled;
listener = new OnClickListener() { listener = new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
startActivity(AccountList.createIntent(getActivity())); startActivity(AccountList.createIntent(getActivity()));
} }
}; };
} else if (commonState == CommonState.empty) { } else if (commonState == CommonState.empty) {
state = ContactListState.offline; state = ContactListState.offline;
text = R.string.application_state_empty; text = R.string.application_state_empty;
button = R.string.application_action_empty; button = R.string.application_action_empty;
listener = new OnClickListener() { listener = new OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
startActivity(AccountAdd.createIntent(getActivity())); startActivity(AccountAdd.createIntent(getActivity()));
} }
}; };
} else { } else {
throw new IllegalStateException(); throw new IllegalStateException();
...@@ -291,9 +270,10 @@ public class ContactListFragment extends Fragment implements ...@@ -291,9 +270,10 @@ public class ContactListFragment extends Fragment implements
} else if (state == ContactListState.connecting) { } else if (state == ContactListState.connecting) {
connectedView.setVisibility(View.VISIBLE); connectedView.setVisibility(View.VISIBLE);
disconnectedView.setVisibility(View.VISIBLE); disconnectedView.setVisibility(View.VISIBLE);
if (disconnectedView.getAnimation() == null) if (disconnectedView.getAnimation() == null) {
disconnectedView.startAnimation(animation); disconnectedView.startAnimation(animation);
} else if (state == ContactListState.online) { }
} else {
connectedView.setVisibility(View.VISIBLE); connectedView.setVisibility(View.VISIBLE);
disconnectedView.setVisibility(View.INVISIBLE); disconnectedView.setVisibility(View.INVISIBLE);
disconnectedView.clearAnimation(); disconnectedView.clearAnimation();
...@@ -312,12 +292,9 @@ public class ContactListFragment extends Fragment implements ...@@ -312,12 +292,9 @@ public class ContactListFragment extends Fragment implements
* Force stop contact list updates before pause or application close. * Force stop contact list updates before pause or application close.
*/ */
void unregisterListeners() { void unregisterListeners() {
Application.getInstance().removeUIListener( Application.getInstance().removeUIListener(OnAccountChangedListener.class, this);
OnAccountChangedListener.class, this); Application.getInstance().removeUIListener(OnContactChangedListener.class, this);
Application.getInstance().removeUIListener( Application.getInstance().removeUIListener(OnChatChangedListener.class, this);
OnContactChangedListener.class, this);
Application.getInstance().removeUIListener(OnChatChangedListener.class,
this);
adapter.removeRefreshRequests(); adapter.removeRefreshRequests();
} }
...@@ -337,10 +314,8 @@ public class ContactListFragment extends Fragment implements ...@@ -337,10 +314,8 @@ public class ContactListFragment extends Fragment implements
void scrollTo(String account) { void scrollTo(String account) {
long count = listView.getCount(); long count = listView.getCount();
for (int position = 0; position < (int) count; position++) { for (int position = 0; position < (int) count; position++) {
BaseEntity baseEntity = (BaseEntity) listView BaseEntity baseEntity = (BaseEntity) listView.getItemAtPosition(position);
.getItemAtPosition(position); if (baseEntity != null && baseEntity instanceof AccountConfiguration
if (baseEntity != null
&& baseEntity instanceof AccountConfiguration
&& baseEntity.getAccount().equals(account)) { && baseEntity.getAccount().equals(account)) {
stopMovement(); stopMovement();
listView.setSelection(position); listView.setSelection(position);
...@@ -355,10 +330,11 @@ public class ContactListFragment extends Fragment implements ...@@ -355,10 +330,11 @@ public class ContactListFragment extends Fragment implements
* @param account * @param account
*/ */
void setSelectedAccount(String account) { void setSelectedAccount(String account) {
if (account.equals(AccountManager.getInstance().getSelectedAccount())) if (account.equals(AccountManager.getInstance().getSelectedAccount())) {
SettingsManager.setContactsSelectedAccount(""); SettingsManager.setContactsSelectedAccount("");
else } else {
SettingsManager.setContactsSelectedAccount(account); SettingsManager.setContactsSelectedAccount(account);
}
stopMovement(); stopMovement();
adapter.onChange(); adapter.onChange();
} }
...@@ -367,8 +343,9 @@ public class ContactListFragment extends Fragment implements ...@@ -367,8 +343,9 @@ public class ContactListFragment extends Fragment implements
* Scroll to the top of contact list. * Scroll to the top of contact list.
*/ */
void scrollUp() { void scrollUp() {
if (listView.getCount() > 0) if (listView.getCount() > 0) {
listView.setSelection(0); listView.setSelection(0);
}
stopMovement(); stopMovement();
} }
...@@ -383,9 +360,7 @@ public class ContactListFragment extends Fragment implements ...@@ -383,9 +360,7 @@ public class ContactListFragment extends Fragment implements
} }
public interface OnContactClickListener { public interface OnContactClickListener {
void onContactClick(AbstractContact contact); void onContactClick(AbstractContact contact);
} }
} }
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
*/ */
package com.xabber.android.ui.adapter; package com.xabber.android.ui.adapter;
import java.util.ArrayList;
import java.util.Collections;
import android.app.Activity; import android.app.Activity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
...@@ -24,12 +21,14 @@ import android.view.View.OnClickListener; ...@@ -24,12 +21,14 @@ import android.view.View.OnClickListener;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.xabber.android.data.SettingsManager;
import com.xabber.android.data.account.AccountManager; import com.xabber.android.data.account.AccountManager;
import com.xabber.android.data.account.StatusMode; import com.xabber.android.data.account.StatusMode;
import com.xabber.android.data.extension.avatar.AvatarManager; import com.xabber.android.data.extension.avatar.AvatarManager;
import com.xabber.androiddev.R; import com.xabber.androiddev.R;
import java.util.ArrayList;
import java.util.Collections;
/** /**
* Adapter for the list of accounts in the title of contact list. * Adapter for the list of accounts in the title of contact list.
* *
...@@ -60,7 +59,7 @@ public class AccountToggleAdapter implements UpdatableAdapter { ...@@ -60,7 +59,7 @@ public class AccountToggleAdapter implements UpdatableAdapter {
this.activity = activity; this.activity = activity;
this.onClickListener = onClickListener; this.onClickListener = onClickListener;
this.linearLayout = linearLayout; this.linearLayout = linearLayout;
accounts = new ArrayList<String>(); accounts = new ArrayList<>();
} }
/** /**
...@@ -76,48 +75,36 @@ public class AccountToggleAdapter implements UpdatableAdapter { ...@@ -76,48 +75,36 @@ public class AccountToggleAdapter implements UpdatableAdapter {
final LayoutInflater inflater = (LayoutInflater) activity final LayoutInflater inflater = (LayoutInflater) activity
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); .getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
while (linearLayout.getChildCount() < size) { while (linearLayout.getChildCount() < size) {
final View view = inflater.inflate(R.layout.account_toggler_item, final View view = inflater.inflate(R.layout.account_toggler_item, linearLayout, false);
linearLayout, false);
linearLayout.addView(view); linearLayout.addView(view);
final AccountViewHolder accountViewHolder = new AccountViewHolder( final AccountViewHolder accountViewHolder = new AccountViewHolder(view);
view);
view.setTag(accountViewHolder); view.setTag(accountViewHolder);
activity.registerForContextMenu(accountViewHolder.statusMode); activity.registerForContextMenu(accountViewHolder.statusMode);
accountViewHolder.statusMode.setOnClickListener(onClickListener); accountViewHolder.statusMode.setOnClickListener(onClickListener);
} }
while (linearLayout.getChildCount() > size) while (linearLayout.getChildCount() > size) {
linearLayout.removeViewAt(size); linearLayout.removeViewAt(size);
}
onChange(); onChange();
} }
@Override @Override
public void onChange() { public void onChange() {
boolean contactsShowAccounts = SettingsManager.contactsShowAccounts();
String selected = AccountManager.getInstance().getSelectedAccount(); String selected = AccountManager.getInstance().getSelectedAccount();
for (int index = 0; index < accounts.size(); index++) { for (int index = 0; index < accounts.size(); index++) {
final View view = linearLayout.getChildAt(index); final View view = linearLayout.getChildAt(index);
final AccountViewHolder accountViewHolder = (AccountViewHolder) view final AccountViewHolder accountViewHolder = (AccountViewHolder) view.getTag();
.getTag();
final String account = accounts.get(index); final String account = accounts.get(index);
StatusMode statusMode = AccountManager.getInstance() StatusMode statusMode = AccountManager.getInstance().getAccount(account).getDisplayStatusMode();
.getAccount(account).getDisplayStatusMode(); int colorLevel = AccountManager.getInstance().getColorLevel(account);
int colorLevel = AccountManager.getInstance()
.getColorLevel(account);
view.getBackground().setLevel(colorLevel); view.getBackground().setLevel(colorLevel);
if (contactsShowAccounts) if (selected == null || account.equals(selected)) {
accountViewHolder.statusMode
.setBackgroundResource(R.drawable.account_border);
else
accountViewHolder.statusMode
.setBackgroundResource(R.drawable.account_border_persistent);
if (selected == null || account.equals(selected))
accountViewHolder.disabled.setVisibility(View.GONE); accountViewHolder.disabled.setVisibility(View.GONE);
else } else {
accountViewHolder.disabled.setVisibility(View.VISIBLE); accountViewHolder.disabled.setVisibility(View.VISIBLE);
accountViewHolder.statusMode.getBackground().setLevel(colorLevel); }
accountViewHolder.statusMode.setImageLevel(statusMode.ordinal()); accountViewHolder.statusMode.setImageLevel(statusMode.ordinal());
accountViewHolder.avatar.setImageDrawable(AvatarManager accountViewHolder.avatar.setImageDrawable(AvatarManager.getInstance().getAccountAvatar(account));
.getInstance().getAccountAvatar(account));
} }
} }
...@@ -137,11 +124,14 @@ public class AccountToggleAdapter implements UpdatableAdapter { ...@@ -137,11 +124,14 @@ public class AccountToggleAdapter implements UpdatableAdapter {
* @return The data for the specified view. * @return The data for the specified view.
*/ */
public String getItemForView(View view) { public String getItemForView(View view) {
if (view.getId() == R.id.status_mode) if (view.getId() == R.id.status_mode) {
view = (View) view.getParent(); view = (View) view.getParent();
for (int index = 0; index < linearLayout.getChildCount(); index++) }
if (view == linearLayout.getChildAt(index)) for (int index = 0; index < linearLayout.getChildCount(); index++) {
if (view == linearLayout.getChildAt(index)) {
return accounts.get(index); return accounts.get(index);
}
}
return null; return null;
} }
......
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
*/ */
package com.xabber.android.ui.adapter; package com.xabber.android.ui.adapter;
import java.util.ArrayList;
import java.util.Locale;
import android.app.Activity; import android.app.Activity;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -27,6 +24,9 @@ import android.widget.Filterable; ...@@ -27,6 +24,9 @@ import android.widget.Filterable;
import com.xabber.android.data.entity.BaseEntity; import com.xabber.android.data.entity.BaseEntity;
import com.xabber.android.data.roster.AbstractContact; import com.xabber.android.data.roster.AbstractContact;
import java.util.ArrayList;
import java.util.Locale;
/** /**
* Base adapter for the list of contacts. * Base adapter for the list of contacts.
* *
...@@ -62,20 +62,13 @@ public abstract class BaseContactAdapter<Inflater extends BaseContactInflater> ...@@ -62,20 +62,13 @@ public abstract class BaseContactAdapter<Inflater extends BaseContactInflater>
public BaseContactAdapter(Activity activity, Inflater inflater) { public BaseContactAdapter(Activity activity, Inflater inflater) {
this.activity = activity; this.activity = activity;
this.locale = Locale.getDefault(); this.locale = Locale.getDefault();
this.baseEntities = new ArrayList<BaseEntity>(); this.baseEntities = new ArrayList<>();
this.inflater = inflater; this.inflater = inflater;
inflater.setAdapter(this); inflater.setAdapter(this);
contactFilter = null; contactFilter = null;
filterString = null; filterString = null;
} }
/**
* @return View inflater.
*/
public Inflater getInflater() {
return inflater;
}
@Override @Override
public void onChange() { public void onChange() {
notifyDataSetChanged(); notifyDataSetChanged();
...@@ -111,8 +104,9 @@ public abstract class BaseContactAdapter<Inflater extends BaseContactInflater> ...@@ -111,8 +104,9 @@ public abstract class BaseContactAdapter<Inflater extends BaseContactInflater>
@Override @Override
public Filter getFilter() { public Filter getFilter() {
if (contactFilter == null) if (contactFilter == null) {
contactFilter = new ContactFilter(); contactFilter = new ContactFilter();
}
return contactFilter; return contactFilter;
} }
...@@ -126,10 +120,11 @@ public abstract class BaseContactAdapter<Inflater extends BaseContactInflater> ...@@ -126,10 +120,11 @@ public abstract class BaseContactAdapter<Inflater extends BaseContactInflater>
@Override @Override
protected void publishResults(CharSequence constraint, protected void publishResults(CharSequence constraint,
FilterResults results) { FilterResults results) {
if (constraint == null || constraint.length() == 0) if (constraint == null || constraint.length() == 0) {
filterString = null; filterString = null;
else } else {
filterString = constraint.toString().toLowerCase(locale); filterString = constraint.toString().toLowerCase(locale);
}
onChange(); onChange();
} }
......
...@@ -59,14 +59,11 @@ public abstract class BaseContactInflater { ...@@ -59,14 +59,11 @@ public abstract class BaseContactInflater {
public BaseContactInflater(Activity activity) { public BaseContactInflater(Activity activity) {
this.activity = activity; this.activity = activity;
layoutInflater = (LayoutInflater) activity layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); avatarInflaterHelper = AbstractAvatarInflaterHelper.createAbstractContactInflaterHelper();
avatarInflaterHelper = AbstractAvatarInflaterHelper
.createAbstractContactInflaterHelper(); Bitmap bitmap = BitmapFactory.decodeResource(activity.getResources(), R.drawable.shadow);
shadowDrawable = new BitmapDrawable(activity.getResources(), bitmap);
Bitmap bitmap = BitmapFactory.decodeResource(activity.getResources(),
R.drawable.shadow);
shadowDrawable = new BitmapDrawable(bitmap);
shadowDrawable.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT); shadowDrawable.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);
} }
...@@ -115,19 +112,18 @@ public abstract class BaseContactInflater { ...@@ -115,19 +112,18 @@ public abstract class BaseContactInflater {
*/ */
public void getView(View view, AbstractContact abstractContact) { public void getView(View view, AbstractContact abstractContact) {
final ViewHolder viewHolder = (ViewHolder) view.getTag(); final ViewHolder viewHolder = (ViewHolder) view.getTag();
if (abstractContact.isConnected()) if (abstractContact.isConnected()) {
viewHolder.shadow.setVisibility(View.GONE); viewHolder.shadow.setVisibility(View.GONE);
else } else {
viewHolder.shadow.setVisibility(View.VISIBLE); viewHolder.shadow.setVisibility(View.VISIBLE);
}
viewHolder.color.setImageLevel(abstractContact.getColorLevel()); viewHolder.color.setImageLevel(abstractContact.getColorLevel());
if (SettingsManager.contactsShowAvatars()) { if (SettingsManager.contactsShowAvatars()) {
viewHolder.avatar.setVisibility(View.VISIBLE); viewHolder.avatar.setVisibility(View.VISIBLE);
viewHolder.avatar.setImageDrawable(abstractContact viewHolder.avatar.setImageDrawable(abstractContact.getAvatarForContactList());
.getAvatarForContactList()); avatarInflaterHelper.updateAvatar(viewHolder.avatar, abstractContact);
avatarInflaterHelper.updateAvatar(viewHolder.avatar,
abstractContact);
((RelativeLayout.LayoutParams) viewHolder.panel.getLayoutParams()) ((RelativeLayout.LayoutParams) viewHolder.panel.getLayoutParams())
.addRule(RelativeLayout.RIGHT_OF, R.id.avatar); .addRule(RelativeLayout.RIGHT_OF, R.id.avatar);
} else { } else {
...@@ -140,14 +136,12 @@ public abstract class BaseContactInflater { ...@@ -140,14 +136,12 @@ public abstract class BaseContactInflater {
final String statusText = getStatusText(abstractContact); final String statusText = getStatusText(abstractContact);
if ("".equals(statusText)) { if ("".equals(statusText)) {
viewHolder.name.getLayoutParams().height = activity.getResources() viewHolder.name.getLayoutParams().height = activity.getResources()
.getDimensionPixelSize( .getDimensionPixelSize(R.dimen.contact_name_height_hide_status);
R.dimen.contact_name_height_hide_status);
viewHolder.name.setGravity(Gravity.CENTER_VERTICAL); viewHolder.name.setGravity(Gravity.CENTER_VERTICAL);
viewHolder.status.setVisibility(View.GONE); viewHolder.status.setVisibility(View.GONE);
} else { } else {
viewHolder.name.getLayoutParams().height = activity.getResources() viewHolder.name.getLayoutParams().height = activity.getResources()
.getDimensionPixelSize( .getDimensionPixelSize(R.dimen.contact_name_height_show_status);
R.dimen.contact_name_height_show_status);
viewHolder.name.setGravity(Gravity.BOTTOM); viewHolder.name.setGravity(Gravity.BOTTOM);
viewHolder.status.setText(statusText); viewHolder.status.setText(statusText);
viewHolder.status.setVisibility(View.VISIBLE); viewHolder.status.setVisibility(View.VISIBLE);
......
...@@ -185,19 +185,6 @@ public class ChatViewerAdapter extends FragmentStatePagerAdapter { ...@@ -185,19 +185,6 @@ public class ChatViewerAdapter extends FragmentStatePagerAdapter {
public void onChatViewAdapterFinishUpdate(); public void onChatViewAdapterFinishUpdate();
} }
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
if (getCurrentFragment() != object) {
currentFragment = ((Fragment) object);
}
super.setPrimaryItem(container, position, object);
}
public Fragment getCurrentFragment() {
return currentFragment;
}
public ArrayList<AbstractChat> getActiveChats() { public ArrayList<AbstractChat> getActiveChats() {
return activeChats; return activeChats;
} }
......
...@@ -14,14 +14,6 @@ ...@@ -14,14 +14,6 @@
*/ */
package com.xabber.android.ui.adapter; package com.xabber.android.ui.adapter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Map.Entry;
import java.util.TreeMap;
import android.app.Activity; import android.app.Activity;
import android.os.Handler; import android.os.Handler;
import android.widget.ListView; import android.widget.ListView;
...@@ -39,14 +31,21 @@ import com.xabber.android.data.roster.GroupManager; ...@@ -39,14 +31,21 @@ import com.xabber.android.data.roster.GroupManager;
import com.xabber.android.data.roster.RosterContact; import com.xabber.android.data.roster.RosterContact;
import com.xabber.android.data.roster.RosterManager; import com.xabber.android.data.roster.RosterManager;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Map.Entry;
import java.util.TreeMap;
/** /**
* Adapter for contact list in the main activity. * Adapter for contact list in the main activity.
* *
* @author alexander.ivanov * @author alexander.ivanov
*/ */
public class ContactListAdapter extends public class ContactListAdapter extends GroupedContactAdapter<ChatContactInflater, GroupManager>
GroupedContactAdapter<ChatContactInflater, GroupManager> implements implements Runnable {
Runnable {
/** /**
* Number of milliseconds between lazy refreshes. * Number of milliseconds between lazy refreshes.
...@@ -71,7 +70,7 @@ public class ContactListAdapter extends ...@@ -71,7 +70,7 @@ public class ContactListAdapter extends
/** /**
* Whether refresh is in progress. * Whether refresh is in progress.
*/ */
private boolean refreshInProgess; private boolean refreshInProgress;
/** /**
* Minimal time when next refresh can be executed. * Minimal time when next refresh can be executed.
...@@ -80,15 +79,14 @@ public class ContactListAdapter extends ...@@ -80,15 +79,14 @@ public class ContactListAdapter extends
private final OnContactListChangedListener listener; private final OnContactListChangedListener listener;
public ContactListAdapter(Activity activity, ListView listView, public ContactListAdapter(
OnContactListChangedListener listener) { Activity activity, ListView listView, OnContactListChangedListener listener) {
super(activity, listView, new ChatContactInflater(activity), super(activity, listView, new ChatContactInflater(activity), GroupManager.getInstance());
GroupManager.getInstance());
this.listener = listener; this.listener = listener;
handler = new Handler(); handler = new Handler();
refreshLock = new Object(); refreshLock = new Object();
refreshRequested = false; refreshRequested = false;
refreshInProgess = false; refreshInProgress = false;
nextRefresh = new Date(); nextRefresh = new Date();
} }
...@@ -97,11 +95,12 @@ public class ContactListAdapter extends ...@@ -97,11 +95,12 @@ public class ContactListAdapter extends
*/ */
public void refreshRequest() { public void refreshRequest() {
synchronized (refreshLock) { synchronized (refreshLock) {
if (refreshRequested) if (refreshRequested) {
return; return;
if (refreshInProgess) }
if (refreshInProgress) {
refreshRequested = true; refreshRequested = true;
else { } else {
long delay = nextRefresh.getTime() - new Date().getTime(); long delay = nextRefresh.getTime() - new Date().getTime();
handler.postDelayed(this, delay > 0 ? delay : 0); handler.postDelayed(this, delay > 0 ? delay : 0);
} }
...@@ -114,7 +113,7 @@ public class ContactListAdapter extends ...@@ -114,7 +113,7 @@ public class ContactListAdapter extends
public void removeRefreshRequests() { public void removeRefreshRequests() {
synchronized (refreshLock) { synchronized (refreshLock) {
refreshRequested = false; refreshRequested = false;
refreshInProgess = false; refreshInProgress = false;
handler.removeCallbacks(this); handler.removeCallbacks(this);
} }
} }
...@@ -123,32 +122,25 @@ public class ContactListAdapter extends ...@@ -123,32 +122,25 @@ public class ContactListAdapter extends
public void onChange() { public void onChange() {
synchronized (refreshLock) { synchronized (refreshLock) {
refreshRequested = false; refreshRequested = false;
refreshInProgess = true; refreshInProgress = true;
handler.removeCallbacks(this); handler.removeCallbacks(this);
} }
final Collection<RosterContact> rosterContacts = RosterManager final Collection<RosterContact> rosterContacts = RosterManager.getInstance().getContacts();
.getInstance().getContacts();
final boolean showOffline = SettingsManager.contactsShowOffline(); final boolean showOffline = SettingsManager.contactsShowOffline();
final boolean showGroups = SettingsManager.contactsShowGroups(); final boolean showGroups = SettingsManager.contactsShowGroups();
final boolean showEmptyGroups = SettingsManager final boolean showEmptyGroups = SettingsManager.contactsShowEmptyGroups();
.contactsShowEmptyGroups(); final boolean showActiveChats = SettingsManager.contactsShowActiveChats();
final boolean showActiveChats = SettingsManager final boolean stayActiveChats = SettingsManager.contactsStayActiveChats();
.contactsShowActiveChats();
final boolean stayActiveChats = SettingsManager
.contactsStayActiveChats();
final boolean showAccounts = SettingsManager.contactsShowAccounts(); final boolean showAccounts = SettingsManager.contactsShowAccounts();
final Comparator<AbstractContact> comparator = SettingsManager final Comparator<AbstractContact> comparator = SettingsManager.contactsOrder();
.contactsOrder(); final CommonState commonState = AccountManager.getInstance().getCommonState();
final CommonState commonState = AccountManager.getInstance() final String selectedAccount = AccountManager.getInstance().getSelectedAccount();
.getCommonState();
final String selectedAccount = AccountManager.getInstance()
.getSelectedAccount();
/** /**
* Accounts. * Accounts.
*/ */
final TreeMap<String, AccountConfiguration> accounts = new TreeMap<String, AccountConfiguration>(); final TreeMap<String, AccountConfiguration> accounts = new TreeMap<>();
/** /**
* Groups. * Groups.
...@@ -168,7 +160,7 @@ public class ContactListAdapter extends ...@@ -168,7 +160,7 @@ public class ContactListAdapter extends
/** /**
* List of rooms and active chats grouped by users inside accounts. * List of rooms and active chats grouped by users inside accounts.
*/ */
final TreeMap<String, TreeMap<String, AbstractChat>> abstractChats = new TreeMap<String, TreeMap<String, AbstractChat>>(); final TreeMap<String, TreeMap<String, AbstractChat>> abstractChats = new TreeMap<>();
/** /**
* Whether there is at least one contact. * Whether there is at least one contact.
...@@ -180,18 +172,17 @@ public class ContactListAdapter extends ...@@ -180,18 +172,17 @@ public class ContactListAdapter extends
*/ */
boolean hasVisibleContacts = false; boolean hasVisibleContacts = false;
for (String account : AccountManager.getInstance().getAccounts()) for (String account : AccountManager.getInstance().getAccounts()) {
accounts.put(account, null); accounts.put(account, null);
}
for (AbstractChat abstractChat : MessageManager.getInstance() for (AbstractChat abstractChat : MessageManager.getInstance().getChats()) {
.getChats()) {
if ((abstractChat instanceof RoomChat || abstractChat.isActive()) if ((abstractChat instanceof RoomChat || abstractChat.isActive())
&& accounts.containsKey(abstractChat.getAccount())) { && accounts.containsKey(abstractChat.getAccount())) {
final String account = abstractChat.getAccount(); final String account = abstractChat.getAccount();
TreeMap<String, AbstractChat> users = abstractChats TreeMap<String, AbstractChat> users = abstractChats.get(account);
.get(account);
if (users == null) { if (users == null) {
users = new TreeMap<String, AbstractChat>(); users = new TreeMap<>();
abstractChats.put(account, users); abstractChats.put(account, users);
} }
users.put(abstractChat.getUser(), abstractChat); users.put(abstractChat.getUser(), abstractChat);
...@@ -203,77 +194,82 @@ public class ContactListAdapter extends ...@@ -203,77 +194,82 @@ public class ContactListAdapter extends
if (showAccounts) { if (showAccounts) {
groups = null; groups = null;
contacts = null; contacts = null;
for (Entry<String, AccountConfiguration> entry : accounts for (Entry<String, AccountConfiguration> entry : accounts.entrySet()) {
.entrySet()) {
entry.setValue(new AccountConfiguration(entry.getKey(), entry.setValue(new AccountConfiguration(entry.getKey(),
GroupManager.IS_ACCOUNT, groupStateProvider)); GroupManager.IS_ACCOUNT, groupStateProvider));
} }
} else { } else {
if (showGroups) { if (showGroups) {
groups = new TreeMap<String, GroupConfiguration>(); groups = new TreeMap<>();
contacts = null; contacts = null;
} else { } else {
groups = null; groups = null;
contacts = new ArrayList<AbstractContact>(); contacts = new ArrayList<>();
} }
} }
if (showActiveChats) if (showActiveChats) {
activeChats = new GroupConfiguration(GroupManager.NO_ACCOUNT, activeChats = new GroupConfiguration(GroupManager.NO_ACCOUNT,
GroupManager.ACTIVE_CHATS, groupStateProvider); GroupManager.ACTIVE_CHATS, groupStateProvider);
else } else {
activeChats = null; activeChats = null;
}
// Build structure. // Build structure.
for (RosterContact rosterContact : rosterContacts) { for (RosterContact rosterContact : rosterContacts) {
if (!rosterContact.isEnabled()) if (!rosterContact.isEnabled()) {
continue; continue;
}
hasContacts = true; hasContacts = true;
final boolean online = rosterContact.getStatusMode().isOnline(); final boolean online = rosterContact.getStatusMode().isOnline();
final String account = rosterContact.getAccount(); final String account = rosterContact.getAccount();
final TreeMap<String, AbstractChat> users = abstractChats final TreeMap<String, AbstractChat> users = abstractChats.get(account);
.get(account);
final AbstractChat abstractChat; final AbstractChat abstractChat;
if (users == null) if (users == null) {
abstractChat = null; abstractChat = null;
else } else {
abstractChat = users.remove(rosterContact.getUser()); abstractChat = users.remove(rosterContact.getUser());
if (showActiveChats && abstractChat != null }
&& abstractChat.isActive()) { if (showActiveChats && abstractChat != null && abstractChat.isActive()) {
activeChats.setNotEmpty(); activeChats.setNotEmpty();
hasVisibleContacts = true; hasVisibleContacts = true;
if (activeChats.isExpanded()) if (activeChats.isExpanded()) {
activeChats.addAbstractContact(rosterContact); activeChats.addAbstractContact(rosterContact);
}
activeChats.increment(online); activeChats.increment(online);
if (!stayActiveChats || (!showAccounts && !showGroups)) if (!stayActiveChats || (!showAccounts && !showGroups)) {
continue; continue;
}
} }
if (selectedAccount != null && !selectedAccount.equals(account)) if (selectedAccount != null && !selectedAccount.equals(account)) {
continue; continue;
}
if (addContact(rosterContact, online, accounts, groups, if (addContact(rosterContact, online, accounts, groups,
contacts, showAccounts, showGroups, showOffline)) contacts, showAccounts, showGroups, showOffline)) {
hasVisibleContacts = true; hasVisibleContacts = true;
}
} }
for (TreeMap<String, AbstractChat> users : abstractChats.values()) for (TreeMap<String, AbstractChat> users : abstractChats.values()) {
for (AbstractChat abstractChat : users.values()) { for (AbstractChat abstractChat : users.values()) {
final AbstractContact abstractContact; final AbstractContact abstractContact;
if (abstractChat instanceof RoomChat) if (abstractChat instanceof RoomChat) {
abstractContact = new RoomContact( abstractContact = new RoomContact((RoomChat) abstractChat);
(RoomChat) abstractChat); } else {
else
abstractContact = new ChatContact(abstractChat); abstractContact = new ChatContact(abstractChat);
}
if (showActiveChats && abstractChat.isActive()) { if (showActiveChats && abstractChat.isActive()) {
activeChats.setNotEmpty(); activeChats.setNotEmpty();
hasVisibleContacts = true; hasVisibleContacts = true;
if (activeChats.isExpanded()) if (activeChats.isExpanded()) {
activeChats.addAbstractContact(abstractContact); activeChats.addAbstractContact(abstractContact);
}
activeChats.increment(false); activeChats.increment(false);
if (!stayActiveChats || (!showAccounts && !showGroups)) if (!stayActiveChats || (!showAccounts && !showGroups)) {
continue; continue;
}
} }
if (selectedAccount != null if (selectedAccount != null && !selectedAccount.equals(abstractChat.getAccount())) {
&& !selectedAccount.equals(abstractChat
.getAccount()))
continue; continue;
}
final String group; final String group;
final boolean online; final boolean online;
if (abstractChat instanceof RoomChat) { if (abstractChat instanceof RoomChat) {
...@@ -284,19 +280,20 @@ public class ContactListAdapter extends ...@@ -284,19 +280,20 @@ public class ContactListAdapter extends
online = false; online = false;
} }
hasVisibleContacts = true; hasVisibleContacts = true;
addContact(abstractContact, group, online, accounts, addContact(abstractContact, group, online, accounts, groups, contacts,
groups, contacts, showAccounts, showGroups); showAccounts, showGroups);
} }
}
// Remove empty groups, sort and apply structure. // Remove empty groups, sort and apply structure.
baseEntities.clear(); baseEntities.clear();
if (hasVisibleContacts) { if (hasVisibleContacts) {
if (showActiveChats) { if (showActiveChats) {
if (!activeChats.isEmpty()) { if (!activeChats.isEmpty()) {
if (showAccounts || showGroups) if (showAccounts || showGroups) {
baseEntities.add(activeChats); baseEntities.add(activeChats);
activeChats }
.sortAbstractContacts(ComparatorByChat.COMPARATOR_BY_CHAT); activeChats.sortAbstractContacts(ComparatorByChat.COMPARATOR_BY_CHAT);
baseEntities.addAll(activeChats.getAbstractContacts()); baseEntities.addAll(activeChats.getAbstractContacts());
} }
} }
...@@ -304,35 +301,30 @@ public class ContactListAdapter extends ...@@ -304,35 +301,30 @@ public class ContactListAdapter extends
for (AccountConfiguration rosterAccount : accounts.values()) { for (AccountConfiguration rosterAccount : accounts.values()) {
baseEntities.add(rosterAccount); baseEntities.add(rosterAccount);
if (showGroups) { if (showGroups) {
if (rosterAccount.isExpanded()) if (rosterAccount.isExpanded()) {
for (GroupConfiguration rosterConfiguration : rosterAccount for (GroupConfiguration rosterConfiguration : rosterAccount
.getSortedGroupConfigurations()) .getSortedGroupConfigurations()) {
if (showEmptyGroups if (showEmptyGroups || !rosterConfiguration.isEmpty()) {
|| !rosterConfiguration.isEmpty()) {
baseEntities.add(rosterConfiguration); baseEntities.add(rosterConfiguration);
rosterConfiguration rosterConfiguration.sortAbstractContacts(comparator);
.sortAbstractContacts(comparator); baseEntities.addAll(rosterConfiguration.getAbstractContacts());
baseEntities.addAll(rosterConfiguration
.getAbstractContacts());
} }
}
}
} else { } else {
rosterAccount.sortAbstractContacts(comparator); rosterAccount.sortAbstractContacts(comparator);
baseEntities.addAll(rosterAccount baseEntities.addAll(rosterAccount.getAbstractContacts());
.getAbstractContacts());
} }
} }
} else { } else {
if (showGroups) { if (showGroups) {
for (GroupConfiguration rosterConfiguration : groups for (GroupConfiguration rosterConfiguration : groups.values()) {
.values()) if (showEmptyGroups || !rosterConfiguration.isEmpty()) {
if (showEmptyGroups
|| !rosterConfiguration.isEmpty()) {
baseEntities.add(rosterConfiguration); baseEntities.add(rosterConfiguration);
rosterConfiguration rosterConfiguration.sortAbstractContacts(comparator);
.sortAbstractContacts(comparator); baseEntities.addAll(rosterConfiguration.getAbstractContacts());
baseEntities.addAll(rosterConfiguration
.getAbstractContacts());
} }
}
} else { } else {
Collections.sort(contacts, comparator); Collections.sort(contacts, comparator);
baseEntities.addAll(contacts); baseEntities.addAll(contacts);
...@@ -340,33 +332,35 @@ public class ContactListAdapter extends ...@@ -340,33 +332,35 @@ public class ContactListAdapter extends
} }
} }
} else { // Search } else { // Search
final ArrayList<AbstractContact> baseEntities = new ArrayList<AbstractContact>(); final ArrayList<AbstractContact> baseEntities = new ArrayList<>();
// Build structure. // Build structure.
for (RosterContact rosterContact : rosterContacts) { for (RosterContact rosterContact : rosterContacts) {
if (!rosterContact.isEnabled()) if (!rosterContact.isEnabled()) {
continue; continue;
}
final String account = rosterContact.getAccount(); final String account = rosterContact.getAccount();
final TreeMap<String, AbstractChat> users = abstractChats final TreeMap<String, AbstractChat> users = abstractChats.get(account);
.get(account); if (users != null) {
if (users != null)
users.remove(rosterContact.getUser()); users.remove(rosterContact.getUser());
if (rosterContact.getName().toLowerCase(locale) }
.contains(filterString)) if (rosterContact.getName().toLowerCase(locale).contains(filterString)) {
baseEntities.add(rosterContact); baseEntities.add(rosterContact);
}
} }
for (TreeMap<String, AbstractChat> users : abstractChats.values()) for (TreeMap<String, AbstractChat> users : abstractChats.values()) {
for (AbstractChat abstractChat : users.values()) { for (AbstractChat abstractChat : users.values()) {
final AbstractContact abstractContact; final AbstractContact abstractContact;
if (abstractChat instanceof RoomChat) if (abstractChat instanceof RoomChat) {
abstractContact = new RoomContact( abstractContact = new RoomContact((RoomChat) abstractChat);
(RoomChat) abstractChat); } else {
else
abstractContact = new ChatContact(abstractChat); abstractContact = new ChatContact(abstractChat);
if (abstractContact.getName().toLowerCase(locale) }
.contains(filterString)) if (abstractContact.getName().toLowerCase(locale).contains(filterString)) {
baseEntities.add(abstractContact); baseEntities.add(abstractContact);
}
} }
}
Collections.sort(baseEntities, comparator); Collections.sort(baseEntities, comparator);
this.baseEntities.clear(); this.baseEntities.clear();
this.baseEntities.addAll(baseEntities); this.baseEntities.addAll(baseEntities);
...@@ -379,10 +373,11 @@ public class ContactListAdapter extends ...@@ -379,10 +373,11 @@ public class ContactListAdapter extends
synchronized (refreshLock) { synchronized (refreshLock) {
nextRefresh = new Date(new Date().getTime() + REFRESH_INTERVAL); nextRefresh = new Date(new Date().getTime() + REFRESH_INTERVAL);
refreshInProgess = false; refreshInProgress = false;
handler.removeCallbacks(this); // Just to be sure. handler.removeCallbacks(this); // Just to be sure.
if (refreshRequested) if (refreshRequested) {
handler.postDelayed(this, REFRESH_INTERVAL); handler.postDelayed(this, REFRESH_INTERVAL);
}
} }
} }
......
...@@ -14,11 +14,6 @@ ...@@ -14,11 +14,6 @@
*/ */
package com.xabber.android.ui.adapter; package com.xabber.android.ui.adapter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.TreeMap;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
...@@ -38,6 +33,11 @@ import com.xabber.android.data.roster.GroupStateProvider; ...@@ -38,6 +33,11 @@ import com.xabber.android.data.roster.GroupStateProvider;
import com.xabber.android.data.roster.ShowOfflineMode; import com.xabber.android.data.roster.ShowOfflineMode;
import com.xabber.androiddev.R; import com.xabber.androiddev.R;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.TreeMap;
/** /**
* Provide grouping implementation for the list of contacts. * Provide grouping implementation for the list of contacts.
* *
...@@ -62,7 +62,7 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater ...@@ -62,7 +62,7 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
static final int TYPE_GROUP = 1; static final int TYPE_GROUP = 1;
static { static {
Collection<Group> groups = new ArrayList<Group>(1); Collection<Group> groups = new ArrayList<>(1);
groups.add(new Group() { groups.add(new Group() {
@Override @Override
public String getName() { public String getName() {
...@@ -95,28 +95,15 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater ...@@ -95,28 +95,15 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
public GroupedContactAdapter(Activity activity, ListView listView, public GroupedContactAdapter(Activity activity, ListView listView,
Inflater inflater, StateProvider groupStateProvider) { Inflater inflater, StateProvider groupStateProvider) {
super(activity, listView, inflater); super(activity, listView, inflater);
layoutInflater = (LayoutInflater) activity layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.groupStateProvider = groupStateProvider; this.groupStateProvider = groupStateProvider;
TypedArray typedArray; TypedArray typedArray;
typedArray = activity.getTheme().obtainStyledAttributes( typedArray = activity.getTheme().obtainStyledAttributes(R.styleable.ContactList);
R.styleable.ContactList); expanderAccountTextColor = typedArray.getColorStateList(R.styleable.ContactList_expanderAccountColor);
expanderAccountTextColor = typedArray expanderGroupTextColor = typedArray.getColorStateList(R.styleable.ContactList_expanderGroupColor);
.getColorStateList(R.styleable.ContactList_expanderAccountColor);
expanderGroupTextColor = typedArray
.getColorStateList(R.styleable.ContactList_expanderGroupColor);
typedArray.recycle(); typedArray.recycle();
} }
/**
* Returns group state provider.
*
* @return
*/
public StateProvider getGroupStateProvider() {
return groupStateProvider;
}
@Override @Override
public int getViewTypeCount() { public int getViewTypeCount() {
return 2; return 2;
...@@ -125,12 +112,13 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater ...@@ -125,12 +112,13 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
Object object = getItem(position); Object object = getItem(position);
if (object instanceof AbstractContact) if (object instanceof AbstractContact) {
return TYPE_CONTACT; return TYPE_CONTACT;
else if (object instanceof GroupConfiguration) } else if (object instanceof GroupConfiguration) {
return TYPE_GROUP; return TYPE_GROUP;
else } else {
throw new IllegalStateException(); throw new IllegalStateException();
}
} }
@Override @Override
...@@ -141,15 +129,12 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater ...@@ -141,15 +129,12 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
final View view; final View view;
final GroupViewHolder viewHolder; final GroupViewHolder viewHolder;
if (convertView == null) { if (convertView == null) {
view = layoutInflater.inflate(R.layout.base_group_item, parent, view = layoutInflater.inflate(R.layout.base_group_item, parent, false);
false); TypedArray typedArray = activity.obtainStyledAttributes(R.styleable.ContactList);
TypedArray typedArray = activity view.setBackgroundDrawable(
.obtainStyledAttributes(R.styleable.ContactList); typedArray.getDrawable(R.styleable.ContactList_expanderBackground));
view.setBackgroundDrawable(typedArray ((ImageView) view.findViewById(R.id.indicator)).setImageDrawable(
.getDrawable(R.styleable.ContactList_expanderBackground)); typedArray.getDrawable(R.styleable.ContactList_expanderIndicator));
((ImageView) view.findViewById(R.id.indicator))
.setImageDrawable(typedArray
.getDrawable(R.styleable.ContactList_expanderIndicator));
typedArray.recycle(); typedArray.recycle();
viewHolder = new GroupViewHolder(view); viewHolder = new GroupViewHolder(view);
...@@ -161,25 +146,23 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater ...@@ -161,25 +146,23 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
final GroupConfiguration configuration = (GroupConfiguration) getItem(position); final GroupConfiguration configuration = (GroupConfiguration) getItem(position);
final int level; final int level;
if (configuration instanceof AccountConfiguration) { if (configuration instanceof AccountConfiguration) {
level = AccountManager.getInstance().getColorLevel( level = AccountManager.getInstance().getColorLevel(configuration.getAccount());
configuration.getAccount());
viewHolder.name.setTextColor(expanderAccountTextColor); viewHolder.name.setTextColor(expanderAccountTextColor);
} else { } else {
level = AccountManager.getInstance().getColorCount(); level = AccountManager.getInstance().getColorCount();
viewHolder.name.setTextColor(expanderGroupTextColor); viewHolder.name.setTextColor(expanderGroupTextColor);
} }
view.getBackground().setLevel(level); view.getBackground().setLevel(level);
viewHolder.name.getBackground().setLevel( viewHolder.name.getBackground().setLevel(configuration.getShowOfflineMode().ordinal());
configuration.getShowOfflineMode().ordinal());
final String name = GroupManager.getInstance().getGroupName( final String name = GroupManager.getInstance().getGroupName(
configuration.getAccount(), configuration.getUser()); configuration.getAccount(), configuration.getUser());
viewHolder.name.setText(name + " (" + configuration.getOnline() viewHolder.name.setText(name + " (" + configuration.getOnline()
+ "/" + configuration.getTotal() + ")"); + "/" + configuration.getTotal() + ")");
viewHolder.indicator.setImageLevel(configuration.isExpanded() ? 1 viewHolder.indicator.setImageLevel(configuration.isExpanded() ? 1 : 0);
: 0);
return view; return view;
} else } else {
throw new IllegalStateException(); throw new IllegalStateException();
}
} }
/** /**
...@@ -191,10 +174,10 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater ...@@ -191,10 +174,10 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
*/ */
protected GroupConfiguration getGroupConfiguration( protected GroupConfiguration getGroupConfiguration(
AccountConfiguration accountConfiguration, String name) { AccountConfiguration accountConfiguration, String name) {
GroupConfiguration groupConfiguration = accountConfiguration GroupConfiguration groupConfiguration = accountConfiguration.getGroupConfiguration(name);
.getGroupConfiguration(name); if (groupConfiguration != null) {
if (groupConfiguration != null)
return groupConfiguration; return groupConfiguration;
}
groupConfiguration = new GroupConfiguration( groupConfiguration = new GroupConfiguration(
accountConfiguration.getAccount(), name, groupStateProvider); accountConfiguration.getAccount(), name, groupStateProvider);
accountConfiguration.addGroupConfiguration(groupConfiguration); accountConfiguration.addGroupConfiguration(groupConfiguration);
...@@ -211,10 +194,10 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater ...@@ -211,10 +194,10 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
protected GroupConfiguration getGroupConfiguration( protected GroupConfiguration getGroupConfiguration(
TreeMap<String, GroupConfiguration> groups, String name) { TreeMap<String, GroupConfiguration> groups, String name) {
GroupConfiguration groupConfiguration = groups.get(name); GroupConfiguration groupConfiguration = groups.get(name);
if (groupConfiguration != null) if (groupConfiguration != null) {
return groupConfiguration; return groupConfiguration;
groupConfiguration = new GroupConfiguration(GroupManager.NO_ACCOUNT, }
name, groupStateProvider); groupConfiguration = new GroupConfiguration(GroupManager.NO_ACCOUNT, name, groupStateProvider);
groups.put(name, groupConfiguration); groups.put(name, groupConfiguration);
return groupConfiguration; return groupConfiguration;
} }
...@@ -231,38 +214,39 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater ...@@ -231,38 +214,39 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
* @param showAccounts * @param showAccounts
* @param showGroups * @param showGroups
*/ */
protected void addContact(AbstractContact abstractContact, String group, protected void addContact(AbstractContact abstractContact, String group, boolean online,
boolean online, TreeMap<String, AccountConfiguration> accounts, TreeMap<String, AccountConfiguration> accounts, TreeMap<String, GroupConfiguration> groups,
TreeMap<String, GroupConfiguration> groups, ArrayList<AbstractContact> contacts, boolean showAccounts, boolean showGroups) {
ArrayList<AbstractContact> contacts, boolean showAccounts,
boolean showGroups) {
if (showAccounts) { if (showAccounts) {
final String account = abstractContact.getAccount(); final String account = abstractContact.getAccount();
final AccountConfiguration accountConfiguration; final AccountConfiguration accountConfiguration;
accountConfiguration = accounts.get(account); accountConfiguration = accounts.get(account);
if (accountConfiguration == null) if (accountConfiguration == null) {
return; return;
}
if (showGroups) { if (showGroups) {
GroupConfiguration groupConfiguration = getGroupConfiguration( GroupConfiguration groupConfiguration
accountConfiguration, group); = getGroupConfiguration(accountConfiguration, group);
if (accountConfiguration.isExpanded()) { if (accountConfiguration.isExpanded()) {
groupConfiguration.setNotEmpty(); groupConfiguration.setNotEmpty();
if (groupConfiguration.isExpanded()) if (groupConfiguration.isExpanded()) {
groupConfiguration.addAbstractContact(abstractContact); groupConfiguration.addAbstractContact(abstractContact);
}
} }
groupConfiguration.increment(online); groupConfiguration.increment(online);
} else { } else {
if (accountConfiguration.isExpanded()) if (accountConfiguration.isExpanded()) {
accountConfiguration.addAbstractContact(abstractContact); accountConfiguration.addAbstractContact(abstractContact);
}
} }
accountConfiguration.increment(online); accountConfiguration.increment(online);
} else { } else {
if (showGroups) { if (showGroups) {
GroupConfiguration groupConfiguration = getGroupConfiguration( GroupConfiguration groupConfiguration = getGroupConfiguration(groups, group);
groups, group);
groupConfiguration.setNotEmpty(); groupConfiguration.setNotEmpty();
if (groupConfiguration.isExpanded()) if (groupConfiguration.isExpanded()) {
groupConfiguration.addAbstractContact(abstractContact); groupConfiguration.addAbstractContact(abstractContact);
}
groupConfiguration.increment(online); groupConfiguration.increment(online);
} else { } else {
contacts.add(abstractContact); contacts.add(abstractContact);
...@@ -292,13 +276,14 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater ...@@ -292,13 +276,14 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
if (showAccounts) { if (showAccounts) {
final AccountConfiguration accountConfiguration; final AccountConfiguration accountConfiguration;
accountConfiguration = accounts.get(abstractContact.getAccount()); accountConfiguration = accounts.get(abstractContact.getAccount());
if (accountConfiguration == null) if (accountConfiguration == null) {
return hasVisible; return false;
}
if (showGroups) { if (showGroups) {
Collection<? extends Group> abstractGroups = abstractContact Collection<? extends Group> abstractGroups = abstractContact.getGroups();
.getGroups(); if (abstractGroups.size() == 0) {
if (abstractGroups.size() == 0)
abstractGroups = NO_GROUP_LIST; abstractGroups = NO_GROUP_LIST;
}
for (Group abstractGroup : abstractGroups) { for (Group abstractGroup : abstractGroups) {
GroupConfiguration groupConfiguration = getGroupConfiguration( GroupConfiguration groupConfiguration = getGroupConfiguration(
accountConfiguration, abstractGroup.getName()); accountConfiguration, abstractGroup.getName());
...@@ -316,41 +301,39 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater ...@@ -316,41 +301,39 @@ public abstract class GroupedContactAdapter<Inflater extends BaseContactInflater
hasVisible = true; hasVisible = true;
if (accountConfiguration.isExpanded()) { if (accountConfiguration.isExpanded()) {
groupConfiguration.setNotEmpty(); groupConfiguration.setNotEmpty();
if (groupConfiguration.isExpanded()) if (groupConfiguration.isExpanded()) {
groupConfiguration groupConfiguration.addAbstractContact(abstractContact);
.addAbstractContact(abstractContact); }
} }
} }
groupConfiguration.increment(online); groupConfiguration.increment(online);
} }
} else { } else {
if (online if (online || (accountConfiguration.getShowOfflineMode() == ShowOfflineMode.always)
|| (accountConfiguration.getShowOfflineMode() == ShowOfflineMode.always)
|| (accountConfiguration.getShowOfflineMode() == ShowOfflineMode.normal && showOffline)) { || (accountConfiguration.getShowOfflineMode() == ShowOfflineMode.normal && showOffline)) {
hasVisible = true; hasVisible = true;
if (accountConfiguration.isExpanded()) if (accountConfiguration.isExpanded()) {
accountConfiguration accountConfiguration.addAbstractContact(abstractContact);
.addAbstractContact(abstractContact); }
} }
} }
accountConfiguration.increment(online); accountConfiguration.increment(online);
} else { } else {
if (showGroups) { if (showGroups) {
Collection<? extends Group> abstractGroups = abstractContact Collection<? extends Group> abstractGroups = abstractContact.getGroups();
.getGroups(); if (abstractGroups.size() == 0) {
if (abstractGroups.size() == 0)
abstractGroups = NO_GROUP_LIST; abstractGroups = NO_GROUP_LIST;
}
for (Group abstractGroup : abstractGroups) { for (Group abstractGroup : abstractGroups) {
GroupConfiguration groupConfiguration = getGroupConfiguration( GroupConfiguration groupConfiguration
groups, abstractGroup.getName()); = getGroupConfiguration(groups, abstractGroup.getName());
if (online if (online || (groupConfiguration.getShowOfflineMode() == ShowOfflineMode.always)
|| (groupConfiguration.getShowOfflineMode() == ShowOfflineMode.always)
|| (groupConfiguration.getShowOfflineMode() == ShowOfflineMode.normal && showOffline)) { || (groupConfiguration.getShowOfflineMode() == ShowOfflineMode.normal && showOffline)) {
groupConfiguration.setNotEmpty(); groupConfiguration.setNotEmpty();
hasVisible = true; hasVisible = true;
if (groupConfiguration.isExpanded()) if (groupConfiguration.isExpanded()) {
groupConfiguration groupConfiguration.addAbstractContact(abstractContact);
.addAbstractContact(abstractContact); }
} }
groupConfiguration.increment(online); groupConfiguration.increment(online);
} }
......
...@@ -36,8 +36,7 @@ public abstract class SmoothContactAdapter<Inflater extends BaseContactInflater> ...@@ -36,8 +36,7 @@ public abstract class SmoothContactAdapter<Inflater extends BaseContactInflater>
*/ */
ListView listView; ListView listView;
public SmoothContactAdapter(Activity activity, ListView listView, public SmoothContactAdapter(Activity activity, ListView listView, Inflater inflater) {
Inflater inflater) {
super(activity, inflater); super(activity, inflater);
this.listView = listView; this.listView = listView;
} }
......
...@@ -43,7 +43,7 @@ public class AccountChooseDialogFragment extends AbstractDialogFragment { ...@@ -43,7 +43,7 @@ public class AccountChooseDialogFragment extends AbstractDialogFragment {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String account = (String) adapter.getItem(which); String account = (String) adapter.getItem(which);
OnChoosedListener listener = (OnChoosedListener) getActivity(); OnChoosedListener listener = (OnChoosedListener) getActivity();
listener.onChoosed(account, user, text); listener.onChoose(account, user, text);
} }
}); });
return builder; return builder;
...@@ -73,7 +73,7 @@ public class AccountChooseDialogFragment extends AbstractDialogFragment { ...@@ -73,7 +73,7 @@ public class AccountChooseDialogFragment extends AbstractDialogFragment {
public interface OnChoosedListener { public interface OnChoosedListener {
void onChoosed(String account, String user, String text); void onChoose(String account, String user, String text);
} }
......
...@@ -14,19 +14,19 @@ ...@@ -14,19 +14,19 @@
--> -->
<level-list xmlns:android="http://schemas.android.com/apk/res/android"> <level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:drawable="@drawable/account_background_1" android:drawable="@color/account_1"
android:minLevel="0" android:minLevel="0"
android:maxLevel="0" /> android:maxLevel="0" />
<item <item
android:drawable="@drawable/account_background_2" android:drawable="@color/account_2"
android:minLevel="1" android:minLevel="1"
android:maxLevel="1" /> android:maxLevel="1" />
<item <item
android:drawable="@drawable/account_background_3" android:drawable="@color/account_3"
android:minLevel="2" android:minLevel="2"
android:maxLevel="2" /> android:maxLevel="2" />
<item <item
android:drawable="@drawable/account_background_4" android:drawable="@color/account_4"
android:minLevel="3" android:minLevel="3"
android:maxLevel="3" /> android:maxLevel="3" />
</level-list> </level-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/account_border_1"
android:minLevel="0"
android:maxLevel="0" />
<item
android:drawable="@drawable/account_border_2"
android:minLevel="1"
android:maxLevel="1" />
<item
android:drawable="@drawable/account_border_3"
android:minLevel="2"
android:maxLevel="2" />
<item
android:drawable="@drawable/account_border_4"
android:minLevel="3"
android:maxLevel="3" />
</level-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="@drawable/account_border_1_pressed" />
<item
android:state_focused="true"
android:drawable="@drawable/account_border_1_pressed" />
<item
android:state_pressed="true"
android:drawable="@drawable/account_border_1_pressed" />
<item
android:drawable="@drawable/account_border_1_normal" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="@drawable/account_border_2_pressed" />
<item
android:state_focused="true"
android:drawable="@drawable/account_border_2_pressed" />
<item
android:state_pressed="true"
android:drawable="@drawable/account_border_2_pressed" />
<item
android:drawable="@drawable/account_border_2_normal" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="@drawable/account_border_3_pressed" />
<item
android:state_focused="true"
android:drawable="@drawable/account_border_3_pressed" />
<item
android:state_pressed="true"
android:drawable="@drawable/account_border_3_pressed" />
<item
android:drawable="@drawable/account_border_3_normal" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="@drawable/account_border_4_pressed" />
<item
android:state_focused="true"
android:drawable="@drawable/account_border_4_pressed" />
<item
android:state_pressed="true"
android:drawable="@drawable/account_border_4_pressed" />
<item
android:drawable="@drawable/account_border_4_normal" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/account_border_1_normal"
android:minLevel="0"
android:maxLevel="0" />
<item
android:drawable="@drawable/account_border_2_normal"
android:minLevel="1"
android:maxLevel="1" />
<item
android:drawable="@drawable/account_border_3_normal"
android:minLevel="2"
android:maxLevel="2" />
<item
android:drawable="@drawable/account_border_4_normal"
android:minLevel="3"
android:maxLevel="3" />
</level-list>
\ No newline at end of file
...@@ -14,19 +14,19 @@ ...@@ -14,19 +14,19 @@
--> -->
<level-list xmlns:android="http://schemas.android.com/apk/res/android"> <level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:drawable="@drawable/account_color_1" android:drawable="@color/account_1"
android:minLevel="0" android:minLevel="0"
android:maxLevel="0" /> android:maxLevel="0" />
<item <item
android:drawable="@drawable/account_color_2" android:drawable="@color/account_2"
android:minLevel="1" android:minLevel="1"
android:maxLevel="1" /> android:maxLevel="1" />
<item <item
android:drawable="@drawable/account_color_3" android:drawable="@color/account_3"
android:minLevel="2" android:minLevel="2"
android:maxLevel="2" /> android:maxLevel="2" />
<item <item
android:drawable="@drawable/account_color_4" android:drawable="@color/account_4"
android:minLevel="3" android:minLevel="3"
android:maxLevel="3" /> android:maxLevel="3" />
</level-list> </level-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/btn_status_mode_normal" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="false"
android:state_focused="false"
android:state_pressed="false"
android:drawable="@drawable/btn_title_back_normal" />
<item
android:drawable="@drawable/btn_title_back_pressed" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="false"
android:state_focused="false"
android:state_pressed="false"
android:drawable="@drawable/btn_title_back_pressed" />
<item
android:drawable="@drawable/btn_title_back_normal" />
</selector>
...@@ -14,15 +14,5 @@ ...@@ -14,15 +14,5 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item android:drawable="@color/account_1" />
android:state_pressed="true"
android:drawable="@drawable/expander_account_1_dark_pressed" />
<item
android:state_selected="true"
android:drawable="@drawable/expander_account_1_dark_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/expander_account_1_dark_focused" />
<item
android:drawable="@drawable/expander_account_1_dark_normal" />
</selector> </selector>
...@@ -14,15 +14,5 @@ ...@@ -14,15 +14,5 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item android:drawable="@color/account_1" />
android:state_pressed="true"
android:drawable="@drawable/expander_account_1_light_pressed" />
<item
android:state_selected="true"
android:drawable="@drawable/expander_account_1_light_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/expander_account_1_light_focused" />
<item
android:drawable="@drawable/expander_account_1_light_normal" />
</selector> </selector>
...@@ -14,15 +14,5 @@ ...@@ -14,15 +14,5 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item android:drawable="@color/account_2" />
android:state_pressed="true"
android:drawable="@drawable/expander_account_2_dark_pressed" />
<item
android:state_selected="true"
android:drawable="@drawable/expander_account_2_dark_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/expander_account_2_dark_focused" />
<item
android:drawable="@drawable/expander_account_2_dark_normal" />
</selector> </selector>
...@@ -14,15 +14,5 @@ ...@@ -14,15 +14,5 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item android:drawable="@color/account_2" />
android:state_pressed="true"
android:drawable="@drawable/expander_account_2_light_pressed" />
<item
android:state_selected="true"
android:drawable="@drawable/expander_account_2_light_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/expander_account_2_light_focused" />
<item
android:drawable="@drawable/expander_account_2_light_normal" />
</selector> </selector>
...@@ -14,15 +14,5 @@ ...@@ -14,15 +14,5 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item android:drawable="@color/account_3" />
android:state_pressed="true"
android:drawable="@drawable/expander_account_3_dark_pressed" />
<item
android:state_selected="true"
android:drawable="@drawable/expander_account_3_dark_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/expander_account_3_dark_focused" />
<item
android:drawable="@drawable/expander_account_3_dark_normal" />
</selector> </selector>
...@@ -14,15 +14,5 @@ ...@@ -14,15 +14,5 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item android:drawable="@color/account_3" />
android:state_pressed="true"
android:drawable="@drawable/expander_account_3_light_pressed" />
<item
android:state_selected="true"
android:drawable="@drawable/expander_account_3_light_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/expander_account_3_light_focused" />
<item
android:drawable="@drawable/expander_account_3_light_normal" />
</selector> </selector>
...@@ -14,15 +14,5 @@ ...@@ -14,15 +14,5 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item android:drawable="@color/account_4" />
android:state_pressed="true"
android:drawable="@drawable/expander_account_4_dark_pressed" />
<item
android:state_selected="true"
android:drawable="@drawable/expander_account_4_dark_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/expander_account_4_dark_focused" />
<item
android:drawable="@drawable/expander_account_4_dark_normal" />
</selector> </selector>
...@@ -14,15 +14,5 @@ ...@@ -14,15 +14,5 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item android:drawable="@color/account_4" />
android:state_pressed="true"
android:drawable="@drawable/expander_account_4_light_pressed" />
<item
android:state_selected="true"
android:drawable="@drawable/expander_account_4_light_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/expander_account_4_light_focused" />
<item
android:drawable="@drawable/expander_account_4_light_normal" />
</selector> </selector>
...@@ -14,15 +14,5 @@ ...@@ -14,15 +14,5 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item android:drawable="@color/material_blue_grey_900" />
android:state_pressed="true"
android:drawable="@drawable/expander_group_dark_pressed" />
<item
android:state_selected="true"
android:drawable="@drawable/expander_group_dark_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/expander_group_dark_focused" />
<item
android:drawable="@drawable/expander_group_dark_normal" />
</selector> </selector>
...@@ -15,14 +15,5 @@ ...@@ -15,14 +15,5 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:state_pressed="true" android:drawable="@color/material_blue_grey_900" />
android:drawable="@drawable/expander_group_light_pressed" />
<item
android:state_selected="true"
android:drawable="@drawable/expander_group_light_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/expander_group_light_focused" />
<item
android:drawable="@drawable/expander_group_light_normal" />
</selector> </selector>
...@@ -14,6 +14,6 @@ ...@@ -14,6 +14,6 @@
--> -->
<level-list xmlns:android="http://schemas.android.com/apk/res/android"> <level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/expander_indicator_dark_hidden" android:minLevel="0" android:maxLevel="0" /> <item android:drawable="@drawable/ic_arrow_drop_right_white_24dp" android:minLevel="0" android:maxLevel="0" />
<item android:drawable="@drawable/expander_indicator_dark_show" android:minLevel="1" android:maxLevel="1" /> <item android:drawable="@drawable/ic_arrow_drop_down_white_24dp" android:minLevel="1" android:maxLevel="1" />
</level-list> </level-list>
\ No newline at end of file
...@@ -14,6 +14,6 @@ ...@@ -14,6 +14,6 @@
--> -->
<level-list xmlns:android="http://schemas.android.com/apk/res/android"> <level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/expander_indicator_light_hidden" android:minLevel="0" android:maxLevel="0" /> <item android:drawable="@drawable/ic_arrow_drop_right_white_24dp" android:minLevel="0" android:maxLevel="0" />
<item android:drawable="@drawable/expander_indicator_light_show" android:minLevel="1" android:maxLevel="1" /> <item android:drawable="@drawable/ic_arrow_drop_down_white_24dp" android:minLevel="1" android:maxLevel="1" />
</level-list> </level-list>
\ No newline at end of file
...@@ -14,19 +14,19 @@ ...@@ -14,19 +14,19 @@
--> -->
<level-list xmlns:android="http://schemas.android.com/apk/res/android"> <level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:drawable="@drawable/title_account_background_1_dark" android:drawable="@color/account_1"
android:minLevel="0" android:minLevel="0"
android:maxLevel="0" /> android:maxLevel="0" />
<item <item
android:drawable="@drawable/title_account_background_2_dark" android:drawable="@color/account_2"
android:minLevel="1" android:minLevel="1"
android:maxLevel="1" /> android:maxLevel="1" />
<item <item
android:drawable="@drawable/title_account_background_3_dark" android:drawable="@color/account_3"
android:minLevel="2" android:minLevel="2"
android:maxLevel="2" /> android:maxLevel="2" />
<item <item
android:drawable="@drawable/title_account_background_4_dark" android:drawable="@color/account_4"
android:minLevel="3" android:minLevel="3"
android:maxLevel="3" /> android:maxLevel="3" />
</level-list> </level-list>
\ No newline at end of file
...@@ -14,19 +14,19 @@ ...@@ -14,19 +14,19 @@
--> -->
<level-list xmlns:android="http://schemas.android.com/apk/res/android"> <level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:drawable="@drawable/title_account_background_1_light" android:drawable="@color/account_1"
android:minLevel="0" android:minLevel="0"
android:maxLevel="0" /> android:maxLevel="0" />
<item <item
android:drawable="@drawable/title_account_background_2_light" android:drawable="@color/account_2"
android:minLevel="1" android:minLevel="1"
android:maxLevel="1" /> android:maxLevel="1" />
<item <item
android:drawable="@drawable/title_account_background_3_light" android:drawable="@color/account_3"
android:minLevel="2" android:minLevel="2"
android:maxLevel="2" /> android:maxLevel="2" />
<item <item
android:drawable="@drawable/title_account_background_4_light" android:drawable="@color/account_4"
android:minLevel="3" android:minLevel="3"
android:maxLevel="3" /> android:maxLevel="3" />
</level-list> </level-list>
\ No newline at end of file
...@@ -21,8 +21,11 @@ ...@@ -21,8 +21,11 @@
> >
<ImageView <ImageView
android:id="@+id/color" android:id="@+id/color"
android:layout_width="wrap_content" android:layout_width="4dp"
android:layout_height="@dimen/avatar_size" android:layout_height="@dimen/avatar_size"
android:layout_marginRight="3dp"
android:layout_marginEnd="3dp"
android:src="@drawable/account_color" android:src="@drawable/account_color"
/> />
<ImageView <ImageView
...@@ -34,7 +37,7 @@ ...@@ -34,7 +37,7 @@
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_weight="1" android:layout_weight="1"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingLeft="4dip" android:paddingLeft="4dip"
android:paddingRight="4dip" android:paddingRight="4dip"
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
android:id="@+id/status_mode" android:id="@+id/status_mode"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/account_border"
android:src="@drawable/ic_status_account" android:src="@drawable/ic_status_account"
android:clickable="true" android:clickable="true"
/> />
...@@ -38,6 +37,6 @@ ...@@ -38,6 +37,6 @@
android:id="@+id/disabled" android:id="@+id/disabled"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/account_border_disabled" android:src="@color/account_disabled"
/> />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -18,11 +18,16 @@ ...@@ -18,11 +18,16 @@
android:layout_height="@dimen/contact_list_item_height" android:layout_height="@dimen/contact_list_item_height"
android:paddingTop="@dimen/contact_list_item_padding_top" android:paddingTop="@dimen/contact_list_item_padding_top"
android:paddingBottom="@dimen/contact_list_item_padding_bottom" android:paddingBottom="@dimen/contact_list_item_padding_bottom"
> >
<ImageView <ImageView
android:id="@+id/color" android:id="@+id/color"
android:layout_width="wrap_content"
android:layout_width="4dp"
android:layout_height="@dimen/avatar_size" android:layout_height="@dimen/avatar_size"
android:layout_marginRight="3dp"
android:layout_marginEnd="3dp"
android:src="@drawable/account_color" android:src="@drawable/account_color"
/> />
<include layout="@layout/base_contact_avatar" /> <include layout="@layout/base_contact_avatar" />
......
...@@ -16,27 +16,29 @@ ...@@ -16,27 +16,29 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/expander_height" android:layout_height="@dimen/expander_height"
android:gravity="center_vertical|left" android:gravity="center_vertical|start"
android:background="@drawable/expander_background_dark" android:background="@drawable/expander_background_dark"
> >
<ImageView <ImageView
android:id="@+id/indicator" android:id="@+id/indicator"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/expander_height" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/expander_arrow_margin_left"
android:layout_marginRight="@dimen/expander_arrow_margin_right"
android:src="@drawable/expander_indicator_dark" android:src="@drawable/expander_indicator_dark"
/> android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/expander_height" android:layout_height="@dimen/expander_height"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_marginRight="@dimen/expander_text_margin_right" android:layout_marginRight="@dimen/expander_text_margin_right"
android:layout_marginEnd="@dimen/expander_text_margin_right"
android:singleLine="true" android:singleLine="true"
android:ellipsize="marquee" android:ellipsize="marquee"
android:background="@drawable/ic_show_offline" android:background="@drawable/ic_show_offline"
android:text="name (0/0)" android:text="name (0/0)"
android:layout_toRightOf="@id/indicator" android:layout_toRightOf="@id/indicator"
android:layout_toEndOf="@id/indicator"
/> />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
--> -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent">
<RelativeLayout <RelativeLayout
android:id="@+id/container" android:id="@+id/container"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:layout_gravity="fill_horizontal"
android:gravity="center_vertical">
<HorizontalScrollView
android:id="@+id/account_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<LinearLayout
android:id="@+id/account_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
\ No newline at end of file
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
android:id="@android:id/list" android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
/> android:drawSelectorOnTop="true" />
<RelativeLayout <RelativeLayout
android:id="@+id/info" android:id="@+id/info"
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
android:singleLine="true" android:singleLine="true"
android:ellipsize="marquee" android:ellipsize="marquee"
android:textStyle="bold" android:textStyle="bold"
android:textColor="?android:attr/textColorPrimary" android:textColor="@color/secondary_text_default_material_light"
android:text="name" android:text="name"
/> />
<TextView <TextView
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
android:gravity="top" android:gravity="top"
android:singleLine="true" android:singleLine="true"
android:ellipsize="marquee" android:ellipsize="marquee"
android:textColor="?android:attr/textColorPrimary" android:textColor="@color/secondary_text_default_material_light"
android:text="status" android:text="status"
/> />
</LinearLayout> </LinearLayout>
......
...@@ -15,4 +15,12 @@ ...@@ -15,4 +15,12 @@
<resources> <resources>
<color name="bright_foreground_dark">#ffffffff</color> <color name="bright_foreground_dark">#ffffffff</color>
<color name="bright_foreground_light">#ff000000</color> <color name="bright_foreground_light">#ff000000</color>
<color name="account_1" >#FFCCFF90</color>
<color name="account_2" >#FFFFE57F</color>
<color name="account_3" >#FFFF8A80</color>
<color name="account_4" >#FF80D8FF</color>
<color name="account_disabled" >#33000000</color>
</resources> </resources>
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
<item name="expanderAccountColor">?android:attr/textColorPrimaryInverse</item> <item name="expanderAccountColor">?android:attr/textColorPrimaryInverse</item>
<item name="accountBackground">@drawable/account_background</item> <item name="accountBackground">@drawable/account_background</item>
<item name="expanderIndicator">@drawable/expander_indicator_dark</item> <item name="expanderIndicator">@drawable/expander_indicator_dark</item>
<item name="titleMainBackground">@drawable/title_main_background_dark</item>
<item name="titleAccountBackground">@drawable/title_account_background_dark</item> <item name="titleAccountBackground">@drawable/title_account_background_dark</item>
<item name="textColorPrimaryNoSelected">@color/bright_foreground_dark</item> <item name="textColorPrimaryNoSelected">@color/bright_foreground_dark</item>
</style> </style>
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.
This file is part of Xabber project; you can redistribute it and/or
modify it under the terms of the GNU General Public License, Version 3.
Xabber is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License,
along with this program. If not, see http://www.gnu.org/licenses/.
-->
<ContactsSource
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ContactsDataKind
android:mimeType="vnd.android.cursor.item/vnd.com.xabber.view"
android:icon="@drawable/ic_information"
android:summaryColumn="data1"
android:detailColumn="data2"
android:detailSocialSummary="false"
/>
</ContactsSource>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment