Merge branch 'release/v0.9.2'

This commit is contained in:
Jan Christian Grünhage 2017-01-19 00:04:38 +01:00
commit 21cbed8522
Signed by: jcgruenhage
GPG key ID: 321A67D9EE8BC3E1
22 changed files with 342 additions and 102 deletions

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -27,7 +27,7 @@ android {
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 9
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "1.0"

View file

@ -9,7 +9,6 @@
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
@ -20,7 +19,7 @@
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="LIBRARY_PROJECT" value="true" />
<option name="PROJECT_TYPE" value="1" />
</configuration>
</facet>
</component>
@ -48,7 +47,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
@ -56,7 +54,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
@ -64,7 +61,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
@ -72,7 +68,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
@ -80,7 +75,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />

View file

@ -22,6 +22,8 @@
package de.arcus.framework.superuser;
import android.os.AsyncTask;
import java.io.IOException;
import de.arcus.framework.logger.Logger;
@ -130,4 +132,20 @@ public class SuperUser {
sessionStop();
return false;
}
public static void askForPermissionInBackground(final SuperUserPermissionRequestListener listener) {
new AsyncTask<Void, Void, Void>() {
boolean hasPermissions;
@Override
protected Void doInBackground(Void... params) {
hasPermissions = askForPermissions();
return null;
}
@Override
protected void onPostExecute(Void result) {
listener.superUserGranted(hasPermissions);
}
}.execute();
}
}

View file

@ -0,0 +1,9 @@
package de.arcus.framework.superuser;
/**
* Created by jcgruenhage on 1/18/17.
*/
public interface SuperUserPermissionRequestListener {
void superUserGranted(boolean granted);
}

View file

@ -32,7 +32,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit

View file

