Added success callback for DashChooseAppDirFragment.ChooseAppDirFragment. Fix bug that directory in app setting didn't updated.
This commit is contained in:
parent
0d4e8ea205
commit
0bc3686ce1
2 changed files with 11 additions and 1 deletions
|
@ -23,6 +23,7 @@ import android.support.v7.app.AlertDialog;
|
|||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
|
@ -334,7 +335,12 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
|
|||
|
||||
private void showAppDirDialogV19() {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(this);
|
||||
ChooseAppDirFragment frg = new DashChooseAppDirFragment.ChooseAppDirFragment(this, (Dialog) null);
|
||||
ChooseAppDirFragment frg = new DashChooseAppDirFragment.ChooseAppDirFragment(this, (Dialog) null) {
|
||||
@Override
|
||||
protected void successCallback() {
|
||||
updateApplicationDirTextAndSummary();
|
||||
}
|
||||
};
|
||||
bld.setView(frg.initView(getLayoutInflater(), null, null));
|
||||
AlertDialog dlg = bld.show();
|
||||
frg.setDialog(dlg);
|
||||
|
|
|
@ -316,6 +316,7 @@ public class DashChooseAppDirFragment {
|
|||
boolean changed = !currentAppFile.getAbsolutePath().equals(selectedFile.getAbsolutePath());
|
||||
getMyApplication().setExternalStorageDirectory(type, selectedFile.getAbsolutePath());
|
||||
if (changed) {
|
||||
successCallback();
|
||||
reloadData();
|
||||
}
|
||||
if (fragment != null && activity instanceof FragmentActivity) {
|
||||
|
@ -333,6 +334,9 @@ public class DashChooseAppDirFragment {
|
|||
};
|
||||
}
|
||||
|
||||
// To be implemented by subclass
|
||||
protected void successCallback() {}
|
||||
|
||||
protected void reloadData() {
|
||||
new ReloadData(activity, getMyApplication()).execute((Void) null);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue