本文整理汇总了Java中com.zhy.adapter.recyclerview.CommonAdapter类的典型用法代码示例。如果您正苦于以下问题:Java CommonAdapter类的具体用法?Java CommonAdapter怎么用?Java CommonAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommonAdapter类属于com.zhy.adapter.recyclerview包,在下文中一共展示了CommonAdapter类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAdapter
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
private CommonAdapter getAdapter() {
return new CommonAdapter<Tip>(this,R.layout.item_layout,tips) {
@Override
protected void convert(ViewHolder holder, final Tip tip, int position) {
holder.setText(R.id.poi_field_id,tip.getName());
holder.setText(R.id.poi_value_id,tip.getDistrict());
holder.getView(R.id.item_layout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EventBus.getDefault().post(tip);
finish();
}
});
}
};
}
开发者ID:Vicent9920,项目名称:MyMap,代码行数:19,代码来源:PoiSearchActivity.java
示例2: getAdapter
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
private CommonAdapter getAdapter() {
return new CommonAdapter<ListViewHoldier>(this,R.layout.item_listview_location,data) {
@Override
protected void convert(ViewHolder holder, final ListViewHoldier listViewHoldier, int position) {
holder.setText(R.id.rl_tv_name,listViewHoldier.title);
holder.setText(R.id.rl_tv_location,listViewHoldier.address);
holder.getView(R.id.rl_tv_subit).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Intent intent = new Intent(mContext,NavigationActivity.class);
// intent.putExtra("value",listViewHoldier.lp);
// intent.putExtra("address",listViewHoldier.address);
// setResult(RESULT_OK,intent);
Tip tip = new Tip();
tip.setDistrict(listViewHoldier.address);
tip.setPostion(listViewHoldier.lp);
EventBus.getDefault().postSticky(tip);
finish();
}
});
}
};
}
开发者ID:Vicent9920,项目名称:MyMap,代码行数:26,代码来源:PiclocationActivity.java
示例3: onActivityCreated
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
int[] intArray = getResources().getIntArray(R.array.colors);
list.clear();
for (int anIntArray : intArray) {
list.add(anIntArray);
}
commonAdapter = new CommonAdapter<Integer>(getActivity(), R.layout.item_coupon_dash_line, list) {
@Override
protected void convert(ViewHolder holder, Integer s, int position) {
CouponView couponView = holder.getView(R.id.couponView);
couponView.setBackgroundColor(s);
}
};
mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
outRect.set(dp2Px(6), dp2Px(6), dp2Px(6), 0);
}
});
mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
mRecyclerView.setAdapter(commonAdapter);
}
开发者ID:dongjunkun,项目名称:CouponView,代码行数:26,代码来源:CouponDashLineFragment.java
示例4: onActivityCreated
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
int[] intArray = getResources().getIntArray(R.array.colors);
list.clear();
for (int anIntArray : intArray) {
list.add(anIntArray);
}
commonAdapter = new CommonAdapter<Integer>(getActivity(), R.layout.item_coupon_combination, list) {
@Override
protected void convert(ViewHolder holder, Integer s, int position) {
CouponView couponView = holder.getView(R.id.couponView);
couponView.setBackgroundColor(s);
}
};
mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
outRect.set(dp2Px(6), dp2Px(6), dp2Px(6), 0);
}
});
mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
mRecyclerView.setAdapter(commonAdapter);
}
开发者ID:dongjunkun,项目名称:CouponView,代码行数:26,代码来源:CouponCombinationFragment.java
示例5: refreshFocusedView
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
/**
* 显示头部的关注列表
*
* @param focusedData
*/
@Override
public void refreshFocusedView(List<TopTopicListBean> focusedData) {
// 作为全局变量,后面的点击事件要用到
mFocusedData = focusedData;
// 如果没有关注,显示3个item
if (!mIsFocused) {
mFocuseView.setData(focusedData);
} else {
// 如果有关注,显示N个item + 添加按钮
CommonAdapter<TopTopicListBean> adapter =
new CommonAdapter<TopTopicListBean>(getActivity(), R.layout.item_focused, focusedData) {
@Override
protected void convert(ViewHolder holder, TopTopicListBean bean, int position) {
ImageLoader.loadImage(getActivity(), bean.getNewIcon(),
(ImageView) holder.getView(R.id.item_focused_iv));
}
};
// 添加Footer
//HeaderAndFooterWrapper headerAndFooterWrapper = new HeaderAndFooterWrapper<>(adapter);
//headerAndFooterWrapper.addFootView(mAddView);
//mFocusedRv.setAdapter(headerAndFooterWrapper);
mFocusedRv.setAdapter(adapter);
//headerAndFooterWrapper.notifyDataSetChanged();
// 设置点击事件
initFocusedItemClickListener(adapter);
}
}
开发者ID:Jay-Ping,项目名称:newIPlay,代码行数:35,代码来源:NewsFocusedFragment.java
示例6: initData
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
@Override
protected void initData() {
/* 隐藏状态栏 */
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.map_test);
gpsMapview.setImageView(bitmap);
setLeftVisiable(true);
controlTabs = new ArrayList<>();
controlTabs.add(new ControlTab(R.mipmap.play));
controlTabs.add(new ControlTab(R.mipmap.stop));
controlTabs.add(new ControlTab(R.mipmap.cancel));
rvControl.setLayoutManager(new LinearLayoutManager(this));
rvControl.setAdapter(new CommonAdapter<ControlTab>(this, R.layout.control_item, controlTabs) {
@Override
protected void convert(ViewHolder holder, ControlTab controlTab, int position) {
((ImageView) holder.getView(R.id.iv)).setImageBitmap(
BitmapFactory
.decodeResource(getResources(), controlTab.getResId()));
}
});
rockerViewCenter.setOnAngleChangeListener(this);
mPresenter.startScanMap();
}
开发者ID:ZhouKanZ,项目名称:SweepRobot,代码行数:33,代码来源:CreateActivity.java
示例7: initAdapter
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
private void initAdapter() {
adapter = new CommonAdapter<TaskPoint>(mCtz,R.layout.item_point_task,points) {
@Override
protected void convert(ViewHolder holder, TaskPoint taskPoint, int position) {
// 将taskPoint绘制到GpsImageView上
gpsMapviewTask.addPoint(taskPoint.getX(),taskPoint.getY(),taskPoint.getTaskName());
holder.setText(R.id.tv_name,taskPoint.getTaskName());
if (position == points.size() - 1){
holder.setVisible(R.id.line_horizontal,false);
}
}
};
}
开发者ID:ZhouKanZ,项目名称:SweepRobot,代码行数:14,代码来源:TaskDetailActivity.java
示例8: initData
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
@Override
protected void initData() {
tasks = new ArrayList<>();
tasks.add(new GpsMap(1,R.mipmap.map_test,"测试地图1","2017-7-18",1));
tasks.add(new GpsMap(2,R.mipmap.map_test,"测试地图2","2017-7-18",2));
tasks.add(new GpsMap(3,R.mipmap.map_test,"测试地图3","2017-7-18",3));
tasks.add(new GpsMap(4,R.mipmap.map_test,"测试地图4","2017-7-18",4));
setLeftVisiable(true);
rvTasks.setLayoutManager(new LinearLayoutManager(this));
rvTasks.setAdapter(new CommonAdapter<GpsMap>(this,R.layout.item_task,tasks) {
@Override
protected void convert(ViewHolder holder, GpsMap gpsMap, int position) {
GpsMap gps = tasks.get(position);
holder.setText(R.id.tv_title,gps.getMapName());
holder.setText(R.id.tv_date,gps.getCreateDate());
holder.setImageBitmap(R.id.iv_map, BitmapFactory.decodeResource(TaskQueueActivity.this.getResources(),gps.getMapResId()));
holder.setOnClickListener(R.id.layout_task_item, new View.OnClickListener() {
@Override
public void onClick(View view) {
TaskTypeActivity.startSelf(TaskQueueActivity.this,TaskTypeActivity.class,null);
}
});
}
});
}
开发者ID:ZhouKanZ,项目名称:SweepRobot,代码行数:33,代码来源:TaskQueueActivity.java
示例9: onActivityCreated
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
int[] intArray = getResources().getIntArray(R.array.colors);
list.clear();
for (int anIntArray : intArray) {
list.add(anIntArray);
}
commonAdapter = new CommonAdapter<Integer>(getActivity(), R.layout.item_coupon_semi_circle, list) {
@Override
protected void convert(ViewHolder holder, Integer s, int position) {
CouponView couponView = holder.getView(R.id.couponView);
couponView.setBackgroundColor(s);
}
};
mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
outRect.set(dp2Px(6), dp2Px(6), dp2Px(6), 0);
}
});
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mRecyclerView.setAdapter(commonAdapter);
}
开发者ID:dongjunkun,项目名称:CouponView,代码行数:28,代码来源:CouponSemiCircleFragment.java
示例10: onCreate
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
android.transition.Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.explode);
getWindow().setEnterTransition(transition);
}
StatusBarUtil.setColor(this, Color.TRANSPARENT);
mDataBinding.btnUpdate.setOnClickListener(this);
mDataBinding.btnUpdate.measure(0, 0);
mUpdateBtnLeft = ScreenUtils.getScreenSize(this)[0] -
mDataBinding.btnUpdate.getMeasuredWidth() - DensityUtils.dp2px(this ,10);
initToolbar();
mSdcardRootPath = Environment.getExternalStorageDirectory()
.getAbsolutePath();
mDataBinding.rlMusice.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new CommonAdapter<MusicInfo>(this, R.layout.item_musicfile, mMusicList) {
@Override
protected void convert(ViewHolder holder, final MusicInfo musicInfo, int position) {
holder.setText(R.id.tv_name, musicInfo.getFilename());
holder.setText(R.id.tv_size, musicInfo.getFileSize());
holder.itemView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
clickItem(musicInfo);
}
});
}
};
mDataBinding.rlMusice.setAdapter(mAdapter);
mDataBinding.rlMusice.addItemDecoration(new DividerItemDecoration(this,
DividerItemDecoration.VERTICAL));
mDao = MyApplication.getInstances().
getDaoSession().getMusicInfoDao();
FileChooserActivityPermissionsDispatcher.refreshDataWithPermissionCheck(this, false);
}
开发者ID:zyl409214686,项目名称:Mp3Cutter,代码行数:36,代码来源:FileChooserActivity.java
示例11: onCreate
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mRecyclerView = findViewById(R.id.id_recyclerview);
List<String> mockDatas = new ArrayList<>();
for (int i = 0; i < 100; i++) {
mockDatas.add(i + "");
}
mRecyclerView.setLayoutManager(mLinearLayoutManager = new LinearLayoutManager(this));
mRecyclerView.setAdapter(new CommonAdapter<String>(MainActivity.this,
R.layout.item,
mockDatas) {
@Override
protected void convert(ViewHolder holder, String o, int position) {
if (position > 0 && position % 7 == 0) {
holder.setVisible(R.id.id_tv_title, false);
holder.setVisible(R.id.id_tv_desc, false);
holder.setVisible(R.id.id_iv_ad, true);
} else {
holder.setVisible(R.id.id_tv_title, true);
holder.setVisible(R.id.id_tv_desc, true);
holder.setVisible(R.id.id_iv_ad, false);
}
}
});
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int fPos = mLinearLayoutManager.findFirstVisibleItemPosition();
int lPos = mLinearLayoutManager.findLastCompletelyVisibleItemPosition();
for (int i = fPos; i <= lPos; i++) {
View view = mLinearLayoutManager.findViewByPosition(i);
AdImageViewVersion1 adImageView = view.findViewById(R.id.id_iv_ad);
if (adImageView.getVisibility() == View.VISIBLE) {
adImageView.setDy(mLinearLayoutManager.getHeight() - view.getTop());
}
}
}
});
}
开发者ID:hongyangAndroid,项目名称:demo_rvadimage,代码行数:49,代码来源:MainActivity.java
示例12: initData
import com.zhy.adapter.recyclerview.CommonAdapter; //导入依赖的package包/类
@Override
protected void initData() {
tabs = new ArrayList<>();
tabs.add(new TaskTab("导航任务"));
tabs.add(new TaskTab("路径任务"));
tabs.add(new TaskTab("清洁任务"));
setLeftVisiable(true);
rvTaskList.setLayoutManager(new LinearLayoutManager(this));
rvTaskList.setAdapter(new CommonAdapter<TaskTab>(this,R.layout.item_task_tab,tabs) {
@Override
protected void convert(ViewHolder holder, TaskTab taskTab, final int position) {
TaskTab tab = tabs.get(position);
holder.setText(R.id.tv_tab_name,tab.getTab_name());
holder.setOnClickListener(R.id.layouot_task_tab, new View.OnClickListener() {
@Override
public void onClick(View view) {
Bundle bundle = new Bundle();
if (position == 0){
// 导航任务
bundle.putString("type","navi");
TaskDetailActivity.startSelf(TaskTypeActivity.this,TaskDetailActivity.class,bundle);
}else if (position == 1){
// 路径任务
bundle.putString("type","path");
TaskDetailActivity.startSelf(TaskTypeActivity.this,TaskDetailActivity.class,bundle);
}else {
// 清洁任务
bundle.putString("type","clear");
TaskDetailActivity.startSelf(TaskTypeActivity.this,TaskDetailActivity.class,bundle);
}
}
});
if (position == 2){
holder.setVisible(R.id.line,false);
}
}
});
}
开发者ID:ZhouKanZ,项目名称:SweepRobot,代码行数:44,代码来源:TaskTypeActivity.java
注:本文中的com.zhy.adapter.recyclerview.CommonAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论