import android.view.WindowManager;
import com.android.gallery3d.R;
-import com.android.gallery3d.app.Gallery;
+import com.android.gallery3d.app.GalleryActivity;
import com.android.gallery3d.app.PackagesMonitor;
import com.android.gallery3d.common.ApiHelper;
import com.android.gallery3d.data.DataManager;
import com.android.gallery3d.util.ThreadPool.CancelListener;
import com.android.gallery3d.util.ThreadPool.JobContext;
+import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
TiledScreenNail.setMaxSide(maxPixels / 2);
}
- public static boolean isHighResolution(Context context) {
- DisplayMetrics metrics = new DisplayMetrics();
- WindowManager wm = (WindowManager)
- context.getSystemService(Context.WINDOW_SERVICE);
- wm.getDefaultDisplay().getMetrics(metrics);
- return metrics.heightPixels > 2048 || metrics.widthPixels > 2048;
- }
-
public static float[] intColorToFloatARGBArray(int from) {
return new float[] {
Color.alpha(from) / 255f,
int state = pm.getComponentEnabledSetting(name);
sCameraAvailableInitialized = true;
sCameraAvailable =
- (state == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT)
- || (state == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
+ (state == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT)
+ || (state == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
return sCameraAvailable;
}
}
public static void startGalleryActivity(Context context) {
- Intent intent = new Intent(context, Gallery.class);
+ Intent intent = new Intent(context, GalleryActivity.class)
+ .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
+ | Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
return path.toLowerCase().hashCode();
}
+ // Return the local path that matches the given bucketId. If no match is
+ // found, return null
+ public static String searchDirForPath(File dir, int bucketId) {
+ File[] files = dir.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isDirectory()) {
+ String path = file.getAbsolutePath();
+ if (GalleryUtils.getBucketId(path) == bucketId) {
+ return path;
+ } else {
+ path = searchDirForPath(file, bucketId);
+ if (path != null) return path;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
// Returns a (localized) string for the given duration (in seconds).
public static String formatDuration(final Context context, int duration) {
int h = duration / 3600;