use of ingage.ingage20.handlers.UserInfoHandler in project iNGAGE by davis123123.
the class UserInfoFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
rootView = inflater.inflate(R.layout.fragment_user_info, container, false);
recycler = (RecyclerView) rootView.findViewById(R.id.info);
mLoadingView = rootView.findViewById(R.id.loading_spinner);
SessionManager session = new SessionManager(getContext());
HashMap<String, String> info = session.getUserDetails();
if (userProfileActivity.getUsername().equals(info.get(SessionManager.KEY_NAME))) {
mLoadingView.setVisibility(View.GONE);
final LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
recycler.setLayoutManager(layoutManager);
adapter = new UserProfileInfoAdapter();
recycler.setAdapter(adapter);
username = info.get(SessionManager.KEY_NAME);
email = info.get(SessionManager.KEY_EMAIL);
tribute_pts = info.get(SessionManager.KEY_TRIBUTE_POINTS);
subs = info.get(SessionManager.KEY_SUBSCRIPTIONS);
date_joined = info.get(SessionManager.KEY_DATE_JOINED);
if (email != null && email.length() > 0)
adapter.add("Email: " + email);
else
adapter.add("Email: N/A");
adapter.add("Tribute points: " + tribute_pts);
setSubscriptions();
adapter.add("Date joined: " + date_joined);
adapter.notifyDataSetChanged();
} else {
UserInfoHandler.CallBackData callBackData = new UserInfoHandler.CallBackData() {
@Override
public void notifyChange(String serverResponse) {
Log.d("SERVERREeeSPONSE", serverResponse);
parseProfileJSON(serverResponse);
crossFadeRecyler();
}
};
handler = new UserInfoHandler();
handler.setCallBackData(callBackData);
handler.enqueue(userProfileActivity.getUsername());
recycler.setVisibility(View.GONE);
mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
}
return rootView;
}
Aggregations