Skip to content

Commit

Permalink
restructured packages
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearfog committed Jun 10, 2023
1 parent aaf2043 commit fbc7d50
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 77 deletions.
10 changes: 5 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@

<!-- 4x1 App Widget -->
<receiver
android:name="org.nuclearfog.apollo.widgets.AppWidgetSmall"
android:name="org.nuclearfog.apollo.ui.widgets.AppWidgetSmall"
android:exported="false"
android:label="@string/app_widget_small">

Expand All @@ -246,7 +246,7 @@

<!-- 4x2 App Widget -->
<receiver
android:name="org.nuclearfog.apollo.widgets.AppWidgetLarge"
android:name="org.nuclearfog.apollo.ui.widgets.AppWidgetLarge"
android:exported="false"
android:label="@string/app_widget_large">

Expand All @@ -261,7 +261,7 @@

<!-- 4x2 alternate App Widget -->
<receiver
android:name="org.nuclearfog.apollo.widgets.AppWidgetLargeAlternate"
android:name="org.nuclearfog.apollo.ui.widgets.AppWidgetLargeAlternate"
android:exported="false"
android:label="@string/app_widget_large_alt">

Expand All @@ -276,7 +276,7 @@

<!-- Resizable recently listened App Widget -->
<receiver
android:name="org.nuclearfog.apollo.widgets.RecentWidgetProvider"
android:name="org.nuclearfog.apollo.ui.widgets.RecentWidgetProvider"
android:exported="false"
android:label="@string/app_widget_recent">

Expand All @@ -301,7 +301,7 @@

<!-- The service serving the RemoteViews to the recently listened App Widget -->
<service
android:name="org.nuclearfog.apollo.widgets.RecentWidgetService"
android:name="org.nuclearfog.apollo.ui.widgets.RecentWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS" />

