Commit 62d3e5f7 authored by Geoffrey Métais's avatar Geoffrey Métais

Remove useless exception

parent 2e27f62f
......@@ -159,9 +159,8 @@ public class LibVLC {
* thumbnail and get information e.g. on the MediaLibraryActivity
*
* @return libVLC instance
* @throws LibVlcException
*/
public static LibVLC getInstance() throws LibVlcException {
public static LibVLC getInstance() {
synchronized (LibVLC.class) {
if (sInstance == null) {
/* First call */
......
......@@ -40,13 +40,11 @@ import android.widget.Spinner;
import android.widget.ToggleButton;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.interfaces.OnEqualizerBarChangeListener;
import org.videolan.vlc.util.Preferences;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.widget.EqualizerBar;
public class EqualizerFragment extends Fragment {
......@@ -91,18 +89,13 @@ public class EqualizerFragment extends Fragment {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
float[] bands = null;
String[] presets = null;
try {
libVlc = VLCInstance.getLibVlcInstance();
bands = libVlc.getBands();
presets = libVlc.getPresets();
if (equalizer == null)
equalizer = Preferences.getFloatArray(preferences, "equalizer_values");
if (equalizer == null)
equalizer = new float[bands.length + 1];
} catch (LibVlcException e) {
e.printStackTrace();
return;
}
libVlc = LibVLC.getInstance();
bands = libVlc.getBands();
presets = libVlc.getPresets();
if (equalizer == null)
equalizer = Preferences.getFloatArray(preferences, "equalizer_values");
if (equalizer == null)
equalizer = new float[bands.length + 1];
// on/off
button.setChecked(libVlc.getEqualizer() != null);
......
......@@ -33,7 +33,6 @@ import android.widget.Button;
import android.widget.TextView;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.vlc.R;
public abstract class PickTimeFragment extends DialogFragment implements DialogInterface.OnKeyListener, View.OnClickListener, View.OnFocusChangeListener, TextView.OnEditorActionListener {
......@@ -60,11 +59,7 @@ public abstract class PickTimeFragment extends DialogFragment implements DialogI
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
try {
mLibVLC = LibVLC.getInstance();
} catch (LibVlcException e) {
getDialog().dismiss();
}
mLibVLC = LibVLC.getInstance();
View view = inflater.inflate(R.layout.jump_to_time, container);
((TextView)view.findViewById(R.id.jump_dialog_title)).setText(getTitle());
mHours = (TextView) view.findViewById(R.id.jump_hours);
......
......@@ -25,7 +25,6 @@ import java.nio.ByteBuffer;
import java.util.Locale;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.libvlc.LibVlcUtil;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.util.Extensions;
......@@ -36,7 +35,6 @@ import org.videolan.vlc.gui.MainActivity;
import org.videolan.vlc.util.BitmapUtil;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.util.WeakHandler;
import android.content.res.Configuration;
......@@ -198,11 +196,7 @@ public class MediaInfoFragment extends ListFragment {
Runnable mLoadImage = new Runnable() {
@Override
public void run() {
try {
mLibVlc = VLCInstance.getLibVlcInstance();
} catch (LibVlcException e) {
return;
}
mLibVlc = LibVLC.getInstance();
mMedia = new Media(mLibVlc, mItem.getLocation());
mMedia.parse();
mMedia.release();
......
......@@ -126,9 +126,7 @@ public class VideoGridFragment extends BrowserFragment implements ISortable, IVi
FragmentActivity activity = getActivity();
if (activity != null)
mThumbnailer = new Thumbnailer(activity, activity.getWindowManager().getDefaultDisplay());
try {
mLibVlc = LibVLC.getInstance();
} catch (LibVlcException e) {}
mLibVlc = LibVLC.getInstance();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
......
......@@ -25,18 +25,20 @@ import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.vlc.MediaDatabase;
import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.MediaWrapper;
import org.videolan.vlc.R;
import org.videolan.vlc.Thumbnailer;
import org.videolan.vlc.gui.CompatErrorActivity;
import org.videolan.vlc.gui.PreferencesActivity;
import org.videolan.vlc.gui.tv.audioplayer.AudioPlayerActivity;
import org.videolan.vlc.gui.tv.browser.GridFragment;
import org.videolan.vlc.gui.tv.browser.MusicFragment;
import org.videolan.vlc.gui.tv.browser.VerticalGridActivity;
import org.videolan.vlc.interfaces.IVideoBrowser;
import org.videolan.vlc.gui.video.VideoListHandler;
import org.videolan.vlc.util.VLCInstance;
import android.app.Activity;
import android.app.FragmentManager;
......@@ -120,12 +122,20 @@ public class MainTvActivity extends Activity implements IVideoBrowser {
/*
* skip browser and show directly Audio Player if a song is playing
*/
if (LibVLC.getExistingInstance() != null){
if (LibVLC.getExistingInstance().isPlaying()){
startActivity(new Intent(this, AudioPlayerActivity.class));
finish();
return;
try {
if (VLCInstance.getLibVlcInstance() != null){
if (LibVLC.getExistingInstance().isPlaying()){
startActivity(new Intent(this, AudioPlayerActivity.class));
finish();
return;
}
}
} catch (LibVlcException e) {
Intent i = new Intent(this, CompatErrorActivity.class);
startActivity(i);
finish();
super.onCreate(savedInstanceState);
return;
}
mContext = this;
setContentView(R.layout.tv_main_fragment);
......
......@@ -57,9 +57,7 @@ public class BrowserGridFragment extends GridFragment implements MediaBrowser.Ev
super.onResume();
if (mAdapter.size() == 0) {
if (mAdapter.size() == 0) {
try {
mMediaBrowser = new MediaBrowser(LibVLC.getInstance(), this);
} catch (LibVlcException e) {}
mMediaBrowser = new MediaBrowser(LibVLC.getInstance(), this);
if (mMediaBrowser != null) {
mMediaList = new ArrayList<>();
if (mMrl != null)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment