adapter=new VideoAdapter(getRecyclerView()); setAdapter(adapter); getRecyclerView().requestFocus();
@Override public boolean onOptionsItemSelected(MenuItem item) { int position=adapter.getCheckedPosition(); if (item.getItemId()==R.id.play_video) { if (position>=0) { playVideo(adapter.getVideoUri(position)); } else { Toast.makeText(this, R.string.msg_choose, Toast.LENGTH_LONG).show(); } return(true); } else if (item.getItemId()==R.id.show_thumbnail) { if (position>=0) { showLargeThumbnail(adapter.getVideoUri(position)); } else { Toast.makeText(this, R.string.msg_choose, Toast.LENGTH_LONG).show(); } return(true); } return(super.onOptionsItemSelected(item)); }
@Override public void onBindViewHolder(RowController holder, int position) { videos.moveToPosition(position); holder.bindModel(videos, isChecked(position)); }
@Override public void onCreate(Bundle state) { super.onCreate(state); setContentView(R.layout.main); player=findViewById(R.id.player); if (player!=null) { player.setOnDragListener(this); } thumbnailLarge=findViewById(R.id.thumbnail_large); if (thumbnailLarge!=null) { thumbnailLarge.setOnDragListener(this); } setLayoutManager(new LinearLayoutManager(this)); adapter=new VideoAdapter(getRecyclerView()); setAdapter(adapter); getRecyclerView().requestFocus(); if (state!=null) { isInPermission= state.getBoolean(STATE_IN_PERMISSION, false); } if (hasFilesPermission()) { loadVideos(); } else if (!isInPermission) { isInPermission=true; ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_PERMS); } }
@Override public void onCreate(Bundle state) { super.onCreate(state); setContentView(R.layout.main); player=findViewById(R.id.player); if (player!=null) { player.setOnDragListener(this); } thumbnailLarge=findViewById(R.id.thumbnail_large); if (thumbnailLarge!=null) { thumbnailLarge.setOnDragListener(this); } setLayoutManager(new LinearLayoutManager(this)); adapter=new VideoAdapter(getRecyclerView()); setAdapter(adapter); getRecyclerView().requestFocus(); if (state!=null) { isInPermission= state.getBoolean(STATE_IN_PERMISSION, false); } if (hasFilesPermission()) { loadVideos(); } else if (!isInPermission) { isInPermission=true; ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_PERMS); } }
@Override public void onCreate(Bundle state) { super.onCreate(state); setContentView(R.layout.main); player=findViewById(R.id.player); if (player!=null) { player.setOnDragListener(this); } thumbnailLarge=findViewById(R.id.thumbnail_large); if (thumbnailLarge!=null) { thumbnailLarge.setOnDragListener(this); } setLayoutManager(new LinearLayoutManager(this)); adapter=new VideoAdapter(getRecyclerView()); setAdapter(adapter); getRecyclerView().requestFocus(); if (state!=null) { isInPermission= state.getBoolean(STATE_IN_PERMISSION, false); } if (hasFilesPermission()) { loadVideos(); } else if (!isInPermission) { isInPermission=true; ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_PERMS); } }
@Override public void onCreate(Bundle state) { super.onCreate(state); setContentView(R.layout.main); player=findViewById(R.id.player); if (player!=null) { player.setOnDragListener(this); } thumbnailLarge=findViewById(R.id.thumbnail_large); if (thumbnailLarge!=null) { thumbnailLarge.setOnDragListener(this); } setLayoutManager(new LinearLayoutManager(this)); adapter=new VideoAdapter(getRecyclerView()); setAdapter(adapter); getRecyclerView().requestFocus(); if (state!=null) { isInPermission= state.getBoolean(STATE_IN_PERMISSION, false); } if (hasFilesPermission()) { loadVideos(); } else if (!isInPermission) { isInPermission=true; ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_PERMS); } }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (event.getRepeatCount()==0) { if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT) { int position=adapter.getCheckedPosition(); if (position>=0) { Uri videoUri=adapter.getVideoUri(position); if (event.isAltPressed()) { playVideo(videoUri); } else if (event.isCtrlPressed()) { showLargeThumbnail(videoUri); } return(true); } } else if (keyCode==KeyEvent.KEYCODE_SLASH && event.isMetaPressed() && Build.VERSION.SDK_INT<Build.VERSION_CODES.N) { new ShortcutDialogFragment().show(getSupportFragmentManager(), "shortcuts"); return(true); } } return(super.onKeyDown(keyCode, event)); }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) { int position=adapter.getCheckedPosition(); if (position>=0) { Uri videoUri=adapter.getVideoUri(position); if (event.isAltPressed()) { playVideo(videoUri); } else if (event.isCtrlPressed()) { showLargeThumbnail(videoUri); } return(true); } } return(super.onKeyDown(keyCode, event)); }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) { int position=adapter.getCheckedPosition(); if (position>=0) { Uri videoUri=adapter.getVideoUri(position); if (event.isAltPressed()) { playVideo(videoUri); } else if (event.isCtrlPressed()) { showLargeThumbnail(videoUri); } return(true); } } return(super.onKeyDown(keyCode, event)); }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) { int position=adapter.getCheckedPosition(); if (position>=0) { Uri videoUri=adapter.getVideoUri(position); if (event.isAltPressed()) { playVideo(videoUri); } else if (event.isCtrlPressed()) { showLargeThumbnail(videoUri); } return(true); } } return(super.onKeyDown(keyCode, event)); }
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) { int position=adapter.getCheckedPosition(); if (position>=0) { Uri videoUri=adapter.getVideoUri(position); if (event.isAltPressed()) { playVideo(videoUri); } else if (event.isCtrlPressed()) { showLargeThumbnail(videoUri); } return(true); } } return(super.onKeyDown(keyCode, event)); }
void setVideos(Cursor videos) { this.videos=videos; notifyDataSetChanged(); }
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor c) { ((VideoAdapter)getAdapter()).setVideos(c); }
void setVideos(Cursor videos) { this.videos=videos; notifyDataSetChanged(); }
@Override public void onLoaderReset(Loader<Cursor> loader) { ((VideoAdapter)getAdapter()).setVideos(null); }
@Override public void onRestoreInstanceState(Bundle state) { adapter.onRestoreInstanceState(state); }
void setVideos(Cursor videos) { this.videos=videos; notifyDataSetChanged(); }
@Override public void onRestoreInstanceState(Bundle state) { adapter.onRestoreInstanceState(state); }
void setVideos(Cursor videos) { this.videos=videos; notifyDataSetChanged(); }