diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/module/prefs/UserPrefs.java b/OpenEdXMobile/src/main/java/org/edx/mobile/module/prefs/UserPrefs.java index ceae8108aa..9aedaaded2 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/module/prefs/UserPrefs.java +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/module/prefs/UserPrefs.java @@ -8,15 +8,7 @@ import com.google.inject.Inject; import com.google.inject.Singleton; -import org.edx.mobile.core.IEdxEnvironment; -import org.edx.mobile.logger.Logger; import org.edx.mobile.model.api.ProfileModel; -import org.edx.mobile.util.AppConstants; -import org.edx.mobile.util.FileUtil; -import org.edx.mobile.util.Sha1Util; - -import java.io.File; -import java.io.IOException; @Singleton public class UserPrefs { @@ -46,9 +38,9 @@ public boolean isDownloadOverWifiOnly() { return onlyWifi; } - public boolean isDownloadToSDCardEnabled(){ + public boolean isDownloadToSDCardEnabled() { final PrefManager prefManger = new PrefManager(context, PrefManager.Pref.USER_PREF); - return prefManger.getBoolean(PrefManager.Key.DOWNLOAD_TO_SDCARD, true); + return prefManger.getBoolean(PrefManager.Key.DOWNLOAD_TO_SDCARD, false); } @Nullable diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/receivers/MediaStatusReceiver.java b/OpenEdXMobile/src/main/java/org/edx/mobile/receivers/MediaStatusReceiver.java index fe447c4575..c59cab0379 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/receivers/MediaStatusReceiver.java +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/receivers/MediaStatusReceiver.java @@ -7,6 +7,7 @@ import com.google.inject.Inject; +import org.edx.mobile.core.IEdxEnvironment; import org.edx.mobile.event.MediaStatusChangeEvent; import org.edx.mobile.model.VideoModel; import org.edx.mobile.model.db.DownloadEntry; @@ -37,6 +38,9 @@ public class MediaStatusReceiver extends RoboBroadcastReceiver { private PrefManager prefManager; + @Inject + protected IEdxEnvironment environment; + public MediaStatusReceiver() { } @@ -97,7 +101,7 @@ private void handleSDCardMounted(final Context context, String hashedUsername) { public void onResult(List result) { final String externalAppDir = FileUtil.getExternalAppDir(context).getAbsolutePath(); final String removableStorageAppDir = FileUtil.getRemovableStorageAppDir(context).getAbsolutePath(); - final boolean downloadToSdCard = prefManager.getBoolean(PrefManager.Key.DOWNLOAD_TO_SDCARD, true); + final boolean downloadToSdCard = environment.getUserPrefs().isDownloadToSDCardEnabled(); for (VideoModel videoModel : result) { updateVideoDownloadFilePathState( videoModel, diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/view/SettingsFragment.java b/OpenEdXMobile/src/main/java/org/edx/mobile/view/SettingsFragment.java index 28c5ad3dd0..ed91a9a56a 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/view/SettingsFragment.java +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/view/SettingsFragment.java @@ -111,7 +111,7 @@ private void updateSDCardSwitch() { EventBus.getDefault().registerSticky(this); } sdCardSwitch.setOnCheckedChangeListener(null); - sdCardSwitch.setChecked(prefManager.getBoolean(PrefManager.Key.DOWNLOAD_TO_SDCARD, false)); + sdCardSwitch.setChecked(environment.getUserPrefs().isDownloadToSDCardEnabled()); sdCardSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {