use of app.insti.api.model.User 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());
}
}
use of app.insti.api.model.User in project IITB-App by wncc.
the class UserFragment method loadUser.
public void loadUser(String userID) {
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.getUser(Utils.getSessionIDHeader(), userID).enqueue(new EmptyCallback<User>() {
@Override
public void onResponse(Call<User> call, Response<User> response) {
if (response.isSuccessful()) {
if (getActivity() == null || getView() == null)
return;
user = response.body();
populateViews();
}
}
});
}
use of app.insti.api.model.User in project IITB-App by wncc.
the class UserFragment method onStart.
@Override
public void onStart() {
super.onStart();
Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
toolbar.setTitle("Profile");
Bundle bundle = getArguments();
String userID = bundle.getString(Constants.USER_ID);
String userJson = bundle.getString(Constants.USER_JSON);
if (user != null) {
populateViews();
} else if (userID != null) {
loadUser(userID);
} else if (userJson != null) {
user = Utils.gson.fromJson(userJson, User.class);
showingMin = true;
populateViews();
}
}
Aggregations