summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bestas <mikeioannina@cyanogenmod.org>2016-04-17 08:49:51 (GMT)
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-04-17 08:49:51 (GMT)
commit1b3cbd3fe25a23aa40b6f88e1e3a02b7de4d6e78 (patch)
treed54829da72bddba4a5c706835bf26421d4db1945
parent7d14986965f3d1b329e9f8e6caec14118cdc84cd (diff)
parent36a2a5b91a8b60f437d764f670b562332e2a8417 (diff)
downloadandroid_packages_apps_Eleven-1b3cbd3fe25a23aa40b6f88e1e3a02b7de4d6e78.zip
android_packages_apps_Eleven-1b3cbd3fe25a23aa40b6f88e1e3a02b7de4d6e78.tar.gz
android_packages_apps_Eleven-1b3cbd3fe25a23aa40b6f88e1e3a02b7de4d6e78.tar.bz2
Merge "CodeCleanup : Replace StringBuffer with String" into cm-13.0
-rw-r--r--src/com/cyanogenmod/eleven/cache/ImageFetcher.java7
-rw-r--r--src/com/cyanogenmod/eleven/loaders/AlbumSongLoader.java9
-rw-r--r--src/com/cyanogenmod/eleven/loaders/LastAddedLoader.java11
-rw-r--r--src/com/cyanogenmod/eleven/loaders/PlaylistSongLoader.java7
-rw-r--r--src/com/cyanogenmod/eleven/provider/PlaylistArtworkStore.java35
-rw-r--r--src/com/cyanogenmod/eleven/utils/MusicUtils.java14
6 files changed, 34 insertions, 49 deletions
diff --git a/src/com/cyanogenmod/eleven/cache/ImageFetcher.java b/src/com/cyanogenmod/eleven/cache/ImageFetcher.java
index 0eb8ec6..42480f4 100644
--- a/src/com/cyanogenmod/eleven/cache/ImageFetcher.java
+++ b/src/com/cyanogenmod/eleven/cache/ImageFetcher.java
@@ -222,12 +222,7 @@ public class ImageFetcher extends ImageWorker {
if (albumName == null || artistName == null) {
return null;
}
- return new StringBuilder(albumName)
- .append("_")
- .append(artistName)
- .append("_")
- .append(Config.ALBUM_ART_SUFFIX)
- .toString();
+ return albumName + "_" + artistName + "_" + Config.ALBUM_ART_SUFFIX;
}
/**
diff --git a/src/com/cyanogenmod/eleven/loaders/AlbumSongLoader.java b/src/com/cyanogenmod/eleven/loaders/AlbumSongLoader.java
index 1a89804..83676cd 100644
--- a/src/com/cyanogenmod/eleven/loaders/AlbumSongLoader.java
+++ b/src/com/cyanogenmod/eleven/loaders/AlbumSongLoader.java
@@ -113,10 +113,9 @@ public class AlbumSongLoader extends WrappedAsyncTaskLoader<List<Song>> {
*/
public static final Cursor makeAlbumSongCursor(final Context context, final Long albumId) {
// Match the songs up with the artist
- final StringBuilder selection = new StringBuilder();
- selection.append(AudioColumns.IS_MUSIC + "=1");
- selection.append(" AND " + AudioColumns.TITLE + " != ''");
- selection.append(" AND " + AudioColumns.ALBUM_ID + "=").append(albumId);
+ String selection = (AudioColumns.IS_MUSIC + "=1") +
+ " AND " + AudioColumns.TITLE + " != ''" +
+ " AND " + AudioColumns.ALBUM_ID + "=" + albumId;
return context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
new String[] {
/* 0 */
@@ -131,7 +130,7 @@ public class AlbumSongLoader extends WrappedAsyncTaskLoader<List<Song>> {
AudioColumns.DURATION,
/* 5 */
AudioColumns.YEAR,
- }, selection.toString(), null,
+ }, selection, null,
PreferenceUtils.getInstance(context).getAlbumSongSortOrder());
}
diff --git a/src/com/cyanogenmod/eleven/loaders/LastAddedLoader.java b/src/com/cyanogenmod/eleven/loaders/LastAddedLoader.java
index f774394..6f948f5 100644
--- a/src/com/cyanogenmod/eleven/loaders/LastAddedLoader.java
+++ b/src/com/cyanogenmod/eleven/loaders/LastAddedLoader.java
@@ -114,11 +114,10 @@ public class LastAddedLoader extends SectionCreator.SimpleListLoader<Song> {
// use the most recent of the two timestamps
if(cutoff < fourWeeksAgo) { cutoff = fourWeeksAgo; }
- final StringBuilder selection = new StringBuilder();
- selection.append(AudioColumns.IS_MUSIC + "=1");
- selection.append(" AND " + AudioColumns.TITLE + " != ''"); //$NON-NLS-2$
- selection.append(" AND " + MediaStore.Audio.Media.DATE_ADDED + ">"); //$NON-NLS-2$
- selection.append(cutoff);
+ String selection = (AudioColumns.IS_MUSIC + "=1") +
+ " AND " + AudioColumns.TITLE + " != ''" +
+ " AND " + MediaStore.Audio.Media.DATE_ADDED + ">" +
+ cutoff;
return context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
new String[] {
@@ -136,6 +135,6 @@ public class LastAddedLoader extends SectionCreator.SimpleListLoader<Song> {
AudioColumns.DURATION,
/* 6 */
AudioColumns.YEAR,
- }, selection.toString(), null, MediaStore.Audio.Media.DATE_ADDED + " DESC");
+ }, selection, null, MediaStore.Audio.Media.DATE_ADDED + " DESC");
}
}
diff --git a/src/com/cyanogenmod/eleven/loaders/PlaylistSongLoader.java b/src/com/cyanogenmod/eleven/loaders/PlaylistSongLoader.java
index d60af42..e998e8f 100644
--- a/src/com/cyanogenmod/eleven/loaders/PlaylistSongLoader.java
+++ b/src/com/cyanogenmod/eleven/loaders/PlaylistSongLoader.java
@@ -256,9 +256,8 @@ public class PlaylistSongLoader extends WrappedAsyncTaskLoader<List<Song>> {
* @return The {@link Cursor} used to run the song query.
*/
public static final Cursor makePlaylistSongCursor(final Context context, final Long playlistID) {
- final StringBuilder mSelection = new StringBuilder();
- mSelection.append(AudioColumns.IS_MUSIC + "=1");
- mSelection.append(" AND " + AudioColumns.TITLE + " != ''"); //$NON-NLS-2$
+ String mSelection = (AudioColumns.IS_MUSIC + "=1") +
+ " AND " + AudioColumns.TITLE + " != ''";
return context.getContentResolver().query(
MediaStore.Audio.Playlists.Members.getContentUri("external", playlistID),
new String[] {
@@ -280,7 +279,7 @@ public class PlaylistSongLoader extends WrappedAsyncTaskLoader<List<Song>> {
AudioColumns.YEAR,
/* 8 */
Playlists.Members.PLAY_ORDER,
- }, mSelection.toString(), null,
+ }, mSelection, null,
MediaStore.Audio.Playlists.Members.DEFAULT_SORT_ORDER);
}
}
diff --git a/src/com/cyanogenmod/eleven/provider/PlaylistArtworkStore.java b/src/com/cyanogenmod/eleven/provider/PlaylistArtworkStore.java
index 1ad2ea2..48a792e 100644
--- a/src/com/cyanogenmod/eleven/provider/PlaylistArtworkStore.java
+++ b/src/com/cyanogenmod/eleven/provider/PlaylistArtworkStore.java
@@ -75,26 +75,21 @@ public class PlaylistArtworkStore {
public void onCreate(final SQLiteDatabase db) {
// create the table
- StringBuilder builder = new StringBuilder();
- builder.append("CREATE TABLE IF NOT EXISTS ");
- builder.append(PlaylistArtworkStoreColumns.NAME);
- builder.append("(");
- builder.append(PlaylistArtworkStoreColumns.ID);
- builder.append(" INT UNIQUE,");
-
- builder.append(PlaylistArtworkStoreColumns.LAST_UPDATE_ARTIST);
- builder.append(" LONG DEFAULT 0,");
-
- builder.append(PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_ARTIST);
- builder.append(" INT DEFAULT 0,");
-
- builder.append(PlaylistArtworkStoreColumns.LAST_UPDATE_COVER);
- builder.append(" LONG DEFAULT 0,");
-
- builder.append(PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_COVER);
- builder.append(" INT DEFAULT 0);");
-
- db.execSQL(builder.toString());
+ String builder = "CREATE TABLE IF NOT EXISTS " +
+ PlaylistArtworkStoreColumns.NAME +
+ "(" +
+ PlaylistArtworkStoreColumns.ID +
+ " INT UNIQUE," +
+ PlaylistArtworkStoreColumns.LAST_UPDATE_ARTIST +
+ " LONG DEFAULT 0," +
+ PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_ARTIST +
+ " INT DEFAULT 0," +
+ PlaylistArtworkStoreColumns.LAST_UPDATE_COVER +
+ " LONG DEFAULT 0," +
+ PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_COVER +
+ " INT DEFAULT 0);";
+
+ db.execSQL(builder);
}
public void onUpgrade(final SQLiteDatabase db, final int oldVersion, final int newVersion) {
diff --git a/src/com/cyanogenmod/eleven/utils/MusicUtils.java b/src/com/cyanogenmod/eleven/utils/MusicUtils.java
index a8acb9f..72aa29e 100644
--- a/src/com/cyanogenmod/eleven/utils/MusicUtils.java
+++ b/src/com/cyanogenmod/eleven/utils/MusicUtils.java
@@ -817,11 +817,10 @@ public final class MusicUtils {
final String[] projection = new String[] {
BaseColumns._ID
};
- final StringBuilder selection = new StringBuilder();
- selection.append(AudioColumns.IS_MUSIC + "=1");
- selection.append(" AND " + MediaColumns.TITLE + "!=''");
+ String selection = (AudioColumns.IS_MUSIC + "=1") +
+ " AND " + MediaColumns.TITLE + "!=''";
final Uri uri = MediaStore.Audio.Genres.Members.getContentUri("external", Long.valueOf(id));
- Cursor cursor = context.getContentResolver().query(uri, projection, selection.toString(),
+ Cursor cursor = context.getContentResolver().query(uri, projection, selection,
null, null);
if (cursor != null) {
final long[] mList = getSongListForCursor(cursor);
@@ -1278,9 +1277,8 @@ public final class MusicUtils {
}
public static final AlbumArtistDetails getAlbumArtDetails(final Context context, final long trackId) {
- final StringBuilder selection = new StringBuilder();
- selection.append(MediaStore.Audio.AudioColumns.IS_MUSIC + "=1");
- selection.append(" AND " + BaseColumns._ID + " = '").append(trackId).append("'");
+ String selection = (AudioColumns.IS_MUSIC + "=1") +
+ " AND " + BaseColumns._ID + " = '" + trackId + "'";
Cursor cursor = context.getContentResolver().query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
@@ -1291,7 +1289,7 @@ public final class MusicUtils {
MediaStore.Audio.AudioColumns.ALBUM,
/* 2 */
MediaStore.Audio.AlbumColumns.ARTIST,
- }, selection.toString(), null, null
+ }, selection, null, null
);
if (!cursor.moveToFirst()) {