add some logging
This commit is contained in:
parent
40a870c7e4
commit
6d9d3101c1
14 changed files with 27 additions and 171 deletions
|
|
@ -82,7 +82,7 @@
|
|||
android:name="com.lge.support.SPLIT_WINDOW"
|
||||
android:value="true" />
|
||||
<meta-data
|
||||
android:name="com.kabouzeid.gramophone.glide.PhonographGlideModule"
|
||||
android:name="com.kabouzeid.gramophone.glide.CustomGlideModule"
|
||||
android:value="GlideModule" />
|
||||
<meta-data
|
||||
android:name="com.bumptech.glide.integration.okhttp3.OkHttpGlideModule"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import android.widget.ImageView;
|
|||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.glide.PhonographColoredTarget;
|
||||
import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
||||
import com.kabouzeid.gramophone.glide.SongGlideRequest;
|
||||
import com.kabouzeid.gramophone.misc.CustomFragmentStatePagerAdapter;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
|
|
@ -131,7 +131,7 @@ public class AlbumCoverPagerAdapter extends CustomFragmentStatePagerAdapter {
|
|||
SongGlideRequest.Builder.from(Glide.with(this), song)
|
||||
.checkIgnoreMediaStore(getActivity())
|
||||
.generatePalette(getActivity()).build()
|
||||
.into(new PhonographColoredTarget(albumCover) {
|
||||
.into(new CustomPaletteTarget(albumCover) {
|
||||
@Override
|
||||
public void onColorReady(int color) {
|
||||
setColor(color);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import com.kabouzeid.appthemehelper.util.MaterialValueHelper;
|
|||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.adapter.base.AbsMultiSelectAdapter;
|
||||
import com.kabouzeid.gramophone.adapter.base.MediaEntryViewHolder;
|
||||
import com.kabouzeid.gramophone.glide.PhonographColoredTarget;
|
||||
import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
||||
import com.kabouzeid.gramophone.glide.SongGlideRequest;
|
||||
import com.kabouzeid.gramophone.helper.SortOrder;
|
||||
import com.kabouzeid.gramophone.helper.menu.SongsMenuHelper;
|
||||
|
|
@ -136,7 +136,7 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
|
||||
.checkIgnoreMediaStore(activity)
|
||||
.generatePalette(activity).build()
|
||||
.into(new PhonographColoredTarget(holder.image) {
|
||||
.into(new CustomPaletteTarget(holder.image) {
|
||||
@Override
|
||||
public void onLoadCleared(Drawable placeholder) {
|
||||
super.onLoadCleared(placeholder);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import android.view.ViewGroup;
|
|||
import com.bumptech.glide.Glide;
|
||||
import com.kabouzeid.appthemehelper.util.ColorUtil;
|
||||
import com.kabouzeid.appthemehelper.util.MaterialValueHelper;
|
||||
import com.kabouzeid.gramophone.glide.PhonographColoredTarget;
|
||||
import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
||||
import com.kabouzeid.gramophone.glide.SongGlideRequest;
|
||||
import com.kabouzeid.gramophone.helper.HorizontalAdapterHelper;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
|
|
@ -57,7 +57,7 @@ public class HorizontalAlbumAdapter extends AlbumAdapter {
|
|||
SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
|
||||
.checkIgnoreMediaStore(activity)
|
||||
.generatePalette(activity).build()
|
||||
.into(new PhonographColoredTarget(holder.image) {
|
||||
.into(new CustomPaletteTarget(holder.image) {
|
||||
@Override
|
||||
public void onLoadCleared(Drawable placeholder) {
|
||||
super.onLoadCleared(placeholder);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import com.kabouzeid.gramophone.R;
|
|||
import com.kabouzeid.gramophone.adapter.base.AbsMultiSelectAdapter;
|
||||
import com.kabouzeid.gramophone.adapter.base.MediaEntryViewHolder;
|
||||
import com.kabouzeid.gramophone.glide.ArtistGlideRequest;
|
||||
import com.kabouzeid.gramophone.glide.PhonographColoredTarget;
|
||||
import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
||||
import com.kabouzeid.gramophone.helper.SortOrder;
|
||||
import com.kabouzeid.gramophone.helper.menu.SongsMenuHelper;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
|
|
@ -127,7 +127,7 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
if (holder.image == null) return;
|
||||
ArtistGlideRequest.Builder.from(Glide.with(activity), artist)
|
||||
.generatePalette(activity).build()
|
||||
.into(new PhonographColoredTarget(holder.image) {
|
||||
.into(new CustomPaletteTarget(holder.image) {
|
||||
@Override
|
||||
public void onLoadCleared(Drawable placeholder) {
|
||||
super.onLoadCleared(placeholder);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import com.kabouzeid.appthemehelper.util.MaterialValueHelper;
|
|||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.adapter.base.AbsMultiSelectAdapter;
|
||||
import com.kabouzeid.gramophone.adapter.base.MediaEntryViewHolder;
|
||||
import com.kabouzeid.gramophone.glide.PhonographColoredTarget;
|
||||
import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
||||
import com.kabouzeid.gramophone.glide.SongGlideRequest;
|
||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||
import com.kabouzeid.gramophone.helper.SortOrder;
|
||||
|
|
@ -136,7 +136,7 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
|||
SongGlideRequest.Builder.from(Glide.with(activity), song)
|
||||
.checkIgnoreMediaStore(activity)
|
||||
.generatePalette(activity).build()
|
||||
.into(new PhonographColoredTarget(holder.image) {
|
||||
.into(new CustomPaletteTarget(holder.image) {
|
||||
@Override
|
||||
public void onLoadCleared(Drawable placeholder) {
|
||||
super.onLoadCleared(placeholder);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import com.kabouzeid.gramophone.glide.audiocover.AudioFileCoverLoader;
|
|||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class PhonographGlideModule implements GlideModule {
|
||||
public class CustomGlideModule implements GlideModule {
|
||||
@Override
|
||||
public void applyOptions(Context context, GlideBuilder builder) {
|
||||
|
||||
|
|
@ -10,8 +10,8 @@ import com.kabouzeid.gramophone.glide.palette.BitmapPaletteTarget;
|
|||
import com.kabouzeid.gramophone.glide.palette.BitmapPaletteWrapper;
|
||||
import com.kabouzeid.gramophone.util.PhonographColorUtil;
|
||||
|
||||
public abstract class PhonographColoredTarget extends BitmapPaletteTarget {
|
||||
public PhonographColoredTarget(ImageView view) {
|
||||
public abstract class CustomPaletteTarget extends BitmapPaletteTarget {
|
||||
public CustomPaletteTarget(ImageView view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
|
|
@ -18,19 +18,17 @@ public class AudioFileCoverFetcher implements DataFetcher<InputStream> {
|
|||
private InputStream stream;
|
||||
|
||||
public AudioFileCoverFetcher(AudioFileCover model) {
|
||||
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
// makes sure we never ever return null here
|
||||
// make sure we never return null here
|
||||
return String.valueOf(model.filePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream loadData(final Priority priority) throws Exception {
|
||||
|
||||
final MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
try {
|
||||
retriever.setDataSource(model.filePath);
|
||||
|
|
@ -49,12 +47,13 @@ public class AudioFileCoverFetcher implements DataFetcher<InputStream> {
|
|||
|
||||
@Override
|
||||
public void cleanup() {
|
||||
// already cleaned up in loadData and ByteArrayInputStream will be GC'd
|
||||
// already cleaned up in loadData
|
||||
if (stream != null) {
|
||||
try {
|
||||
stream.close();
|
||||
} catch (IOException ignore) {
|
||||
} catch (IOException e) {
|
||||
// can't do much about it
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import java.io.InputStream;
|
|||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
|
||||
public class AudioFileCoverLoader implements StreamModelLoader<AudioFileCover> {
|
||||
|
||||
@Override
|
||||
|
|
@ -32,4 +31,3 @@ public class AudioFileCoverLoader implements StreamModelLoader<AudioFileCover> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,22 +4,16 @@ import java.io.ByteArrayInputStream;
|
|||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException;
|
||||
import org.jaudiotagger.audio.exceptions.ReadOnlyFileException;
|
||||
import org.jaudiotagger.audio.mp3.MP3File;
|
||||
import org.jaudiotagger.tag.TagException;
|
||||
import org.jaudiotagger.tag.images.Artwork;
|
||||
|
||||
public class AudioFileCoverUtils {
|
||||
|
||||
public static final String[] FALLBACKS = {"cover.jpg", "album.jpg", "folder.jpg", "cover.png", "album.png", "folder.png"};
|
||||
|
||||
|
||||
public static InputStream fallback(String path) throws FileNotFoundException {
|
||||
// Method 1: use embedded high resolution album art if there is any
|
||||
// use embedded high resolution album art
|
||||
try {
|
||||
MP3File mp3File = new MP3File(path);
|
||||
if (mp3File.hasID3v2Tag()) {
|
||||
|
|
@ -29,14 +23,12 @@ public class AudioFileCoverUtils {
|
|||
return new ByteArrayInputStream(imageData);
|
||||
}
|
||||
}
|
||||
// If there are any exceptions, we ignore them and continue to the other fallback method
|
||||
} catch (ReadOnlyFileException ignored) {
|
||||
} catch (InvalidAudioFrameException ignored) {
|
||||
} catch (TagException ignored) {
|
||||
} catch (IOException ignored) {
|
||||
} catch (Exception e) {
|
||||
// log exceptions and continue to the other fallback method
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Method 2: look for album art in external files
|
||||
// look for album art in external files
|
||||
final File parent = new File(path).getParentFile();
|
||||
for (String fallback : FALLBACKS) {
|
||||
File cover = new File(parent, fallback);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import com.kabouzeid.gramophone.adapter.song.AlbumSongAdapter;
|
|||
import com.kabouzeid.gramophone.dialogs.AddToPlaylistDialog;
|
||||
import com.kabouzeid.gramophone.dialogs.DeleteSongsDialog;
|
||||
import com.kabouzeid.gramophone.dialogs.SleepTimerDialog;
|
||||
import com.kabouzeid.gramophone.glide.PhonographColoredTarget;
|
||||
import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
||||
import com.kabouzeid.gramophone.glide.SongGlideRequest;
|
||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
|
|
@ -143,7 +143,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
|||
.checkIgnoreMediaStore(this)
|
||||
.generatePalette(this).build()
|
||||
.dontAnimate()
|
||||
.into(new PhonographColoredTarget(albumArtImageView) {
|
||||
.into(new CustomPaletteTarget(albumArtImageView) {
|
||||
@Override
|
||||
public void onColorReady(int color) {
|
||||
setColors(color);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import com.kabouzeid.gramophone.adapter.song.ArtistSongAdapter;
|
|||
import com.kabouzeid.gramophone.dialogs.AddToPlaylistDialog;
|
||||
import com.kabouzeid.gramophone.dialogs.SleepTimerDialog;
|
||||
import com.kabouzeid.gramophone.glide.ArtistGlideRequest;
|
||||
import com.kabouzeid.gramophone.glide.PhonographColoredTarget;
|
||||
import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.interfaces.LoaderIds;
|
||||
|
|
@ -187,7 +187,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
|||
ArtistGlideRequest.Builder.from(Glide.with(this), artist)
|
||||
.generatePalette(this).build()
|
||||
.dontAnimate()
|
||||
.into(new PhonographColoredTarget(artistImage) {
|
||||
.into(new CustomPaletteTarget(artistImage) {
|
||||
@Override
|
||||
public void onColorReady(int color) {
|
||||
setColors(color);
|
||||
|
|
|
|||
|
|
@ -1,133 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright 2013 Philip Schiffer
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
<notices>
|
||||
<notice>
|
||||
<name>Advanced RecyclerView</name>
|
||||
<url>https://github.com/h6ah4i/android-advancedrecyclerview</url>
|
||||
<copyright>Copyright (C) 2015 Haruki Hasegawa</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>android-issue-reporter</name>
|
||||
<url>https://github.com/HeinrichReimer/android-issue-reporter</url>
|
||||
<copyright>Copyright 2016 Heinrich Reimer</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Android-ObservableScrollView</name>
|
||||
<url>https://github.com/ksoichiro/Android-ObservableScrollView</url>
|
||||
<copyright>Copyright 2014 Soichiro Kashima</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Android Open Source Project</name>
|
||||
<url>http://developer.android.com/tools/support-library/index.html</url>
|
||||
<copyright>Copyright (C) 2016 The Android Open Source Project</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Android Sliding Up Panel</name>
|
||||
<url>https://github.com/umano/AndroidSlidingUpPanel</url>
|
||||
<copyright />
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Android Support Libraries</name>
|
||||
<url>http://developer.android.com/tools/support-library/index.html</url>
|
||||
<copyright>Copyright (C) 2016 The Android Open Source Project</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Android In-App Billing v3 Library</name>
|
||||
<url>https://github.com/anjlab/android-inapp-billing-v3</url>
|
||||
<copyright>Copyright 2014 AnjLab</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Butter Knife</name>
|
||||
<url>https://github.com/JakeWharton/butterknife</url>
|
||||
<copyright>Copyright 2013 Jake Wharton</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Eleven</name>
|
||||
<url>https://github.com/CyanogenMod/android_packages_apps_Eleven</url>
|
||||
<copyright>Copyright (c) 2014, The CyanogenMod Project</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Glide</name>
|
||||
<url>https://github.com/bumptech/glide</url>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Launcher 3</name>
|
||||
<url>https://android.googlesource.com/platform/packages/apps/Launcher3</url>
|
||||
<copyright>Copyright (C) 2010 The Android Open Source Project</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Linear Layout Manager</name>
|
||||
<url>https://github.com/serso/android-linear-layout-manager</url>
|
||||
<copyright>Copyright 2014 serso aka se.solovyev</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Material Contextual Action Bar</name>
|
||||
<url>https://github.com/afollestad/material-cab</url>
|
||||
<copyright>Copyright 2016 Aidan Follestad</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Material Dialogs</name>
|
||||
<url>https://github.com/afollestad/material-dialogs</url>
|
||||
<copyright>Copyright (c) 2015 Aidan Michael Follestad</copyright>
|
||||
<license>MIT License</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Material Intro</name>
|
||||
<url>https://github.com/HeinrichReimer/material-intro</url>
|
||||
<copyright>Copyright 2016 Heinrich Reimer</copyright>
|
||||
<license>MIT License</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>OkHttp</name>
|
||||
<url>https://github.com/square/okhttp</url>
|
||||
<copyright />
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>RecyclerView-FastScroll</name>
|
||||
<url>https://github.com/timusus/RecyclerView-FastScroll</url>
|
||||
<copyright>Copyright (C) 2016 Tim Malseed</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>Retrofit</name>
|
||||
<url>https://github.com/square/retrofit</url>
|
||||
<copyright>Copyright 2013 Square, Inc.</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>SeekArc</name>
|
||||
<url>https://github.com/Triggertrap/SeekArc</url>
|
||||
<copyright>Copyright (c) 2013 Triggertrap Ltd
|
||||
Author Neil Davies
|
||||
</copyright>
|
||||
<license>MIT License</license>
|
||||
</notice>
|
||||
</notices>
|
||||
Loading…
Add table
Add a link
Reference in a new issue