本文整理汇总了Java中com.daimajia.swipe.SimpleSwipeListener类的典型用法代码示例。如果您正苦于以下问题:Java SimpleSwipeListener类的具体用法?Java SimpleSwipeListener怎么用?Java SimpleSwipeListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleSwipeListener类属于com.daimajia.swipe包,在下文中一共展示了SimpleSwipeListener类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBindViewHolder
import com.daimajia.swipe.SimpleSwipeListener; //导入依赖的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);
}
示例2: onBindViewHolder
import com.daimajia.swipe.SimpleSwipeListener; //导入依赖的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);
}
示例3: onBindViewHolder
import com.daimajia.swipe.SimpleSwipeListener; //导入依赖的package包/类
@Override
public void onBindViewHolder(final FavoriteHolder viewHolder, final int position) {
//更新数据
viewHolder.setData(mDataset.get(position), mContext);
viewHolder.swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown);
viewHolder.swipeLayout.addSwipeListener(new SimpleSwipeListener() {
@Override
public void onOpen(SwipeLayout layout) {
}
});
viewHolder.tv_item_swipe_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DbFav dbFav = DbFav.Builder(mContext, DbConstant.DbFavrite);
String title = mDataset.get(position).getTitle();//存储删除前的标题,回调用
//删除数据
dbFav.DeleteItem(mDataset.get(position).getUrl());
boolean isNull = dbFav.FindAllIsExit();//删除后数据是否为null,回调用
mItemManger.removeShownLayouts(viewHolder.swipeLayout);
notifyItemRemoved(position);
notifyItemRangeChanged(position, mDataset.size());
mItemManger.closeAllItems();
dbFav.Close();
//回调
onFavoriteItemDeleteListener.onItemDelete(title, isNull);
}
});
viewHolder.llitemcontent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//跳转到电视剧
JumpActivityUtil.JumpPageDetail2(position, mContext, mDataset);
}
});
mItemManger.bindView(viewHolder.itemView, position);
}
示例4: generateView
import com.daimajia.swipe.SimpleSwipeListener; //导入依赖的package包/类
@Override
public View generateView(final int position, ViewGroup parent) {
View v = LayoutInflater.from(mContext).inflate(R.layout.listview_item, null);
swipeLayout = (SwipeLayout)v.findViewById(getSwipeLayoutResourceId(position));
swipeLayout.addSwipeListener(new SimpleSwipeListener() {
@Override
public void onOpen(SwipeLayout arg0) {
// while open, set the animations of the 3 buttons
YoYo.with(GlobalSettings.TIP_ANIMATION_STYLE)
.duration(GlobalSettings.TIP_ANIMATION_DURATION)
.delay(GlobalSettings.TIP_ANIMATION_DELAY)
.playOn(arg0.findViewById(R.id.right_arrow));
YoYo.with(GlobalSettings.TIP_ANIMATION_STYLE)
.duration(GlobalSettings.TIP_ANIMATION_DURATION)
.delay(GlobalSettings.TIP_ANIMATION_DELAY)
.playOn(arg0.findViewById(R.id.be_top));
YoYo.with(GlobalSettings.TIP_ANIMATION_STYLE)
.duration(GlobalSettings.TIP_ANIMATION_DURATION)
.delay(GlobalSettings.TIP_ANIMATION_DELAY)
.playOn(arg0.findViewById(R.id.set_time));
YoYo.with(GlobalSettings.TIP_ANIMATION_STYLE)
.duration(GlobalSettings.TIP_ANIMATION_DURATION)
.delay(GlobalSettings.TIP_ANIMATION_DELAY)
.playOn(arg0.findViewById(R.id.set_star));
YoYo.with(GlobalSettings.TIP_ANIMATION_STYLE)
.duration(GlobalSettings.TIP_ANIMATION_DURATION)
.delay(GlobalSettings.TIP_ANIMATION_DELAY)
.playOn(arg0.findViewById(R.id.delete));
}
});
return v;
}
示例5: generateView
import com.daimajia.swipe.SimpleSwipeListener; //导入依赖的package包/类
@Override
public View generateView(final int position, ViewGroup parent) {
View v = LayoutInflater.from(mContext).inflate(R.layout.past_listview_item, null);
width = parent.getWidth();
swipeLayout = (SwipeLayout)v.findViewById(getSwipeLayoutResourceId(position));
swipeLayout.addSwipeListener(new SimpleSwipeListener() {
@Override
public void onOpen(SwipeLayout arg0) {
// while open, set the animations of the buttons
YoYo.with(GlobalSettings.TIP_ANIMATION_STYLE)
.duration(GlobalSettings.TIP_ANIMATION_DURATION)
.delay(GlobalSettings.TIP_ANIMATION_DELAY)
.playOn(arg0.findViewById(R.id.past_be_top));
YoYo.with(GlobalSettings.TIP_ANIMATION_STYLE)
.duration(GlobalSettings.TIP_ANIMATION_DURATION)
.delay(GlobalSettings.TIP_ANIMATION_DELAY)
.playOn(arg0.findViewById(R.id.past_right_arrow));
YoYo.with(GlobalSettings.TIP_ANIMATION_STYLE)
.duration(GlobalSettings.TIP_ANIMATION_DURATION)
.delay(GlobalSettings.TIP_ANIMATION_DELAY)
.playOn(arg0.findViewById(R.id.past_delete));
}
});
return v;
}
示例6: onBindViewHolder
import com.daimajia.swipe.SimpleSwipeListener; //导入依赖的package包/类
@Override
public void onBindViewHolder(final TagViewHolder viewHolder, final int position) {
viewHolder.textView.setText(mTags.get(position));
viewHolder.deleteButton.setEnabled(true);
viewHolder.deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
viewHolder.deleteButton.setEnabled(false);
// animate and delete tag
YoYo.with(Techniques.Bounce).duration(200).withListener(new SimpleNineoldAnimatorListener() {
@Override
public void onAnimationEnd(Animator animation) {
String tag = viewHolder.textView.getText().toString();
mItemManger.removeShownLayouts(viewHolder.swipeLayout);
mTags.remove(tag);
notifyItemRemoved(position);
notifyItemRangeChanged(position, mTags.size());
mItemManger.closeAllItems();
mDeleteListener.onDelete(tag);
}
}).playOn(viewHolder.deleteButton);
}
});
viewHolder.swipeLayout.addSwipeListener(new SimpleSwipeListener() {
@Override
public void onOpen(SwipeLayout layout) {
YoYo.with(Techniques.Tada).duration(500).delay(100).playOn(layout.findViewById(R.id.trash_image_view));
}
});
mItemManger.bindView(viewHolder.itemView, position);
}