@ -33,9 +33,13 @@ android {
minSdkVersion 21
targetSdkVersion 25
// TODO Change Version with releases
versionCode 103
versionName '0.9.1'
versionCode 104
versionName '0.9.2'
vectorDrawables.useSupportLibrary = true
jackOptions {
enabled true
}
}
buildTypes {
release {
@ -43,6 +47,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
@ -53,4 +61,5 @@ dependencies {
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-vector-drawable:25.1.0'
compile "com.github.paolorotolo:appintro:4.1.0"
}

View file

@ -9,7 +9,6 @@
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
@ -23,7 +22,7 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/test/debug" />
<exclude-output />
@ -47,7 +46,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
@ -55,7 +53,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
@ -63,25 +60,22 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
@ -98,10 +92,13 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/25.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/25.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/transition/25.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.github.paolorotolo/appintro/4.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
@ -126,6 +123,7 @@
<orderEntry type="library" exported="" name="appcompat-v7-25.1.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-25.1.0" level="project" />
<orderEntry type="library" exported="" name="support-core-utils-25.1.0" level="project" />
<orderEntry type="library" exported="" name="appintro-4.1.0" level="project" />
<orderEntry type="module" module-name="playmusiclib" exported="" />
<orderEntry type="module" module-name="framework" exported="" />
<orderEntry type="library" exported="" name="mp3agic-0.8.4" level="project" />

View file

@ -48,11 +48,15 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.MusicContainerListActivity" />
</activity>
<activity
android:name=".activities.Intro"
android:label="Play Music Exporter Intro"/>
<service android:name=".services.ExportService" />
<service android:name=".services.ExportAllService" />
<service android:name=".services.ExportAllJob"
android:permission="android.permission.BIND_JOB_SERVICE"/>
<service
android:name=".services.ExportAllJob"
android:permission="android.permission.BIND_JOB_SERVICE" />
<meta-data
android:name="crashhandler.email"

View file

@ -0,0 +1,181 @@
package re.jcg.playmusicexporter.activities;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntroFragment;
import java.util.Optional;
import de.arcus.framework.superuser.SuperUser;
import re.jcg.playmusicexporter.R;
import re.jcg.playmusicexporter.settings.PlayMusicExporterPreferences;
public class Intro extends AppIntro {
private static final String TAG = "PME_Intro";
private static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 1;
Fragment welcome;
Fragment warning;
Fragment storage;
Fragment superuser;
Fragment finish;
private void initFragments() {
welcome = AppIntroFragment.newInstance(
"Welcome!",
"This is the Play Music Exporter. It can export songs from Play Music " +
"and save them as MP3 files where you want them to be.",
R.drawable.ic_launcher_transparent,
Color.parseColor("#ef6c00"));
warning = AppIntroFragment.newInstance(
"Warning!",
"You are responsible for what you do with this app. Depending on where you live " +
"it might be illegal to use this app. We discourage piracy of music " +
"and other intellectual property. Sharing music you exported with " +
"this tool might be a very bad idea, Google could put an invisible " +
"watermark on the music, so that people can trace the MP3s back to " +
"the owner of the Google account that was used.",
R.drawable.ic_warning_white,
Color.parseColor("#ef6c00"));
storage = AppIntroFragment.newInstance(
"We need access to your storage.",
"We need to access the external storage, " +
"for copying the Play Music database to a folder," +
"where we have the right to work with it. " +
"We also need access to the external storage," +
"to finish up the MP3s, from encrypted without ID3 tags," +
"to decrypted with ID3 tags, before we save them to your export path.",
R.drawable.ic_folder_white,
Color.parseColor("#ef6c00"));
superuser = AppIntroFragment.newInstance(
"We need root access.",
"Some of the files we need to access are in the private folders of Play Music. " +
"Android prevents apps from accessing the private folders " +
"of other apps, but luckily, you can circumvent this protection " +
"with root access. Without root access this app can't do anything.",
R.drawable.ic_superuser,
Color.parseColor("#ef6c00"));
finish = AppIntroFragment.newInstance(
"Tutorial finished!",
"One note: Should you revoke any of these permission, the tutorial will be " +
"shown again on the next launch.",
R.drawable.ic_launcher_transparent,
Color.parseColor("#ef6c00"));
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getSupportActionBar() != null) getSupportActionBar().hide();
showSkipButton(false);
initFragments();
addSlide(welcome);
addSlide(warning);
addSlide(storage);
addSlide(superuser);
addSlide(finish);
pager.setPagingEnabled(true);
}
@Override
public void onSlideChanged(@Nullable Fragment oldFragment, @Nullable Fragment newFragment) {
super.onSlideChanged(oldFragment, newFragment);
logSlideChanged(oldFragment, newFragment);
if (warning.equals(oldFragment) && storage.equals(newFragment)) {
promptAcceptWarning();
} else if (storage.equals(oldFragment) && superuser.equals(newFragment)) {
requestStoragePermission();
} else if (superuser.equals(oldFragment) && finish.equals(newFragment)) {
SuperUser.askForPermissionInBackground(granted -> {
if (!granted) {
AlertDialog.Builder builder =
new AlertDialog.Builder(this);
builder.setTitle(R.string.dialog_superuser_access_denied_title);
builder.setMessage(R.string.dialog_superuser_access_denied);
builder.setCancelable(false);
builder.setPositiveButton(R.string.text_okay, (dialog, which)
-> pager.setCurrentItem(pager.getCurrentItem() - 1));
builder.show();
}
});
}
}
private void requestStoragePermission() {
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch (requestCode) {
case PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE: {
// If request is cancelled, the result arrays are empty.
if (!(grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
// Shows a warning and close the app
AlertDialog.Builder builder =
new AlertDialog.Builder(this);
builder.setTitle(R.string.dialog_storage_access_denied_title);
builder.setMessage(R.string.dialog_storage_access_denied);
builder.setCancelable(false);
builder.setPositiveButton(R.string.text_okay, (dialog, which)
-> pager.setCurrentItem(pager.getCurrentItem() - 1));
builder.show();
}
}
}
}
private void promptAcceptWarning() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Understood?");
builder.setMessage("Have you read and understood this?");
builder.setCancelable(false);
builder.setNegativeButton("No", ((dialog, which)
-> pager.setCurrentItem(pager.getCurrentItem() - 1)));
builder.setPositiveButton("Yes", (((dialog, which) -> dialog.dismiss())));
builder.show();
}
private void logSlideChanged(@Nullable Fragment oldFragment, @Nullable Fragment newFragment) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// Optional.ofNullable requires API level 24, and I won't do manual null checks.
Log.i(TAG, "Fragment switched from {" +
Optional.ofNullable(oldFragment).map(Fragment::toString).orElse("") +
"} to {" +
Optional.ofNullable(newFragment).map(Fragment::toString).orElse("") +
"}.");
}
}
@Override
public void onDonePressed(Fragment currentFragment) {
PlayMusicExporterPreferences.init(this);
PlayMusicExporterPreferences.setSetupDone(true);
startActivity(new Intent(this, MusicContainerListActivity.class));
}
}

