Search in sources :

Example 1 with RecordFileProvider

use of adapter.RecordFileProvider 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);
}
Also used : Bundle(android.os.Bundle) RecordFileProvider(adapter.RecordFileProvider) Intent(android.content.Intent) Date(java.util.Date) RecordFile(entity.RecordFile) Timer(java.util.Timer) TimerTask(java.util.TimerTask) Items(me.drakeet.multitype.Items) MultiTypeAdapter(me.drakeet.multitype.MultiTypeAdapter)

Aggregations

RecordFileProvider (adapter.RecordFileProvider)1 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 RecordFile (entity.RecordFile)1 Date (java.util.Date)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 Items (me.drakeet.multitype.Items)1 MultiTypeAdapter (me.drakeet.multitype.MultiTypeAdapter)1