Gallery2: Fix views overlap
"No photos found" and camera button were overlapped.
Camera button layout params changed and it was moved no data text below
and aligned center horizontal.
Change-Id: Idd76efaa54dd178eb3ff2cb5fae3ca17ef5acea3
diff --git a/res/values/ids.xml b/res/values/ids.xml
index f5b4a48..93ea5c0 100644
--- a/res/values/ids.xml
+++ b/res/values/ids.xml
@@ -23,4 +23,6 @@
<item type="id" name="ingest_notification_scanning" />
<item type="id" name="ingest_notification_importing" />
+
+ <item type="id" name="empty_album" />
</resources>
diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java
index ec65896..2b87f97 100755
--- a/src/com/android/gallery3d/app/AlbumSetPage.java
+++ b/src/com/android/gallery3d/app/AlbumSetPage.java
@@ -261,6 +261,7 @@
tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000"));
tvEmptyAlbum.setGravity(Gravity.CENTER);
tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
+ tvEmptyAlbum.setId(R.id.empty_album);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
@@ -412,8 +413,14 @@
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
- lp.addRule(RelativeLayout.CENTER_IN_PARENT);
+ if (tvEmptyAlbum != null && tvEmptyAlbum.getVisibility() == View.VISIBLE) {
+ lp.addRule(RelativeLayout.BELOW, tvEmptyAlbum.getId());
+ lp.addRule(RelativeLayout.CENTER_HORIZONTAL);
+ } else {
+ lp.addRule(RelativeLayout.CENTER_IN_PARENT);
+ }
galleryRoot.addView(mCameraButton, lp);
+
return true;
}