use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class ContactListPresenter method getSearchResults.
private ArrayList<AbstractContact> getSearchResults(Collection<RosterContact> rosterContacts, Comparator<AbstractContact> comparator, Map<AccountJid, Map<UserJid, AbstractChat>> abstractChats) {
final ArrayList<AbstractContact> baseEntities = new ArrayList<>();
// Build structure.
for (RosterContact rosterContact : rosterContacts) {
if (!rosterContact.isEnabled()) {
continue;
}
final AccountJid account = rosterContact.getAccount();
final Map<UserJid, AbstractChat> users = abstractChats.get(account);
if (users != null) {
users.remove(rosterContact.getUser());
}
if (rosterContact.getName().toLowerCase(locale).contains(filterString)) {
baseEntities.add(rosterContact);
}
}
for (Map<UserJid, AbstractChat> users : abstractChats.values()) {
for (AbstractChat abstractChat : users.values()) {
final AbstractContact abstractContact;
if (abstractChat instanceof RoomChat) {
abstractContact = new RoomContact((RoomChat) abstractChat);
} else {
abstractContact = new ChatContact(abstractChat);
}
if (abstractContact.getName().toLowerCase(locale).contains(filterString)) {
baseEntities.add(abstractContact);
}
}
}
Collections.sort(baseEntities, comparator);
return baseEntities;
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class ContactListPresenter method onItemClick.
public void onItemClick(IFlexible item) {
if (item instanceof ContactVO) {
AccountJid accountJid = ((ContactVO) item).getAccountJid();
UserJid userJid = ((ContactVO) item).getUserJid();
if (view != null)
view.onContactClick(RosterManager.getInstance().getAbstractContact(accountJid, userJid));
} else if (item instanceof ButtonVO) {
ButtonVO button = (ButtonVO) item;
if (view != null)
view.onButtonItemClick(button);
}
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class AccountHistorySettingsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account_history_settings);
AccountJid account = getAccount(getIntent());
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setTitle(R.string.account_chat_history);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
BarPainter barPainter = new BarPainter(this, toolbar);
barPainter.updateWithAccountName(account);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction().add(R.id.account_history_settings_fragment, AccountHistorySettingsFragment.newInstance(account)).commit();
}
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class AccountSyncActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account_synchronization);
final Intent intent = getIntent();
AccountJid account = getAccount(intent);
if (account == null) {
finish();
return;
}
accountItem = AccountManager.getInstance().getAccount(account);
if (accountItem == null) {
Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
finish();
return;
}
jid = accountItem.getAccount().getFullJid().asBareJid().toString();
toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
toolbar.setTitle(R.string.account_sync);
barPainter = new BarPainter(this, toolbar);
barPainter.updateWithAccountName(account);
btnDeleteSettings = (Button) findViewById(R.id.btnDeleteSettings);
switchSync = (Switch) findViewById(R.id.switchSync);
rlSyncSwitch = (RelativeLayout) findViewById(R.id.rlSyncSwitch);
tvJid = (TextView) findViewById(R.id.tvJid);
tvStatus = (TextView) findViewById(R.id.tvStatus);
ivStatus = (ImageView) findViewById(R.id.ivStatus);
syncStatusView = (LinearLayout) findViewById(R.id.syncStatusView);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
rlSyncSwitch.setOnClickListener(this);
btnDeleteSettings.setOnClickListener(this);
syncStatusView.setOnClickListener(this);
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class BookmarksActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bokmarks);
final Intent intent = getIntent();
AccountJid account = getAccount(intent);
if (account == null) {
finish();
return;
}
accountItem = AccountManager.getInstance().getAccount(account);
if (accountItem == null) {
Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
finish();
return;
}
toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
toolbar.setTitle(R.string.account_bookmarks);
toolbar.inflateMenu(R.menu.toolbar_bookmark_list);
toolbar.setOnMenuItemClickListener(this);
barPainter = new BarPainter(this, toolbar);
barPainter.updateWithAccountName(account);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.server_info_recycler_view);
bookmarksAdapter = new BookmarkAdapter(this);
bookmarksAdapter.setListener(this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(bookmarksAdapter);
progressBar = findViewById(R.id.server_info_progress_bar);
tvNotSupport = (TextView) findViewById(R.id.tvNotSupport);
requestBookmarks(false);
}
Aggregations