<!-- Music service -->
Expand Down
23 changes: 0 additions & 23 deletions app/src/main/java/org/nuclearfog/apollo/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
*/
public final class Config {

/**
* Used to distinguish album art from artist images
*/
public static final String ALBUM_ART_SUFFIX = "album";
/**
* The ID of an artist, album, genre, or playlist passed to the profile activity
*/
Expand Down Expand Up @@ -50,25 +46,6 @@ public final class Config {
* path to a music folder
*/
public static final String FOLDER = "folder_path";
/**
* Play from search intent
*/
public static final String PLAY_FROM_SEARCH = "android.media.action.MEDIA_PLAY_FROM_SEARCH";
/**
* user aent for Last FM
*/
public static final String USER_AGENT = "Apollo";

/**
* MIME type for album/artist images
*/
public static final String MIME_IMAGE = "image/*";

/**
* MIME type for sharing songs
*/
public static final String MIME_AUDIO = "audio/*";

/**
* maximal scroll speed when dragging a list element
*/
Expand Down
20 changes: 9 additions & 11 deletions app/src/main/java/org/nuclearfog/apollo/cache/ImageFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import androidx.annotation.Nullable;
import androidx.core.content.res.ResourcesCompat;

import org.nuclearfog.apollo.Config;
import org.nuclearfog.apollo.MusicPlaybackService;
import org.nuclearfog.apollo.R;
import org.nuclearfog.apollo.lastfm.Album;
Expand All @@ -46,27 +45,26 @@
* A subclass of {@link ImageWorker} that fetches images from a URL.
*/
public class ImageFetcher extends ImageWorker {
/**
*
*/

public static final int IO_BUFFER_SIZE_BYTES = 1024;
/**
*
*/
private static final int DEFAULT_MAX_IMAGE_HEIGHT = 1024;
/**
*
*/
private static final int DEFAULT_MAX_IMAGE_WIDTH = 1024;

/**
* size of the artist/album art of the notification image
*/
private static final int NOTIFICATION_SIZE = 200;

/**
* location folder name of the image cache
*/
private static final String DEFAULT_CACHE_DIR = "download";

/**
* Used to distinguish album art from artist images
*/
private static final String ALBUM_ART_SUFFIX = "album";

private static final ImageSize[] QUALITY = {
ImageSize.MEGA, ImageSize.EXTRALARGE, ImageSize.LARGE,
ImageSize.MEDIUM, ImageSize.SMALL, ImageSize.UNKNOWN};
Expand Down Expand Up @@ -244,7 +242,7 @@ public static String generateAlbumCacheKey(String albumName, String artistName)
if (albumName == null || artistName == null) {
return null;
}
return albumName + "_" + artistName + "_" + Config.ALBUM_ART_SUFFIX;
return albumName + "_" + artistName + "_" + ALBUM_ART_SUFFIX;
}

/**
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/org/nuclearfog/apollo/lastfm/Caller.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

package org.nuclearfog.apollo.lastfm;

import static org.nuclearfog.apollo.Config.USER_AGENT;

import android.annotation.SuppressLint;
import android.content.Context;

Expand Down Expand Up @@ -71,6 +69,11 @@ public class Caller {
*/
private static final String PARAM_API_KEY = "api_key";

/**
* user aent for Last FM
*/
private static final String USER_AGENT = "Apollo";

/**
*
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import android.content.Intent;

import org.nuclearfog.apollo.MusicPlaybackService;
import org.nuclearfog.apollo.widgets.AppWidgetBase;
import org.nuclearfog.apollo.widgets.AppWidgetLarge;
import org.nuclearfog.apollo.widgets.AppWidgetLargeAlternate;
import org.nuclearfog.apollo.widgets.AppWidgetSmall;
import org.nuclearfog.apollo.widgets.RecentWidgetProvider;
import org.nuclearfog.apollo.ui.widgets.AppWidgetBase;
import org.nuclearfog.apollo.ui.widgets.AppWidgetLarge;
import org.nuclearfog.apollo.ui.widgets.AppWidgetLargeAlternate;
import org.nuclearfog.apollo.ui.widgets.AppWidgetSmall;
import org.nuclearfog.apollo.ui.widgets.RecentWidgetProvider;

import java.lang.ref.WeakReference;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

package org.nuclearfog.apollo.ui.activities;

import static org.nuclearfog.apollo.Config.MIME_AUDIO;
import static org.nuclearfog.apollo.utils.MusicUtils.REQUEST_DELETE_FILES;

import android.animation.ObjectAnimator;
import android.app.SearchManager;
import android.app.SearchableInfo;
Expand Down Expand Up @@ -95,6 +92,11 @@ public class AudioPlayerActivity extends AppCompatActivity implements ServiceCon
*/
private static final int MSG_ID = 0x65059CC4;

/**
* MIME type for sharing songs
*/
private static final String MIME_AUDIO = "audio/*";

/**
* The service token
*/
Expand Down Expand Up @@ -499,7 +501,7 @@ public void onStopTrackingTouch(SeekBar bar) {
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_DELETE_FILES && resultCode == RESULT_OK) {
if (requestCode == MusicUtils.REQUEST_DELETE_FILES && resultCode == RESULT_OK) {
MusicUtils.onPostDelete(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
package org.nuclearfog.apollo.ui.activities;

import static org.nuclearfog.apollo.Config.FOLDER;
import static org.nuclearfog.apollo.Config.MIME_IMAGE;
import static org.nuclearfog.apollo.utils.MusicUtils.REQUEST_DELETE_FILES;

import android.annotation.SuppressLint;
Expand Down Expand Up @@ -153,6 +152,11 @@ public class ProfileActivity extends ActivityBase implements ActivityResultCallb
*/
private long[] ids = {0};

/**
* MIME type for album/artist images
*/
private static final String MIME_IMAGE = "image/*";

/**
* MIME type of the profile
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@

package org.nuclearfog.apollo.ui.activities;

import static org.nuclearfog.apollo.Config.ID;
import static org.nuclearfog.apollo.Config.IDS;
import static org.nuclearfog.apollo.Config.MIME_TYPE;
import static org.nuclearfog.apollo.Config.NAME;
import static org.nuclearfog.apollo.Config.PLAY_FROM_SEARCH;

import android.app.SearchManager;
import android.content.ComponentName;
import android.content.Intent;
Expand All @@ -31,6 +25,7 @@
import androidx.loader.app.LoaderManager.LoaderCallbacks;
import androidx.loader.content.Loader;

import org.nuclearfog.apollo.Config;
import org.nuclearfog.apollo.R;
import org.nuclearfog.apollo.loaders.SearchLoader;
import org.nuclearfog.apollo.model.Song;
Expand All @@ -55,6 +50,10 @@ public class ShortcutActivity extends AppCompatActivity implements ServiceConnec
* ID of the loader
*/
private static final int LOADER_ID = 0x32942390;
/**
* Play from search intent
*/
private static final String PLAY_FROM_SEARCH = "android.media.action.MEDIA_PLAY_FROM_SEARCH";
/**
* If true, this class will begin playback and open
* {@link AudioPlayerActivity}, false will close the class after playback,
Expand Down Expand Up @@ -105,8 +104,8 @@ public void onServiceConnected(ComponentName name, IBinder service) {
LoaderManager.getInstance(this).initLoader(LOADER_ID, null, this);
} else if (MusicUtils.isConnected()) {
//sHandler.post(new AsyncHandler(this));
String requestedMimeType = mIntent.getStringExtra(MIME_TYPE);
long id = mIntent.getLongExtra(ID, -1);
String requestedMimeType = mIntent.getStringExtra(Config.MIME_TYPE);
long id = mIntent.getLongExtra(Config.ID, -1);
if (requestedMimeType == null) {
return;
}
Expand All @@ -129,7 +128,7 @@ public void onServiceConnected(ComponentName name, IBinder service) {
// Shuffle the genre track list
mShouldShuffle = true;
// Get the genre song list
long[] ids = ApolloUtils.readSerializedIDs(mIntent.getStringExtra(IDS));
long[] ids = ApolloUtils.readSerializedIDs(mIntent.getStringExtra(Config.IDS));
mList = MusicUtils.getSongListForGenres(getApplicationContext(), ids);
break;

Expand Down Expand Up @@ -158,7 +157,7 @@ public void onServiceConnected(ComponentName name, IBinder service) {
// Don't shuffle the folders track list
mShouldShuffle = false;
// get folder path
String folder = "%" + mIntent.getStringExtra(NAME);
String folder = "%" + mIntent.getStringExtra(Config.NAME);
// Get folder song list
mList = MusicUtils.getSongListForFolder(getApplicationContext(), folder);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.devspark.appmsg;
package org.nuclearfog.apollo.ui.appmsg;

import android.app.Activity;
import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.devspark.appmsg;
package org.nuclearfog.apollo.ui.appmsg;

import android.os.Handler;
import android.os.Looper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.Fragment;

import com.devspark.appmsg.AppMsg;
import org.nuclearfog.apollo.ui.appmsg.AppMsg;

import org.nuclearfog.apollo.BuildConfig;
import org.nuclearfog.apollo.R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.viewpagerindicator.TitlePageIndicator;
import com.viewpagerindicator.TitlePageIndicator.OnCenterItemClickListener;
import org.nuclearfog.apollo.ui.views.TitlePageIndicator;
import org.nuclearfog.apollo.ui.views.TitlePageIndicator.OnCenterItemClickListener;

import org.nuclearfog.apollo.R;
import org.nuclearfog.apollo.adapters.PagerAdapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.viewpagerindicator;
package org.nuclearfog.apollo.ui.views;

import static android.view.MotionEvent.ACTION_MASK;
import static android.view.MotionEvent.ACTION_POINTER_DOWN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* governing permissions and limitations under the License.
*/

package org.nuclearfog.apollo.widgets;
package org.nuclearfog.apollo.ui.widgets;

import android.annotation.SuppressLint;
import android.app.PendingIntent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* governing permissions and limitations under the License.
*/

package org.nuclearfog.apollo.widgets;
package org.nuclearfog.apollo.ui.widgets;

import android.annotation.SuppressLint;
import android.app.PendingIntent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* governing permissions and limitations under the License.
*/

package org.nuclearfog.apollo.widgets;
package org.nuclearfog.apollo.ui.widgets;

import android.annotation.SuppressLint;
import android.app.PendingIntent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* governing permissions and limitations under the License.
*/

package org.nuclearfog.apollo.widgets;
package org.nuclearfog.apollo.ui.widgets;

import android.annotation.SuppressLint;
import android.app.PendingIntent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* governing permissions and limitations under the License.
*/

package org.nuclearfog.apollo.widgets;
package org.nuclearfog.apollo.ui.widgets;

import android.annotation.SuppressLint;
import android.app.PendingIntent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* governing permissions and limitations under the License.
*/

package org.nuclearfog.apollo.widgets;
package org.nuclearfog.apollo.ui.widgets;

import android.content.Context;
import android.content.Intent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentActivity;

import com.devspark.appmsg.AppMsg;
import org.nuclearfog.apollo.ui.appmsg.AppMsg;

import org.nuclearfog.apollo.Config;
import org.nuclearfog.apollo.R;
Expand Down
Loading

0 comments on commit fbc7d50

Please sign in to comment.