com.daimajia.swipe.SwipeLayout Java Examples

The following examples show how to use com.daimajia.swipe.SwipeLayout. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LikeDeletableAdapter.java    From rox-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
    Context context = holder.itemView.getContext();
    holder.likeNameTextView.setText(categories.get(position).getName());
    Picasso.with(context)
            .load(categories.get(position).getIconUrl())
            .transform(new ColorTransformation(context.getResources().getColor(R.color.secondary_text)))
            .placeholder(R.drawable.ic_generic_category)
            .into(holder.likeImageView);
    holder.swipeLayout.setShowMode(SwipeLayout.ShowMode.PullOut);
    holder.swipeLayout.setDragEdge(SwipeLayout.DragEdge.Right);
    holder.deleteButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mItemManger.removeShownLayouts(holder.swipeLayout);
            Category removedCategory = categories.remove(position);
            notifyDataSetChanged();
            mItemManger.closeAllItems();
            if (removeLikeListener != null)  removeLikeListener.onRemove(removedCategory);
        }
    });
}
 
Example #2
Source File: ArchivedConversationsListAdapter.java    From chat21-android-sdk with GNU Affero General Public License v3.0 6 votes vote down vote up
public ViewHolder(View itemView) {
            super(itemView);

            recipientPicture = itemView.findViewById(R.id.recipient_picture);
            recipientDisplayName = itemView.findViewById(R.id.recipient_display_name);
            senderDisplayName = itemView.findViewById(R.id.sender_display_name);
            lastTextMessage = itemView.findViewById(R.id.last_text_message);
            lastMessageTimestamp = itemView.findViewById(R.id.last_message_timestamp);

            reopen = itemView.findViewById(R.id.reopen);

            swipeItem = itemView.findViewById(R.id.swipe_item);
            swipeItem.setShowMode(SwipeLayout.ShowMode.PullOut);
//            swipeItem.addDrag(SwipeLayout.DragEdge.Left, swipeItem.findViewById(R.id.swipe_left));
            swipeItem.addDrag(SwipeLayout.DragEdge.Right, swipeItem.findViewById(R.id.swipe_right));
        }
 
Example #3
Source File: ConversationsListAdapter.java    From chat21-android-sdk with GNU Affero General Public License v3.0 6 votes vote down vote up
public ViewHolder(View itemView) {
            super(itemView);

            recipientPicture = itemView.findViewById(R.id.recipient_picture);
            recipientDisplayName = itemView.findViewById(R.id.recipient_display_name);
            senderDisplayName = itemView.findViewById(R.id.sender_display_name);
            lastTextMessage = itemView.findViewById(R.id.last_text_message);
            lastMessageTimestamp = itemView.findViewById(R.id.last_message_timestamp);

            close = itemView.findViewById(R.id.close);
            unread = itemView.findViewById(R.id.unread);

            swipeItem = itemView.findViewById(R.id.swipe_item);
            swipeItem.setShowMode(SwipeLayout.ShowMode.PullOut);
//            swipeItem.addDrag(SwipeLayout.DragEdge.Left, swipeItem.findViewById(R.id.swipe_left));
            swipeItem.addDrag(SwipeLayout.DragEdge.Right, swipeItem.findViewById(R.id.swipe_right));
        }
 
Example #4
Source File: FragmentBlockedUser.java    From iGap-Android with GNU Affero General Public License v3.0 6 votes vote down vote up
public ViewHolder(View view) {
    super(view);

    image = (CircleImageView) view.findViewById(R.id.imageView);
    title = (CustomTextViewMedium) view.findViewById(R.id.title);
    subtitle = (CustomTextViewMedium) view.findViewById(R.id.subtitle);
    bottomLine = view.findViewById(R.id.bottomLine);
    bottomLine.setVisibility(View.VISIBLE);
    view.findViewById(R.id.topLine).setVisibility(View.GONE);

    //itemView.setOnLongClickListener(new View.OnLongClickListener() {
    //    @Override
    //    public boolean onLongClick(View v) {
    //        openDialogToggleBlock(realmRegisteredInfo.getId());
    //        return true;
    //    }
    //});
    swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipeRevealLayout);
    swipeLayout.getSurfaceView().setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            openDialogToggleBlock(realmRegisteredInfo.getId());
        }
    });
}
 
