use of androidx.recyclerview.widget.RecyclerView in project xabber-android by redsolution.
the class AccountActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Intent intent = getIntent();
account = getAccount(intent);
if (account == null) {
LogManager.i(LOG_TAG, "Account is null, finishing!");
finish();
return;
}
accountItem = AccountManager.getInstance().getAccount(account);
if (accountItem == null) {
Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
finish();
return;
}
if (ACTION_CONNECTION_SETTINGS.equals(intent.getAction())) {
isConnectionSettingsAction = true;
startAccountSettingsActivity();
setIntent(null);
}
setContentView(R.layout.activity_account);
Toolbar 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) {
NavUtils.navigateUpFromSameTask(AccountActivity.this);
}
});
toolbar.setTitle(R.string.contact_account);
toolbar.inflateMenu(R.menu.toolbar_account);
MenuItem item = toolbar.getMenu().findItem(R.id.action_account_switch);
switchCompat = (SwitchCompat) item.getActionView().findViewById(R.id.account_switch_view);
switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
AccountManager.getInstance().setEnabled(accountItem.getAccount(), isChecked);
}
});
barPainter = new BarPainter(this, toolbar);
UserJid fakeAccountUser;
try {
fakeAccountUser = UserJid.from(account.getFullJid().asBareJid());
} catch (UserJid.UserJidCreateException e) {
throw new IllegalStateException();
}
bestContact = RosterManager.getInstance().getBestContact(account, fakeAccountUser);
contactTitleView = findViewById(R.id.contact_title_expanded);
statusIcon = findViewById(R.id.ivStatus);
statusText = (TextView) findViewById(R.id.status_text);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.account_options_recycler_view);
accountOptionsAdapter = new AccountOptionsAdapter(AccountOption.getValues(), this, accountItem);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(accountOptionsAdapter);
recyclerView.setNestedScrollingEnabled(false);
Fragment fragmentById = getFragmentManager().findFragmentById(R.id.account_fragment_container);
if (fragmentById == null) {
getSupportFragmentManager().beginTransaction().add(R.id.account_fragment_container, ContactVcardViewerFragment.newInstance(account)).commit();
}
}
use of androidx.recyclerview.widget.RecyclerView in project xabber-android by redsolution.
the class AccountListActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account_list);
toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_clear_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
NavUtils.navigateUpFromSameTask(AccountListActivity.this);
}
});
toolbar.setTitle(R.string.title_reordering_account);
toolbar.inflateMenu(R.menu.toolbar_account_list);
toolbar.setOnMenuItemClickListener(this);
barPainter = new BarPainter(this, toolbar);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.account_list_recycler_view);
tvSummary = (TextView) findViewById(R.id.tvSummary);
accountListAdapter = new AccountListReorderAdapter(this, this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(accountListAdapter);
ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(accountListAdapter);
touchHelper = new ItemTouchHelper(callback);
touchHelper.attachToRecyclerView(recyclerView);
}
use of androidx.recyclerview.widget.RecyclerView in project xabber-android by redsolution.
the class ActiveSessionsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_active_sessions);
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_active_sessions);
barPainter = new BarPainter(this, toolbar);
barPainter.updateWithAccountName(account);
progressBar = findViewById(R.id.progressBar);
contentView = findViewById(R.id.contentView);
tvActiveSessions = findViewById(R.id.tvActiveSessions);
terminateAll = findViewById(R.id.llTerminateAll);
terminateAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showTerminateAllSessionsDialog();
}
});
// other sessions
RecyclerView recyclerView = findViewById(R.id.rvSessions);
adapter = new SessionAdapter(this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
recyclerView.setNestedScrollingEnabled(false);
// current session
tvCurrentClient = findViewById(R.id.tvClient);
tvCurrentDevice = findViewById(R.id.tvDevice);
tvCurrentIPAddress = findViewById(R.id.tvIPAddress);
tvCurrentDate = findViewById(R.id.tvDate);
updateData();
}
use of androidx.recyclerview.widget.RecyclerView 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);
}
use of androidx.recyclerview.widget.RecyclerView in project xabber-android by redsolution.
the class ServerInfoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_server_info);
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 = (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(accountItem.getConnection().getXMPPServiceDomain());
BarPainter barPainter = new BarPainter(this, toolbar);
barPainter.updateWithAccountName(account);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.server_info_recycler_view);
serverInfoAdapter = new ServerInfoAdapter();
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(serverInfoAdapter);
progressBar = findViewById(R.id.server_info_progress_bar);
requestServerInfo();
}
Aggregations