use of com.instructure.loginapi.login.adapter.PreviousUsersAdapter in project instructure-android by instructure.
the class BaseLoginLandingPageActivity method loadPreviousUsers.
private void loadPreviousUsers() {
ArrayList<SignedInUser> previousUsers = PreviousUsersUtils.get(this);
resizePreviousUsersRecyclerView(previousUsers);
mPreviousLoginRecyclerView.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
mPreviousLoginRecyclerView.setAdapter(new PreviousUsersAdapter(previousUsers, new PreviousUsersAdapter.PreviousUsersEvents() {
@Override
public void onPreviousUserClick(SignedInUser user) {
ApiPrefs.setProtocol(user.protocol);
ApiPrefs.setUser(user.user);
ApiPrefs.setDomain(user.domain);
ApiPrefs.setToken(user.token);
Intent intent = launchApplicationMainActivityIntent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
}
@Override
public void onRemovePreviousUserClick(SignedInUser user, int position) {
PreviousUsersUtils.remove(BaseLoginLandingPageActivity.this, user);
}
@Override
public void onNowEmpty() {
ObjectAnimator fade = ObjectAnimator.ofFloat(mPreviousLoginWrapper, View.ALPHA, 1F, 0F);
ObjectAnimator move = ObjectAnimator.ofFloat(mPreviousLoginWrapper, View.TRANSLATION_Y, 0, mPreviousLoginWrapper.getTop());
AnimatorSet set = new AnimatorSet();
set.playTogether(fade, move);
set.setDuration(430);
set.start();
}
}));
mPreviousLoginWrapper.setVisibility((previousUsers.size() > 0) ? View.VISIBLE : View.GONE);
}
Aggregations