Example #5
Source File: SwipeItemMangerImpl.java    From AndroidSwipeLayout with MIT License 6 votes vote down vote up
public void bind(View view, int position) {
    int resId = swipeAdapterInterface.getSwipeLayoutResourceId(position);
    SwipeLayout swipeLayout = (SwipeLayout) view.findViewById(resId);
    if (swipeLayout == null)
        throw new IllegalStateException("can not find SwipeLayout in target view");

    if (swipeLayout.getTag(resId) == null) {
        OnLayoutListener onLayoutListener = new OnLayoutListener(position);
        SwipeMemory swipeMemory = new SwipeMemory(position);
        swipeLayout.addSwipeListener(swipeMemory);
        swipeLayout.addOnLayoutListener(onLayoutListener);
        swipeLayout.setTag(resId, new ValueBox(position, swipeMemory, onLayoutListener));
        mShownLayouts.add(swipeLayout);
    } else {
        ValueBox valueBox = (ValueBox) swipeLayout.getTag(resId);
        valueBox.swipeMemory.setPosition(position);
        valueBox.onLayoutListener.setPosition(position);
        valueBox.position = position;
    }
}
 
Example #6
Source File: ContactListActivity.java    From weMessage with GNU Affero General Public License v3.0 5 votes vote down vote up
private void init(){
    if (!isInit){
        isInit = true;

        swipeLayout = (SwipeLayout) itemView;
        contactPictureView = itemView.findViewById(R.id.contactPictureView);
        contactDisplayNameView = itemView.findViewById(R.id.contactDisplayNameView);
        contactHandle = itemView.findViewById(R.id.contactHandle);
        toggleBlockButton = itemView.findViewById(R.id.contactToggleBlockButton);
        removeContactButton = itemView.findViewById(R.id.contactRemoveButton);
    }
}
 
Example #7
Source File: LikeDeletableAdapter.java    From rox-android with Apache License 2.0 5 votes vote down vote up
public ViewHolder(View itemView) {
    super(itemView);
    swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe);
    likeImageView = (ImageView) itemView.findViewById(R.id.like_image);
    likeNameTextView = (TextView) itemView.findViewById(R.id.like_name);
    deleteButton = (ImageButton) itemView.findViewById(R.id.delete_button);
}
 
Example #8
Source File: PoiRouteAdapter.java    From rox-android with Apache License 2.0 5 votes vote down vote up
public BottomViewHolder(View itemView) {
    super(itemView);
    swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe);
    categoryImageView = (ImageView) itemView.findViewById(R.id.category_image);
    poiNameView = (TextView) itemView.findViewById(R.id.poi_name);
    categoryNameView = (TextView) itemView.findViewById(R.id.category_name);
    deleteButton = (ImageButton) itemView.findViewById(R.id.delete_button);
}
 
Example #9
Source File: PoiRouteAdapter.java    From rox-android with Apache License 2.0 5 votes vote down vote up
public MiddleViewHolder(View itemView) {
    super(itemView);
    swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe);
    categoryImageView = (ImageView) itemView.findViewById(R.id.category_image);
    poiNameView = (TextView) itemView.findViewById(R.id.poi_name);
    categoryNameView = (TextView) itemView.findViewById(R.id.category_name);
    deleteButton = (ImageButton) itemView.findViewById(R.id.delete_button);
}
 
Example #10
Source File: SwipeItemMangerImpl.java    From AndroidSwipeLayout with MIT License 5 votes vote down vote up
@Override
public void onOpen(SwipeLayout layout) {
    if (mode == Attributes.Mode.Multiple)
        mOpenPositions.add(position);
    else {
        closeAllExcept(layout);
        mOpenPosition = position;
    }
}
 
Example #11
Source File: SwipeItemMangerImpl.java    From AndroidSwipeLayout with MIT License 5 votes vote down vote up
@Override
public void onClose(SwipeLayout layout) {
    if (mode == Attributes.Mode.Multiple) {
        mOpenPositions.remove(position);
    } else {
        mOpenPosition = INVALID_POSITION;
    }
}
 
Example #12
Source File: SwipeItemMangerImpl.java    From AndroidSwipeLayout with MIT License 5 votes vote down vote up
@Override
public void onLayout(SwipeLayout v) {
    if (isOpen(position)) {
        v.open(false, false);
    } else {
        v.close(false, false);
    }
}
 
Example #13
Source File: SwipeItemMangerImpl.java    From AndroidSwipeLayout with MIT License 5 votes vote down vote up
@Override
public void closeAllItems() {
    if (mode == Attributes.Mode.Multiple) {
        mOpenPositions.clear();
    } else {
        mOpenPosition = INVALID_POSITION;
    }
    for (SwipeLayout s : mShownLayouts) {
        s.close();
    }
}
 
Example #14
Source File: SwipeItemMangerImpl.java    From AndroidSwipeLayout with MIT License 5 votes vote down vote up
@Override
public void closeAllExcept(SwipeLayout layout) {
    for (SwipeLayout s : mShownLayouts) {
        if (s != layout)
            s.close();
    }
}
 
Example #15
Source File: ContactListActivity.java    From weMessage with GNU Affero General Public License v3.0 5 votes vote down vote up
public void closeUnderlyingView(){
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (swipeLayout.getOpenStatus() != SwipeLayout.Status.Close) {
                swipeLayout.close();
            }
        }
    });
}
 
