Cleaned up the Util classes

This commit is contained in:
Karim Abou Zeid 2015-07-11 02:08:54 +02:00
commit 88d4dd8e80
37 changed files with 214 additions and 417 deletions

View file

@ -25,7 +25,7 @@ import com.kabouzeid.gramophone.model.Song;
import com.kabouzeid.gramophone.service.MusicService;
import com.kabouzeid.gramophone.ui.activities.MainActivity;
import com.kabouzeid.gramophone.util.MusicUtil;
import com.kabouzeid.gramophone.util.PreferenceUtils;
import com.kabouzeid.gramophone.util.PreferenceUtil;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.assist.ImageSize;
@ -89,7 +89,7 @@ public class PlayingNotificationHelper {
};
public void updateNotification() {
updateNotification(PreferenceUtils.getInstance(service).coloredNotification());
updateNotification(PreferenceUtil.getInstance(service).coloredNotification());
}
private void updateNotification(final boolean isColored) {

View file

@ -0,0 +1,160 @@
/*
* Copyright (C) 2012 Andrew Neal Licensed under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
* or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package com.kabouzeid.gramophone.helper;
import android.provider.MediaStore;
/**
* Holds all of the sort orders for each list type.
*
* @author Andrew Neal (andrewdneal@gmail.com)
*/
public final class SortOrder {
/**
* This class is never instantiated
*/
public SortOrder() {
}
/**
* Artist sort order entries.
*/
public interface ArtistSortOrder {
/* Artist sort order A-Z */
String ARTIST_A_Z = MediaStore.Audio.Artists.DEFAULT_SORT_ORDER;
/* Artist sort order Z-A */
String ARTIST_Z_A = ARTIST_A_Z + " DESC";
/* Artist sort order number of songs */
String ARTIST_NUMBER_OF_SONGS = MediaStore.Audio.Artists.NUMBER_OF_TRACKS
+ " DESC";
/* Artist sort order number of albums */
String ARTIST_NUMBER_OF_ALBUMS = MediaStore.Audio.Artists.NUMBER_OF_ALBUMS
+ " DESC";
}
/**
* Album sort order entries.
*/
public interface AlbumSortOrder {
/* Album sort order A-Z */
String ALBUM_A_Z = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
/* Album sort order Z-A */
String ALBUM_Z_A = ALBUM_A_Z + " DESC";
/* Album sort order songs */
String ALBUM_NUMBER_OF_SONGS = MediaStore.Audio.Albums.NUMBER_OF_SONGS
+ " DESC";
/* Album sort order artist */
String ALBUM_ARTIST = MediaStore.Audio.Albums.ARTIST;
/* Album sort order year */
String ALBUM_YEAR = MediaStore.Audio.Albums.FIRST_YEAR + " DESC";
}
/**
* Song sort order entries.
*/
public interface SongSortOrder {
/* Song sort order A-Z */
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/* Song sort order Z-A */
String SONG_Z_A = SONG_A_Z + " DESC";
/* Song sort order artist */
String SONG_ARTIST = MediaStore.Audio.Media.ARTIST;
/* Song sort order album */
String SONG_ALBUM = MediaStore.Audio.Media.ALBUM;
/* Song sort order year */
String SONG_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
/* Song sort order duration */
String SONG_DURATION = MediaStore.Audio.Media.DURATION + " DESC";
/* Song sort order date */
String SONG_DATE = MediaStore.Audio.Media.DATE_ADDED + " DESC";
}
/**
* Album song sort order entries.
*/
public interface AlbumSongSortOrder {
/* Album song sort order A-Z */
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/* Album song sort order Z-A */
String SONG_Z_A = SONG_A_Z + " DESC";
/* Album song sort order track list */
String SONG_TRACK_LIST = MediaStore.Audio.Media.TRACK + ", "
+ MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/* Album song sort order duration */
String SONG_DURATION = SongSortOrder.SONG_DURATION;
}
/**
* Artist song sort order entries.
*/
public interface ArtistSongSortOrder {
/* Artist song sort order A-Z */
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/* Artist song sort order Z-A */
String SONG_Z_A = SONG_A_Z + " DESC";
/* Artist song sort order album */
String SONG_ALBUM = MediaStore.Audio.Media.ALBUM;
/* Artist song sort order year */
String SONG_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
/* Artist song sort order duration */
String SONG_DURATION = MediaStore.Audio.Media.DURATION + " DESC";
/* Artist song sort order date */
String SONG_DATE = MediaStore.Audio.Media.DATE_ADDED + " DESC";
}
/**
* Artist album sort order entries.
*/
public interface ArtistAlbumSortOrder {
/* Artist album sort order A-Z */
String ALBUM_A_Z = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
/* Artist album sort order Z-A */
String ALBUM_Z_A = ALBUM_A_Z + " DESC";
/* Artist album sort order songs */
String ALBUM_NUMBER_OF_SONGS = MediaStore.Audio.Artists.Albums.NUMBER_OF_SONGS
+ " DESC";
/* Artist album sort order year */
String ALBUM_YEAR = MediaStore.Audio.Artists.Albums.FIRST_YEAR
+ " DESC";
/* Artist album sort order year */
String ALBUM_YEAR_ASC = MediaStore.Audio.Artists.Albums.FIRST_YEAR
+ " ASC";
}
}

View file

@ -29,7 +29,7 @@ import android.graphics.Bitmap;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.kabouzeid.gramophone.util.Util;
import com.kabouzeid.gramophone.util.ImageUtil;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -64,7 +64,7 @@ public class StackBlurManager {
*/
public StackBlurManager(@NonNull Bitmap image) {
// resize Bitmap to prevent OOM and OOB exceptions and increase the performance
this.image = Util.getResizedBitmap(image, 500, 500, false);
this.image = ImageUtil.getResizedBitmap(image, 500, 500, false);
blurProcess = new JavaBlurProcess();
}