Merge branch 'audiorecorder-1.4.11'

This commit is contained in:
Alexey Kuznetsov 2017-03-15 14:24:10 +03:00
commit a3e5462ee7
3 changed files with 9 additions and 57 deletions

View file

@ -8,8 +8,8 @@ android {
applicationId "com.github.axet.audiorecorder"
minSdkVersion 9
targetSdkVersion 23
versionCode 112
versionName "1.4.10"
versionCode 113
versionName "1.4.11"
}
signingConfigs {
release {
@ -43,11 +43,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.github.axet:android-audio-library:0.0.10' // compile project(':android-audio-library')
debugCompile 'com.github.axet:libogg:1.3.2-2:debug@aar'
debugCompile 'com.github.axet:libvorbis:1.3.5-2:debug@aar'
debugCompile 'com.github.axet:vorbis:1.0.0-2:debug@aar'
releaseCompile 'com.github.axet:libogg:1.3.2-2:release@aar'
releaseCompile 'com.github.axet:libvorbis:1.3.5-2:release@aar'
releaseCompile 'com.github.axet:vorbis:1.0.0-2:release@aar'
compile 'com.github.axet:android-audio-library:0.0.13' // compile project(':android-audio-library')
}

View file

@ -99,7 +99,7 @@ public class MainActivity extends AppCompatActivity {
list.setAdapter(recordings);
list.setEmptyView(findViewById(R.id.empty_list));
if (permitted()) {
if (Storage.permitted(MainActivity.this, PERMISSIONS, 1)) {
storage.migrateLocalStorage();
}
}
@ -158,7 +158,7 @@ public class MainActivity extends AppCompatActivity {
return;
}
if (permitted(PERMISSIONS))
if (Storage.permitted(this, PERMISSIONS))
recordings.load();
else
recordings.load();
@ -208,7 +208,7 @@ public class MainActivity extends AppCompatActivity {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case 1:
if (permitted(permissions)) {
if (Storage.permitted(MainActivity.this, permissions)) {
storage.migrateLocalStorage();
recordings.load();
checkPending();
@ -222,29 +222,6 @@ public class MainActivity extends AppCompatActivity {
public static final String[] PERMISSIONS = new String[]{READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
boolean permitted(String[] ss) {
if (Build.VERSION.SDK_INT < 16)
return true;
for (String s : ss) {
if (ContextCompat.checkSelfPermission(this, s) != PackageManager.PERMISSION_GRANTED) {
return false;
}
}
return true;
}
boolean permitted() {
if (Build.VERSION.SDK_INT < 16)
return true;
for (String s : PERMISSIONS) {
if (ContextCompat.checkSelfPermission(this, s) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, PERMISSIONS, 1);
return false;
}
}
return true;
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);

View file

@ -94,12 +94,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
} else {
// For all other preferences, set the summary to the value's
// simple string representation.
if (key.equals(MainApplication.PREFERENCE_STORAGE)) { // if storage is disabled, show local path
Storage storage = new Storage(preference.getContext());
preference.setSummary(storage.getStoragePath().toString());
} else {
preference.setSummary(stringValue);
}
preference.setSummary(stringValue);
}
return true;
}
@ -146,7 +141,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
if (Build.VERSION.SDK_INT < 11) {
addPreferencesFromResource(R.xml.pref_general);
bindPreferenceSummaryToValue(findPreference(MainApplication.PREFERENCE_STORAGE));
ListPreference enc = (ListPreference) findPreference(MainApplication.PREFERENCE_ENCODING);
String v = enc.getValue();
@ -229,7 +223,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case 1:
if (permitted(this, permissions))
if (Storage.permitted(this, permissions))
;
else
Toast.makeText(this, R.string.not_permitted, Toast.LENGTH_SHORT).show();
@ -238,17 +232,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
public static final String[] PERMISSIONS = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
public static boolean permitted(Context context, String[] ss) {
if (Build.VERSION.SDK_INT < 16)
return true;
for (String s : ss) {
if (ContextCompat.checkSelfPermission(context, s) != PackageManager.PERMISSION_GRANTED) {
return false;
}
}
return true;
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals(MainApplication.PREFERENCE_THEME)) {
@ -286,11 +269,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
addPreferencesFromResource(R.xml.pref_general);
setHasOptionsMenu(true);
if (!permitted(getActivity(), PERMISSIONS)) {
if (!Storage.permitted(getActivity(), PERMISSIONS)) {
Preference p = findPreference(MainApplication.PREFERENCE_STORAGE);
getPreferenceScreen().removePreference(p);
} else {
bindPreferenceSummaryToValue(findPreference(MainApplication.PREFERENCE_STORAGE));
}
ListPreference enc = (ListPreference) findPreference(MainApplication.PREFERENCE_ENCODING);