check write & freespace

This commit is contained in:
Alexey Kuznetsov 2017-11-27 16:42:56 +03:00
commit f9fc20b847
2 changed files with 7 additions and 5 deletions

View file

@ -55,5 +55,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.github.axet:android-audio-library:1.0.64' // compile project(':android-audio-library')
compile 'com.github.axet:android-audio-library:1.0.65' // compile project(':android-audio-library')
}

View file

@ -54,6 +54,8 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
public static final String[] PERMISSIONS = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
public static final int RESULT_STORAGE = 1;
Handler handler = new Handler();
public static <T> T[] removeElement(Class<T> c, T[] aa, int i) {
@ -247,9 +249,9 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
StoragePathPreferenceCompat s = (StoragePathPreferenceCompat) pm.findPreference(MainApplication.PREFERENCE_STORAGE);
s.setStorage(new Storage(getContext()));
s.setPermissionsDialog(this, PERMISSIONS, 1);
s.setPermissionsDialog(this, PERMISSIONS, RESULT_STORAGE);
if (Build.VERSION.SDK_INT >= 21)
s.setStorageAccessFramework(this, 2);
s.setStorageAccessFramework(this, RESULT_STORAGE);
}
@Override
@ -276,7 +278,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
StoragePathPreferenceCompat s = (StoragePathPreferenceCompat) findPreference(MainApplication.PREFERENCE_STORAGE);
switch (requestCode) {
case 1:
case RESULT_STORAGE:
s.onRequestPermissionsResult(permissions, grantResults);
break;
}
@ -289,7 +291,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
StoragePathPreferenceCompat s = (StoragePathPreferenceCompat) findPreference(MainApplication.PREFERENCE_STORAGE);
switch (requestCode) {
case 2:
case RESULT_STORAGE:
s.onActivityResult(resultCode, data);
break;
}