[Android] Remove old video browser
Geoffrey Métais
git at videolan.org
Fri Jan 15 17:22:28 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 15 17:20:21 2016 +0100| [ac0e424ab289e62383f71b5d4bf617c8b8047ff6] | committer: Geoffrey Métais
Remove old video browser
> https://code.videolan.org/videolan/vlc-android/commit/ac0e424ab289e62383f71b5d4bf617c8b8047ff6
---
.../vlc/gui/tv/browser/VideoGridFragment.java | 154 ---------------------
1 file changed, 154 deletions(-)
diff --git a/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/VideoGridFragment.java b/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/VideoGridFragment.java
deleted file mode 100644
index 7bb6bf8..0000000
--- a/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/VideoGridFragment.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * *************************************************************************
- * VideoGridFragment.java
- * **************************************************************************
- * Copyright © 2015 VLC authors and VideoLAN
- * Author: Geoffrey Métais
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- * ***************************************************************************
- */
-
-package org.videolan.vlc.gui.tv.browser;
-
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v17.leanback.widget.OnItemViewClickedListener;
-import android.support.v17.leanback.widget.Presenter;
-import android.support.v17.leanback.widget.Row;
-import android.support.v17.leanback.widget.RowPresenter;
-import android.support.v4.util.SimpleArrayMap;
-
-import org.videolan.vlc.R;
-import org.videolan.vlc.gui.tv.MainTvActivity;
-import org.videolan.vlc.gui.tv.browser.interfaces.BrowserActivityInterface;
-import org.videolan.vlc.gui.video.VideoListHandler;
-import org.videolan.vlc.interfaces.IVideoBrowser;
-import org.videolan.vlc.media.MediaUtils;
-import org.videolan.vlc.media.MediaWrapper;
-import org.videolan.vlc.media.Thumbnailer;
-
-import java.util.ArrayList;
-
-public class VideoGridFragment extends MediaLibBrowserFragment implements IVideoBrowser {
-
- private Handler mHandler = new VideoListHandler(this);
- protected static Thumbnailer sThumbnailer;
- SimpleArrayMap<String, Integer> mMediaIndex;
- ArrayList<MediaWrapper> mVideoList;
-
- private volatile AsyncVideoUpdate mUpdater = null;
-
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- sThumbnailer = MainTvActivity.getThumbnailer();
- }
-
- public void onResume() {
- super.onResume();
- mMediaLibrary.addUpdateHandler(mHandler);
- if (mUpdater == null) {
- mUpdater = new AsyncVideoUpdate();
- mUpdater.execute();
- }
- if (sThumbnailer != null)
- sThumbnailer.setVideoBrowser(this);
- }
-
- public void onPause() {
- super.onPause();
- mMediaLibrary.removeUpdateHandler(mHandler);
- /* unregister from thumbnailer */
- if (sThumbnailer != null)
- sThumbnailer.setVideoBrowser(null);
- }
-
- public class AsyncVideoUpdate extends AsyncTask<Void, MediaWrapper, Void> {
-
- public AsyncVideoUpdate() {}
-
- @Override
- protected void onPreExecute(){
- setTitle(getString(R.string.app_name_full));
- mAdapter.clear();
- ((BrowserActivityInterface)getActivity()).showProgress(true);
- }
- @Override
- protected Void doInBackground(Void... params) {
- int size;
- MediaWrapper MediaWrapper;
-
- mVideoList = mMediaLibrary.getVideoItems();
- size = mVideoList == null ? 0 : mVideoList.size();
- mMediaIndex = new SimpleArrayMap<String, Integer>(size);
-
- for (int i = 0 ; i < size ; ++i){
- MediaWrapper = mVideoList.get(i);
- mMediaIndex.put(MediaWrapper.getLocation(), Integer.valueOf(i));
- publishProgress(MediaWrapper);
- }
- return null;
- }
-
- protected void onProgressUpdate(MediaWrapper... medias){
- mAdapter.add(medias[0]);
- }
-
- @Override
- protected void onPostExecute(Void result) {
- ((BrowserActivityInterface)getActivity()).showProgress(false);
- setOnItemViewClickedListener(mClickListener);
- }
- }
-
-
- OnItemViewClickedListener mClickListener = new OnItemViewClickedListener() {
- @Override
- public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
- RowPresenter.ViewHolder rowViewHolder, Row row) {
- MediaUtils.openList(mContext, mVideoList, mMediaIndex.get(((MediaWrapper)item).getLocation()).intValue());
- }
- };
- @Override
- public void setItemToUpdate(MediaWrapper item) {
- mHandler.sendMessage(mHandler.obtainMessage(VideoListHandler.UPDATE_ITEM, item));
- }
-
- public void updateItem(MediaWrapper item) {
- if (mAdapter != null && mMediaIndex != null && item != null
- && mMediaIndex.containsKey(item.getLocation()))
- mAdapter.notifyArrayItemRangeChanged(mMediaIndex.get(item.getLocation()).intValue(), 1);
- }
-
- @Override
- public void sendTextInfo(String info, int progress, int max) {}
-
- @Override
- public void updateList() {
- if (mUpdater == null) {
- new AsyncVideoUpdate().execute();
- }
- }
-
- @Override
- public void showProgressBar() {}
-
- @Override
- public void hideProgressBar() {}
-
- @Override
- public void clearTextInfo() {}
-}
More information about the Android
mailing list