summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoCamera.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/VideoCamera.java')
-rw-r--r--src/com/android/camera/VideoCamera.java50
1 files changed, 34 insertions, 16 deletions
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 65b4103..b3a9721 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -73,6 +73,7 @@ import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.Button;
import android.widget.CursorAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -152,7 +153,9 @@ public class VideoCamera extends NoSearchActivity
// last captured pictures.
private ListView mThumbnailList;
private OnItemClickListener mThumbnailItemClickListener =
- new ThumbnailItemClickListener();
+ new ThumbnailItemClickListener();
+ private ThumbnailAdapter mThumbnailAdapter;
+
private boolean mStartPreviewFail = false;
private int mStorageStatus = STORAGE_STATUS_OK;
@@ -490,6 +493,9 @@ public class VideoCamera extends NoSearchActivity
case R.id.review_thumbnail:
if (!mMediaRecorderRecording) viewVideo(mThumbnailButton);
break;
+ case R.id.btn_gallery:
+ gotoGallery();
+ break;
}
}
@@ -1504,26 +1510,38 @@ public class VideoCamera extends NoSearchActivity
private void initThumbnailList() {
mThumbnailList = (ListView) findViewById(R.id.thumbnail_list);
- if (mThumbnailList != null) {
- int width = mThumbnailList.getWidth();
- int height = mThumbnailList.getHeight();
- int thumbnailCount = (height + mThumbnailList.getDividerHeight())
- / (width + mThumbnailList.getDividerHeight());
- Cursor cursor = getThumbnailsCursor(thumbnailCount);
- ThumbnailAdapter adapter = new ThumbnailAdapter(
- getApplicationContext(), R.layout.thumbnail_item, cursor,
- false);
- mThumbnailList.setAdapter(adapter);
- mThumbnailList.setOnItemClickListener(mThumbnailItemClickListener);
+ if (mThumbnailList == null) return;
+
+ int width = mThumbnailList.getWidth();
+ int height = mThumbnailList.getHeight();
+
+ // Add gallery button to header view.
+ if (mThumbnailList.getHeaderViewsCount() == 0) {
+ LayoutInflater inflater = getLayoutInflater();
+ Button b = new Button(this);
+ ListView.LayoutParams params = new ListView.LayoutParams(width, width);
+ b.setId(R.id.btn_gallery);
+ b.setLayoutParams(params);
+ b.setOnClickListener(this);
+ b.setBackgroundResource(R.drawable.ic_menu_gallery);
+ mThumbnailList.addHeaderView(b);
}
+
+ // Set cursor adapter.
+ int thumbnailCount = (height + mThumbnailList.getDividerHeight())
+ / (width + mThumbnailList.getDividerHeight()) - 1;
+ Cursor cursor = getThumbnailsCursor(thumbnailCount);
+ mThumbnailAdapter = new ThumbnailAdapter(
+ getApplicationContext(), R.layout.thumbnail_item, cursor,
+ false);
+ mThumbnailList.setAdapter(mThumbnailAdapter);
+ mThumbnailList.setOnItemClickListener(mThumbnailItemClickListener);
}
private void updateThumbnailList() {
if (mThumbnailList == null) return;
- CursorAdapter adapter = (CursorAdapter) mThumbnailList.getAdapter();
- Cursor cursor = adapter.getCursor();
- cursor.requery();
- adapter.notifyDataSetChanged();
+ mThumbnailAdapter.getCursor().requery();
+ mThumbnailAdapter.notifyDataSetChanged();
}
private class ThumbnailItemClickListener implements OnItemClickListener {