summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraActivity.java12
-rw-r--r--src/com/android/camera/PhotoUI.java2
-rw-r--r--src/com/android/camera/VideoModule.java14
-rw-r--r--src/com/android/camera/VideoUI.java2
-rw-r--r--src/com/android/camera/data/LocalData.java56
-rw-r--r--src/com/android/camera/ui/CameraSwitcher.java14
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java3
7 files changed, 50 insertions, 53 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index c5cbb7e8a..07cb6ced7 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -44,6 +44,7 @@ import android.widget.ImageView;
import com.android.camera.data.CameraDataAdapter;
import com.android.camera.data.LocalData;
+import com.android.camera.ui.CameraSwitcher;
import com.android.camera.ui.CameraSwitcher.CameraSwitchListener;
import com.android.camera.ui.FilmStripView;
import com.android.gallery3d.R;
@@ -55,11 +56,6 @@ public class CameraActivity extends Activity
private static final String TAG = "CAM_Activity";
- public static final int PHOTO_MODULE_INDEX = 0;
- public static final int VIDEO_MODULE_INDEX = 1;
- public static final int PANORAMA_MODULE_INDEX = 2;
- public static final int LIGHTCYCLE_MODULE_INDEX = 3;
-
private static final String INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE =
"android.media.action.STILL_IMAGE_CAMERA_SECURE";
public static final String ACTION_IMAGE_CAPTURE_SECURE =
@@ -422,13 +418,13 @@ public class CameraActivity extends Activity
closeModule(mCurrentModule);
mCurrentModuleIndex = i;
switch (i) {
- case VIDEO_MODULE_INDEX:
+ case CameraSwitcher.VIDEO_MODULE_INDEX:
mCurrentModule = new VideoModule();
break;
- case PHOTO_MODULE_INDEX:
+ case CameraSwitcher.PHOTO_MODULE_INDEX:
mCurrentModule = new PhotoModule();
break;
- case LIGHTCYCLE_MODULE_INDEX:
+ case CameraSwitcher.LIGHTCYCLE_MODULE_INDEX:
mCurrentModule = LightCycleHelper.createPanoramaModule();
break;
default:
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index b2a9df8cc..96d21f017 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -195,7 +195,7 @@ public class PhotoUI implements PieListener,
mShutterButton = (ShutterButton) mRootView.findViewById(R.id.shutter_button);
mSwitcher = (CameraSwitcher) mRootView.findViewById(R.id.camera_switcher);
- mSwitcher.setCurrentIndex(0);
+ mSwitcher.setCurrentIndex(CameraSwitcher.PHOTO_MODULE_INDEX);
mSwitcher.setSwitchListener((CameraSwitchListener) mActivity);
mMenuButton = mRootView.findViewById(R.id.menu);
if (ApiHelper.HAS_FACE_DETECTION) {
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 839037fc0..0daa67246 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -394,12 +394,6 @@ public class VideoModule implements CameraModule,
readVideoPreferences();
mUI.setPrefChangedListener(this);
- new Thread(new Runnable() {
- @Override
- public void run() {
- startPreview();
- }
- }).start();
mQuickCapture = mActivity.getIntent().getBooleanExtra(EXTRA_QUICK_CAPTURE, false);
mLocationManager = new LocationManager(mActivity, null);
@@ -761,7 +755,11 @@ public class VideoModule implements CameraModule,
new Thread(new Runnable() {
@Override
public void run() {
- startPreview();
+ synchronized (mCameraOpened) {
+ if (mCameraOpened) {
+ startPreview();
+ }
+ }
}
}).start();
} else {
@@ -931,8 +929,8 @@ public class VideoModule implements CameraModule,
CameraHolder.instance().release();
}
mCameraOpened = false;
+ mCameraDevice = null;
}
- mCameraDevice = null;
mPreviewing = false;
mSnapshotInProgress = false;
}
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index c446b9778..169fc7d54 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -143,7 +143,7 @@ public class VideoUI implements PieRenderer.PieListener,
((CameraRootView) mRootView).setDisplayChangeListener(this);
mShutterButton = (ShutterButton) mRootView.findViewById(R.id.shutter_button);
mSwitcher = (CameraSwitcher) mRootView.findViewById(R.id.camera_switcher);
- mSwitcher.setCurrentIndex(1);
+ mSwitcher.setCurrentIndex(CameraSwitcher.VIDEO_MODULE_INDEX);
mSwitcher.setSwitchListener((CameraSwitchListener) mActivity);
initializeMiscControls();
initializeControlByIntent();
diff --git a/src/com/android/camera/data/LocalData.java b/src/com/android/camera/data/LocalData.java
index 0ccc63950..d509dc8ac 100644
--- a/src/com/android/camera/data/LocalData.java
+++ b/src/com/android/camera/data/LocalData.java
@@ -148,14 +148,15 @@ public interface LocalData extends FilmStripView.ImageData {
}
@Override
- public boolean delete(Context c) {
+ public boolean delete(Context ctx) {
File f = new File(path);
return f.delete();
}
- protected View fillViewBackground(Context c, View v,
+ protected ImageView fillImageView(Context ctx, ImageView v,
int decodeWidth, int decodeHeight, Drawable placeHolder) {
- v.setBackground(placeHolder);
+ v.setScaleType(ImageView.ScaleType.FIT_XY);
+ v.setImageDrawable(placeHolder);
BitmapLoadTask task = getBitmapLoadTask(v, decodeWidth, decodeHeight);
task.execute();
@@ -163,9 +164,10 @@ public interface LocalData extends FilmStripView.ImageData {
}
@Override
- public View getView(Context c,
+ public View getView(Context ctx,
int decodeWidth, int decodeHeight, Drawable placeHolder) {
- return fillViewBackground(c, new ImageView(c), decodeWidth, decodeHeight, placeHolder);
+ return fillImageView(ctx, new ImageView(ctx),
+ decodeWidth, decodeHeight, placeHolder);
}
@Override
@@ -192,16 +194,16 @@ public interface LocalData extends FilmStripView.ImageData {
public abstract int getType();
protected abstract BitmapLoadTask getBitmapLoadTask(
- View v, int decodeWidth, int decodeHeight);
+ ImageView v, int decodeWidth, int decodeHeight);
/*
* An AsyncTask class that loads the bitmap in the background thread.
* Sub-classes should implement their own "protected Bitmap doInBackground(Void... )"
*/
protected abstract class BitmapLoadTask extends AsyncTask<Void, Void, Bitmap> {
- protected View mView;
+ protected ImageView mView;
- protected BitmapLoadTask(View v) {
+ protected BitmapLoadTask(ImageView v) {
mView = v;
}
@@ -213,8 +215,8 @@ public interface LocalData extends FilmStripView.ImageData {
return;
}
BitmapDrawable d = new BitmapDrawable(bitmap);
- d.setGravity(Gravity.FILL);
- mView.setBackground(d);
+ mView.setScaleType(ImageView.ScaleType.FIT_XY);
+ mView.setImageDrawable(d);
}
}
}
@@ -325,7 +327,7 @@ public interface LocalData extends FilmStripView.ImageData {
@Override
protected BitmapLoadTask getBitmapLoadTask(
- View v, int decodeWidth, int decodeHeight) {
+ ImageView v, int decodeWidth, int decodeHeight) {
return new PhotoBitmapLoadTask(v, decodeWidth, decodeHeight);
}
@@ -343,7 +345,7 @@ public interface LocalData extends FilmStripView.ImageData {
private int mDecodeWidth;
private int mDecodeHeight;
- public PhotoBitmapLoadTask(View v, int decodeWidth, int decodeHeight) {
+ public PhotoBitmapLoadTask(ImageView v, int decodeWidth, int decodeHeight) {
super(v);
mDecodeWidth = decodeWidth;
mDecodeHeight = decodeHeight;
@@ -466,18 +468,25 @@ public interface LocalData extends FilmStripView.ImageData {
}
@Override
- public boolean delete(Context c) {
- ContentResolver cr = c.getContentResolver();
+ public boolean delete(Context ctx) {
+ ContentResolver cr = ctx.getContentResolver();
cr.delete(CONTENT_URI, VideoColumns._ID + "=" + id, null);
- return super.delete(c);
+ return super.delete(ctx);
}
@Override
- public View getView(final Context c,
+ public View getView(final Context ctx,
int decodeWidth, int decodeHeight, Drawable placeHolder) {
- FrameLayout f = new FrameLayout(c);
- fillViewBackground(c, f, decodeWidth, decodeHeight, placeHolder);
- ImageView icon = new ImageView(c);
+
+ // ImageView for the bitmap.
+ ImageView iv = new ImageView(ctx);
+ iv.setLayoutParams(new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER));
+ fillImageView(ctx, iv, decodeWidth, decodeHeight, placeHolder);
+
+ // ImageView for the play icon.
+ ImageView icon = new ImageView(ctx);
icon.setImageResource(R.drawable.ic_control_play);
icon.setScaleType(ImageView.ScaleType.CENTER);
icon.setLayoutParams(new FrameLayout.LayoutParams(
@@ -486,22 +495,25 @@ public interface LocalData extends FilmStripView.ImageData {
icon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- Util.playVideo(c, mPlayUri, title);
+ Util.playVideo(ctx, mPlayUri, title);
}
});
+
+ FrameLayout f = new FrameLayout(ctx);
+ f.addView(iv);
f.addView(icon);
return f;
}
@Override
protected BitmapLoadTask getBitmapLoadTask(
- View v, int decodeWidth, int decodeHeight) {
+ ImageView v, int decodeWidth, int decodeHeight) {
return new VideoBitmapLoadTask(v);
}
private final class VideoBitmapLoadTask extends BitmapLoadTask {
- public VideoBitmapLoadTask(View v) {
+ public VideoBitmapLoadTask(ImageView v) {
super(v);
}
diff --git a/src/com/android/camera/ui/CameraSwitcher.java b/src/com/android/camera/ui/CameraSwitcher.java
index 537577fb5..90d88d29a 100644
--- a/src/com/android/camera/ui/CameraSwitcher.java
+++ b/src/com/android/camera/ui/CameraSwitcher.java
@@ -48,12 +48,10 @@ public class CameraSwitcher extends RotateImageView
public static final int PHOTO_MODULE_INDEX = 0;
public static final int VIDEO_MODULE_INDEX = 1;
- public static final int PANORAMA_MODULE_INDEX = 2;
- public static final int LIGHTCYCLE_MODULE_INDEX = 3;
+ public static final int LIGHTCYCLE_MODULE_INDEX = 2;
private static final int[] DRAW_IDS = {
R.drawable.ic_switch_camera,
R.drawable.ic_switch_video,
- R.drawable.ic_switch_pan,
R.drawable.ic_switch_photosphere
};
public interface CameraSwitchListener {
@@ -98,17 +96,13 @@ public class CameraSwitcher extends RotateImageView
public void initializeDrawables(Context context) {
int totaldrawid = (LightCycleHelper.hasLightCycleCapture(context)
? DRAW_IDS.length : DRAW_IDS.length - 1);
- if (!ApiHelper.HAS_OLD_PANORAMA) totaldrawid--;
int[] drawids = new int[totaldrawid];
int[] moduleids = new int[totaldrawid];
int ix = 0;
for (int i = 0; i < DRAW_IDS.length; i++) {
- if (i == PANORAMA_MODULE_INDEX && !ApiHelper.HAS_OLD_PANORAMA) {
- continue; // not enabled, so don't add to UI
- }
if (i == LIGHTCYCLE_MODULE_INDEX && !LightCycleHelper.hasLightCycleCapture(context)) {
- continue; // not enabled, so don't add to UI
+ continue; // not enabled, so don't add to UI
}
moduleids[ix] = i;
drawids[ix++] = DRAW_IDS[i];
@@ -188,10 +182,6 @@ public class CameraSwitcher extends RotateImageView
item.setContentDescription(getContext().getResources().getString(
R.string.accessibility_switch_to_video));
break;
- case R.drawable.ic_switch_pan:
- item.setContentDescription(getContext().getResources().getString(
- R.string.accessibility_switch_to_panorama));
- break;
case R.drawable.ic_switch_photosphere:
item.setContentDescription(getContext().getResources().getString(
R.string.accessibility_switch_to_new_panorama));
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
index c95a15a99..9d103d590 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java
@@ -17,6 +17,7 @@
package com.android.gallery3d.filtershow.filters;
import android.util.Log;
+
import com.android.gallery3d.filtershow.editors.BasicEditor;
public class FilterRepresentation implements Cloneable {
@@ -229,7 +230,7 @@ public class FilterRepresentation implements Cloneable {
public void deSerializeRepresentation(String[][] rep) {
for (int i = 0; i < rep.length; i++) {
if ("Name".equals(rep[i][0])) {
- mName = rep[i][0];
+ mName = rep[i][1];
break;
}
}