当前位置: 首页>>代码示例>>Java>>正文


Java Attributes类代码示例

本文整理汇总了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);

}
 
开发者ID:cxbiao,项目名称:Android_Study_Demos,代码行数:19,代码来源:RecyclerViewExample.java

示例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);
}
 
开发者ID:andreynovikov,项目名称:Androzic,代码行数:23,代码来源:WaypointList.java

示例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);
}
 
开发者ID:andreynovikov,项目名称:Androzic,代码行数:26,代码来源:RouteList.java

示例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();
    }
}
 
开发者ID:ymqq,项目名称:CommonFramework,代码行数:38,代码来源:RecyclerViewExample.java

示例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();
    }
}
 
开发者ID:ymqq,项目名称:CommonFramework,代码行数:39,代码来源:ShareActivity.java

示例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();
}
 
开发者ID:chenzj-king,项目名称:RealmSample,代码行数:38,代码来源:DeleteFragment.java

示例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();
}
 
开发者ID:chenzj-king,项目名称:GreenDaoSample,代码行数:37,代码来源:DeleteFragment.java

示例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();
    }
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:13,代码来源:SwipeItemMangerImpl.java

示例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();
    }
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:13,代码来源:SwipeItemMangerImpl.java

示例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();
    }
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:12,代码来源:SwipeItemMangerImpl.java

示例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);
    }
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:9,代码来源:SwipeItemMangerImpl.java

示例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;
    }
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:9,代码来源:SwipeItemMangerImpl.java

示例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;
    }
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:9,代码来源:SwipeItemMangerImpl.java

示例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;
    }
}
 
开发者ID:tengbinlive,项目名称:info_demo,代码行数:10,代码来源:SwipeItemMangerImpl.java

示例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;
}
 
开发者ID:a750183047,项目名称:SqliteDB-Android-DEMO,代码行数:34,代码来源:ShowAllMerchants.java


注:本文中的com.daimajia.swipe.util.Attributes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。