new release

This commit is contained in:
Page Asgardius 2023-07-27 15:32:48 -07:00
parent 29f5aa5b60
commit 03b5f4f19a
5 changed files with 36 additions and 6 deletions

View file

@ -9,8 +9,8 @@ android {
applicationId "asgardius.page.s3music"
minSdk 21
targetSdk 33
versionCode 9
versionName "0.1.1"
versionCode 10
versionName "0.2.0"
setProperty("archivesBaseName", "s3-music-$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />

View file

@ -0,0 +1,21 @@
package asgardius.page.s3music;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
public class SdcardCheck {
public static boolean isInstalledOnSdCard(Context context) {
PackageManager pm = context.getPackageManager();
try {
PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
ApplicationInfo ai = pi.applicationInfo;
return (ai.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) == ApplicationInfo.FLAG_EXTERNAL_STORAGE;
} catch (PackageManager.NameNotFoundException e) {
// ignore
}
return false;
}
}

View file

@ -185,10 +185,17 @@ public class VideoPlayer extends AppCompatActivity {
mediaSessionConnector.setPlayer(player);
//mediaSession.setActive(true);
evictor = new LeastRecentlyUsedCacheEvictor(maxCacheSize);
simpleCache = new SimpleCache(
new File(this.getFilesDir(), "media"),
evictor,
standaloneDatabaseProvider);
if(SdcardCheck.isInstalledOnSdCard(this)) {
simpleCache = new SimpleCache(
new File(this.getExternalFilesDirs(null)[this.getExternalFilesDirs(null).length-1], "media"),
evictor,
standaloneDatabaseProvider);
} else {
simpleCache = new SimpleCache(
new File(this.getFilesDir(), "media"),
evictor,
standaloneDatabaseProvider);
}
playerView.setPlayer(player);
controlView.setPlayer(player);
playerView.setUseController(false);

View file

@ -0,0 +1 @@
* Allow move app to SD Card