Example #16
Source File: ChatViewFragment.java    From weMessage with GNU Affero General Public License v3.0 5 votes vote down vote up
private void init(){
    if (!isInit) {
        isInit = true;

        swipeLayout = (SwipeLayout) itemView;
        chatContactRemoveButtonLayout = itemView.findViewById(R.id.chatContactRemoveButtonLayout);
        chatContactPictureView = itemView.findViewById(R.id.chatContactPictureView);
        chatContactDisplayNameView = itemView.findViewById(R.id.chatContactDisplayNameView);
    }
}
 
Example #17
Source File: ForumListAdapter.java    From TLint with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.swipeLayout)
void swipeLayoutClick() {
    if (swipeLayout.getOpenStatus() == SwipeLayout.Status.Close) {
        if (onItemClickListener != null) {
            onItemClickListener.onForumClick(forum);
        }
    }
}
 
Example #18
Source File: RecyclerViewAdapter.java    From AndroidSwipeLayout with MIT License 5 votes vote down vote up
public SimpleViewHolder(View itemView) {
    super(itemView);
    swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe);
    textViewPos = (TextView) itemView.findViewById(R.id.position);
    textViewData = (TextView) itemView.findViewById(R.id.text_data);
    buttonDelete = (Button) itemView.findViewById(R.id.delete);

    itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Log.d(getClass().getSimpleName(), "onItemSelected: " + textViewData.getText().toString());
            Toast.makeText(view.getContext(), "onItemSelected: " + textViewData.getText().toString(), Toast.LENGTH_SHORT).show();
        }
    });
}
 
Example #19
Source File: BaseSwipeAdapter.java    From AndroidSwipeLayout with MIT License 4 votes vote down vote up
@Override
public void removeShownLayouts(SwipeLayout layout) {
    mItemManger.removeShownLayouts(layout);
}
 
Example #20
Source File: ChatViewFragment.java    From weMessage with GNU Affero General Public License v3.0 4 votes vote down vote up
public void closeUnderlyingView(){
    if (swipeLayout.getOpenStatus() != SwipeLayout.Status.Close) {
        swipeLayout.close();
    }
}
 
Example #21
Source File: StoryViewHolder.java    From hacker-news-android with Apache License 2.0 4 votes vote down vote up
public StoryViewHolder(View itemView) {
    super(itemView);
    swipeLayout = (SwipeLayout) itemView;
    ButterKnife.inject(this, itemView);
}
 
Example #22
Source File: SwipeItemMangerImpl.java    From AndroidSwipeLayout with MIT License 4 votes vote down vote up
@Override
public void onStartOpen(SwipeLayout layout) {
    if (mode == Attributes.Mode.Single) {
        closeAllExcept(layout);
    }
}
 
Example #23
Source File: SwipeItemMangerImpl.java    From AndroidSwipeLayout with MIT License 4 votes vote down vote up
@Override
public List<SwipeLayout> getOpenLayouts() {
    return new ArrayList<SwipeLayout>(mShownLayouts);
}
 
Example #24
Source File: SwipeItemMangerImpl.java    From AndroidSwipeLayout with MIT License 4 votes vote down vote up
@Override
public void removeShownLayouts(SwipeLayout layout) {
    mShownLayouts.remove(layout);
}
 
Example #25
Source File: SimpleCursorSwipeAdapter.java    From AndroidSwipeLayout with MIT License 4 votes vote down vote up
@Override
public void closeAllExcept(SwipeLayout layout) {
    mItemManger.closeAllExcept(layout);
}
 
Example #26
Source File: SimpleCursorSwipeAdapter.java    From AndroidSwipeLayout with MIT License 4 votes vote down vote up
@Override
public List<SwipeLayout> getOpenLayouts() {
    return mItemManger.getOpenLayouts();
}
 
Example #27
Source File: BaseSwipeAdapter.java    From AndroidSwipeLayout with MIT License 4 votes vote down vote up
@Override
public List<SwipeLayout> getOpenLayouts() {
    return mItemManger.getOpenLayouts();
}
 
Example #28
Source File: BaseSwipeAdapter.java    From AndroidSwipeLayout with MIT License 4 votes vote down vote up
@Override
public void closeAllExcept(SwipeLayout layout) {
    mItemManger.closeAllExcept(layout);
}
 
Example #29
Source File: RecyclerSwipeAdapter.java    From AndroidSwipeLayout with MIT License 4 votes vote down vote up
@Override
public void removeShownLayouts(SwipeLayout layout) {
    mItemManger.removeShownLayouts(layout);
}
 
Example #30
Source File: RecyclerSwipeAdapter.java    From AndroidSwipeLayout with MIT License 4 votes vote down vote up
@Override
public List<SwipeLayout> getOpenLayouts() {
    return mItemManger.getOpenLayouts();
}