Search in sources :

Example 1 with OKAchievementsListResponseHandler

use of io.openkit.OKAchievementsListResponseHandler in project openkit-android by OpenKit.

the class OKAchievementsFragment method getAchievements.

private void getAchievements() {
    spinnerBar.setVisibility(View.VISIBLE);
    OKAchievement.getAchievements(new OKAchievementsListResponseHandler() {

        @Override
        public void onSuccess(List<OKAchievement> achievementList) {
            listAdapter = new OKAchievementsListAdapter(OKAchievementsFragment.this.getActivity(), android.R.layout.simple_list_item_1, achievementList);
            numAchievements = achievementList.size();
            listHeaderTextView.setText(numAchievements + " Achievements");
            OKAchievementsFragment.this.setListAdapter(listAdapter);
            listView.setVisibility(View.VISIBLE);
            spinnerBar.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onFailure(Throwable e, JSONObject errorResponse) {
            spinnerBar.setVisibility(View.INVISIBLE);
            if (OKAchievementsFragment.this.getActivity() != null) {
                Toast toast = Toast.makeText(OKAchievementsFragment.this.getActivity(), "Couldn't connect to server to get achivements", Toast.LENGTH_LONG);
                toast.show();
            }
        }
    });
    startedAchievementsRequest = true;
}
Also used : JSONObject(org.json.JSONObject) Toast(android.widget.Toast) OKAchievementsListResponseHandler(io.openkit.OKAchievementsListResponseHandler) OKAchievement(io.openkit.OKAchievement)

Aggregations

Toast (android.widget.Toast)1 OKAchievement (io.openkit.OKAchievement)1 OKAchievementsListResponseHandler (io.openkit.OKAchievementsListResponseHandler)1 JSONObject (org.json.JSONObject)1