Search in sources :

Example 1 with OfferedAchievement

use of app.insti.api.model.OfferedAchievement in project IITB-App by wncc.

the class GenericAdapter method onClick.

@Override
public void onClick(CardInterface cardInterface, Fragment fragment, View view) {
    if (cardInterface instanceof Event) {
        Utils.openEventFragment((Event) cardInterface, fragment, view.findViewById(R.id.object_picture));
    } else if (cardInterface instanceof Body) {
        Utils.openBodyFragment((Body) cardInterface, fragment, view.findViewById(R.id.object_picture));
    } else if (cardInterface instanceof User) {
        Utils.openUserFragment((User) cardInterface, fragment, view.findViewById(R.id.object_picture));
    } else if (cardInterface instanceof Role) {
        Utils.openBodyFragment(((Role) cardInterface).getRoleBodyDetails(), fragment, view.findViewById(R.id.object_picture));
    } else if (cardInterface instanceof Achievement) {
        Achievement a = (Achievement) cardInterface;
        if (a.getAchievementEvent() != null) {
            a.getAchievementEvent().setEventBodies(new ArrayList<>());
            a.getAchievementEvent().getEventBodies().add(a.getAchievementBody());
            Utils.openEventFragment(a.getAchievementEvent(), fragment, view.findViewById(R.id.object_picture));
        } else {
            Utils.openBodyFragment(a.getAchievementBody(), fragment, view.findViewById(R.id.object_picture));
        }
    } else if (cardInterface instanceof OfferedAchievement) {
        WebViewFragment webViewFragment = new WebViewFragment();
        Bundle bundle = new Bundle();
        bundle.putString(Constants.WV_TYPE, Constants.WV_TYPE_NEW_OFFERED_ACHIEVEMENT);
        bundle.putString(Constants.WV_ID, ((OfferedAchievement) cardInterface).getAchievementID());
        webViewFragment.setArguments(bundle);
        Utils.updateFragment(webViewFragment, fragment.getActivity());
    }
}
Also used : Role(app.insti.api.model.Role) WebViewFragment(app.insti.fragment.WebViewFragment) User(app.insti.api.model.User) OfferedAchievement(app.insti.api.model.OfferedAchievement) Bundle(android.os.Bundle) Event(app.insti.api.model.Event) Achievement(app.insti.api.model.Achievement) OfferedAchievement(app.insti.api.model.OfferedAchievement) Body(app.insti.api.model.Body)

Aggregations

Bundle (android.os.Bundle)1 Achievement (app.insti.api.model.Achievement)1 Body (app.insti.api.model.Body)1 Event (app.insti.api.model.Event)1 OfferedAchievement (app.insti.api.model.OfferedAchievement)1 Role (app.insti.api.model.Role)1 User (app.insti.api.model.User)1 WebViewFragment (app.insti.fragment.WebViewFragment)1