fix storage

This commit is contained in:
Alexey Kuznetsov 2017-03-13 09:25:29 +03:00
commit 74723ee7e8
2 changed files with 9 additions and 2 deletions

View file

@ -45,5 +45,5 @@ dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.github.axet:android-audio-library:0.0.8' // compile project(':android-audio-library')
compile 'com.github.axet:android-audio-library:0.0.9' // compile project(':android-audio-library')
}

View file

@ -24,6 +24,7 @@ import android.support.v7.app.ActionBar;
import android.view.MenuItem;
import android.widget.Toast;
import com.github.axet.audiolibrary.app.Storage;
import com.github.axet.audiorecorder.R;
import com.github.axet.audiorecorder.app.MainApplication;
import com.github.axet.audiolibrary.encoders.Factory;
@ -61,6 +62,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
String stringValue = value.toString();
String key = preference.getKey();
if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
@ -92,7 +94,12 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements Sha
} else {
// For all other preferences, set the summary to the value's
// simple string representation.
preference.setSummary(stringValue);
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);
}
}
return true;
}