Search in sources :

Example 11 with EasyRecyclerView

use of com.hippo.easyrecyclerview.EasyRecyclerView in project EhViewer by seven332.

the class GalleryCommentsScene method onItemClick.

@Override
public boolean onItemClick(EasyRecyclerView parent, View view, int position, long id) {
    Activity activity = getActivity2();
    if (null == activity) {
        return false;
    }
    RecyclerView.ViewHolder holder = parent.getChildViewHolder(view);
    if (holder instanceof CommentHolder) {
        CommentHolder commentHolder = (CommentHolder) holder;
        ClickableSpan span = commentHolder.comment.getCurrentSpan();
        commentHolder.comment.clearCurrentSpan();
        if (span instanceof URLSpan) {
            UrlOpener.openUrl(activity, ((URLSpan) span).getURL(), true);
            return true;
        }
    }
    showCommentDialog(position);
    return true;
}
Also used : MainActivity(com.hippo.ehviewer.ui.MainActivity) Activity(android.app.Activity) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) URLSpan(android.text.style.URLSpan) ClickableSpan(android.text.style.ClickableSpan)

Example 12 with EasyRecyclerView

use of com.hippo.easyrecyclerview.EasyRecyclerView in project EhViewer by seven332.

the class GalleryInfoScene method onCreateView3.

@SuppressWarnings("deprecation")
@Nullable
@Override
public View onCreateView3(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.scene_gallery_info, container, false);
    Context context = getContext2();
    Assert.assertNotNull(context);
    mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
    InfoAdapter adapter = new InfoAdapter();
    mRecyclerView.setAdapter(adapter);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
    LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(LinearDividerItemDecoration.VERTICAL, context.getResources().getColor(R.color.divider), LayoutUtils.dp2pix(context, 1));
    decoration.setPadding(context.getResources().getDimensionPixelOffset(R.dimen.keyline_margin));
    mRecyclerView.addItemDecoration(decoration);
    mRecyclerView.setSelector(Ripple.generateRippleDrawable(context, false));
    mRecyclerView.setClipToPadding(false);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setOnItemClickListener(this);
    return view;
}
Also used : Context(android.content.Context) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) LinearDividerItemDecoration(com.hippo.easyrecyclerview.LinearDividerItemDecoration) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 13 with EasyRecyclerView

use of com.hippo.easyrecyclerview.EasyRecyclerView in project EhViewer by seven332.

the class GalleryListScene method onItemClick.

@Override
public boolean onItemClick(EasyRecyclerView parent, View view, int position, long id) {
    if (null == mHelper || null == mRecyclerView) {
        return false;
    }
    GalleryInfo gi = mHelper.getDataAt(position);
    Bundle args = new Bundle();
    args.putString(GalleryDetailScene.KEY_ACTION, GalleryDetailScene.ACTION_GALLERY_INFO);
    args.putParcelable(GalleryDetailScene.KEY_GALLERY_INFO, gi);
    Announcer announcer = new Announcer(GalleryDetailScene.class).setArgs(args);
    View thumb;
    if (ApiHelper.SUPPORT_TRANSITION && null != (thumb = view.findViewById(R.id.thumb))) {
        announcer.setTranHelper(new EnterGalleryDetailTransaction(thumb));
    }
    startScene(announcer);
    return true;
}
Also used : Announcer(com.hippo.scene.Announcer) Bundle(android.os.Bundle) GalleryInfo(com.hippo.ehviewer.client.data.GalleryInfo) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) ShowcaseView(com.github.amlcurran.showcaseview.ShowcaseView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) RecyclerView(android.support.v7.widget.RecyclerView)

Example 14 with EasyRecyclerView

use of com.hippo.easyrecyclerview.EasyRecyclerView in project EhViewer by seven332.

the class HistoryScene method onItemClick.

@Override
public boolean onItemClick(EasyRecyclerView parent, View view, int position, long id) {
    if (null == mLazyList) {
        return false;
    }
    Bundle args = new Bundle();
    args.putString(GalleryDetailScene.KEY_ACTION, GalleryDetailScene.ACTION_GALLERY_INFO);
    args.putParcelable(GalleryDetailScene.KEY_GALLERY_INFO, mLazyList.get(position));
    Announcer announcer = new Announcer(GalleryDetailScene.class).setArgs(args);
    View thumb;
    if (ApiHelper.SUPPORT_TRANSITION && null != (thumb = view.findViewById(R.id.thumb))) {
        announcer.setTranHelper(new EnterGalleryDetailTransaction(thumb));
    }
    startScene(announcer);
    return true;
}
Also used : Announcer(com.hippo.scene.Announcer) Bundle(android.os.Bundle) EasyRecyclerView(com.hippo.easyrecyclerview.EasyRecyclerView) View(android.view.View) SimpleRatingView(com.hippo.ehviewer.widget.SimpleRatingView) LoadImageView(com.hippo.widget.LoadImageView) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView)

Aggregations

EasyRecyclerView (com.hippo.easyrecyclerview.EasyRecyclerView)14 RecyclerView (android.support.v7.widget.RecyclerView)10 Context (android.content.Context)8 View (android.view.View)8 TextView (android.widget.TextView)8 Nullable (android.support.annotation.Nullable)6 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 SuppressLint (android.annotation.SuppressLint)5 Drawable (android.graphics.drawable.Drawable)5 ViewTransition (com.hippo.view.ViewTransition)5 LinearDividerItemDecoration (com.hippo.easyrecyclerview.LinearDividerItemDecoration)4 Activity (android.app.Activity)3 Resources (android.content.res.Resources)3 GeneralItemAnimator (com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator)3 SwipeDismissItemAnimator (com.h6ah4i.android.widget.advrecyclerview.animator.SwipeDismissItemAnimator)3 RecyclerViewSwipeManager (com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager)3 RecyclerViewTouchActionGuardManager (com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager)3 MainActivity (com.hippo.ehviewer.ui.MainActivity)3 SimpleRatingView (com.hippo.ehviewer.widget.SimpleRatingView)3 LoadImageView (com.hippo.widget.LoadImageView)3