Search in sources :

Example 1 with RankingTopUsersAdapter

use of cl.smartcities.isci.transportinspector.adapters.RankingTopUsersAdapter in project androidApp by InspectorIncognito.

the class RankingActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_account_user_ranking);
    ArrayList<TranSappUser> topRanking = this.getIntent().getExtras().getParcelableArrayList(TOP_RANKING_KEY);
    ArrayList<TranSappUser> tranSappUserRanking = this.getIntent().getExtras().getParcelableArrayList(USER_RANKING_KEY);
    rcyList = findViewById(R.id.rcyList);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    rcyList.setLayoutManager(layoutManager);
    rcyList.addItemDecoration(new InsetDecoration(this));
    adapter = new RankingTopUsersAdapter(this, topRanking);
    rcyList.setAdapter(adapter);
    if (!TranSappAccountManager.isLoggedIn()) {
        finish();
        return;
    }
    RankingAdapter rankingAdapter = new RankingAdapter(this, tranSappUserRanking, TranSappAccountManager.getCurrentAccount().currentUser);
    listView = findViewById(R.id.list_view);
    listView.setLayoutManager(new LinearLayoutManager(this));
    listView.setAdapter(rankingAdapter);
    listView.getLayoutManager().scrollToPosition(getFixedUserPosition(getCurrentUserPosition(tranSappUserRanking)));
    setResult(RESULT_OK);
}
Also used : RankingTopUsersAdapter(cl.smartcities.isci.transportinspector.adapters.RankingTopUsersAdapter) TranSappUser(cl.smartcities.isci.transportinspector.gamification.transappUser.TranSappUser) RankingAdapter(cl.smartcities.isci.transportinspector.adapters.RankingAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RankingAdapter (cl.smartcities.isci.transportinspector.adapters.RankingAdapter)1 RankingTopUsersAdapter (cl.smartcities.isci.transportinspector.adapters.RankingTopUsersAdapter)1 TranSappUser (cl.smartcities.isci.transportinspector.gamification.transappUser.TranSappUser)1