Search in sources :

Example 1 with UserProfileInfoAdapter

use of ingage.ingage.adapters.UserProfileInfoAdapter 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)

Example 2 with UserProfileInfoAdapter

use of ingage.ingage.adapters.UserProfileInfoAdapter in project iNGAGE by davis123123.

the class UserInfoFragment method crossFadeRecyler.

private void crossFadeRecyler() {
    recycler = (RecyclerView) rootView.findViewById(R.id.info);
    final LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    recycler.setLayoutManager(layoutManager);
    adapter = new UserProfileInfoAdapter();
    recycler.setAdapter(adapter);
    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();
    recycler.setAlpha(0f);
    recycler.setVisibility(View.VISIBLE);
    // Animate the content view to 100% opacity, and clear any animation
    // listener set on the view.
    recycler.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null);
    mLoadingView.animate().alpha(0f).setDuration(mShortAnimationDuration).setListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mLoadingView.setVisibility(View.GONE);
        }
    });
}
Also used : UserProfileInfoAdapter(ingage.ingage.adapters.UserProfileInfoAdapter) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

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