From 90dbf3ca1a6462811a81e7b34d512bbb0bd4f661 Mon Sep 17 00:00:00 2001 From: David Black Date: Sun, 17 Mar 2013 19:35:32 +0000 Subject: [PATCH] enable com.andrew.apollo v1.0 minus lyrics --- metadata/com.andrew.apollo.txt | 22 +- metadata/com.andrew.apollo/lyrics.patch | 392 ++++++++++++++++++++++++ 2 files changed, 410 insertions(+), 4 deletions(-) create mode 100644 metadata/com.andrew.apollo/lyrics.patch diff --git a/metadata/com.andrew.apollo.txt b/metadata/com.andrew.apollo.txt index 355dc78674..354e37f35d 100644 --- a/metadata/com.andrew.apollo.txt +++ b/metadata/com.andrew.apollo.txt @@ -1,24 +1,38 @@ Category:Multimedia License:Apache2 +Website:https://github.com/adneal/Apollo-CM Source Code:https://github.com/adneal/Apollo-CM +Issue Tracker:http://code.google.com/p/apollo-music-player/issues/list +Donate:http://www.cyanogenmod.org Summary:Music player Description: +The music app that comes bundled with CyanogenMod ROM v10. +We publish at the latest commit from the original author's repo +(because that still supports Android 2.3) while +incorporating a CyanogenMod patch to remove +lyrics fetching functionality. +Depending on what happens to the source code we may +remove the Android 2.3 support in subsequent versions. . Repo Type:git -Repo:https://github.com/adneal/Apollo-CM +#Also master branch https://github.com/CyanogenMod/android_packages_apps_Apollo +Repo:https://github.com/adneal/Apollo-CM -Build Version:1.0,1,!need to get ok from dev 9102afb63c,\ +Build Version:1.0,1,9102afb63c,patch=lyrics.patch,\ srclibs=ActionBarSherlock@4.2.0;ViewPagerIndicator@2.4.1;AppMsg@d5859f0cc4,\ prebuild=sed -i 's@\(android.library.reference.1=\).*@\1$$ActionBarSherlock$$@' project.properties && \ sed -i 's@\(android.library.reference.2=\).*@\1$$ViewPagerIndicator$$@' project.properties && \ sed -i 's@\(android.library.reference.3=\).*@\1$$AppMsg$$@' project.properties && \ cp libs/android-support-v4.jar $$ActionBarSherlock$$/libs && \ cp libs/android-support-v4.jar $$ViewPagerIndicator$$/libs && \ -find . -type f -print0 | xargs -0 sed -i 's/Crouton/AppMsg/g' && sed -i '/proguard/d' project.properties +rm src/com/andrew/apollo/lyrics/LyricsWikiProvider.java \ +src/com/andrew/apollo/ui/fragments/LyricsFragment.java && \ +find . -type f -print0 | xargs -0 sed -i 's/Crouton/AppMsg/g' && \ +sed -i '/proguard/d' project.properties -Update Check Mode:None +Update Check Mode:RepoManifest Current Version:1.0 Current Version Code:1 diff --git a/metadata/com.andrew.apollo/lyrics.patch b/metadata/com.andrew.apollo/lyrics.patch new file mode 100644 index 0000000000..4c33b0ced1 --- /dev/null +++ b/metadata/com.andrew.apollo/lyrics.patch @@ -0,0 +1,392 @@ +diff --git a/libs/jaudiotagger.jar b/libs/jaudiotagger.jar +deleted file mode 100644 +index 51d7774..0000000 +Binary files a/libs/jaudiotagger.jar and /dev/null differ +diff --git a/res/layout/lyrics_base.xml b/res/layout/lyrics_base.xml +deleted file mode 100644 +index 821a8f2..0000000 +--- a/res/layout/lyrics_base.xml ++++ /dev/null +@@ -1,46 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +- +\ No newline at end of file +diff --git a/res/menu/audio_player.xml b/res/menu/audio_player.xml +index 8625074..74af706 100644 +--- a/res/menu/audio_player.xml ++++ b/res/menu/audio_player.xml +@@ -25,12 +25,8 @@ + android:showAsAction="never" + android:title="@string/menu_equalizer"/> + +- + +- +\ No newline at end of file ++ +diff --git a/res/values/strings.xml b/res/values/strings.xml +index 0f0296d..6ea3bc3 100644 +--- a/res/values/strings.xml ++++ b/res/values/strings.xml +@@ -38,9 +38,6 @@ + Save queue + Clear Favorites + Share +- Save lyrics +- Delete lyrics +- Fetch lyrics + Place on Home screen + Equalizer + Simple +@@ -126,8 +123,6 @@ + \"%s\" set as ringtone + Playlist renamed + set as the theme +- lyrics saved +- lyrics deleted + + + Interface +@@ -183,7 +178,5 @@ + No search results found + Songs you mark as favorites will be shown here. + Albums you\'ve listened to will show up here. Try playing some music. +- Lyrics for \"%s\" could not be found +- To fetch lyrics for \"%s\" use \"Fetch lyrics\" in the menu. + +- +\ No newline at end of file ++ +diff --git a/res/values/themeconfig.xml b/res/values/themeconfig.xml +index bb5fb21..d41a5b7 100644 +--- a/res/values/themeconfig.xml ++++ b/res/values/themeconfig.xml +@@ -25,9 +25,6 @@ + + @color/transparent_white + +- +- @color/white +- + + @color/white + @color/transparent_white +@@ -51,4 +48,4 @@ + @color/transparent_white + @color/transparent_white + +- +\ No newline at end of file ++ +diff --git a/src/com/andrew/apollo/lyrics/LyricsProvider.java b/src/com/andrew/apollo/lyrics/LyricsProvider.java +deleted file mode 100644 +index 0ca57be..0000000 +--- a/src/com/andrew/apollo/lyrics/LyricsProvider.java ++++ /dev/null +@@ -1,22 +0,0 @@ +- +-package com.andrew.apollo.lyrics; +- +-public interface LyricsProvider { +- +- /** +- * Gives the lyrics of the song, or null if they werent found +- * +- * @param artist Artist name +- * @param song Song name +- * @return Full lyrics as a {@link String} +- */ +- public String getLyrics(String artist, String song); +- +- /** +- * Gives the name of the provider implementation +- * +- * @return The name of the lyrics provider +- */ +- public String getProviderName(); +- +-} +diff --git a/src/com/andrew/apollo/lyrics/LyricsProviderFactory.java b/src/com/andrew/apollo/lyrics/LyricsProviderFactory.java +deleted file mode 100644 +index 2aff457..0000000 +--- a/src/com/andrew/apollo/lyrics/LyricsProviderFactory.java ++++ /dev/null +@@ -1,27 +0,0 @@ +- +-package com.andrew.apollo.lyrics; +- +-public final class LyricsProviderFactory { +- +- /* This class is never initiated. */ +- public LyricsProviderFactory() { +- } +- +- /** +- * @param filePath The path to save the lyrics. +- * @return A new instance of {@link OfflineLyricsProvider}. +- */ +- public static final LyricsProvider getOfflineProvider(String filePath) { +- return new OfflineLyricsProvider(filePath); +- } +- +- /** +- * @return The current lyrics provider. +- */ +- public static final LyricsProvider getMainOnlineProvider() { +- return new LyricsWikiProvider(); +- } +- +- // TODO Implement more providers, and also a system to iterate over them +- +-} +diff --git a/src/com/andrew/apollo/lyrics/OfflineLyricsProvider.java b/src/com/andrew/apollo/lyrics/OfflineLyricsProvider.java +deleted file mode 100644 +index dac8738..0000000 +--- a/src/com/andrew/apollo/lyrics/OfflineLyricsProvider.java ++++ /dev/null +@@ -1,138 +0,0 @@ +- +-package com.andrew.apollo.lyrics; +- +-import org.jaudiotagger.audio.AudioFile; +-import org.jaudiotagger.audio.AudioFileIO; +-import org.jaudiotagger.audio.exceptions.CannotReadException; +-import org.jaudiotagger.audio.exceptions.CannotWriteException; +-import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException; +-import org.jaudiotagger.audio.exceptions.ReadOnlyFileException; +-import org.jaudiotagger.tag.FieldKey; +-import org.jaudiotagger.tag.Tag; +-import org.jaudiotagger.tag.TagException; +- +-import java.io.File; +-import java.io.IOException; +- +-public class OfflineLyricsProvider implements LyricsProvider { +- +- private File mAudioFile; +- +- /** +- * Constructor of OfflineLyricsProvider +- * +- * @param filePath The path to save the lyrics +- */ +- public OfflineLyricsProvider(final String filePath) { +- setTrackFile(filePath); +- } +- +- /** +- * @param path The file to save our {@link File} +- */ +- public void setTrackFile(final String path) { +- if (path == null) { +- return; +- } +- mAudioFile = new File(path); +- } +- +- /** +- * {@inheritDoc} +- */ +- @Override +- public String getLyrics(final String artist, final String song) { +- String lyrics = null; +- try { +- if (mAudioFile == null) { +- return null; +- } +- if (mAudioFile.exists()) { +- // Use jAudioTagger library to get the file's lyrics +- final AudioFile file = AudioFileIO.read(mAudioFile); +- final Tag tag = file.getTag(); +- lyrics = tag.getFirst(FieldKey.LYRICS); +- } +- } catch (final ReadOnlyFileException e) { +- e.printStackTrace(); +- } catch (final CannotReadException e) { +- e.printStackTrace(); +- } catch (final IOException e) { +- e.printStackTrace(); +- } catch (final TagException e) { +- e.printStackTrace(); +- } catch (final InvalidAudioFrameException e) { +- e.printStackTrace(); +- } catch (final UnsupportedOperationException e) { +- e.printStackTrace(); +- } +- return lyrics; +- } +- +- /** +- * {@inheritDoc} +- */ +- @Override +- public String getProviderName() { +- return "File metadata"; +- } +- +- /** +- * @param lyrics The lyrics to save +- * @param filePath The path to save them +- */ +- public static void saveLyrics(final String lyrics, final String filePath) { +- try { +- final File file = new File(filePath); +- if (file.exists()) { +- // Use jAudioTagger library to set the file's lyrics +- final AudioFile audioFile = AudioFileIO.read(file); +- final Tag tag = audioFile.getTag(); +- tag.setField(FieldKey.LYRICS, lyrics); +- audioFile.commit(); +- } +- } catch (final ReadOnlyFileException e) { +- e.printStackTrace(); +- } catch (final CannotReadException e) { +- e.printStackTrace(); +- } catch (final IOException e) { +- e.printStackTrace(); +- } catch (final TagException e) { +- e.printStackTrace(); +- } catch (final InvalidAudioFrameException e) { +- e.printStackTrace(); +- } catch (final CannotWriteException e) { +- e.printStackTrace(); +- } catch (final NullPointerException e) { +- e.printStackTrace(); +- } +- } +- +- /** +- * @param filePath The path to the lyrics we're deleting +- */ +- public static void deleteLyrics(final String filePath) { +- try { +- final File file = new File(filePath); +- if (file.exists()) { +- // Use jAudioTagger library to delete the file's lyrics +- final AudioFile audioFile = AudioFileIO.read(file); +- final Tag tag = audioFile.getTag(); +- tag.deleteField(FieldKey.LYRICS); +- audioFile.commit(); +- } +- } catch (final ReadOnlyFileException e) { +- e.printStackTrace(); +- } catch (final CannotReadException e) { +- e.printStackTrace(); +- } catch (final IOException e) { +- e.printStackTrace(); +- } catch (final TagException e) { +- e.printStackTrace(); +- } catch (final InvalidAudioFrameException e) { +- e.printStackTrace(); +- } catch (final CannotWriteException e) { +- e.printStackTrace(); +- } +- } +-} +diff --git a/src/com/andrew/apollo/ui/activities/AudioPlayerActivity.java b/src/com/andrew/apollo/ui/activities/AudioPlayerActivity.java +index a952f74..840bbdb 100644 +--- a/src/com/andrew/apollo/ui/activities/AudioPlayerActivity.java ++++ b/src/com/andrew/apollo/ui/activities/AudioPlayerActivity.java +@@ -51,7 +51,6 @@ import com.andrew.apollo.MusicPlaybackService; + import com.andrew.apollo.R; + import com.andrew.apollo.adapters.PagerAdapter; + import com.andrew.apollo.cache.ImageFetcher; +-import com.andrew.apollo.ui.fragments.LyricsFragment; + import com.andrew.apollo.ui.fragments.QueueFragment; + import com.andrew.apollo.utils.ApolloUtils; + import com.andrew.apollo.utils.MusicUtils; +@@ -351,10 +350,6 @@ public class AudioPlayerActivity extends SherlockFragmentActivity implements Ser + // Sound effects + NavUtils.openEffectsPanel(this); + return true; +- case R.id.menu_download_lyrics: +- updateLyrics(true); +- hideAlbumArt(); +- return true; + case R.id.menu_settings: + // Settings + NavUtils.openSettings(this); +@@ -471,8 +466,6 @@ public class AudioPlayerActivity extends SherlockFragmentActivity implements Ser + mPagerAdapter = new PagerAdapter(this); + // Queue + mPagerAdapter.add(QueueFragment.class, null); +- // Lyrics +- mPagerAdapter.add(LyricsFragment.class, null); + + // Initialize the ViewPager + mViewPager = (ViewPager)findViewById(R.id.audio_player_pager); +@@ -548,15 +541,6 @@ public class AudioPlayerActivity extends SherlockFragmentActivity implements Ser + mRepeatButton.updateRepeatState(); + } + +- /** +- * Refreshes the lyrics and moves the view pager to the lyrics fragment. +- */ +- public void updateLyrics(final boolean force) { +- ((LyricsFragment)mPagerAdapter.getFragment(1)).fetchLyrics(force); +- if (force && mViewPager.getCurrentItem() != 1) { +- mViewPager.setCurrentItem(1, true); +- } +- } + + /** + * @param delay When to update +@@ -884,8 +868,6 @@ public class AudioPlayerActivity extends SherlockFragmentActivity implements Ser + mReference.get().updateNowPlayingInfo(); + // Update the favorites icon + mReference.get().invalidateOptionsMenu(); +- // Update the lyrics +- mReference.get().updateLyrics(false); + } else if (action.equals(MusicPlaybackService.PLAYSTATE_CHANGED)) { + // Set the play and pause image + mReference.get().mPlayPauseButton.updateState();