Skip to content

Commit

Permalink
Update AppCompat
Browse files Browse the repository at this point in the history
Workaround for the Marshmallow problem (writes temp files to external storage instead of the private data)
Update binary
  • Loading branch information
Arcus92 committed Nov 13, 2015
1 parent 6e2a763 commit e520845
Show file tree
Hide file tree
Showing 15 changed files with 145 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .idea/libraries/appcompat_v7_23_1_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/libraries/appcompat_v7_23_1_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/libraries/design_23_1_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/libraries/support_annotations_23_1_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions .idea/libraries/support_v4_23_1_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified apk/playmusicexporter-release.apk
Binary file not shown.
2 changes: 2 additions & 0 deletions framework/framework.iml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
Expand Down
12 changes: 6 additions & 6 deletions playmusicexporter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "de.arcus.playmusicexporter2"
minSdkVersion 8
targetSdkVersion 23
versionCode 101
versionName '2.4.1'
versionCode 102
versionName '2.4.2'
}
buildTypes {
release {
Expand All @@ -45,9 +45,9 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile project(':framework')
compile project(':playmusiclib')
}
18 changes: 9 additions & 9 deletions playmusicexporter/playmusicexporter.iml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
Expand All @@ -92,11 +92,11 @@
</content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
<orderEntry type="library" exported="" name="design-23.1.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
<orderEntry type="library" exported="" name="design-23.1.1" level="project" />
<orderEntry type="module" module-name="playmusiclib" exported="" />
<orderEntry type="module" module-name="framework" exported="" />
</component>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@

package de.arcus.playmusicexporter2.activities;

import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.view.Menu;
Expand Down Expand Up @@ -93,6 +99,8 @@ public void onViewTypeChanged(NavigationDrawerFragment.ViewType viewType) {

private SearchView mSearchView;

private static final int PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -134,6 +142,59 @@ protected void onCreate(Bundle savedInstanceState) {
.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
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) {

// Continue loading
loadPlayMusicExporter();
} else {
// 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, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Close the app
MusicContainerListActivity.this.finish();
}
});
builder.show();

}
return;
}
}
}
/**
* Loads the PlayMusicExporter lib and shows the list
*/
private void loadPlayMusicExporter()
{
// Gets the running instance
mPlayMusicManager = PlayMusicManager.getInstance();

Expand Down
2 changes: 2 additions & 0 deletions playmusicexporter/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@
<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">Build date</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>
</resources>
5 changes: 5 additions & 0 deletions playmusicexporter/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@
<string name="notification_export_finished_summery">%1$d tracks were exported successfully!</string>
<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="toast_error_track_not_offline">You can only export offline tracks. Try to download the album offline in Play Music.</string>

<string name="text_okay">Okay</string>

<string name="search">Search&#8230;</string>
<string name="button_export_group">Export all tracks</string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,15 @@ private String getTempDatabasePath() {
* @return Gets the temp path to the exported music
*/
private String getTempPath() {
return mContext.getCacheDir().getAbsolutePath();
// Marshmallow hack
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// Use the internal storage instead
String path = Environment.getExternalStorageDirectory() + "/PlayMusicExporter/";
FileTools.directoryCreate(path);
return path;
} else {
return mContext.getCacheDir().getAbsolutePath();
}
}

/**
Expand Down

0 comments on commit e520845

Please sign in to comment.