Search in sources :

Example 1 with UserInfoHandler

use of ingage.ingage.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);
        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);
        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();
            }
        };
        String ip = App.getAppContext().getResources().getString(R.string.ip);
        handler = new UserInfoHandler();
        handler.setCallBackData(callBackData);
        handler.enqueue(userProfileActivity.getUsername(), ip);
        recycler.setVisibility(View.GONE);
        mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
    }
    return rootView;
}
Also used : UserProfileInfoAdapter(ingage.ingage.adapters.UserProfileInfoAdapter) SessionManager(ingage.ingage.managers.SessionManager) UserInfoHandler(ingage.ingage.handlers.UserInfoHandler) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 UserProfileInfoAdapter (ingage.ingage.adapters.UserProfileInfoAdapter)1 UserInfoHandler (ingage.ingage.handlers.UserInfoHandler)1 SessionManager (ingage.ingage.managers.SessionManager)1