Commit 27d001b5 authored by Edward Wang's avatar Edward Wang
Browse files

Util: enhancements to refactoring

-Fix file headers
-Fix TAGs
-Rename BitmapHelper to BitmapUtil as with AudioUtil and such.
-Remove unneeded CamelCase in logcat
parent dbc023b0
......@@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.List;
import org.videolan.libvlc.Media;
import org.videolan.vlc.util.BitmapHelper;
import org.videolan.vlc.util.BitmapUtil;
public class MediaGroup extends Media {
......@@ -41,7 +41,7 @@ public class MediaGroup extends Media {
media.getTime(),
media.getLength(),
Media.TYPE_GROUP,
BitmapHelper.getPictureFromCache(media),
BitmapUtil.getPictureFromCache(media),
media.getTitle(),
media.getArtist(),
media.getGenre(),
......
......@@ -34,7 +34,7 @@ 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.BitmapHelper;
import org.videolan.vlc.util.BitmapUtil;
import org.videolan.vlc.util.VLCInstance;
import android.content.Context;
......@@ -108,7 +108,7 @@ public class Thumbnailer implements Runnable {
* @param id the if of the file browser item.
*/
public void addJob(Media item) {
if(BitmapHelper.getPictureFromCache(item) != null || item.isPictureParsed())
if(BitmapUtil.getPictureFromCache(item) != null || item.isPictureParsed())
return;
lock.lock();
mItems.add(item);
......
......@@ -29,7 +29,7 @@ import java.io.StringWriter;
import java.io.Writer;
import java.lang.Thread.UncaughtExceptionHandler;
import org.videolan.vlc.util.LogCat;
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 {
LogCat.writeLogcat(filename);
Logcat.writeLogcat(filename);
} catch (IOException e) {
Log.e(TAG, "Cannot write logcat to disk");
}
......
......@@ -10,7 +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.Logcat;
import org.videolan.vlc.util.Util;
import android.app.Activity;
......@@ -77,7 +77,7 @@ public class NativeCrashActivity extends Activity {
protected String doInBackground(Void... v) {
String log = null;
try {
log = LogCat.getLogcat();
log = Logcat.getLogcat();
} catch (IOException e) {
e.printStackTrace();
}
......
......@@ -29,7 +29,7 @@ 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.LogCat;
import org.videolan.vlc.util.Logcat;
import org.videolan.vlc.util.VLCInstance;
import android.app.AlertDialog;
......@@ -210,7 +210,7 @@ public class PreferencesActivity extends PreferenceActivity implements OnSharedP
"yyyyMMdd_kkmmss", System.currentTimeMillis());
String filename = Environment.getExternalStorageDirectory().getPath() + "/vlc_logcat_" + timestamp + ".log";
try {
LogCat.writeLogcat(filename);
Logcat.writeLogcat(filename);
Toast.makeText(
PreferencesActivity.this,
String.format(
......
......@@ -28,7 +28,7 @@ import org.videolan.libvlc.Media;
import org.videolan.libvlc.TrackInfo;
import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.R;
import org.videolan.vlc.util.BitmapHelper;
import org.videolan.vlc.util.BitmapUtil;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.VLCInstance;
import org.videolan.vlc.util.WeakHandler;
......@@ -133,7 +133,7 @@ public class MediaInfoFragment extends ListFragment {
return;
mImage.copyPixelsFromBuffer(ByteBuffer.wrap(b));
mImage = BitmapHelper.cropBorders(mImage, width, height);
mImage = BitmapUtil.cropBorders(mImage, width, height);
mHandler.sendEmptyMessage(NEW_IMAGE);
}
......
......@@ -28,7 +28,7 @@ import org.videolan.libvlc.Media;
import org.videolan.vlc.MediaGroup;
import org.videolan.vlc.R;
import org.videolan.vlc.util.BitmapCache;
import org.videolan.vlc.util.BitmapHelper;
import org.videolan.vlc.util.BitmapUtil;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.Util;
......@@ -170,7 +170,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
Media media = getItem(position);
/* Thumbnail */
Bitmap thumbnail = BitmapHelper.getPictureFromCache(media);
Bitmap thumbnail = BitmapUtil.getPictureFromCache(media);
if (thumbnail == null) {
// missing thumbnail
thumbnail = BitmapCache.GetFromResource(v, R.drawable.icon_g);
......
/*****************************************************************************
* Util.java
* AndroidDevices.java
*****************************************************************************
* Copyright © 2011-2014 VLC authors and VideoLAN
*
......@@ -40,6 +40,7 @@ import android.os.Environment;
import android.telephony.TelephonyManager;
public class AndroidDevices {
public final static String TAG = "VLC/Util/AndroidDevices";
final static boolean hasNavBar;
......
/*****************************************************************************
* Util.java
* BitmapUtil.java
*****************************************************************************
* Copyright © 2011-2014 VLC authors and VideoLAN
*
......@@ -27,8 +27,8 @@ import org.videolan.vlc.VLCApplication;
import android.content.Context;
import android.graphics.Bitmap;
public class BitmapHelper {
public final static String TAG = "VLC/Util";
public class BitmapUtil {
public final static String TAG = "VLC/Util/BitmapUtil";
public static Bitmap cropBorders(Bitmap bitmap, int width, int height)
{
......
/*****************************************************************************
* Util.java
* Logcat.java
*****************************************************************************
* Copyright © 2011-2014 VLC authors and VideoLAN
*
......@@ -27,7 +27,8 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class LogCat {
public class Logcat {
public final static String TAG = "VLC/Util/Logcat";
/**
* Writes the current app logcat to a file.
......
/*****************************************************************************
* Util.java
* Preferences.java
*****************************************************************************
* Copyright © 2011-2014 VLC authors and VideoLAN
*
......@@ -27,6 +27,7 @@ import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
public class Preferences {
public final static String TAG = "VLC/Util/Preferences";
public static float[] getFloatArray(SharedPreferences pref, String key) {
float[] array = null;
......
/*****************************************************************************
* Util.java
* Strings.java
*****************************************************************************
* Copyright © 2011-2014 VLC authors and VideoLAN
*
......@@ -25,6 +25,7 @@ import java.text.NumberFormat;
import java.util.Locale;
public class Strings {
public final static String TAG = "VLC/Util/Strings";
public static String stripTrailingSlash(String s) {
if( s.endsWith("/") && s.length() > 1 )
......
/*****************************************************************************
* Util.java
* VLCInstance.java
*****************************************************************************
* Copyright © 2011-2014 VLC authors and VideoLAN
*
......@@ -32,6 +32,7 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager;
public class VLCInstance {
public final static String TAG = "VLC/Util/VLCInstance";
/** A set of utility functions for the VLC application */
public static LibVLC getLibVlcInstance() throws LibVlcException {
......
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