diff options
| -rw-r--r-- | res/layout/photopage_bottom_controls.xml | 26 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 10 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/PhotoPageBottomControls.java | 32 |
3 files changed, 11 insertions, 57 deletions
diff --git a/res/layout/photopage_bottom_controls.xml b/res/layout/photopage_bottom_controls.xml index fc9882280..3f19af150 100644 --- a/res/layout/photopage_bottom_controls.xml +++ b/res/layout/photopage_bottom_controls.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/photopage_bottom_controls" android:layout_width="match_parent" android:layout_height="56dp" android:layout_alignParentBottom="true" + android:layout_gravity="bottom" android:background="#42000000" + android:gravity="bottom" android:orientation="horizontal" android:visibility="gone" > @@ -12,12 +14,9 @@ android:id="@+id/photopage_bottom_control_edit" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_alignParentStart="true" - android:layout_centerVertical="true" + android:layout_gravity="center_vertical" + android:layout_weight="1" android:background="@null" - android:paddingStart="20dp" - android:layout_marginBottom="20dp" android:src="@drawable/edit" android:visibility="gone" /> @@ -25,10 +24,8 @@ android:id="@+id/photopage_bottom_control_share" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_marginBottom="20dp" - android:layout_centerInParent="true" - android:layout_centerVertical="true" + android:layout_gravity="center_vertical" + android:layout_weight="1" android:background="@null" android:src="@drawable/share" android:visibility="gone" /> @@ -37,13 +34,10 @@ android:id="@+id/photopage_bottom_control_delete" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_alignParentEnd="true" - android:layout_centerVertical="true" - android:layout_marginBottom="20dp" + android:layout_gravity="center_vertical" + android:layout_weight="1" android:background="@null" - android:paddingEnd="20dp" android:src="@drawable/delete" android:visibility="gone" /> -</RelativeLayout> +</LinearLayout> diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index b11dadcc2..0a7d58944 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -207,7 +207,6 @@ public abstract class PhotoPage extends ActivityState implements private ShareActionProvider mShareActionProvider; private Intent mShareIntent; - private boolean mIsPhotoChanged = true; private final PanoramaSupportCallback mUpdatePanoramaMenuItemsCallback = new PanoramaSupportCallback() { @Override @@ -516,7 +515,6 @@ public abstract class PhotoPage extends ActivityState implements public void onPhotoChanged(int index, Path item) { int oldIndex = mCurrentIndex; mCurrentIndex = index; - mIsPhotoChanged = true; if (mHasCameraScreennailOrPlaceholder) { if (mCurrentIndex > 0) { @@ -628,14 +626,6 @@ public abstract class PhotoPage extends ActivityState implements if (mCurrentPhoto == null) { return false; } - if (mIsPhotoChanged) { - if (mCurrentPhoto.getMediaType() == MediaObject.MEDIA_TYPE_VIDEO) { - mBottomControls.setSharePositionForVideo(mActivity); - } else { - mBottomControls.setSharePositionForImage(); - } - mIsPhotoChanged = false; - } switch (control) { case R.id.photopage_bottom_controls: return mShowBars; diff --git a/src/com/android/gallery3d/app/PhotoPageBottomControls.java b/src/com/android/gallery3d/app/PhotoPageBottomControls.java index f12f6fb69..80ae3875b 100644 --- a/src/com/android/gallery3d/app/PhotoPageBottomControls.java +++ b/src/com/android/gallery3d/app/PhotoPageBottomControls.java @@ -53,8 +53,6 @@ public class PhotoPageBottomControls implements OnClickListener { private static final int CONTAINER_ANIM_DURATION_MS = 200; private static final int CONTROL_ANIM_DURATION_MS = 150; - private ImageButton imgShare; - private RelativeLayout.LayoutParams defaultParams; private static Animation getControlAnimForVisibility(boolean visible) { Animation anim = visible ? new AlphaAnimation(0f, 1f) @@ -72,10 +70,6 @@ public class PhotoPageBottomControls implements OnClickListener { mContainer = (ViewGroup) inflater .inflate(R.layout.photopage_bottom_controls, mParentLayout, false); mParentLayout.addView(mContainer); - imgShare = (ImageButton) mContainer - .findViewById(R.id.photopage_bottom_control_share); - defaultParams = (RelativeLayout.LayoutParams) imgShare - .getLayoutParams(); for (int i = mContainer.getChildCount() - 1; i >= 0; i--) { View child = mContainer.getChildAt(i); child.setOnClickListener(this); @@ -90,30 +84,6 @@ public class PhotoPageBottomControls implements OnClickListener { mDelegate.refreshBottomControlsWhenReady(); } - public void setSharePositionForImage() { - RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) imgShare - .getLayoutParams(); - params.removeRule(RelativeLayout.ALIGN_PARENT_START); - params.removeRule(RelativeLayout.ALIGN_PARENT_LEFT); - params.leftMargin = 0; - params.addRule(RelativeLayout.CENTER_IN_PARENT,-1); - imgShare.setLayoutParams(params); - } - - public void setSharePositionForVideo(Context context) { - imgShare = (ImageButton) mContainer - .findViewById(R.id.photopage_bottom_control_share); - RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) imgShare - .getLayoutParams(); - params.addRule(RelativeLayout.ALIGN_PARENT_START,-1); - Resources r = context.getResources(); - int margin = (int) TypedValue.applyDimension( - TypedValue.COMPLEX_UNIT_DIP, 20, r.getDisplayMetrics()); - params.leftMargin = margin; - imgShare.setLayoutParams(params); - - } - private void hide() { mContainer.clearAnimation(); mContainerAnimOut.reset(); @@ -150,7 +120,7 @@ public class PhotoPageBottomControls implements OnClickListener { control.clearAnimation(); control.startAnimation(getControlAnimForVisibility(curVisibility)); } - control.setVisibility(curVisibility ? View.VISIBLE : View.INVISIBLE); + control.setVisibility(curVisibility ? View.VISIBLE : View.GONE); mControlsVisible.put(control, curVisibility); } } |