View file

@ -23,7 +23,6 @@
package re.jcg.playmusicexporter.activities;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
@ -55,6 +54,7 @@ import de.arcus.playmusiclib.datasources.ArtistDataSource;
import de.arcus.playmusiclib.datasources.PlaylistDataSource;
import de.arcus.playmusiclib.enums.ID3v2Version;
import de.arcus.playmusiclib.items.MusicTrackList;
import re.jcg.playmusicexporter.settings.PlayMusicExporterPreferences;
/**
* An activity representing a list of Tracks. This activity
@ -104,59 +104,68 @@ public class MusicContainerListActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_track_list);
//Adds the crash handler to this class
CrashHandler.addCrashHandler(this);
Logger.getInstance().logVerbose("Activity", "onCreate(" + this.getLocalClassName() + ")");
PlayMusicExporterPreferences.init(this);
if (!PlayMusicExporterPreferences.getSetupDone()) {
startActivity(new Intent(this, Intro.class));
finish();
} else {
// Setup ActionBar
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.app_name);
setContentView(R.layout.activity_track_list);
Logger.getInstance().logVerbose("Activity", "onCreate(" + this.getLocalClassName() + ")");
// Setup ActionBar
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.app_name);
}
mNavigationDrawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
mNavigationDrawerFragment.setOnListViewChanged(this);
// Set up the drawer.
mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
if (findViewById(R.id.track_detail_container) != null) {
// The detail container view will be present only in the
// large-screen layouts (res/values-large and
// res/values-sw600dp). If this view is present, then the
// activity should be in two-pane mode.
mTwoPane = true;
// In two-pane mode, list items should be given the
// 'activated' state when touched.
((MusicContainerListFragment) getSupportFragmentManager()
.findFragmentById(R.id.fragment_main))
.setActivateOnItemClick(true);
}
boolean waitForPermissions = false;
// Check file system permissions
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
waitForPermissions = true;
}
if (!waitForPermissions)
loadPlayMusicExporter();
}
mNavigationDrawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
mNavigationDrawerFragment.setOnListViewChanged(this);
// Set up the drawer.
mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
if (findViewById(R.id.track_detail_container) != null) {
// The detail container view will be present only in the
// large-screen layouts (res/values-large and
// res/values-sw600dp). If this view is present, then the
// activity should be in two-pane mode.
mTwoPane = true;
// In two-pane mode, list items should be given the
// 'activated' state when touched.
((MusicContainerListFragment) getSupportFragmentManager()
.findFragmentById(R.id.fragment_main))
.setActivateOnItemClick(true);
}
boolean waitForPermissions = false;
// Check file system permissions
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE);
waitForPermissions = true;
}
if (!waitForPermissions)
loadPlayMusicExporter();
}
@Override
@ -176,13 +185,7 @@ public class MusicContainerListActivity extends AppCompatActivity
builder.setTitle(R.string.dialog_storage_access_denied_title);
builder.setMessage(R.string.dialog_storage_access_denied);
builder.setCancelable(false);
builder.setPositiveButton(R.string.text_okay, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Close the app
MusicContainerListActivity.this.finish();
}
});
builder.setPositiveButton(R.string.text_okay, (dialog, which) -> MusicContainerListActivity.this.finish());
builder.show();
}
@ -211,8 +214,8 @@ public class MusicContainerListActivity extends AppCompatActivity
mPlayMusicManager.setID3EnableArtwork(true);
mPlayMusicManager.setID3EnableFallback(true);
mPlayMusicManager.setID3v2Version(ID3v2Version.ID3v23);
mPlayMusicManager.setID3ArtworkFormat(Bitmap.CompressFormat.JPEG);
mPlayMusicManager.setID3ArtworkMaximumSize(512);
mPlayMusicManager.setID3ArtworkFormat(Bitmap.CompressFormat.PNG);
mPlayMusicManager.setID3ArtworkMaximumSize(PlayMusicExporterPreferences.getAlbumArtSize());
} catch (Exception e) {
Logger.getInstance().logError("SetupPlayMusicExporter", e.toString());

View file

@ -4,6 +4,7 @@ package re.jcg.playmusicexporter.settings;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Environment;
import android.preference.PreferenceManager;
import re.jcg.playmusicexporter.fragments.NavigationDrawerFragment;
@ -27,18 +28,25 @@ public class PlayMusicExporterPreferences {
//TODO Split Export Paths in export prefs, this won't work else.
private static final String ALBA_EXPORT_PATH = "preference_alba_export_path";
private static final String GROUPS_EXPORT_PATH = "preference_groups_export_path";
private static final String URI_DEFAULT = Uri.EMPTY.toString();
private static final String URI_DEFAULT = Uri.fromFile(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC)).toString();
private static final String AUTO_EXPORT_STRUCTURE = "preference_auto_export_structure";
private static final String ALBA_EXPORT_STRUCTURE = "preference_alba_export_structure";
private static final String GROUPS_EXPORT_STRUCTURE = "preference_groups_export_structure";
private static final String EXPORT_STRUCTURE_DEFAULT = "{album-artist}/{album}/{disc=CD $}/{no=$$.} {title}.mp3";
private static final String EXPORT_ALBUM_ART_SIZE = "preference_id3_artwork_size";
private static final int EXPORT_ALBUM_ART_SIZE_DEFAULT = 512;
private static final String DRAWER_LEARNED = "pref_drawer_learned";
private static final boolean DRAWER_LEARNED_DEFAULT = false;
private static final String DRAWER_SELECTED_TYPE = "pref_drawer_selected_type";
private static final String DRAWER_SELECTED_TYPE_DEFAULT = "Album";
private static final String SETUP_DONE = "preference_setup_done";
private static final boolean SETUP_DONE_DEFAULT = false;
private PlayMusicExporterPreferences() {
}
@ -141,4 +149,20 @@ public class PlayMusicExporterPreferences {
public static boolean getAutoExportRequireCharging() {
return preferences.getBoolean(AUTO_EXPORT_REQUIRE_CHARGING, AUTO_EXPORT_REQUIRE_CONDITION_DEFAULT);
}
public static boolean getSetupDone() {
return preferences.getBoolean(SETUP_DONE, SETUP_DONE_DEFAULT);
}
public static void setSetupDone(boolean done) {
preferences.edit().putBoolean(SETUP_DONE, done).apply();
}
public static int getAlbumArtSize() {
return Integer.parseInt(preferences.getString(EXPORT_ALBUM_ART_SIZE, "" + EXPORT_ALBUM_ART_SIZE_DEFAULT));
}
public static void setAlbumArtSize(int size) {
preferences.edit().putString(EXPORT_ALBUM_ART_SIZE, "" + size).apply();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -61,8 +61,8 @@
<string name="toast_error_track_not_offline">Sie können nur offline Titel exportieren. Versuchen Sie das Album in Play Music offline herunterzuladen.</string>
<string name="settings_build_date">Kompilationsdatum</string>
<string name="settings_category_develop">Entwicklung</string>
<string name="dialog_storage_access_denied_title">Daten-Zugriff verweigert</string>
<string name="dialog_storage_access_denied">Der PlayMusicExpoerter benötigt Schreibrechte auf der SD-Karte. Dies ist Teil des Marshmallow-Fix.\n\nBitte starten Sie die App neu und erlauben Sie die Berechtigung.</string>
<string name="dialog_storage_access_denied_title">Speicher-Zugriff verweigert</string>
<string name="dialog_storage_access_denied">Der Play Music Exporter benötigt Schreibzugriff auf den externen Speicher, ohne diesen kann die App nicht genutzt werden.</string>
<string name="text_okay">OK</string>
<string name="pref_header_about">Über</string>
<string name="pref_header_automation">Automatisierung</string>
@ -98,4 +98,6 @@
<string name="settings_category_groups_export">Export Speichereinstellungen für Playlists</string>
<string name="settings_export_path_alba">Export Pfad für Alben</string>
<string name="settings_export_path_groups">Export Pfad für Playlists</string>
<string name="dialog_superuser_access_denied_title">Administrator-Zugriff verweigert</string>
<string name="dialog_superuser_access_denied">Der Play Music Exporter benötigt Administrator Rechte, ohne diese Rechte kann die App nicht genutzt werden.</string>
</resources>

View file

@ -50,7 +50,11 @@
<string name="notification_export_finished_single_summery">%1$s was exported successfully!</string>
<string name="dialog_storage_access_denied_title">Storage access denied</string>
<string name="dialog_storage_access_denied">The PlayMusicExporter always needs to write to the external storage. This is part of the Marshmallow fix.\n\nPlease restart the app and grant the permission.</string>
<string name="dialog_storage_access_denied">The Play Music Exporter does not work without write access to the external storage. You can not use this app without granting it write access.</string>
<string name="dialog_superuser_access_denied_title">Superuser access denied</string>
<string name="dialog_superuser_access_denied">The Play Music Exporter does not work without superuser access. You can not use this app without granting it superuser access.</string>
<string name="toast_error_track_not_offline">You can only export offline tracks. Try to download the album offline in Play Music.</string>
@ -68,7 +72,7 @@
<string name="settings_category_auto_export_conditions">Export conditions</string>
<string name="settings_category_auto_export_path_subdir">Export path and subdirectory structure</string>
<string name="settings_category_debug">Debug</string>
<string name="settings_category_alba_export">Export location alba</string>
<string name="settings_category_alba_export">Export location albums</string>
<string name="settings_category_groups_export">Export location groups</string>
@ -83,7 +87,7 @@
<string name="settings_auto_export_different_path_switch_summary">Off means that the automatic export uses the same export path as manual album exports.</string>
<string name="settings_auto_export_different_path">Export path</string>
<string name="settings_auto_export_different_structure_switch">Use a different subdirectory structure</string>
<string name="settings_auto_export_different_structure_switch_summary">Off means that the automatic export uses the same subdirectory structure as alba.</string>
<string name="settings_auto_export_different_structure_switch_summary">Off means that the automatic export uses the same subdirectory structure as albums.</string>
<string name="settings_auto_export_different_structure">Subdirectory structure</string>
<string name="settings_category_export_location">Export Location</string>
@ -91,7 +95,7 @@
<string name="settings_export_subdirectory_structure_dialog_message">Use / for a new folder \n Available Tags: \n - {album-artist} \n - {album} \n - {artist} \n - {title} \n - {disc=CD $} \n - {no=$$.} \n - {year} \n - {genre} \n</string>
<string name="settings_export_path_alba">Export path for alba</string>
<string name="settings_export_path_alba">Export path for albums</string>
<string name="settings_export_structure_alba">Subdirectory structure for albums</string>
<string name="settings_export_subdirectory_structure_album">Set your subdirectory structure</string>
<string name="settings_export_subdirectory_structure_album_example">Example: Beatles/Help!/13. Yesterday.mp3</string>

View file

@ -50,11 +50,11 @@
<!-- TODO change Version number and build date with releases -->
<!-- Version number-->
<Preference
android:summary="0.9.1"
android:summary="0.9.2"
android:title="@string/settings_version_number" />
<!-- Build date-->
<Preference
android:summary="31.12.2016"
android:summary="19.01.2017"
android:title="@string/settings_build_date" />
</PreferenceCategory>

View file

@ -27,7 +27,7 @@ android {
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 9
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "1.0"

View file

@ -9,7 +9,6 @@
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
@ -20,7 +19,7 @@
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="LIBRARY_PROJECT" value="true" />
<option name="PROJECT_TYPE" value="1" />
</configuration>
</facet>
</component>
@ -48,7 +47,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
@ -56,7 +54,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
@ -64,7 +61,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
@ -72,7 +68,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
@ -80,7 +75,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />