summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-04-15 16:35:44 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-04-15 16:35:44 +0000
commit1ca8bd0623a33234829ebad205be8c166d17d6c1 (patch)
treeff25ff3afde82a05219638e1370aae1fe8f2e573
parent7f5ea5f4180249ce5b0e7c4a28930791e07e7943 (diff)
parent3712a0cfa01170bfcb7807a191727d57bb3652fe (diff)
downloadandroid_packages_wallpapers_LivePicker-1ca8bd0623a33234829ebad205be8c166d17d6c1.tar.gz
android_packages_wallpapers_LivePicker-1ca8bd0623a33234829ebad205be8c166d17d6c1.tar.bz2
android_packages_wallpapers_LivePicker-1ca8bd0623a33234829ebad205be8c166d17d6c1.zip
Snap for 5470312 from 3712a0cfa01170bfcb7807a191727d57bb3652fe to qt-release
Change-Id: I024470e925f822828471ad982d533b9411f69eb3
-rw-r--r--res/layout/page_info.xml29
-rw-r--r--res/layout/page_settings.xml7
-rw-r--r--res/values-land/dimensions.xml20
-rw-r--r--res/values-ml/strings.xml3
-rw-r--r--res/values-ta/strings.xml3
-rw-r--r--res/values-ur/strings.xml3
-rw-r--r--res/values/dimensions.xml11
-rw-r--r--src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java1
-rw-r--r--src/com/android/wallpaper/livepicker/widget/ConstraintViewPager.java27
9 files changed, 86 insertions, 18 deletions
diff --git a/res/layout/page_info.xml b/res/layout/page_info.xml
index 7187b56..f7baad0 100644
--- a/res/layout/page_info.xml
+++ b/res/layout/page_info.xml
@@ -15,29 +15,35 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/page_info"
android:orientation="vertical"
- android:paddingHorizontal="@dimen/preview_attribution_pane_horizontal_padding"
- android:paddingVertical="@dimen/preview_attribution_pane_vertical_padding">
+ android:paddingHorizontal="@dimen/preview_attribution_pane_horizontal_padding">
+
+ <Space
+ android:id="@+id/preview_attribution_pane_title_spacer"
+ android:layout_width="0dp"
+ android:layout_height="@dimen/preview_attribution_pane_inner_spacer_height"/>
<TextView
android:id="@+id/preview_attribution_pane_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="start"
+ android:minHeight="@dimen/preview_attribution_pane_title_height"
android:ellipsize="end"
android:forceHasOverlappingRendering="false"
- android:gravity="center_horizontal"
+ android:gravity="center"
android:singleLine="true"
- android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Title"
+ android:textAppearance="@*android:style/TextAppearance.DeviceDefault.SearchResult.Title"
android:visibility="gone"/>
<TextView
android:id="@+id/preview_attribution_pane_author"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:minHeight="@dimen/preview_attribution_pane_author_height"
android:layout_marginTop="@dimen/preview_attribution_pane_author_top_margin"
android:forceHasOverlappingRendering="false"
- android:gravity="center_horizontal"
+ android:gravity="center"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:visibility="gone"/>
@@ -45,17 +51,24 @@
android:id="@+id/preview_attribution_pane_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="@dimen/preview_attribution_pane_description_top_margin"
+ android:minHeight="@dimen/preview_attribution_pane_description_height"
android:forceHasOverlappingRendering="false"
android:gravity="center_horizontal"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Caption"
android:visibility="gone"/>
+ <Space
+ android:id="@+id/preview_attribution_pane_spacer"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_marginTop="@dimen/preview_attribution_pane_inner_spacer_height"
+ android:layout_weight="1"/>
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
- android:layout_marginTop="@dimen/preview_attribution_pane_explore_top_margin"
+ android:layout_marginBottom="@dimen/preview_attribution_pane_button_bottom_margin"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
diff --git a/res/layout/page_settings.xml b/res/layout/page_settings.xml
index 25b4aec..5729aa3 100644
--- a/res/layout/page_settings.xml
+++ b/res/layout/page_settings.xml
@@ -24,10 +24,17 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
+ <Space
+ android:id="@+id/preview_attribution_pane_spacer"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ android:layout_weight="1"/>
+
<com.google.android.material.button.MaterialButton
android:id="@+id/preview_attribution_pane_set_wallpaper_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/preview_attribution_pane_button_bottom_margin"
style="@style/ButtonStyle"
android:text="@string/set_live_wallpaper"/>
diff --git a/res/values-land/dimensions.xml b/res/values-land/dimensions.xml
new file mode 100644
index 0000000..e2d5ffe
--- /dev/null
+++ b/res/values-land/dimensions.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<resources>
+ <!-- Dimensions for the preview attribution pane. -->
+ <dimen name="preview_attribution_pane_author_top_margin">8dp</dimen>
+ <dimen name="preview_attribution_pane_button_bottom_margin">14dp</dimen>
+</resources>
diff --git a/res/values-ml/strings.xml b/res/values-ml/strings.xml
index 03cc3e6..1117b69 100644
--- a/res/values-ml/strings.xml
+++ b/res/values-ml/strings.xml
@@ -35,6 +35,5 @@
<string name="explore_further" msgid="2891466461738034935">"അടുത്തറിയുക"</string>
<string name="tab_info" msgid="2612717074705274392">"വിവരം"</string>
<string name="tab_customize" msgid="5282247400178296263">"ഇഷ്‌ടാനുസൃതമാക്കുക"</string>
- <!-- no translation found for delete_wallpaper_confirmation (6449356646369781400) -->
- <skip />
+ <string name="delete_wallpaper_confirmation" msgid="6449356646369781400">"നിങ്ങളുടെ ഫോണിൽ നിന്ന് ഈ വാൾപേപ്പർ ഇല്ലാതാക്കണോ?"</string>
</resources>
diff --git a/res/values-ta/strings.xml b/res/values-ta/strings.xml
index df10ae3..945afc5 100644
--- a/res/values-ta/strings.xml
+++ b/res/values-ta/strings.xml
@@ -35,6 +35,5 @@
<string name="explore_further" msgid="2891466461738034935">"கண்டறி"</string>
<string name="tab_info" msgid="2612717074705274392">"தகவல்"</string>
<string name="tab_customize" msgid="5282247400178296263">"தனிப்பயனாக்கு"</string>
- <!-- no translation found for delete_wallpaper_confirmation (6449356646369781400) -->
- <skip />
+ <string name="delete_wallpaper_confirmation" msgid="6449356646369781400">"மொபைலில் இருந்து இந்த வால்பேப்பரை நீக்கவா?"</string>
</resources>
diff --git a/res/values-ur/strings.xml b/res/values-ur/strings.xml
index 8890527..2ae7341 100644
--- a/res/values-ur/strings.xml
+++ b/res/values-ur/strings.xml
@@ -35,6 +35,5 @@
<string name="explore_further" msgid="2891466461738034935">"دریافت کریں"</string>
<string name="tab_info" msgid="2612717074705274392">"معلومات"</string>
<string name="tab_customize" msgid="5282247400178296263">"حسب ضرورت بنائیں"</string>
- <!-- no translation found for delete_wallpaper_confirmation (6449356646369781400) -->
- <skip />
+ <string name="delete_wallpaper_confirmation" msgid="6449356646369781400">"اس وال پیپر کو آپ کے فون سے حذف کریں؟"</string>
</resources>
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index 5066ca3..9e92df7 100644
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -34,10 +34,13 @@
<!-- Dimensions for the preview attribution pane. -->
<dimen name="preview_attribution_pane_horizontal_padding">24dp</dimen>
- <dimen name="preview_attribution_pane_vertical_padding">13dp</dimen>
- <dimen name="preview_attribution_pane_author_top_margin">12dp</dimen>
- <dimen name="preview_attribution_pane_description_top_margin">2dp</dimen>
- <dimen name="preview_attribution_pane_explore_top_margin">12dp</dimen>
+ <dimen name="preview_attribution_pane_extra_spacer_height">16dp</dimen>
+ <dimen name="preview_attribution_pane_inner_spacer_height">14dp</dimen>
+ <dimen name="preview_attribution_pane_title_height">48dp</dimen>
+ <dimen name="preview_attribution_pane_author_height">24dp</dimen>
+ <dimen name="preview_attribution_pane_author_top_margin">0dp</dimen>
+ <dimen name="preview_attribution_pane_description_height">34dp</dimen>
+ <dimen name="preview_attribution_pane_button_bottom_margin">8dp</dimen>
<!-- Dimensions for the ConstraintViewPager on preview activity. -->
<dimen name="preview_viewpager_round_radius">12dp</dimen>
diff --git a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
index 095c8e1..9cd50c3 100644
--- a/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
+++ b/src/com/android/wallpaper/livepicker/LiveWallpaperPreview.java
@@ -176,6 +176,7 @@ public class LiveWallpaperPreview extends Activity {
if (SHOW_DUMMY_DATA) {
attributionTitle.setText("Diorama, Yosemite");
+ attributionTitle.setVisibility(View.VISIBLE);
attributionAuthor.setText("Live Earth Collection - Android Earth");
attributionAuthor.setVisibility(View.VISIBLE);
attributionDescription.setText("Lorem ipsum dolor sit amet, consectetur adipiscing"
diff --git a/src/com/android/wallpaper/livepicker/widget/ConstraintViewPager.java b/src/com/android/wallpaper/livepicker/widget/ConstraintViewPager.java
index c4dcf09..985cad6 100644
--- a/src/com/android/wallpaper/livepicker/widget/ConstraintViewPager.java
+++ b/src/com/android/wallpaper/livepicker/widget/ConstraintViewPager.java
@@ -24,36 +24,63 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.ViewPager;
+import com.android.wallpaper.livepicker.R;
+
/**
* When ConstraintViewPager is being measured, it will get all height of pages and makes itself
* height as the same as the maximum height.
*/
public class ConstraintViewPager extends ViewPager {
+ private final int mExtraSpacerHeight;
+
public ConstraintViewPager(@NonNull Context context) {
this(context, null /* attrs */);
}
public ConstraintViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
+ mExtraSpacerHeight = context.getResources().getDimensionPixelSize(
+ R.dimen.preview_attribution_pane_extra_spacer_height);
}
/**
* Visit all child views first and then determine the maximum height for ViewPager.
+ * Info page will add extra height in top area determined by empty space.
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int maxChildHeight = 0;
+ int infoChildHeight = 0;
+ int infoTopPadding = 0;
+ View infoPage = null;
for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i);
view.measure(widthMeasureSpec,
MeasureSpec.makeMeasureSpec(0 /* size */, MeasureSpec.UNSPECIFIED));
int childHeight = view.getMeasuredHeight();
+ // Get info page height and top padding.
+ if (view.getId() == R.id.page_info) {
+ infoPage = view;
+ infoChildHeight = childHeight;
+ infoTopPadding = view.getPaddingTop();
+ }
if (childHeight > maxChildHeight) {
maxChildHeight = childHeight;
}
}
+ // Add extra padding in info page top area if info page has enough empty space to
+ // accommodate above and below extra height.
+ // 1. "infoChildHeight - infoTopPadding" means info page height without extra padding.
+ // 2. "mExtraSpacerHeight * 2" means above and below extra height.
+ if (maxChildHeight > (infoChildHeight - infoTopPadding + mExtraSpacerHeight * 2)) {
+ if (infoPage != null && infoTopPadding != mExtraSpacerHeight) {
+ infoPage.setPadding(infoPage.getPaddingLeft(), mExtraSpacerHeight,
+ infoPage.getPaddingRight(), infoPage.getPaddingBottom());
+ }
+ }
+
if (maxChildHeight != 0) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(maxChildHeight, MeasureSpec.EXACTLY);
}