use of me.drakeet.multitype.Items in project KL2 by jweihao.
the class RecyclerViewMultiTypeActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recycler_view_multi_type);
ButterKnife.bind(this);
LinearLayoutManager manager = new LinearLayoutManager(this);
manager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(manager);
mTypeAdapter = new MultiTypeAdapter();
/* 注册类型和View的对应关系 */
mTypeAdapter.register(Category.class, new CategoryViewBinder());
mTypeAdapter.register(Song.class, new SongViewBinder());
mTypeAdapter.register(PostList.class, new HorizontalItemViewBinder());
mRecyclerView.setAdapter(mTypeAdapter);
/* 模拟加载数据,也可以稍后再加载,然后使用
* mTypeAdapter.notifyDataSetChanged(); 刷新列表 */
mItems = new Items();
List<Post> posts = new ArrayList();
for (int i = 0; i < 30; i++) {
mItems.add(new Category("天青色等烟雨,而我在等你。"));
mItems.add(new Song("Android", R.drawable.ic_launcher));
mItems.add(new Song("IOS", R.mipmap.ic_launcher_round));
// mItems.add(new PostList(new Post(R.drawable.ic_launcher, "机器人"), 1));
posts.add(new Post(R.mipmap.ic_launcher_round, "机器人"));
}
mItems.add(2, new PostList(posts));
mTypeAdapter.setItems(mItems);
mTypeAdapter.notifyDataSetChanged();
}
use of me.drakeet.multitype.Items in project GwellDemo by dxsdyhm.
the class AllarmImageListActivity method initData.
private void initData() {
items = new Items();
adapter = new MultiTypeAdapter(items);
creatFile();
AlarmInfoProvider p = new AlarmInfoProvider();
p.setOnItemClickListner(listner);
adapter.register(AlarmInfo.class, p);
rcAllarm.setLayoutManager(new LinearLayoutManager(this));
rcAllarm.setAdapter(adapter);
}
use of me.drakeet.multitype.Items in project GwellDemo by dxsdyhm.
the class RecordFilesActivity method getRecordFiles.
private void getRecordFiles() {
txLoading.setVisibility(View.VISIBLE);
txLoading.setText(R.string.loading);
// 经过转换后的设备密码
devicePwd = P2PHandler.getInstance().EntryPassword(devicePwd);
items = new Items();
adapter = new MultiTypeAdapter(items);
Date endDate = new Date(System.currentTimeMillis());
RecordFileProvider recordFileProvider = new RecordFileProvider();
adapter.register(RecordFile.class, recordFileProvider);
recordFileProvider.setOnItemClickListner(new RecordFileProvider.OnItemClickListner() {
@Override
public void onItemClick(int position, RecordFile recordFile) {
Intent intent = new Intent(RecordFilesActivity.this, PlayBackActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("file", recordFile);
intent.putExtra("recordFile", bundle);
intent.putExtra("deviceId", deviceId);
intent.putExtra("devicePwd", devicePwd);
startActivity(intent);
}
});
// 获取录像列表
P2PHandler.getInstance().getRecordFiles(deviceId, devicePwd, startDate, endDate);
rcRecordfiles.setAdapter(adapter);
new Timer().schedule(new TimerTask() {
@Override
public void run() {
if (items.size() == 0) {
hander.sendEmptyMessage(0);
}
}
}, 8000);
}
use of me.drakeet.multitype.Items in project GwellDemo by dxsdyhm.
the class SensorActivity method initRC.
private void initRC() {
rcSensor.setLayoutManager(new GridLayoutManager(this, 8));
items = new Items();
adapter = new MultiTypeAdapter(items);
SensorProvider provider = new SensorProvider();
adapter.register(Integer.class, provider);
provider.setOnItemClickListner(new SensorProvider.OnItemClickListner() {
@Override
public void onItemClick(int position, Integer integer) {
if (integer == 1) {
// 学习配对
P2PHandler.getInstance().setDefenceAreaState(deviceId, devicePass, position / 8, position % 8, 0);
Toast.makeText(SensorActivity.this, R.string.start_pair, Toast.LENGTH_SHORT).show();
currentPositon = position;
}
}
});
rcSensor.setAdapter(adapter);
}
use of me.drakeet.multitype.Items in project GwellDemo by dxsdyhm.
the class DeviceActivity method initUI.
private void initUI() {
txDeviceinfo.setText(device.toString());
items = new Items();
adapter = new MultiTypeAdapter(items);
adapter.register(LogInfo.class, new LogInfoProvider());
ryContent.setLayoutManager(new LinearLayoutManager(this));
ryContent.setAdapter(adapter);
etIp.setText(IPDefault);
etPort.setText(String.valueOf(Server_port));
ryContent.setVisibility(View.GONE);
// setTitle(getString(R.string.wait_label));
String tips = getString(R.string.wait_label);
txUertips.setText(tips);
txUertips.append("\n");
txUertips.append(String.format(getString(R.string.tips2), surpprot_email));
Linkify.addLinks(txUertips, Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES);
}
Aggregations