Commit a4698253 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf
Browse files

Split org.videolan.vlc.util.Util in different files

This should allow to have a cleaner codebase and dependencies
parent bac446e7
......@@ -325,7 +325,7 @@ public class Media implements Comparable<Media> {
* Returns the raw picture object. Likely to be NULL in VLC for Android
* due to lazy-loading.
*
* Use {@link org.videolan.vlc.util.Util#getPictureFromCache(Media)} instead.
* Use {@link org.videolan.vlc.util.Bitmap#getPictureFromCache(Media)} instead.
*
* @return The raw picture or NULL
*/
......@@ -336,7 +336,7 @@ public class Media implements Comparable<Media> {
/**
* Sets the raw picture object.
*
* In VLC for Android, use {@link org.videolan.vlc.util.Util#setPicture(Media, Bitmap)} instead.
* In VLC for Android, use {@link org.videolan.vlc.MediaDatabase#setPicture(Media, Bitmap)} instead.
*
* @param p
*/
......
......@@ -38,6 +38,7 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteFullException;
import android.database.sqlite.SQLiteOpenHelper;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
......@@ -668,4 +669,17 @@ public class MediaDatabase {
public synchronized void emptyDatabase() {
mDb.delete(MEDIA_TABLE_NAME, null, null);
}
public static void setPicture(Media m, Bitmap p) {
Log.d(TAG, "Setting new picture for " + m.getTitle());
try {
getInstance().updateMedia(
m.getLocation(),
mediaColumn.MEDIA_PICTURE,
p);
} catch (SQLiteFullException e) {
Log.d(TAG, "SQLiteFullException while setting picture");
}
m.setPictureParsed(true);
}
}
......@@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.List;
import org.videolan.libvlc.Media;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.BitmapHelper;
public class MediaGroup extends Media {
......@@ -41,7 +41,7 @@ public class MediaGroup extends Media {
media.getTime(),
media.getLength(),
Media.TYPE_GROUP,
Util.getPictureFromCache(media),
BitmapHelper.getPictureFromCache(media),
media.getTitle(),
media.getArtist(),
media.getGenre(),
......
......@@ -39,7 +39,8 @@ import org.videolan.libvlc.Media;
import org.videolan.vlc.gui.MainActivity;
import org.videolan.vlc.gui.audio.AudioBrowserFragment;
import org.videolan.vlc.gui.video.VideoGridFragment;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.util.WeakHandler;
import android.content.Context;
......@@ -208,7 +209,7 @@ public class MediaLibrary {
public void run() {
LibVLC libVlcInstance;
try {
libVlcInstance = Util.getLibVlcInstance();
libVlcInstance = VLCInstance.getLibVlcInstance();
} catch (LibVlcException e1) {
Log.e(TAG, "ERROR: LibVLCException while trying to get instance");
return;
......@@ -223,7 +224,7 @@ public class MediaLibrary {
List<File> mediaDirs = DBManager.getMediaDirs();
if (mediaDirs.size() == 0) {
// Use all available storage directories as our default
String storageDirs[] = Util.getMediaDirectories();
String storageDirs[] = AndroidDevices.getMediaDirectories();
for (String dir: storageDirs) {
File f = new File(dir);
if (f.exists())
......
......@@ -22,7 +22,7 @@ package org.videolan.vlc;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.vlc.audio.AudioService;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
import android.content.BroadcastReceiver;
import android.content.Context;
......@@ -46,7 +46,7 @@ public class RemoteControlClientReceiver extends BroadcastReceiver {
String action = intent.getAction();
LibVLC mLibVLC;
try {
mLibVLC = Util.getLibVlcInstance();
mLibVLC = VLCInstance.getLibVlcInstance();
} catch (LibVlcException e) {
return;
}
......
......@@ -34,7 +34,8 @@ import org.videolan.libvlc.LibVlcException;
import org.videolan.libvlc.Media;
import org.videolan.vlc.gui.MainActivity;
import org.videolan.vlc.gui.video.VideoGridFragment;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.BitmapHelper;
import org.videolan.vlc.util.VLCInstance;
import android.content.Context;
import android.graphics.Bitmap;
......@@ -70,7 +71,7 @@ public class Thumbnailer implements Runnable {
public void start(VideoGridFragment videoGridFragment) {
if (mLibVlc == null) {
try {
mLibVlc = Util.getLibVlcInstance();
mLibVlc = VLCInstance.getLibVlcInstance();
} catch (LibVlcException e) {
Log.e(TAG, "Can't obtain libvlc instance");
e.printStackTrace();
......@@ -107,7 +108,7 @@ public class Thumbnailer implements Runnable {
* @param id the if of the file browser item.
*/
public void addJob(Media item) {
if(Util.getPictureFromCache(item) != null || item.isPictureParsed())
if(BitmapHelper.getPictureFromCache(item) != null || item.isPictureParsed())
return;
lock.lock();
mItems.add(item);
......@@ -166,7 +167,7 @@ public class Thumbnailer implements Runnable {
byte[] b = mLibVlc.getThumbnail(item.getLocation(), width, height);
if (b == null) {// We were not able to create a thumbnail for this item, store a dummy
Util.setPicture(item, Bitmap.createBitmap(1, 1, Config.ARGB_8888));
MediaDatabase.setPicture(item, Bitmap.createBitmap(1, 1, Config.ARGB_8888));
continue;
}
......@@ -174,7 +175,7 @@ public class Thumbnailer implements Runnable {
Log.i(TAG, "Thumbnail created for " + item.getFileName());
Util.setPicture(item, thumbnail);
MediaDatabase.setPicture(item, thumbnail);
// Post to the file browser the new item.
mVideoGridFragment.setItemToUpdate(item);
......
......@@ -29,7 +29,7 @@ import java.io.StringWriter;
import java.io.Writer;
import java.lang.Thread.UncaughtExceptionHandler;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.LogCat;
import android.os.Environment;
import android.text.format.DateFormat;
......@@ -98,7 +98,7 @@ public class VlcCrashHandler implements UncaughtExceptionHandler {
CharSequence timestamp = DateFormat.format("yyyyMMdd_kkmmss", System.currentTimeMillis());
String filename = name + "_" + timestamp + ".log";
try {
Util.writeLogcat(filename);
LogCat.writeLogcat(filename);
} catch (IOException e) {
Log.e(TAG, "Cannot write logcat to disk");
}
......
......@@ -52,7 +52,8 @@ import org.videolan.vlc.gui.audio.AudioUtil;
import org.videolan.vlc.gui.video.VideoPlayerActivity;
import org.videolan.vlc.interfaces.IAudioService;
import org.videolan.vlc.interfaces.IAudioServiceCallback;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.util.WeakHandler;
import android.annotation.TargetApi;
......@@ -150,7 +151,7 @@ public class AudioService extends Service {
// Get libVLC instance
try {
mLibVLC = Util.getLibVlcInstance();
mLibVLC = VLCInstance.getLibVlcInstance();
} catch (LibVlcException e) {
e.printStackTrace();
}
......@@ -1372,7 +1373,7 @@ public class AudioService extends Service {
}
private synchronized void loadLastPlaylist() {
if (!Util.hasExternalStorage())
if (!AndroidDevices.hasExternalStorage())
return;
String line;
......@@ -1415,7 +1416,7 @@ public class AudioService extends Service {
}
private synchronized void saveCurrentMedia() {
if (!Util.hasExternalStorage())
if (!AndroidDevices.hasExternalStorage())
return;
FileOutputStream output;
......@@ -1436,7 +1437,7 @@ public class AudioService extends Service {
}
private synchronized void saveMediaList() {
if (!Util.hasExternalStorage())
if (!AndroidDevices.hasExternalStorage())
return;
FileOutputStream output;
......
......@@ -30,6 +30,8 @@ import java.util.Stack;
import org.videolan.libvlc.Media;
import org.videolan.vlc.MediaDatabase;
import org.videolan.vlc.R;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.CustomDirectories;
import org.videolan.vlc.util.Util;
import android.app.AlertDialog;
......@@ -95,8 +97,8 @@ public class BrowserActivity extends ListActivity {
private void refreshRoots() {
ArrayList<String> list = new ArrayList<String>();
list.addAll(Arrays.asList(Util.getStorageDirectories()));
list.addAll(Arrays.asList(Util.getCustomDirectories()));
list.addAll(Arrays.asList(AndroidDevices.getStorageDirectories()));
list.addAll(Arrays.asList(CustomDirectories.getCustomDirectories()));
mRoots = list.toArray(new String[list.size()]);
}
......@@ -114,7 +116,7 @@ public class BrowserActivity extends ListActivity {
final File item = mAdapter.getItem(position);
if (mCurrentDir != null
|| item.getPath().equals(BrowserAdapter.ADD_ITEM_PATH)
|| Arrays.asList(Util.getStorageDirectories()).contains(
|| Arrays.asList(AndroidDevices.getStorageDirectories()).contains(
item.getPath())) {
return;
}
......@@ -129,7 +131,7 @@ public class BrowserActivity extends ListActivity {
if(f.getPath().startsWith(item.getPath()))
dbManager.removeDir(f.getPath());
}
Util.removeCustomDirectory(item.getPath());
CustomDirectories.removeCustomDirectory(item.getPath());
refresh();
return true;
}
......@@ -190,7 +192,7 @@ public class BrowserActivity extends ListActivity {
b.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Util.addCustomDirectory(input.getText().toString());
CustomDirectories.addCustomDirectory(input.getText().toString());
refresh();
}
});
......
......@@ -23,7 +23,7 @@ package org.videolan.vlc.gui;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.vlc.R;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
import android.app.Activity;
import android.os.Bundle;
......@@ -42,7 +42,7 @@ public class DebugLogActivity extends Activity {
final LibVLC instance;
try {
instance = Util.getLibVlcInstance();
instance = VLCInstance.getLibVlcInstance();
} catch (LibVlcException e) { return; }
final Button startLog = (Button)findViewById(R.id.start_log);
......
......@@ -32,7 +32,8 @@ import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.Media;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.Strings;
import android.content.Context;
import android.os.Build;
......@@ -104,7 +105,7 @@ public class DirectoryAdapter extends BaseAdapter {
public Boolean existsChild(String _n) {
for(DirectoryAdapter.Node n : this.children) {
if(Util.nullEquals(n.name, _n)) return true;
if(Strings.nullEquals(n.name, _n)) return true;
}
return false;
}
......@@ -124,7 +125,7 @@ public class DirectoryAdapter extends BaseAdapter {
public DirectoryAdapter.Node ensureExists(String _n) {
for(DirectoryAdapter.Node n : this.children) {
if(Util.nullEquals(n.name, _n)) return n;
if(Strings.nullEquals(n.name, _n)) return n;
}
DirectoryAdapter.Node nn = new Node(_n);
this.children.add(nn);
......@@ -181,7 +182,7 @@ public class DirectoryAdapter extends BaseAdapter {
private void populateNode(DirectoryAdapter.Node n, String path, int depth) {
if (path == null) {
// We're on the storage list
String storages[] = Util.getMediaDirectories();
String storages[] = AndroidDevices.getMediaDirectories();
for (String storage : storages) {
File f = new File(storage);
DirectoryAdapter.Node child = new DirectoryAdapter.Node(f.getName(), getVisibleName(f));
......@@ -257,7 +258,7 @@ public class DirectoryAdapter extends BaseAdapter {
private void DirectoryAdapter_Core(Context activityContext, String rootDir) {
if (rootDir != null)
rootDir = Util.stripTrailingSlash(rootDir);
rootDir = Strings.stripTrailingSlash(rootDir);
Log.v(TAG, "rootMRL is " + rootDir);
mInflater = LayoutInflater.from(activityContext);
mRootNode = new DirectoryAdapter.Node(rootDir);
......@@ -365,12 +366,12 @@ public class DirectoryAdapter extends BaseAdapter {
public int browse(String directoryName) {
if (this.mCurrentDir == null) {
// We're on the storage list
String storages[] = Util.getMediaDirectories();
String storages[] = AndroidDevices.getMediaDirectories();
for (String storage : storages) {
storage = Util.stripTrailingSlash(storage);
storage = Strings.stripTrailingSlash(storage);
if (storage.endsWith(directoryName)) {
this.mCurrentRoot = storage;
this.mCurrentDir = Util.stripTrailingSlash(storage);
this.mCurrentDir = Strings.stripTrailingSlash(storage);
break;
}
}
......@@ -379,7 +380,7 @@ public class DirectoryAdapter extends BaseAdapter {
this.mCurrentDir = new URI(
LibVLC.PathToURI(this.mCurrentDir + "/" + directoryName))
.normalize().getPath();
this.mCurrentDir = Util.stripTrailingSlash(this.mCurrentDir);
this.mCurrentDir = Strings.stripTrailingSlash(this.mCurrentDir);
if (this.mCurrentDir.equals(getParentDir(this.mCurrentRoot))) {
// Returning to the storage list
......@@ -460,7 +461,7 @@ public class DirectoryAdapter extends BaseAdapter {
} catch (URISyntaxException e) {
e.printStackTrace();
}
return Util.stripTrailingSlash(path);
return Strings.stripTrailingSlash(path);
}
private String getVisibleName(File file) {
......
......@@ -42,6 +42,7 @@ import org.videolan.vlc.gui.video.VideoGridFragment;
import org.videolan.vlc.gui.video.VideoListAdapter;
import org.videolan.vlc.interfaces.ISortable;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.util.WeakHandler;
import org.videolan.vlc.widget.SlidingPaneLayout;
......@@ -167,7 +168,7 @@ public class MainActivity extends ActionBarActivity {
try {
// Start LibVLC
Util.getLibVlcInstance();
VLCInstance.getLibVlcInstance();
} catch (LibVlcException e) {
e.printStackTrace();
Intent i = new Intent(this, CompatErrorActivity.class);
......
......@@ -10,6 +10,7 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.videolan.vlc.R;
import org.videolan.vlc.util.LogCat;
import org.videolan.vlc.util.Util;
import android.app.Activity;
......@@ -76,7 +77,7 @@ public class NativeCrashActivity extends Activity {
protected String doInBackground(Void... v) {
String log = null;
try {
log = Util.getLogcat();
log = LogCat.getLogcat();
} catch (IOException e) {
e.printStackTrace();
}
......
......@@ -29,7 +29,8 @@ import org.videolan.vlc.audio.AudioService;
import org.videolan.vlc.audio.AudioServiceController;
import org.videolan.vlc.gui.audio.AudioUtil;
import org.videolan.vlc.util.BitmapCache;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.LogCat;
import org.videolan.vlc.util.VLCInstance;
import android.app.AlertDialog;
import android.app.Dialog;
......@@ -209,7 +210,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
"yyyyMMdd_kkmmss", System.currentTimeMillis());
String filename = Environment.getExternalStorageDirectory().getPath() + "/vlc_logcat_" + timestamp + ".log";
try {
Util.writeLogcat(filename);
LogCat.writeLogcat(filename);
Toast.makeText(
PreferencesActivity.this,
String.format(
......@@ -289,7 +290,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
|| key.equalsIgnoreCase("enable_time_stretching_audio")
|| key.equalsIgnoreCase("enable_verbose_mode")
|| key.equalsIgnoreCase("network_caching")) {
Util.updateLibVlcSettings(sharedPreferences);
VLCInstance.updateLibVlcSettings(sharedPreferences);
LibVLC.restart(this);
}
}
......
......@@ -31,7 +31,7 @@ import org.videolan.vlc.R;
import org.videolan.vlc.audio.AudioServiceController;
import org.videolan.vlc.gui.CommonDialogs;
import org.videolan.vlc.gui.MainActivity;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.VlcRunnable;
import org.videolan.vlc.widget.FlingViewGroup;
......@@ -227,7 +227,7 @@ public class AudioAlbumsSongsFragment extends Fragment {
menu.setGroupVisible(R.id.songs_view_only, false);
menu.setGroupVisible(R.id.phone_only, false);
}
if (!Util.isPhone())
if (!AndroidDevices.isPhone())
menu.setGroupVisible(R.id.phone_only, false);
}
......
......@@ -31,7 +31,7 @@ import org.videolan.vlc.R;
import org.videolan.vlc.audio.AudioServiceController;
import org.videolan.vlc.gui.CommonDialogs;
import org.videolan.vlc.gui.MainActivity;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.VlcRunnable;
import org.videolan.vlc.util.WeakHandler;
import org.videolan.vlc.widget.FlingViewGroup;
......@@ -227,7 +227,7 @@ public class AudioBrowserFragment extends Fragment {
MenuItem play = menu.findItem(R.id.audio_list_browser_play);
play.setVisible(true);
}
if (!Util.isPhone())
if (!AndroidDevices.isPhone())
menu.setGroupVisible(R.id.phone_only, false);
}
......
......@@ -36,6 +36,7 @@ import org.videolan.vlc.gui.CommonDialogs.MenuType;
import org.videolan.vlc.gui.audio.widget.CoverMediaSwitcher;
import org.videolan.vlc.gui.audio.widget.HeaderMediaSwitcher;
import org.videolan.vlc.interfaces.IAudioPlayer;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.widget.AudioMediaSwitcher.AudioMediaSwitcherListener;
......@@ -369,13 +370,13 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
int time = mAudioController.getTime();
int length = mAudioController.getLength();
mHeaderTime.setText(Util.millisToString(time));
mLength.setText(Util.millisToString(length));
mHeaderTime.setText(Strings.millisToString(time));
mLength.setText(Strings.millisToString(length));
mTimeline.setMax(length);
mProgressBar.setMax(length);
if(!mPreviewingSeek) {
mTime.setText(Util.millisToString(mShowRemainingTime ? time-length : time));
mTime.setText(Strings.millisToString(mShowRemainingTime ? time-length : time));
mTimeline.setProgress(time);
mProgressBar.setProgress(time);
}
......@@ -424,8 +425,8 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
public void onProgressChanged(SeekBar sb, int prog, boolean fromUser) {
if (fromUser) {
mAudioController.setTime(prog);
mTime.setText(Util.millisToString(mShowRemainingTime ? prog-mAudioController.getLength() : prog));
mHeaderTime.setText(Util.millisToString(prog));
mTime.setText(Strings.millisToString(mShowRemainingTime ? prog-mAudioController.getLength() : prog));
mHeaderTime.setText(Strings.millisToString(prog));
}
}
};
......@@ -607,7 +608,7 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
possibleSeek = 0;
}
mTime.setText(Util.millisToString(mShowRemainingTime ? possibleSeek-mAudioController.getLength() : possibleSeek));
mTime.setText(Strings.millisToString(mShowRemainingTime ? possibleSeek-mAudioController.getLength() : possibleSeek));
mTimeline.setProgress(possibleSeek);
mProgressBar.setProgress(possibleSeek);
h.postDelayed(seekRunnable, 50);
......
......@@ -34,6 +34,7 @@ import org.videolan.libvlc.LibVlcUtil;
import org.videolan.libvlc.Media;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.BitmapCache;
import org.videolan.vlc.util.MurmurHash;
import org.videolan.vlc.util.Util;
......@@ -117,7 +118,7 @@ public class AudioUtil {
@SuppressLint("NewApi")
public static void prepareCacheFolder(Context context) {
if (LibVlcUtil.isFroyoOrLater() && Util.hasExternalStorage() && context.getExternalCacheDir() != null)
if (LibVlcUtil.isFroyoOrLater() && AndroidDevices.hasExternalStorage() && context.getExternalCacheDir() != null)
CACHE_DIR = context.getExternalCacheDir().getPath();
else
CACHE_DIR = Environment.getExternalStorageDirectory().getPath() + "/Android/data/" + context.getPackageName() + "/cache";
......@@ -231,7 +232,7 @@ public class AudioUtil {
}
// if external storage is not available, skip covers to prevent slow audio browsing
if (!Util.hasExternalStorage())
if (!AndroidDevices.hasExternalStorage())
return null;
try {
......
......@@ -24,7 +24,8 @@ 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.Util;
import org.videolan.vlc.util.Preferences;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.widget.EqualizerBar;
import android.content.Context;
......@@ -107,11 +108,11 @@ public class EqualizerFragment extends Fragment {
float[] bands = null;
String[] presets = null;
try {
libVlc = Util.getLibVlcInstance();
libVlc = VLCInstance.getLibVlcInstance();
bands = libVlc.getBands();
presets = libVlc.getPresets();
if (equalizer == null)
equalizer = Util.getFloatArray(preferences, "equalizer_values");
equalizer = Preferences.getFloatArray(preferences, "equalizer_values");
if (equalizer == null)
equalizer = new float[bands.length + 1];
} catch (LibVlcException e) {
......@@ -175,7 +176,7 @@ public class EqualizerFragment extends Fragment {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("equalizer_enabled", button.isChecked());
Util.putFloatArray(editor, "equalizer_values", equalizer);
Preferences.putFloatArray(editor, "equalizer_values", equalizer);
editor.putInt("equalizer_preset", equalizer_presets.getSelectedItemPosition());
editor.commit();
}
......
......@@ -22,6 +22,7 @@ package org.videolan.vlc.gui.expandable;
import org.videolan.libvlc.LibVLC;
import org.videolan.vlc.R;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.widget.ExpandableLayout;
......@@ -55,7 +56,7 @@ public class SpeedSelector extends ExpandableLayout {
rate = libVLC.getRate();
}
setText(Util.formatRateString(rate));
setText(Strings.formatRateString(rate));
mSeekbar.setProgress((int) (((Math.log(rate) / Math.log(4)) + 1) * 100));
mSeekbar.setOnSeekBarChangeListener(mSeekBarListener);
......@@ -66,7 +67,7 @@ public class SpeedSelector extends ExpandableLayout {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
float rate = (float) Math.pow(4, ((double) progress / (double) 100) - 1);
setText(Util.formatRateString(rate));
setText(Strings.formatRateString(rate));
LibVLC.getExistingInstance().setRate(rate);
}
......