Пример #1
0
 private void focusHelper(boolean idIsEmpty) {
   View parent = getView();
   if (getActivity() == null || !(getActivity() instanceof MainActivity)) return;
   MainActivity activity = (MainActivity) getActivity();
   activity.setMenuFocusDown(idIsEmpty, android.R.id.list);
   activity.setSearchAsFocusDown(idIsEmpty, parent, android.R.id.list);
 }
Пример #2
0
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   MediaWrapper media = mVideoAdapter.getItem(position);
   if (media == null) return;
   if (media instanceof MediaGroup) {
     MainActivity activity = (MainActivity) getActivity();
     activity.showSecondaryFragment(SecondaryActivity.VIDEO_GROUP_LIST, media.getTitle());
   } else playVideo(media, false);
 }
Пример #3
0
 private boolean handleContextItemSelected(MenuItem menu, int position) {
   if (position >= mVideoAdapter.getCount()) return false;
   MediaWrapper media = mVideoAdapter.getItem(position);
   if (media == null) return false;
   switch (menu.getItemId()) {
     case R.id.video_list_play_from_start:
       playVideo(media, true);
       return true;
     case R.id.video_list_play_audio:
       playAudio(media);
       return true;
     case R.id.video_list_info:
       Activity activity = getActivity();
       if (activity instanceof MainActivity)
         ((MainActivity) activity)
             .showSecondaryFragment(SecondaryActivity.MEDIA_INFO, media.getLocation());
       else {
         Intent i = new Intent(activity, SecondaryActivity.class);
         i.putExtra("fragment", "mediaInfo");
         i.putExtra("param", media.getLocation());
         startActivity(i);
       }
       return true;
     case R.id.video_list_delete:
       Snackbar.make(getView(), getString(R.string.file_deleted), Snackbar.LENGTH_LONG)
           .setAction(android.R.string.cancel, mCancelDeleteMediaListener)
           .show();
       Message msg = mDeleteHandler.obtainMessage(DELETE_MEDIA, position, 0);
       mDeleteHandler.sendMessageDelayed(msg, DELETE_DURATION);
       return true;
   }
   return false;
 }
Пример #4
0
 @Override
 public void sendTextInfo(String info, int progress, int max) {
   if (mMainActivity != null) mMainActivity.sendTextInfo(info, progress, max);
 }
Пример #5
0
 @Override
 public void clearTextInfo() {
   if (mMainActivity != null) mMainActivity.clearTextInfo();
 }
Пример #6
0
 @Override
 public void hideProgressBar() {
   if (mMainActivity != null) mMainActivity.hideProgressBar();
 }
Пример #7
0
 @Override
 public void showProgressBar() {
   if (mMainActivity != null) mMainActivity.showProgressBar();
 }