summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app/AbstractGalleryActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/app/AbstractGalleryActivity.java')
-rw-r--r--src/com/android/gallery3d/app/AbstractGalleryActivity.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/app/AbstractGalleryActivity.java b/src/com/android/gallery3d/app/AbstractGalleryActivity.java
index 84a9b5753..9f43b8de4 100644
--- a/src/com/android/gallery3d/app/AbstractGalleryActivity.java
+++ b/src/com/android/gallery3d/app/AbstractGalleryActivity.java
@@ -28,10 +28,14 @@ import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
+import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
+import android.os.Environment;
import android.os.IBinder;
+import android.os.storage.StorageManager;
+import android.preference.PreferenceManager;
import android.support.v4.print.PrintHelper;
import android.view.Menu;
import android.view.MenuItem;
@@ -46,6 +50,7 @@ import com.android.gallery3d.data.MediaItem;
import com.android.gallery3d.filtershow.cache.ImageLoader;
import com.android.gallery3d.ui.GLRoot;
import com.android.gallery3d.ui.GLRootView;
+import com.android.gallery3d.util.MediaSetUtils;
import com.android.gallery3d.util.PanoramaViewHelper;
import com.android.gallery3d.util.ThreadPool;
import com.android.photos.data.GalleryBitmapPool;
@@ -75,6 +80,7 @@ public class AbstractGalleryActivity extends Activity implements GalleryContext
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ setStoragePath();
mOrientationManager = new OrientationManager(this);
toggleStatusBarByOrientation();
getWindow().setBackgroundDrawable(null);
@@ -83,6 +89,21 @@ public class AbstractGalleryActivity extends Activity implements GalleryContext
doBindBatchService();
}
+ private void setStoragePath() {
+ final String defaultStoragePath = Environment.getExternalStorageDirectory().toString();
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ String storagePath = prefs.getString(StorageChangeReceiver.KEY_STORAGE,
+ defaultStoragePath);
+
+ // Check if volume is mounted
+ StorageManager sm = (StorageManager) getSystemService(Context.STORAGE_SERVICE);
+ if (!sm.getVolumeState(storagePath).equals(Environment.MEDIA_MOUNTED)) {
+ storagePath = defaultStoragePath;
+ }
+
+ MediaSetUtils.setRoot(storagePath);
+ }
+
@Override
protected void onSaveInstanceState(Bundle outState) {
mGLRootView.lockRenderThread();