Code rearanged
This commit is contained in:
parent
00e3724ab4
commit
6aaf926ff7
27 changed files with 107 additions and 158 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
package com.kabouzeid.gramophone;
|
package com.kabouzeid.gramophone;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.android.volley.Request;
|
import com.android.volley.Request;
|
||||||
|
|
@ -12,7 +11,6 @@ import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||||
import com.kabouzeid.gramophone.misc.AppKeys;
|
import com.kabouzeid.gramophone.misc.AppKeys;
|
||||||
import com.squareup.otto.Bus;
|
import com.squareup.otto.Bus;
|
||||||
import com.squareup.otto.ThreadEnforcer;
|
import com.squareup.otto.ThreadEnforcer;
|
||||||
import com.squareup.picasso.Picasso;
|
|
||||||
|
|
||||||
import io.fabric.sdk.android.Fabric;
|
import io.fabric.sdk.android.Fabric;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ public class PlaylistSongAdapter extends RecyclerView.Adapter<PlaylistSongAdapte
|
||||||
itemView.setOnClickListener(new View.OnClickListener() {
|
itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
MusicPlayerRemote.openQueue((List<Song>) (List)dataSet, getAdapterPosition(), true);
|
MusicPlayerRemote.openQueue((List<Song>) (List) dataSet, getAdapterPosition(), true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public class AddToPlaylistDialogHelper {
|
||||||
CharSequence[] playlistNames = new CharSequence[playlists.size() + 1];
|
CharSequence[] playlistNames = new CharSequence[playlists.size() + 1];
|
||||||
playlistNames[0] = context.getResources().getString(R.string.action_new_playlist);
|
playlistNames[0] = context.getResources().getString(R.string.action_new_playlist);
|
||||||
for (int i = 1; i < playlistNames.length; i++) {
|
for (int i = 1; i < playlistNames.length; i++) {
|
||||||
playlistNames[i] = playlists.get(i-1).name;
|
playlistNames[i] = playlists.get(i - 1).name;
|
||||||
}
|
}
|
||||||
return new MaterialDialog.Builder(context)
|
return new MaterialDialog.Builder(context)
|
||||||
.items(playlistNames)
|
.items(playlistNames)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,9 @@ public class CreatePlaylistDialogHelper {
|
||||||
public static MaterialDialog getDialog(final Context context, final List<Song> songs) {
|
public static MaterialDialog getDialog(final Context context, final List<Song> songs) {
|
||||||
final EditText editText = new EditText(context);
|
final EditText editText = new EditText(context);
|
||||||
ViewGroup layout = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.dialog_empty_frame, null);
|
ViewGroup layout = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.dialog_empty_frame, null);
|
||||||
if (editText.getParent() != null) {((ViewGroup) editText.getParent()).removeView(editText);}
|
if (editText.getParent() != null) {
|
||||||
|
((ViewGroup) editText.getParent()).removeView(editText);
|
||||||
|
}
|
||||||
layout.addView(editText, new LinearLayout.LayoutParams(
|
layout.addView(editText, new LinearLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
return new MaterialDialog.Builder(context)
|
return new MaterialDialog.Builder(context)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import com.kabouzeid.gramophone.util.PlaylistsUtil;
|
||||||
* Created by karim on 19.03.15.
|
* Created by karim on 19.03.15.
|
||||||
*/
|
*/
|
||||||
public class DeletePlaylistDialogHelper {
|
public class DeletePlaylistDialogHelper {
|
||||||
public static MaterialDialog getDialog(final Context context, final int playlistId){
|
public static MaterialDialog getDialog(final Context context, final int playlistId) {
|
||||||
return new MaterialDialog.Builder(context)
|
return new MaterialDialog.Builder(context)
|
||||||
.title(context.getResources().getString(R.string.delete_playlist) + PlaylistsUtil.getNameForPlaylist(context, playlistId))
|
.title(context.getResources().getString(R.string.delete_playlist) + PlaylistsUtil.getNameForPlaylist(context, playlistId))
|
||||||
.positiveText(context.getResources().getString(R.string.ok))
|
.positiveText(context.getResources().getString(R.string.ok))
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ public class MusicPlayerRemote {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void moveSong(int from, int to) {
|
public static void moveSong(int from, int to) {
|
||||||
if(musicService != null){
|
if (musicService != null) {
|
||||||
musicService.moveSong(from, to);
|
musicService.moveSong(from, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ import android.app.TaskStackBuilder;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
|
|
||||||
|
|
@ -21,9 +19,7 @@ import com.kabouzeid.gramophone.model.Song;
|
||||||
import com.kabouzeid.gramophone.service.MusicService;
|
import com.kabouzeid.gramophone.service.MusicService;
|
||||||
import com.kabouzeid.gramophone.ui.activities.MusicControllerActivity;
|
import com.kabouzeid.gramophone.ui.activities.MusicControllerActivity;
|
||||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||||
import com.squareup.picasso.MemoryPolicy;
|
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
import com.squareup.picasso.Target;
|
|
||||||
|
|
||||||
public class PlayingNotificationHelper {
|
public class PlayingNotificationHelper {
|
||||||
public static final String TAG = PlayingNotificationHelper.class.getSimpleName();
|
public static final String TAG = PlayingNotificationHelper.class.getSimpleName();
|
||||||
|
|
@ -165,7 +161,9 @@ public class PlayingNotificationHelper {
|
||||||
notificationLayout.setImageViewResource(R.id.album_art, R.drawable.default_album_art);
|
notificationLayout.setImageViewResource(R.id.album_art, R.drawable.default_album_art);
|
||||||
notificationLayoutExpanded.setImageViewResource(R.id.album_art, R.drawable.default_album_art);
|
notificationLayoutExpanded.setImageViewResource(R.id.album_art, R.drawable.default_album_art);
|
||||||
notificationManager.notify(NOTIFICATION_ID, notification);
|
notificationManager.notify(NOTIFICATION_ID, notification);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
public void killNotification() {
|
public void killNotification() {
|
||||||
service.stopForeground(true);
|
service.stopForeground(true);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import com.afollestad.materialdialogs.MaterialDialog;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.PlayingQueueAdapter;
|
import com.kabouzeid.gramophone.adapter.PlayingQueueAdapter;
|
||||||
import com.kabouzeid.gramophone.model.Song;
|
import com.kabouzeid.gramophone.model.Song;
|
||||||
import com.kabouzeid.gramophone.util.PlaylistsUtil;
|
|
||||||
import com.mobeta.android.dslv.DragSortListView;
|
import com.mobeta.android.dslv.DragSortListView;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ public class LastFMAlbumInfoUtil {
|
||||||
public static void downloadAlbumInfoJSON(final Context context, final String album, final String artist, final Response.Listener<JSONObject> callbackSuccess, final Response.ErrorListener callbackError) {
|
public static void downloadAlbumInfoJSON(final Context context, final String album, final String artist, final Response.Listener<JSONObject> callbackSuccess, final Response.ErrorListener callbackError) {
|
||||||
App app = (App) context.getApplicationContext();
|
App app = (App) context.getApplicationContext();
|
||||||
String albumUrl = LastFMAlbumInfoUtil.getAlbumUrl(album, artist);
|
String albumUrl = LastFMAlbumInfoUtil.getAlbumUrl(album, artist);
|
||||||
JsonObjectRequest albumInfoJSONRequest = new JsonObjectRequest(0, albumUrl, (JSONObject)null, new Response.Listener<JSONObject>() {
|
JsonObjectRequest albumInfoJSONRequest = new JsonObjectRequest(0, albumUrl, (JSONObject) null, new Response.Listener<JSONObject>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONObject response) {
|
||||||
LastFMAlbumInfoUtil.saveAlbumJSONDataToCacheAndDisk(context, album, artist, response);
|
LastFMAlbumInfoUtil.saveAlbumJSONDataToCacheAndDisk(context, album, artist, response);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class LastFMArtistBiographyLoader {
|
||||||
private static void downloadArtistBio(final Context context, final String artist, final ArtistBioLoaderCallback callback) {
|
private static void downloadArtistBio(final Context context, final String artist, final ArtistBioLoaderCallback callback) {
|
||||||
App app = (App) context.getApplicationContext();
|
App app = (App) context.getApplicationContext();
|
||||||
String artistUrl = LastFMArtistInfoUtil.getArtistUrl(artist);
|
String artistUrl = LastFMArtistInfoUtil.getArtistUrl(artist);
|
||||||
JsonObjectRequest artistInfoJSONRequest = new JsonObjectRequest(0, artistUrl, (JSONObject)null, new Response.Listener<JSONObject>() {
|
JsonObjectRequest artistInfoJSONRequest = new JsonObjectRequest(0, artistUrl, (JSONObject) null, new Response.Listener<JSONObject>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONObject response) {
|
||||||
LastFMArtistInfoUtil.saveArtistJSONDataToCacheAndDisk(context, artist, response);
|
LastFMArtistInfoUtil.saveArtistJSONDataToCacheAndDisk(context, artist, response);
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ public class LastFMArtistInfoUtil {
|
||||||
public static void downloadArtistJSON(final Context context, final String artist, final Response.Listener<JSONObject> callback) {
|
public static void downloadArtistJSON(final Context context, final String artist, final Response.Listener<JSONObject> callback) {
|
||||||
App app = (App) context.getApplicationContext();
|
App app = (App) context.getApplicationContext();
|
||||||
String artistUrl = LastFMArtistInfoUtil.getArtistUrl(artist);
|
String artistUrl = LastFMArtistInfoUtil.getArtistUrl(artist);
|
||||||
JsonObjectRequest artistInfoJSONRequest = new JsonObjectRequest(0, artistUrl, (JSONObject)null, new Response.Listener<JSONObject>() {
|
JsonObjectRequest artistInfoJSONRequest = new JsonObjectRequest(0, artistUrl, (JSONObject) null, new Response.Listener<JSONObject>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONObject response) {
|
||||||
LastFMArtistInfoUtil.saveArtistJSONDataToCacheAndDisk(context, artist, response);
|
LastFMArtistInfoUtil.saveArtistJSONDataToCacheAndDisk(context, artist, response);
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,10 @@
|
||||||
package com.kabouzeid.gramophone.lastfm.artist;
|
package com.kabouzeid.gramophone.lastfm.artist;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.volley.Response;
|
import com.android.volley.Response;
|
||||||
import com.kabouzeid.gramophone.provider.ArtistJSONStore;
|
import com.kabouzeid.gramophone.provider.ArtistJSONStore;
|
||||||
import com.squareup.picasso.Picasso;
|
|
||||||
import com.squareup.picasso.Target;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class AlbumLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Album> getAlbums(Context context, String query) {
|
public static List<Album> getAlbums(Context context, String query) {
|
||||||
Cursor cursor = makeAlbumCursor(context, MediaStore.Audio.AlbumColumns.ALBUM + " LIKE ?", new String[]{"%"+query+"%"});
|
Cursor cursor = makeAlbumCursor(context, MediaStore.Audio.AlbumColumns.ALBUM + " LIKE ?", new String[]{"%" + query + "%"});
|
||||||
List<Album> albums = new ArrayList<>();
|
List<Album> albums = new ArrayList<>();
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class ArtistLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Artist> getArtists(Context context, String query) {
|
public static List<Artist> getArtists(Context context, String query) {
|
||||||
Cursor cursor = makeArtistCursor(context, MediaStore.Audio.ArtistColumns.ARTIST + " LIKE ?", new String[]{"%"+query+"%"});
|
Cursor cursor = makeArtistCursor(context, MediaStore.Audio.ArtistColumns.ARTIST + " LIKE ?", new String[]{"%" + query + "%"});
|
||||||
List<Artist> artists = new ArrayList<>();
|
List<Artist> artists = new ArrayList<>();
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,7 @@ import android.database.Cursor;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.provider.MediaStore.Audio.AudioColumns;
|
import android.provider.MediaStore.Audio.AudioColumns;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.model.Playlist;
|
|
||||||
import com.kabouzeid.gramophone.model.PlaylistSong;
|
import com.kabouzeid.gramophone.model.PlaylistSong;
|
||||||
import com.kabouzeid.gramophone.model.Song;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,10 @@ public class SongFilePathLoader {
|
||||||
return songFiles;
|
return songFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSongFilePath(Context context, int queryId){
|
public static String getSongFilePath(Context context, int queryId) {
|
||||||
try {
|
try {
|
||||||
return getSongFilePaths(context, new int[]{queryId}).get(0);
|
return getSongFilePaths(context, new int[]{queryId}).get(0);
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ public class SongLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Song> getSongs(final Context context, final String query) {
|
public static List<Song> getSongs(final Context context, final String query) {
|
||||||
Cursor cursor = makeSongCursor(context, MediaStore.Audio.AudioColumns.TITLE + " LIKE ?", new String[]{"%"+query+"%"});
|
Cursor cursor = makeSongCursor(context, MediaStore.Audio.AudioColumns.TITLE + " LIKE ?", new String[]{"%" + query + "%"});
|
||||||
List<Song> songs = new ArrayList<>();
|
List<Song> songs = new ArrayList<>();
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,11 @@ import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
|
|
||||||
|
|
||||||
public class DragSortRecycler extends RecyclerView.ItemDecoration implements RecyclerView.OnItemTouchListener {
|
public class DragSortRecycler extends RecyclerView.ItemDecoration implements RecyclerView.OnItemTouchListener {
|
||||||
|
|
@ -72,69 +70,60 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
OnDragStateChangedListener dragStateChangedListener;
|
OnDragStateChangedListener dragStateChangedListener;
|
||||||
|
|
||||||
|
|
||||||
|
public interface OnItemMovedListener {
|
||||||
public interface OnItemMovedListener
|
|
||||||
{
|
|
||||||
public void onItemMoved(int from, int to);
|
public void onItemMoved(int from, int to);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnDragStateChangedListener {
|
public interface OnDragStateChangedListener {
|
||||||
public void onDragStart();
|
public void onDragStart();
|
||||||
|
|
||||||
public void onDragStop();
|
public void onDragStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void debugLog(String log)
|
private void debugLog(String log) {
|
||||||
{
|
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
Log.d(TAG, log);
|
Log.d(TAG, log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecyclerView.OnScrollListener getScrollListener()
|
public RecyclerView.OnScrollListener getScrollListener() {
|
||||||
{
|
|
||||||
return scrollListener;
|
return scrollListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the item move interface
|
* Set the item move interface
|
||||||
*/
|
*/
|
||||||
public void setOnItemMovedListener(OnItemMovedListener swif)
|
public void setOnItemMovedListener(OnItemMovedListener swif) {
|
||||||
{
|
|
||||||
moveInterface = swif;
|
moveInterface = swif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setViewHandleId(int id)
|
public void setViewHandleId(int id) {
|
||||||
{
|
|
||||||
viewHandleId = id;
|
viewHandleId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeftDragArea(int w)
|
public void setLeftDragArea(int w) {
|
||||||
{
|
|
||||||
dragHandleWidth = w;
|
dragHandleWidth = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFloatingAlpha(float a)
|
public void setFloatingAlpha(float a) {
|
||||||
{
|
|
||||||
floatingItemAlpha = a;
|
floatingItemAlpha = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFloatingBgColor(int c)
|
public void setFloatingBgColor(int c) {
|
||||||
{
|
|
||||||
floatingItemBgColor = c;
|
floatingItemBgColor = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set the window at top and bottom of list, must be between 0 and 0.5
|
Set the window at top and bottom of list, must be between 0 and 0.5
|
||||||
For example 0.1 uses the top and bottom 10% of the lists for scrolling
|
For example 0.1 uses the top and bottom 10% of the lists for scrolling
|
||||||
*/
|
*/
|
||||||
public void setAutoScrollWindow(float w)
|
public void setAutoScrollWindow(float w) {
|
||||||
{
|
|
||||||
autoScrollWindow = w;
|
autoScrollWindow = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set the autoscroll speed, default is 0.5
|
Set the autoscroll speed, default is 0.5
|
||||||
*/
|
*/
|
||||||
public void setAutoScrollSpeed(float speed)
|
public void setAutoScrollSpeed(float speed) {
|
||||||
{
|
|
||||||
autoScrollSpeed = speed;
|
autoScrollSpeed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,63 +134,55 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
debugLog("getItemOffsets");
|
debugLog("getItemOffsets");
|
||||||
|
|
||||||
debugLog("View top = " + view.getTop());
|
debugLog("View top = " + view.getTop());
|
||||||
if (selectedDragItemPos != -1)
|
if (selectedDragItemPos != -1) {
|
||||||
{
|
|
||||||
int itemPos = rv.getChildPosition(view);
|
int itemPos = rv.getChildPosition(view);
|
||||||
debugLog("itemPos =" + itemPos);
|
debugLog("itemPos =" + itemPos);
|
||||||
|
|
||||||
if(!canDragOver(itemPos)) {
|
if (!canDragOver(itemPos)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Movement of finger
|
//Movement of finger
|
||||||
float totalMovement = fingerY-fingerAnchorY;
|
float totalMovement = fingerY - fingerAnchorY;
|
||||||
|
|
||||||
if (itemPos == selectedDragItemPos)
|
if (itemPos == selectedDragItemPos) {
|
||||||
{
|
|
||||||
view.setVisibility(View.INVISIBLE);
|
view.setVisibility(View.INVISIBLE);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
//Make view visible incase invisible
|
//Make view visible incase invisible
|
||||||
view.setVisibility(View.VISIBLE);
|
view.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
//Find middle of the floatingItem
|
//Find middle of the floatingItem
|
||||||
float floatMiddleY = floatingItemBounds.top + floatingItemBounds.height()/2;
|
float floatMiddleY = floatingItemBounds.top + floatingItemBounds.height() / 2;
|
||||||
|
|
||||||
//Moving down the list
|
//Moving down the list
|
||||||
//These will auto-animate if the device continually sends touch motion events
|
//These will auto-animate if the device continually sends touch motion events
|
||||||
// if (totalMovment>0)
|
// if (totalMovment>0)
|
||||||
{
|
{
|
||||||
if ((itemPos > selectedDragItemPos) && (view.getTop() < floatMiddleY))
|
if ((itemPos > selectedDragItemPos) && (view.getTop() < floatMiddleY)) {
|
||||||
{
|
float amountUp = (floatMiddleY - view.getTop()) / (float) view.getHeight();
|
||||||
float amountUp = (floatMiddleY - view.getTop()) / (float)view.getHeight();
|
|
||||||
// amountUp *= 0.5f;
|
// amountUp *= 0.5f;
|
||||||
if (amountUp > 1)
|
if (amountUp > 1)
|
||||||
amountUp = 1;
|
amountUp = 1;
|
||||||
|
|
||||||
outRect.top = -(int)(floatingItemBounds.height()*amountUp);
|
outRect.top = -(int) (floatingItemBounds.height() * amountUp);
|
||||||
outRect.bottom = (int)(floatingItemBounds.height()*amountUp);
|
outRect.bottom = (int) (floatingItemBounds.height() * amountUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//Moving up the list
|
}//Moving up the list
|
||||||
// else if (totalMovment < 0)
|
// else if (totalMovment < 0)
|
||||||
{
|
{
|
||||||
if((itemPos < selectedDragItemPos) && (view.getBottom() > floatMiddleY))
|
if ((itemPos < selectedDragItemPos) && (view.getBottom() > floatMiddleY)) {
|
||||||
{
|
float amountDown = ((float) view.getBottom() - floatMiddleY) / (float) view.getHeight();
|
||||||
float amountDown = ((float)view.getBottom() - floatMiddleY) / (float)view.getHeight();
|
|
||||||
// amountDown *= 0.5f;
|
// amountDown *= 0.5f;
|
||||||
if (amountDown > 1)
|
if (amountDown > 1)
|
||||||
amountDown = 1;
|
amountDown = 1;
|
||||||
|
|
||||||
outRect.top = (int)(floatingItemBounds.height()*amountDown);
|
outRect.top = (int) (floatingItemBounds.height() * amountDown);
|
||||||
outRect.bottom = -(int)(floatingItemBounds.height()*amountDown);
|
outRect.bottom = -(int) (floatingItemBounds.height() * amountDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
outRect.top = 0;
|
outRect.top = 0;
|
||||||
outRect.bottom = 0;
|
outRect.bottom = 0;
|
||||||
//Make view visible incase invisible
|
//Make view visible incase invisible
|
||||||
|
|
@ -215,15 +196,14 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
* This *seems* to work, another method would be to use
|
* This *seems* to work, another method would be to use
|
||||||
* getItemOffsets, but I think that could miss items?..
|
* getItemOffsets, but I think that could miss items?..
|
||||||
*/
|
*/
|
||||||
private int getNewPostion(RecyclerView rv)
|
private int getNewPostion(RecyclerView rv) {
|
||||||
{
|
|
||||||
int itemsOnScreen = rv.getLayoutManager().getChildCount();
|
int itemsOnScreen = rv.getLayoutManager().getChildCount();
|
||||||
|
|
||||||
float floatMiddleY = floatingItemBounds.top + floatingItemBounds.height()/2;
|
float floatMiddleY = floatingItemBounds.top + floatingItemBounds.height() / 2;
|
||||||
|
|
||||||
int above=0;
|
int above = 0;
|
||||||
int below = Integer.MAX_VALUE;
|
int below = Integer.MAX_VALUE;
|
||||||
for (int n=0;n < itemsOnScreen;n++) //Scan though items on screen, however they may not
|
for (int n = 0; n < itemsOnScreen; n++) //Scan though items on screen, however they may not
|
||||||
{ // be in order!
|
{ // be in order!
|
||||||
|
|
||||||
View view = rv.getLayoutManager().getChildAt(n);
|
View view = rv.getLayoutManager().getChildAt(n);
|
||||||
|
|
@ -236,13 +216,12 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
if (itemPos == selectedDragItemPos) //Don't check against itself!
|
if (itemPos == selectedDragItemPos) //Don't check against itself!
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float viewMiddleY = view.getTop() + view.getHeight()/2;
|
float viewMiddleY = view.getTop() + view.getHeight() / 2;
|
||||||
if (floatMiddleY > viewMiddleY) //Is above this item
|
if (floatMiddleY > viewMiddleY) //Is above this item
|
||||||
{
|
{
|
||||||
if (itemPos > above)
|
if (itemPos > above)
|
||||||
above = itemPos;
|
above = itemPos;
|
||||||
}
|
} else if (floatMiddleY <= viewMiddleY) //Is below this item
|
||||||
else if (floatMiddleY <= viewMiddleY) //Is below this item
|
|
||||||
{
|
{
|
||||||
if (itemPos < below)
|
if (itemPos < below)
|
||||||
below = itemPos;
|
below = itemPos;
|
||||||
|
|
@ -254,9 +233,7 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
if (below < selectedDragItemPos) //Need to count itself
|
if (below < selectedDragItemPos) //Need to count itself
|
||||||
below++;
|
below++;
|
||||||
return below - 1;
|
return below - 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (above < selectedDragItemPos)
|
if (above < selectedDragItemPos)
|
||||||
above++;
|
above++;
|
||||||
|
|
||||||
|
|
@ -273,28 +250,24 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
{
|
{
|
||||||
View itemView = rv.findChildViewUnder(e.getX(), e.getY());
|
View itemView = rv.findChildViewUnder(e.getX(), e.getY());
|
||||||
|
|
||||||
if (itemView==null)
|
if (itemView == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean dragging = false;
|
boolean dragging = false;
|
||||||
|
|
||||||
if ((dragHandleWidth > 0 ) && (e.getX() < dragHandleWidth))
|
if ((dragHandleWidth > 0) && (e.getX() < dragHandleWidth)) {
|
||||||
{
|
|
||||||
dragging = true;
|
dragging = true;
|
||||||
}
|
} else if (viewHandleId != -1) {
|
||||||
else if (viewHandleId != -1)
|
|
||||||
{
|
|
||||||
//Find the handle in the list item
|
//Find the handle in the list item
|
||||||
View handleView = itemView.findViewById(viewHandleId);
|
View handleView = itemView.findViewById(viewHandleId);
|
||||||
|
|
||||||
if (handleView == null)
|
if (handleView == null) {
|
||||||
{
|
|
||||||
Log.e(TAG, "The view ID " + viewHandleId + " was not found in the RecycleView item");
|
Log.e(TAG, "The view ID " + viewHandleId + " was not found in the RecycleView item");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//View should be visible to drag
|
//View should be visible to drag
|
||||||
if(handleView.getVisibility()!=View.VISIBLE) {
|
if (handleView.getVisibility() != View.VISIBLE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -314,7 +287,7 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
itemView.getTop() + yRel + handleView.getHeight()
|
itemView.getTop() + yRel + handleView.getHeight()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (touchBounds.contains((int)e.getX(), (int)e.getY()))
|
if (touchBounds.contains((int) e.getX(), (int) e.getY()))
|
||||||
dragging = true;
|
dragging = true;
|
||||||
|
|
||||||
debugLog("parentItemPos = " + parentItemPos[0] + " " + parentItemPos[1]);
|
debugLog("parentItemPos = " + parentItemPos[0] + " " + parentItemPos[1]);
|
||||||
|
|
@ -322,15 +295,14 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (dragging)
|
if (dragging) {
|
||||||
{
|
|
||||||
debugLog("Started Drag");
|
debugLog("Started Drag");
|
||||||
|
|
||||||
setIsDragging(true);
|
setIsDragging(true);
|
||||||
|
|
||||||
floatingItem = createFloatingBitmap(itemView);
|
floatingItem = createFloatingBitmap(itemView);
|
||||||
|
|
||||||
fingerAnchorY = (int)e.getY();
|
fingerAnchorY = (int) e.getY();
|
||||||
fingerOffsetInViewY = fingerAnchorY - itemView.getTop();
|
fingerOffsetInViewY = fingerAnchorY - itemView.getTop();
|
||||||
fingerY = fingerAnchorY;
|
fingerY = fingerAnchorY;
|
||||||
|
|
||||||
|
|
@ -348,10 +320,8 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
debugLog("onTouchEvent");
|
debugLog("onTouchEvent");
|
||||||
|
|
||||||
if ((e.getAction() == MotionEvent.ACTION_UP) ||
|
if ((e.getAction() == MotionEvent.ACTION_UP) ||
|
||||||
(e.getAction() == MotionEvent.ACTION_CANCEL))
|
(e.getAction() == MotionEvent.ACTION_CANCEL)) {
|
||||||
{
|
if ((e.getAction() == MotionEvent.ACTION_UP) && selectedDragItemPos != -1) {
|
||||||
if ((e.getAction() == MotionEvent.ACTION_UP) && selectedDragItemPos != -1)
|
|
||||||
{
|
|
||||||
int newPos = getNewPostion(rv);
|
int newPos = getNewPostion(rv);
|
||||||
if (moveInterface != null)
|
if (moveInterface != null)
|
||||||
moveInterface.onItemMoved(selectedDragItemPos, newPos);
|
moveInterface.onItemMoved(selectedDragItemPos, newPos);
|
||||||
|
|
@ -365,14 +335,13 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fingerY = (int)e.getY();
|
fingerY = (int) e.getY();
|
||||||
|
|
||||||
if (floatingItem!=null)
|
if (floatingItem != null) {
|
||||||
{
|
|
||||||
floatingItemBounds.top = fingerY - fingerOffsetInViewY;
|
floatingItemBounds.top = fingerY - fingerOffsetInViewY;
|
||||||
|
|
||||||
if (floatingItemBounds.top < -floatingItemStatingBounds.height()/2) //Allow half the view out the top
|
if (floatingItemBounds.top < -floatingItemStatingBounds.height() / 2) //Allow half the view out the top
|
||||||
floatingItemBounds.top = -floatingItemStatingBounds.height()/2;
|
floatingItemBounds.top = -floatingItemStatingBounds.height() / 2;
|
||||||
|
|
||||||
floatingItemBounds.bottom = floatingItemBounds.top + floatingItemStatingBounds.height();
|
floatingItemBounds.bottom = floatingItemBounds.top + floatingItemStatingBounds.height();
|
||||||
|
|
||||||
|
|
@ -380,27 +349,24 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
}
|
}
|
||||||
|
|
||||||
//Do auto scrolling at end of list
|
//Do auto scrolling at end of list
|
||||||
float scrollAmount=0;
|
float scrollAmount = 0;
|
||||||
if (fingerY > (rv.getHeight() * (1-autoScrollWindow)))
|
if (fingerY > (rv.getHeight() * (1 - autoScrollWindow))) {
|
||||||
{
|
scrollAmount = (fingerY - (rv.getHeight() * (1 - autoScrollWindow)));
|
||||||
scrollAmount = (fingerY - (rv.getHeight() * (1-autoScrollWindow)));
|
} else if (fingerY < (rv.getHeight() * autoScrollWindow)) {
|
||||||
}
|
|
||||||
else if (fingerY < (rv.getHeight() * autoScrollWindow))
|
|
||||||
{
|
|
||||||
scrollAmount = (fingerY - (rv.getHeight() * autoScrollWindow));
|
scrollAmount = (fingerY - (rv.getHeight() * autoScrollWindow));
|
||||||
}
|
}
|
||||||
debugLog("Scroll: " + scrollAmount);
|
debugLog("Scroll: " + scrollAmount);
|
||||||
|
|
||||||
scrollAmount *= autoScrollSpeed;
|
scrollAmount *= autoScrollSpeed;
|
||||||
rv.scrollBy(0, (int)scrollAmount);
|
rv.scrollBy(0, (int) scrollAmount);
|
||||||
|
|
||||||
rv.invalidateItemDecorations();// Redraw
|
rv.invalidateItemDecorations();// Redraw
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setIsDragging(final boolean dragging) {
|
private void setIsDragging(final boolean dragging) {
|
||||||
if(dragging != isDragging) {
|
if (dragging != isDragging) {
|
||||||
isDragging = dragging;
|
isDragging = dragging;
|
||||||
if(dragStateChangedListener != null) {
|
if (dragStateChangedListener != null) {
|
||||||
if (isDragging) {
|
if (isDragging) {
|
||||||
dragStateChangedListener.onDragStart();
|
dragStateChangedListener.onDragStart();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -416,12 +382,13 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
|
|
||||||
|
|
||||||
Paint bgColor = new Paint();
|
Paint bgColor = new Paint();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||||
if (floatingItem != null) {
|
if (floatingItem != null) {
|
||||||
floatingItem.setAlpha((int)(255 * floatingItemAlpha));
|
floatingItem.setAlpha((int) (255 * floatingItemAlpha));
|
||||||
bgColor.setColor(floatingItemBgColor);
|
bgColor.setColor(floatingItemBgColor);
|
||||||
c.drawRect(floatingItemBounds,bgColor);
|
c.drawRect(floatingItemBounds, bgColor);
|
||||||
floatingItem.draw(c);
|
floatingItem.draw(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -441,8 +408,6 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param position
|
* @param position
|
||||||
* @return True if we can drag the item over this position, False if not.
|
* @return True if we can drag the item over this position, False if not.
|
||||||
*/
|
*/
|
||||||
|
|
@ -451,9 +416,8 @@ public class DragSortRecycler extends RecyclerView.ItemDecoration implements Rec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private BitmapDrawable createFloatingBitmap(View v)
|
private BitmapDrawable createFloatingBitmap(View v) {
|
||||||
{
|
floatingItemStatingBounds = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
|
||||||
floatingItemStatingBounds = new Rect(v.getLeft(), v.getTop(),v.getRight(), v.getBottom());
|
|
||||||
floatingItemBounds = new Rect(floatingItemStatingBounds);
|
floatingItemBounds = new Rect(floatingItemStatingBounds);
|
||||||
|
|
||||||
Bitmap bitmap = Bitmap.createBitmap(floatingItemStatingBounds.width(),
|
Bitmap bitmap = Bitmap.createBitmap(floatingItemStatingBounds.width(),
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.kabouzeid.gramophone.model;
|
package com.kabouzeid.gramophone.model;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.kabouzeid.gramophone.model;
|
package com.kabouzeid.gramophone.model;
|
||||||
|
|
||||||
public class PlaylistSong extends Song{
|
public class PlaylistSong extends Song {
|
||||||
public int playlistId;
|
public int playlistId;
|
||||||
public int idInPlayList;
|
public int idInPlayList;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package com.kabouzeid.gramophone.service;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
public class MediaButtonIntentReceiver extends BroadcastReceiver {
|
public class MediaButtonIntentReceiver extends BroadcastReceiver {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import com.kabouzeid.gramophone.App;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.songadapter.AlbumSongAdapter;
|
import com.kabouzeid.gramophone.adapter.songadapter.AlbumSongAdapter;
|
||||||
import com.kabouzeid.gramophone.comparator.SongTrackNumberComparator;
|
import com.kabouzeid.gramophone.comparator.SongTrackNumberComparator;
|
||||||
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
|
||||||
import com.kabouzeid.gramophone.loader.AlbumLoader;
|
import com.kabouzeid.gramophone.loader.AlbumLoader;
|
||||||
import com.kabouzeid.gramophone.loader.AlbumSongLoader;
|
import com.kabouzeid.gramophone.loader.AlbumSongLoader;
|
||||||
import com.kabouzeid.gramophone.misc.AppKeys;
|
import com.kabouzeid.gramophone.misc.AppKeys;
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ public class ArtistDetailActivity extends AbsFabActivity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private MaterialDialog getBiographyDialog(){
|
private MaterialDialog getBiographyDialog() {
|
||||||
return new MaterialDialog.Builder(ArtistDetailActivity.this)
|
return new MaterialDialog.Builder(ArtistDetailActivity.this)
|
||||||
.title(artist.name)
|
.title(artist.name)
|
||||||
.content(biography)
|
.content(biography)
|
||||||
|
|
@ -316,7 +316,7 @@ public class ArtistDetailActivity extends AbsFabActivity {
|
||||||
NavigationUtil.openPlayingQueueDialog(this);
|
NavigationUtil.openPlayingQueueDialog(this);
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_biography:
|
case R.id.action_biography:
|
||||||
if(biography != null){
|
if (biography != null) {
|
||||||
getBiographyDialog().show();
|
getBiographyDialog().show();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(ArtistDetailActivity.this, getResources().getString(R.string.biography_unavailable), Toast.LENGTH_SHORT).show();
|
Toast.makeText(ArtistDetailActivity.this, getResources().getString(R.string.biography_unavailable), Toast.LENGTH_SHORT).show();
|
||||||
|
|
|
||||||
|
|
@ -14,29 +14,24 @@ import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog;
|
|
||||||
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout;
|
import com.google.samples.apps.iosched.ui.widget.SlidingTabLayout;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.helper.AboutDeveloperDialogHelper;
|
import com.kabouzeid.gramophone.helper.AboutDeveloperDialogHelper;
|
||||||
import com.kabouzeid.gramophone.helper.CreatePlaylistDialogHelper;
|
import com.kabouzeid.gramophone.helper.CreatePlaylistDialogHelper;
|
||||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||||
import com.kabouzeid.gramophone.helper.PlayingQueueDialogHelper;
|
|
||||||
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
||||||
import com.kabouzeid.gramophone.model.MusicRemoteEvent;
|
import com.kabouzeid.gramophone.model.MusicRemoteEvent;
|
||||||
import com.kabouzeid.gramophone.model.Song;
|
import com.kabouzeid.gramophone.model.Song;
|
||||||
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
import com.kabouzeid.gramophone.ui.activities.base.AbsFabActivity;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.NavigationDrawerFragment;
|
import com.kabouzeid.gramophone.ui.fragments.NavigationDrawerFragment;
|
||||||
|
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.AbsMainActivityFragment;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.AlbumViewFragment;
|
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.AlbumViewFragment;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.ArtistViewFragment;
|
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.ArtistViewFragment;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.AbsMainActivityFragment;
|
|
||||||
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.PlaylistViewFragment;
|
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.PlaylistViewFragment;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.SongViewFragment;
|
import com.kabouzeid.gramophone.ui.fragments.mainactivityfragments.SongViewFragment;
|
||||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||||
|
|
@ -216,7 +211,7 @@ public class MainActivity extends AbsFabActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
switch (currentPage){
|
switch (currentPage) {
|
||||||
case 3:
|
case 3:
|
||||||
getMenuInflater().inflate(R.menu.menu_playlists, menu);
|
getMenuInflater().inflate(R.menu.menu_playlists, menu);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ public class PlaylistsUtil {
|
||||||
context.getContentResolver().update(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
|
context.getContentResolver().update(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
|
||||||
contentValues,
|
contentValues,
|
||||||
MediaStore.Audio.Playlists._ID + "=?",
|
MediaStore.Audio.Playlists._ID + "=?",
|
||||||
new String[]{ String.valueOf(id) });
|
new String[]{String.valueOf(id)});
|
||||||
App.bus.post(new DataBaseChangedEvent(DataBaseChangedEvent.PLAYLISTS_CHANGED));
|
App.bus.post(new DataBaseChangedEvent(DataBaseChangedEvent.PLAYLISTS_CHANGED));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,9 @@ import android.provider.MediaStore;
|
||||||
*/
|
*/
|
||||||
public final class SortOrder {
|
public final class SortOrder {
|
||||||
|
|
||||||
/** This class is never instantiated */
|
/**
|
||||||
|
* This class is never instantiated
|
||||||
|
*/
|
||||||
public SortOrder() {
|
public SortOrder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue