use of adapter.SensorProvider 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);
}
Aggregations