diff options
-rw-r--r-- | res/anim/footer_appear.xml | 25 | ||||
-rw-r--r-- | res/anim/footer_disappear.xml | 25 | ||||
-rwxr-xr-x | res/drawable/btn_check_buttonless_off.png | bin | 0 -> 716 bytes | |||
-rw-r--r-- | res/layout/gallery.xml | 58 | ||||
-rw-r--r-- | res/layout/grid.xml | 44 | ||||
-rw-r--r-- | res/layout/image_gallery_2.xml | 85 | ||||
-rw-r--r-- | res/layout/slide_show.xml | 27 | ||||
-rw-r--r-- | res/values/strings.xml | 9 | ||||
-rw-r--r-- | src/com/android/camera/ImageGallery.java | 44 |
9 files changed, 158 insertions, 159 deletions
diff --git a/res/anim/footer_appear.xml b/res/anim/footer_appear.xml new file mode 100644 index 0000000..e9242b8 --- /dev/null +++ b/res/anim/footer_appear.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" > + <translate + android:fromYDelta="+10%p" + android:toYDelta="0" + android:duration="300" /> +</set> diff --git a/res/anim/footer_disappear.xml b/res/anim/footer_disappear.xml new file mode 100644 index 0000000..1331931 --- /dev/null +++ b/res/anim/footer_disappear.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +** +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<set xmlns:android="http://schemas.android.com/apk/res/android" > + <translate + android:fromYDelta="0" + android:toYDelta="+10%p" + android:duration="300" /> +</set> diff --git a/res/drawable/btn_check_buttonless_off.png b/res/drawable/btn_check_buttonless_off.png Binary files differnew file mode 100755 index 0000000..45216dd --- /dev/null +++ b/res/drawable/btn_check_buttonless_off.png diff --git a/res/layout/gallery.xml b/res/layout/gallery.xml deleted file mode 100644 index 61a0db2..0000000 --- a/res/layout/gallery.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2007 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:orientation="horizontal"> - - <View android:background="#FF000000" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_alignParentTop="true" - android:layout_alignParentLeft="true" - /> - - <ImageView android:id="@+id/switcher1" - android:background="#FF000000" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_alignParentTop="true" - android:layout_alignParentLeft="true" - android:visibility="invisible" - /> - - <ImageView android:id="@+id/switcher2" - android:background="#55000000" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_alignParentTop="true" - android:layout_alignParentLeft="true" - android:visibility="invisible" - /> - - <Gallery android:id="@+id/gallery" - android:background="#55000000" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_alignParentLeft="true" - - android:gravity="center_vertical" - android:spacing="16dp" - /> - -</RelativeLayout> diff --git a/res/layout/grid.xml b/res/layout/grid.xml deleted file mode 100644 index 2bdbc8a..0000000 --- a/res/layout/grid.xml +++ /dev/null @@ -1,44 +0,0 @@ -<!-- -/** - * Copyright (c) 2007, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ ---> - -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:background="#FFFFFF"> - - <ImageSwitcher android:id="@+id/switcher" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_alignParentTop="true" - android:layout_alignParentLeft="true" - /> - - <GridView android:id="@+id/gallery" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - - android:padding="0dp" - android:verticalSpacing="0dp" - android:horizontalSpacing="0dp" - android:stretchMode="columnWidth" - - android:gravity="center" - /> - -</RelativeLayout> - diff --git a/res/layout/image_gallery_2.xml b/res/layout/image_gallery_2.xml index 6b1194d..390a6e4 100644 --- a/res/layout/image_gallery_2.xml +++ b/res/layout/image_gallery_2.xml @@ -15,45 +15,76 @@ --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/root" - android:layout_width="fill_parent" - android:layout_height="fill_parent"> + android:layout_width="fill_parent" + android:layout_height="fill_parent"> <view class="com.android.camera.GridViewSpecial" - android:id="@+id/grid" - android:focusable="true" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:listSelector="@drawable/grid_background" + android:id="@+id/grid" + android:focusable="true" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:listSelector="@drawable/grid_background" /> <RelativeLayout android:id="@+id/no_images" - android:visibility="gone" - android:orientation="vertical" - android:layout_centerInParent="true" - android:layout_width="fill_parent" - android:layout_height="fill_parent"> + android:visibility="gone" + android:orientation="vertical" + android:layout_centerInParent="true" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> <ImageView - android:id="@+id/no_pictures_image" - android:layout_centerInParent="true" - android:layout_gravity="center" - android:background="@drawable/ic_gallery_empty2" - android:layout_width="wrap_content" - android:layout_height="wrap_content" + android:id="@+id/no_pictures_image" + android:layout_centerInParent="true" + android:layout_gravity="center" + android:background="@drawable/ic_gallery_empty2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> <TextView - android:layout_below="@id/no_pictures_image" - android:layout_centerHorizontal="true" - android:paddingTop="5dip" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:text="@string/image_gallery_NoImageView_text" - android:textColor="#FFBEBEBE" - android:textSize="18dip" + android:layout_below="@id/no_pictures_image" + android:layout_centerHorizontal="true" + android:paddingTop="5dip" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:text="@string/image_gallery_NoImageView_text" + android:textColor="#FFBEBEBE" + android:textSize="18dip" /> </RelativeLayout> + <LinearLayout android:id="@+id/footer_organize" + android:orientation="horizontal" + android:visibility="gone" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:paddingTop="5dip" + android:paddingLeft="4dip" + android:paddingRight="4dip" + android:paddingBottom="1dip" + android:background="@android:drawable/bottom_bar"> + + <Button android:id="@+id/share" + android:layout_width="0dip" + android:layout_height="fill_parent" + android:layout_weight="1" + android:text="@string/multiselect_share" /> + + <Button android:id="@+id/delete" + android:layout_width="0dip" + android:layout_height="fill_parent" + android:layout_weight="1" + android:text="@string/multiselect_delete" /> + + <Button android:id="@+id/close" + android:layout_width="0dip" + android:layout_height="fill_parent" + android:layout_weight="1" + android:text="@string/multiselect_close" /> + </LinearLayout> + </RelativeLayout> diff --git a/res/layout/slide_show.xml b/res/layout/slide_show.xml deleted file mode 100644 index e9bfe0f..0000000 --- a/res/layout/slide_show.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2007 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent"> - - <view android:id="@+id/imageview" - class="com.android.camera.SlideShow$ImageViewTouch" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - /> - -</FrameLayout> diff --git a/res/values/strings.xml b/res/values/strings.xml index dbce7ea..70d7ff3 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -595,5 +595,14 @@ <!-- Displayed as a toast when a video file is too large to attach to a Gmail message. --> <string name="too_large_to_attach">File too large to attach.</string> + + <!-- The title shown on the button which share the selected images by gmail, mms, and etc. --> + <string name="multiselect_share">Share</string> + + <!-- The title shown on the button which will delete all the selected images --> + <string name="multiselect_delete">Delete</string> + + <!-- Title shown on the button which will close the multiselction mode --> + <string name="multiselect_close">Close</string> </resources> diff --git a/src/com/android/camera/ImageGallery.java b/src/com/android/camera/ImageGallery.java index 6816880..29b46a8 100644 --- a/src/com/android/camera/ImageGallery.java +++ b/src/com/android/camera/ImageGallery.java @@ -52,6 +52,8 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; import android.widget.TextView; import android.widget.Toast; @@ -73,6 +75,7 @@ public class ImageGallery extends Activity implements private MenuItem mSlideShowItem; private SharedPreferences mPrefs; private long mVideoSizeLimit = Long.MAX_VALUE; + private View mFooterOrganizeView; BroadcastReceiver mReceiver = null; @@ -106,6 +109,8 @@ public class ImageGallery extends Activity implements mGvs.requestFocus(); mGvs.setListener(this); + mFooterOrganizeView = findViewById(R.id.footer_organize); + if (isPickIntent()) { mVideoSizeLimit = getIntent().getLongExtra( MediaStore.EXTRA_SIZE_LIMIT, Long.MAX_VALUE); @@ -471,7 +476,7 @@ public class ImageGallery extends Activity implements item.setAlphabeticShortcut('p'); item.setIcon(android.R.drawable.ic_menu_preferences); - item = menu.add(R.string.multiselect); + item = menu.add(0, 0, 900, R.string.multiselect); item.setOnMenuItemClickListener( new MenuItem.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { @@ -597,8 +602,11 @@ public class ImageGallery extends Activity implements // if in multiselect mode if (mMultiSelected != null) { + int original = mMultiSelected.size(); if (!mMultiSelected.add(img)) mMultiSelected.remove(img); mGvs.invalidateImage(index); + if (original == 0) showFooter(); + if (mMultiSelected.size() == 0) hideFooter(); return; } @@ -771,6 +779,7 @@ public class ImageGallery extends Activity implements private Drawable mVideoOverlay; private Drawable mVideoMmsErrorOverlay; private Drawable mMultiSelectTrue; + private Drawable mMultiSelectFalse; public void drawImage(Canvas canvas, IImage image, Bitmap b, int xPos, int yPos, int w, int h) { @@ -839,10 +848,12 @@ public class ImageGallery extends Activity implements overlay.draw(canvas); } - if (mMultiSelected != null && mMultiSelected.contains(image)) { + if (mMultiSelected != null) { initializeMultiSelectDrawables(); - Drawable checkBox = mMultiSelectTrue; + Drawable checkBox = mMultiSelected.contains(image) + ? mMultiSelectTrue + : mMultiSelectFalse; int width = checkBox.getIntrinsicWidth(); int height = checkBox.getIntrinsicHeight(); int left = 5 + xPos; @@ -858,6 +869,10 @@ public class ImageGallery extends Activity implements mMultiSelectTrue = getResources() .getDrawable(R.drawable.btn_check_buttonless_on); } + if (mMultiSelectFalse == null) { + mMultiSelectFalse = getResources() + .getDrawable(R.drawable.btn_check_buttonless_off); + } } private Bitmap mMissingImageThumbnailBitmap; @@ -881,4 +896,27 @@ public class ImageGallery extends Activity implements return mMissingVideoThumbnailBitmap; } } + + private Animation mFooterAppear; + private Animation mFooterDisappear; + + private void showFooter() { + mFooterOrganizeView.setVisibility(View.VISIBLE); + if (mFooterAppear == null) { + mFooterAppear = AnimationUtils.loadAnimation( + this, R.anim.footer_appear); + } + mFooterOrganizeView.startAnimation(mFooterAppear); + } + + private void hideFooter() { + if (mFooterOrganizeView.getVisibility() != View.GONE) { + mFooterOrganizeView.setVisibility(View.GONE); + if (mFooterDisappear == null) { + mFooterDisappear = AnimationUtils.loadAnimation( + this, R.anim.footer_disappear); + } + mFooterOrganizeView.startAnimation(mFooterDisappear); + } + } } |