本文整理汇总了Java中com.daimajia.swipe.util.Attributes类的典型用法代码示例。如果您正苦于以下问题:Java Attributes类的具体用法?Java Attributes怎么用?Java Attributes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Attributes类属于com.daimajia.swipe.util包,在下文中一共展示了Attributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recyclerview_demo);
recyclerView= (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
List<String> data=new ArrayList<String>();
for(int i=0;i<50;i++){
data.add("主体内容:"+i);
}
RecyclerViewAdapter adapter=new RecyclerViewAdapter(this,data);
adapter.setMode(Attributes.Mode.Single);
recyclerView.setAdapter(adapter);
}
示例2: onActivityCreated
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
TextView emptyView = (TextView) getListView().getEmptyView();
if (emptyView != null)
emptyView.setText(R.string.msg_empty_waypoint_list);
FloatingActionButton fab = (FloatingActionButton) getView().findViewById(R.id.actionButton);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
waypointActionsCallback.onWaypointEdit(new Waypoint());
}
});
adapter = new WaypointListAdapter(getActivity());
setListAdapter(adapter);
adapter.setMode(Attributes.Mode.Single);
}
示例3: onActivityCreated
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
TextView emptyView = (TextView) getListView().getEmptyView();
if (emptyView != null)
emptyView.setText(R.string.msg_empty_route_list);
FloatingActionButton fab = (FloatingActionButton) getView().findViewById(R.id.actionButton);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
Androzic application = Androzic.getApplication();
Route route = new Route("New route", "", true);
application.addRoute(route);
routeActionsCallback.onRouteEdit(route);
}
});
adapter = new RouteListAdapter(getActivity());
setListAdapter(adapter);
adapter.setMode(Attributes.Mode.Single);
}
示例4: onCreate
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recyclerview);
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setTitle("RecyclerView");
}
}
// Layout Managers:
recyclerView.setLayoutManager(new LinearLayoutManager(this));
// Item Decorator:
recyclerView.addItemDecoration(new DividerItemDecoration(getResources().getDrawable(R.drawable.divider)));
recyclerView.setItemAnimator(new DefaultItemAnimator());
// Adapter:
String[] adapterData = new String[]{"Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"};
mDataSet = new ArrayList<String>(Arrays.asList(adapterData));
mAdapter = new RecyclerViewAdapter(this, recyclerView, mDataSet);
((RecyclerViewAdapter) mAdapter).setMode(Attributes.Mode.Single);
recyclerView.setAdapter(mAdapter);
try {
new ItemTouchBuilder()
.setList(mDataSet)
.setAdapter(mAdapter)
.setSwappable(false)
.create(recyclerView)
.attachToRecyclerView(recyclerView);
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: initViews
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
protected void initViews() {
setContentView(R.layout.activity_share);
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
// Layout Managers:
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
// Adapter:
String[] adapterData = new String[]{"Alabama", "Alaska", "Arizona", "Arkansas", "California",
"Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho",
"Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland",
"Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana",
"Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York",
"North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania",
"Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah",
"Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"};
mDataSet = new ArrayList<String>(Arrays.asList(adapterData));
mAdapter = new RecyclerViewAdapter(this, recyclerView, mDataSet);
((RecyclerViewAdapter) mAdapter).setMode(Attributes.Mode.Single);
recyclerView.setAdapter(mAdapter);
/* Listeners */
recyclerView.setOnScrollListener(onScrollListener);
try {
new ItemTouchBuilder()
.setList(mDataSet)
.setAdapter(mAdapter)
.setSwappable(false)
.create(recyclerView)
.attachToRecyclerView(recyclerView);
} catch (Exception e) {
e.printStackTrace();
}
}
示例6: initViews
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
protected void initViews(View view) {
ButterKnife.bind(this, view);
//init cache data
mUsers = new ArrayList<>();
mAdapter = new UserDeleteAdapter(mUsers, new CustomItemClickListener() {
@Override
public void onItemClick(View view, final int position) {
if (view.getId() == R.id.trash) {
getBaseAct().showBaseNotitleDialog("是否删除此条数据", getString(android.R.string.ok),
getString(android.R.string.cancel), new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
if (which == DialogAction.POSITIVE) {
Realm realm = RealmManager.getRealm();
realm.beginTransaction();
User delUser = mUsers.get(position);
delUser.deleteFromRealm();
realm.commitTransaction();
dialog.dismiss();
onRefresh();
}
}
});
}
}
});
mAdapter.setMode(Attributes.Mode.Single);
mRecycler.setAdapter(mAdapter);
mRecycler.setRefreshListener(this);
mAdapter.notifyDataSetChanged();
selectData();
}
示例7: initViews
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
protected void initViews(View view) {
ButterKnife.bind(this, view);
//init cache data
mUserDao = AppContext.getInstance().getDaoSession().getUserDao();
mUserList = mUserDao.loadAll();
mAdapter = new UserDeleteAdapter(mUserList, new CustomItemClickListener() {
@Override
public void onItemClick(View view, final int position) {
if (view.getId() == R.id.trash) {
getBaseAct().showBaseNotitleDialog("是否删除此条数据", getString(android.R.string.ok),
getString(android.R.string.cancel), new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
if (which == DialogAction.POSITIVE) {
//del the data
User user = mAdapter.getItemData(position);
mUserDao.delete(user);
mAdapter.remove(position);
postEvent(new UserDataEvent(mUserDao.loadAll()));
dialog.dismiss();
}
}
});
}
}
});
((RecyclerSwipeAdapter) mAdapter).setMode(Attributes.Mode.Single);
mRecycler.setAdapter(mAdapter);
mRecycler.setRefreshListener(this);
mAdapter.notifyDataSetChanged();
}
示例8: openItem
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
public void openItem(int position) {
if (mode == Attributes.Mode.Multiple) {
if (!mOpenPositions.contains(position))
mOpenPositions.add(position);
} else {
mOpenPosition = position;
}
if (mBaseAdapter != null) {
mBaseAdapter.notifyDataSetChanged();
}
}
示例9: closeItem
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
public void closeItem(int position) {
if (mode == Attributes.Mode.Multiple) {
mOpenPositions.remove(position);
} else {
if (mOpenPosition == position)
mOpenPosition = INVALID_POSITION;
}
if (mBaseAdapter != null) {
mBaseAdapter.notifyDataSetChanged();
}
}
示例10: closeAllItems
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
public void closeAllItems() {
if (mode == Attributes.Mode.Multiple) {
mOpenPositions.clear();
} else {
mOpenPosition = INVALID_POSITION;
}
for (SwipeLayout s : mShownLayouts) {
s.close();
}
}
示例11: getOpenItems
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
public List<Integer> getOpenItems() {
if (mode == Attributes.Mode.Multiple) {
return new ArrayList<Integer>(mOpenPositions);
} else {
return Arrays.asList(mOpenPosition);
}
}
示例12: isOpen
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
public boolean isOpen(int position) {
if (mode == Attributes.Mode.Multiple) {
return mOpenPositions.contains(position);
} else {
return mOpenPosition == position;
}
}
示例13: onClose
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
public void onClose(SwipeLayout layout) {
if (mode == Attributes.Mode.Multiple) {
mOpenPositions.remove(position);
} else {
mOpenPosition = INVALID_POSITION;
}
}
示例14: onOpen
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Override
public void onOpen(SwipeLayout layout) {
if (mode == Attributes.Mode.Multiple)
mOpenPositions.add(position);
else {
closeAllExcept(layout);
mOpenPosition = position;
}
}
示例15: onCreateView
import com.daimajia.swipe.util.Attributes; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.all_merchants_layout,container,false);
Log.e("ShowMerchandise", "进来了");
tbDataBase = TBDataBase.getInstance(getActivity());
tbDataBase.openDB(getActivity());
recyclerView = (RecyclerView)view.findViewById(R.id.recycler_view);
//Layout 信息
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
//Item 属性
recyclerView.addItemDecoration(new DividerItemDecoration(getResources().getDrawable(R.drawable.divider)));
//recyclerView.setItemAnimator(new FadeInLeftAnimator()); // FadeInLeftAnimator 类没有找到
goodsList = tbDataBase.loadMerchants();
mDataSet = new ArrayList<Merchants>();
for (int i = 0;i<goodsList.size();i++){
mDataSet.add(goodsList.get(i));
}
mAdapter = new AllMerchantsAdapter(getActivity(), mDataSet);
((AllMerchantsAdapter) mAdapter).setMode(Attributes.Mode.Single);
recyclerView.setAdapter(mAdapter);
//设置监听器
recyclerView.setOnScrollListener(onScrollListener);
return view;
}