Search in sources :

Example 1 with RecentCommentsAdapter

use of ingage.ingage20.adapters.RecentCommentsAdapter in project iNGAGE by davis123123.

the class RecentCommentsFragment method crossFadeRecyler.

private void crossFadeRecyler() {
    adapter = new RecentCommentsAdapter(getContext());
    recycler = (RecyclerView) rootView.findViewById(R.id.rvRecentComments);
    final LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    recycler.setLayoutManager(layoutManager);
    recycler.setAdapter(adapter);
    for (int i = 0; i < UserProfileActivity.recentComments.size(); i++) {
        // Log.i("STATE", "recent comment : " + UserProfileActivity.recentComments.get(i).thread_title + ", " + UserProfileActivity.recentComments.get(i).recent_comment);
        adapter.add(UserProfileActivity.recentComments.get(i));
    }
    adapter.notifyDataSetChanged();
    // if no recent activities/comments, then show message
    if (adapter.getItemCount() == 0) {
        recycler.setVisibility(View.GONE);
        RelativeLayout rlMessage = (RelativeLayout) rootView.findViewById(R.id.rlMessage);
        rlMessage.setAlpha(0f);
        rlMessage.setVisibility(View.VISIBLE);
        // Animate the content view to 100% opacity, and clear any animation
        // listener set on the view.
        rlMessage.animate().alpha(1f).setDuration(mShortAnimationDuration).setListener(null);
        // Animate the loading view to 0% opacity. After the animation ends,
        // set its visibility to GONE as an optimization step (it won't
        // participate in layout passes, etc.)
        mLoadingView.animate().alpha(0f).setDuration(mShortAnimationDuration).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mLoadingView.setVisibility(View.GONE);
            }
        });
    // ImageView icon = (ImageView) rootView.findViewById(R.id.ivIcon);
    // icon.setColorFilter(getContext().getResources().getColor(R.color.dark_gray));
    } else {
        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);
    }
    // Animate the loading view to 0% opacity. After the animation ends,
    // set its visibility to GONE as an optimization step (it won't
    // participate in layout passes, etc.)
    mLoadingView.animate().alpha(0f).setDuration(mShortAnimationDuration).setListener(new AnimatorListenerAdapter() {

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

Aggregations

Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RelativeLayout (android.widget.RelativeLayout)1 RecentCommentsAdapter (ingage.ingage20.adapters.RecentCommentsAdapter)1