本文整理汇总了Java中com.daimajia.swipe.SwipeLayout类的典型用法代码示例。如果您正苦于以下问题:Java SwipeLayout类的具体用法?Java SwipeLayout怎么用?Java SwipeLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SwipeLayout类属于com.daimajia.swipe包,在下文中一共展示了SwipeLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: swap
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
public boolean swap(final int a, final int b){
if(a<0||a>=size()||b<0||b>=size()||a==b)return false;
if(a>b) return swap(b, a);
final SwipeLayout av = get(a).getWrapper();
final SwipeLayout bv = get(b).getWrapper();
av.close(true);
bv.close(true);
super.add(b, super.remove(a));
if(adapter!=null){
MainActivity.saveCards(ctx);
adapter.notifyItemMoved(a, b);
adapter.notifyItemChanged(a);
adapter.notifyItemChanged(b);
}
return true;
}
示例2: DialogsHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
public DialogsHolder(View itemView, DialogsRecyclerViewAdapter adapter) {
super(itemView);
this.adapter = adapter;
mLastMessage = (TextView) itemView.findViewById(R.id.chats_item_last_message);
mLastMessageDate = (TextView) itemView.findViewById(R.id.chats_item_last_message_date);
mNewMessageIndicator = (TextView) itemView.findViewById(R.id.new_message_indicator);
mMessageAuthor = (TextView) itemView.findViewById(R.id.chats_item_last_message_author);
imageView = (CircleImageView) itemView.findViewById(R.id.chats_item_chat_image);
mTitle = (TextView) itemView.findViewById(R.id.chats_item_name);
swipeLayout = (SwipeLayout) itemView.findViewById(R.id.chats_item_swipe_layout);
deleteButton = (Button) itemView.findViewById(R.id.chats_item_delete_button);
deleteButton.setOnClickListener(v -> {
//deleteItem();
confirm();
});
surfaceLayout = (RelativeLayout) itemView.findViewById(R.id.chats_item_surface_view);
surfaceLayout.setOnClickListener(v -> {
adapter.onDialogClickCallback.onDialogClick(getAdapterPosition());
});
}
示例3: onBindViewHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
@SuppressLint("DefaultLocale")
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
final User itemData = mData.get(position);
holder.mNameTv.setText(String.format("姓名:%s", itemData.name));
holder.mSexTv.setText(String.format("性别:%s", itemData.sex));
holder.mPhoneNumTv.setText(String.format("电话号码:%s", itemData.phoneNum));
RealmResults<ExtendBean> realmResults = itemData.mExtendBeanRealmList.where().equalTo("key", "education").findAll();
if (realmResults.size() == 1) {
holder.mEducationTv.setText(String.format("学历:%s", realmResults.get(0).value));
} else {
holder.mEducationTv.setText(String.format("学历:%s", "無"));
}
holder.mSwipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown);
holder.mSwipeLayout.addSwipeListener(new SimpleSwipeListener() {
@Override
public void onOpen(SwipeLayout layout) {
YoYo.with(Techniques.Tada).duration(500).delay(100).playOn(layout.findViewById(R.id.trash));
}
});
mItemManger.bindView(holder.itemView, position);
}
示例4: onBindViewHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
@SuppressLint("DefaultLocale")
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
final User itemData = mData.get(position);
holder.mNameTv.setText(String.format("姓名:%s", itemData.getName()));
holder.mSexTv.setText(String.format("性别:%s", itemData.getSex()));
holder.mPhoneNumTv.setText(String.format("电话号码:%d", itemData.getPhoneNumber()));
holder.mSwipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown);
holder.mSwipeLayout.addSwipeListener(new SimpleSwipeListener() {
@Override
public void onOpen(SwipeLayout layout) {
YoYo.with(Techniques.Tada).duration(500).delay(100).playOn(layout.findViewById(R.id.trash));
}
});
mItemManger.bindView(holder.itemView, position);
}
示例5: ViewHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
public ViewHolder(View itemView) {
super(itemView);
time_tv = (TextView) itemView.findViewById(R.id.time_tv);
location_tv = (TextView) itemView.findViewById(R.id.location_tv);
routine_tv = (TextView) itemView.findViewById(R.id.routine_tv);
slots_tv = (TextView) itemView.findViewById(R.id.slots_tv);
date_tv = (TextView) itemView.findViewById(R.id.date_tv);
delete_bt = (android.widget.ImageButton) itemView.findViewById(R.id.delete_bt);
share_bt = (android.widget.ImageButton) itemView.findViewById(R.id.share_bt);
layout = (android.widget.RelativeLayout) itemView.findViewById(R.id.cardView);
myRideLayout = (SwipeLayout) itemView.findViewById(R.id.card_view_my_ride);
newRequest_iv = (ImageView) itemView.findViewById(R.id.newRequest_iv);
name_tv = (TextView) itemView.findViewById(R.id.name_tv);
photo_iv = (CircleImageView) itemView.findViewById(R.id.photo_iv);
newMsgIndicator_iv = (ImageView) itemView.findViewById(R.id.newMsgIndicator_iv);
card_list_separator = (android.widget.FrameLayout) itemView.findViewById(R.id.card_list_separator);
list_separator_text = (TextView) itemView.findViewById(R.id.list_separator_text);
}
示例6: initialize
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
@Override
public void initialize(View target, int position) {
int resId = getSwipeLayoutId(position);
OnLayoutListener onLayoutListener = new OnLayoutListener(position);
SwipeLayout swipeLayout = (SwipeLayout) target.findViewById(resId);
if (swipeLayout == null)
throw new IllegalStateException("can not find SwipeLayout in target view");
SwipeMemory swipeMemory = new SwipeMemory(position);
swipeLayout.addSwipeListener(swipeMemory);
swipeLayout.addOnLayoutListener(onLayoutListener);
swipeLayout.setTag(resId, new ValueBox(position, swipeMemory, onLayoutListener));
mShownLayouts.add(swipeLayout);
}
示例7: setupView
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
private static void setupView(View view) {
if(SwipeLayoutInfoView.root == null) {
SwipeLayoutInfoView.root = view;
SwipeLayoutInfoView.swipeLayout = (SwipeLayout) view.findViewById(R.id.timer_swipe_layout);
SwipeLayoutInfoView.swipeBottomWrapperLayout = (RelativeLayout) view.findViewById(R.id.bottom_wrapper);
SwipeLayoutInfoView.timerPlaceholderView = view.findViewById(R.id.timer_placeholder);
SwipeLayoutInfoView.timerPlaceholderTopText = (TextView) view.findViewById(R.id.timer_placeholder_top);
SwipeLayoutInfoView.timerPlaceholderBottomText = (TextView) view.findViewById(R.id.timer_placeholder_bottom);
SwipeLayoutInfoView.timerInfoView = view.findViewById(R.id.timer_info_layout);
SwipeLayoutInfoView.timerName = (TextView) view.findViewById(R.id.timer_name);
SwipeLayoutInfoView.timerTypeIcon = (ImageView) view.findViewById(R.id.timer_type_icon);
SwipeLayoutInfoView.timerDeleteIcon = (ImageView) view.findViewById(R.id.timer_delete_icon);
SwipeLayoutInfoView.timerEditIcon = (ImageView) view.findViewById(R.id.timer_edit_icon);
SwipeLayoutInfoView.timerOnOffSwitch = (Switch) view.findViewById(R.id.timer_switch);
SwipeLayoutInfoView.timerStartTimeView = (TextView) view.findViewById(R.id.timer_start_time);
SwipeLayoutInfoView.timerEndTimeView = (TextView) view.findViewById(R.id.timer_end_time);
SwipeLayoutInfoView.timerDaysView = (TextView) view.findViewById(R.id.timer_days);
SwipeLayoutInfoView.vibrateBitmap = BitmapFactory.decodeResource(view.getContext().getResources(), R.drawable.ic_action_vibrate);
SwipeLayoutInfoView.silentBitmap = BitmapFactory.decodeResource(view.getContext().getResources(), R.drawable.ic_action_silent);
}
}
示例8: SimpleViewHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
public SimpleViewHolder(View itemView) {
super(itemView);
swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe);
goodsNameTextView = (TextView) itemView.findViewById(R.id.goods_name);
goodsPriceTextView = (TextView) itemView.findViewById(R.id.goods_price);
goodsIntroduction = (TextView) itemView.findViewById(R.id.goods_introduction);
goodsPicture = (ImageView) itemView.findViewById(R.id.goods_picture_bitmap);
goodsMerchants = (TextView) itemView.findViewById(R.id.magnifier);
goodsPraise = (ImageView) itemView.findViewById(R.id.star);
itemView.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
}
});
}
示例9: SimpleViewHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
public SimpleViewHolder(View itemView) {
super(itemView);
swipeLayout = (SwipeLayout) itemView.findViewById(R.id.swipe);
goodsNameTextView = (TextView) itemView.findViewById(R.id.goods_name);
goodsPriceTextView = (TextView) itemView.findViewById(R.id.goods_price);
goodsIntroduction = (TextView) itemView.findViewById(R.id.goods_introduction);
goodsPicture = (ImageView) itemView.findViewById(R.id.goods_picture_bitmap);
goodsPraise = (TextView) itemView.findViewById(R.id.magnifier);
goodsId = (TextView) itemView.findViewById(R.id.star);
itemView.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
}
});
}
示例10: SimpleViewHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
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 v) {
Log.d(getClass().getSimpleName(), "onItemSelected: " + textViewData.getText().toString());
Toast.makeText(v.getContext(), "onItemSelected: " + textViewData.getText().toString(), Toast.LENGTH_SHORT).show();
}
});
}
示例11: bind
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
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;
}
}
示例12: onBindViewHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
@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);
}
});
}
示例13: BookViewHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
public BookViewHolder(View itemView) {
super(itemView);
swipeLayout = (SwipeLayout) itemView.findViewById(R.id.book_swipe_layout);
booksPicName = (TextView) itemView.findViewById(R.id.book_pic_name);
bookName = (TextView) itemView.findViewById(R.id.book_name);
bookAuthor = (TextView) itemView.findViewById(R.id.book_author);
bookCurrentAndTotalWords = (TextView) itemView.findViewById(R.id.book_current_position);
setButtonEdit((TextView) itemView.findViewById(R.id.edit_book));
setButtonShare((TextView) itemView.findViewById(R.id.share_book));
setButtonUpload((TextView) itemView.findViewById(R.id.upload_book));
setButtonDelete((TextView) itemView.findViewById(R.id.delete_book));
}
示例14: SimpleViewHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
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);
}
示例15: onBindViewHolder
import com.daimajia.swipe.SwipeLayout; //导入依赖的package包/类
@Override
public void onBindViewHolder(DialogsHolder holder, int position) {
DialogModel dialog = dialogs.get(position);
holder.setPosition(position);
holder.mLastMessage.setText(dialog.getLastMessage());
holder.mLastMessageDate.setText(String.valueOf(dialog.getLastMessageTime()));
if (dialog.getLastMessageUserId() == currentUserId) {
holder.mMessageAuthor.setText(R.string.me);
} else {
String userName = userNames.get(dialog.getLastMessageUserId().longValue());
if(userName != null)
holder.mMessageAuthor.setText(userNames.get(dialog.getLastMessageUserId().longValue()));
}
holder.mTitle.setText(dialog.getName());
if (dialog.getUnreadMessagesCount() != null && dialog.getUnreadMessagesCount() != 0) {
holder.mLastMessageDate.setTextColor(context.getResources().getColor(R.color.chats_item_last_message_date_new));
holder.mTitle.setTextColor(context.getResources().getColor(R.color.chats_item_name_new));
holder.mNewMessageIndicator.setVisibility(View.VISIBLE);
holder.mNewMessageIndicator.setText(String.format("+%d", dialog.getUnreadMessagesCount()));
ViewCompat.setZ(holder.mNewMessageIndicator, 1000000);
} else {
holder.mLastMessageDate.setTextColor(context.getResources().getColor(R.color.chats_item_last_message_date));
holder.mTitle.setTextColor(context.getResources().getColor(R.color.chats_item_name));
holder.mNewMessageIndicator.setVisibility(View.GONE);
}
holder.swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown);
Bitmap photo = dialogPhotos.get(dialog.getDialogId());
if (photo != null) {
holder.imageView.setImageBitmap(photo);
} else {
holder.imageView.setImageDrawable(context.getResources().getDrawable(R.drawable.user_icon));
}
mItemManger.bindView(holder.itemView, position);
}