summaryrefslogtreecommitdiffstats
path: root/WallpaperPicker
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-02-13 10:40:07 -0800
committerSunny Goyal <sunnygoyal@google.com>2015-02-26 19:33:38 +0000
commit9c83a0da6d6faf4d8a81effd27997ffb12bf3fdd (patch)
tree4eb1a6b895a7489af6ddb17b8a97c6e93ba8581a /WallpaperPicker
parent560616da70648bed04c00aa804503ec72ace1337 (diff)
downloadandroid_packages_apps_Trebuchet-9c83a0da6d6faf4d8a81effd27997ffb12bf3fdd.zip
android_packages_apps_Trebuchet-9c83a0da6d6faf4d8a81effd27997ffb12bf3fdd.tar.gz
android_packages_apps_Trebuchet-9c83a0da6d6faf4d8a81effd27997ffb12bf3fdd.tar.bz2
Cleaning up some resources in WallpaperPickerActivity
Change-Id: I4923403c0c094d0ae0b00e3a08a13099c3addb10
Diffstat (limited to 'WallpaperPicker')
-rw-r--r--WallpaperPicker/res/layout/wallpaper_cropper.xml3
-rw-r--r--WallpaperPicker/res/layout/wallpaper_picker.xml42
-rw-r--r--WallpaperPicker/res/layout/wallpaper_picker_image_picker_item.xml1
-rw-r--r--WallpaperPicker/res/layout/wallpaper_picker_item.xml1
-rw-r--r--WallpaperPicker/res/layout/wallpaper_picker_live_wallpaper_item.xml1
-rw-r--r--WallpaperPicker/res/layout/wallpaper_picker_third_party_item.xml1
-rw-r--r--WallpaperPicker/res/values-sw720dp-v19/styles.xml2
-rw-r--r--WallpaperPicker/res/values-sw720dp/styles.xml2
-rw-r--r--WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java2
-rw-r--r--WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java2
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java64
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperRootView.java39
12 files changed, 46 insertions, 114 deletions
diff --git a/WallpaperPicker/res/layout/wallpaper_cropper.xml b/WallpaperPicker/res/layout/wallpaper_cropper.xml
index abb8608..ffe8df0 100644
--- a/WallpaperPicker/res/layout/wallpaper_cropper.xml
+++ b/WallpaperPicker/res/layout/wallpaper_cropper.xml
@@ -19,7 +19,6 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/wallpaper_root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.android.launcher3.CropView
@@ -28,7 +27,7 @@
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/loading"
- style="@android:style/Widget.Holo.ProgressBar.Large"
+ style="?android:attr/progressBarStyleLarge"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/WallpaperPicker/res/layout/wallpaper_picker.xml b/WallpaperPicker/res/layout/wallpaper_picker.xml
index c36493d..0b970b0 100644
--- a/WallpaperPicker/res/layout/wallpaper_picker.xml
+++ b/WallpaperPicker/res/layout/wallpaper_picker.xml
@@ -18,60 +18,74 @@
*/
-->
-<com.android.launcher3.WallpaperRootView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/wallpaper_root"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:launcher="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent" >
+
<com.android.launcher3.CropView
android:id="@+id/cropView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
+
<ProgressBar
android:id="@+id/loading"
- style="@android:style/Widget.Holo.ProgressBar.Large"
- android:visibility="invisible"
+ style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_centerInParent="true"
+ android:layout_gravity="center"
android:indeterminate="true"
android:indeterminateOnly="true"
- android:background="@android:color/transparent" />
+ android:visibility="invisible" />
+
<LinearLayout
android:id="@+id/wallpaper_strip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
+ android:layout_gravity="bottom"
+ android:fitsSystemWindows="true"
android:orientation="vertical" >
+
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/tile_shadow_top" />
+
<HorizontalScrollView
android:id="@+id/wallpaper_scroll_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
- <LinearLayout android:id="@+id/master_wallpaper_list"
+
+ <LinearLayout
+ android:id="@+id/master_wallpaper_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
- <LinearLayout android:id="@+id/wallpaper_list"
+
+ <LinearLayout
+ android:id="@+id/wallpaper_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
- <LinearLayout android:id="@+id/live_wallpaper_list"
+
+ <LinearLayout
+ android:id="@+id/live_wallpaper_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
- <LinearLayout android:id="@+id/third_party_wallpaper_list"
+
+ <LinearLayout
+ android:id="@+id/third_party_wallpaper_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
</LinearLayout>
</HorizontalScrollView>
+
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@drawable/tile_shadow_bottom" />
</LinearLayout>
-</com.android.launcher3.WallpaperRootView>
+
+</FrameLayout> \ No newline at end of file
diff --git a/WallpaperPicker/res/layout/wallpaper_picker_image_picker_item.xml b/WallpaperPicker/res/layout/wallpaper_picker_image_picker_item.xml
index ae3c43d..dc65244 100644
--- a/WallpaperPicker/res/layout/wallpaper_picker_image_picker_item.xml
+++ b/WallpaperPicker/res/layout/wallpaper_picker_image_picker_item.xml
@@ -20,7 +20,6 @@
android:layout_height="@dimen/wallpaperThumbnailHeight"
android:focusable="true"
android:clickable="true"
- android:background="@drawable/wallpaper_tile_fg"
android:foreground="@drawable/wallpaper_tile_fg">
<ImageView
android:id="@+id/wallpaper_image"
diff --git a/WallpaperPicker/res/layout/wallpaper_picker_item.xml b/WallpaperPicker/res/layout/wallpaper_picker_item.xml
index 0ac8f97..3f57fcd 100644
--- a/WallpaperPicker/res/layout/wallpaper_picker_item.xml
+++ b/WallpaperPicker/res/layout/wallpaper_picker_item.xml
@@ -20,7 +20,6 @@
android:layout_height="@dimen/wallpaperThumbnailHeight"
android:focusable="true"
android:clickable="true"
- android:background="@drawable/wallpaper_tile_fg"
android:foreground="@drawable/wallpaper_tile_fg">
<ImageView
android:id="@+id/wallpaper_image"
diff --git a/WallpaperPicker/res/layout/wallpaper_picker_live_wallpaper_item.xml b/WallpaperPicker/res/layout/wallpaper_picker_live_wallpaper_item.xml
index 29fdb1b..2b152fc 100644
--- a/WallpaperPicker/res/layout/wallpaper_picker_live_wallpaper_item.xml
+++ b/WallpaperPicker/res/layout/wallpaper_picker_live_wallpaper_item.xml
@@ -20,7 +20,6 @@
android:layout_height="@dimen/wallpaperThumbnailHeight"
android:focusable="true"
android:clickable="true"
- android:background="@drawable/wallpaper_tile_fg"
android:foreground="@drawable/wallpaper_tile_fg">
<ImageView
android:id="@+id/wallpaper_image"
diff --git a/WallpaperPicker/res/layout/wallpaper_picker_third_party_item.xml b/WallpaperPicker/res/layout/wallpaper_picker_third_party_item.xml
index 68661bc..a7e3a0c 100644
--- a/WallpaperPicker/res/layout/wallpaper_picker_third_party_item.xml
+++ b/WallpaperPicker/res/layout/wallpaper_picker_third_party_item.xml
@@ -20,7 +20,6 @@
android:layout_height="@dimen/wallpaperThumbnailHeight"
android:focusable="true"
android:clickable="true"
- android:background="@drawable/wallpaper_tile_fg"
android:foreground="@drawable/wallpaper_tile_fg">
<ImageView
android:id="@+id/wallpaper_image"
diff --git a/WallpaperPicker/res/values-sw720dp-v19/styles.xml b/WallpaperPicker/res/values-sw720dp-v19/styles.xml
index 9107851..d8dab22 100644
--- a/WallpaperPicker/res/values-sw720dp-v19/styles.xml
+++ b/WallpaperPicker/res/values-sw720dp-v19/styles.xml
@@ -18,7 +18,7 @@
-->
<resources>
- <style name="Theme" parent="android:Theme.Holo.Wallpaper.NoTitleBar">
+ <style name="Theme" parent="@android:style/Theme.DeviceDefault.Wallpaper.NoTitleBar">
<item name="android:windowActionModeOverlay">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
diff --git a/WallpaperPicker/res/values-sw720dp/styles.xml b/WallpaperPicker/res/values-sw720dp/styles.xml
index b489090..12f8884 100644
--- a/WallpaperPicker/res/values-sw720dp/styles.xml
+++ b/WallpaperPicker/res/values-sw720dp/styles.xml
@@ -18,7 +18,7 @@
-->
<resources>
- <style name="Theme" parent="android:Theme.Holo.Wallpaper.NoTitleBar">
+ <style name="Theme" parent="@android:style/Theme.DeviceDefault.Wallpaper.NoTitleBar">
<item name="android:windowActionModeOverlay">true</item>
</style>
</resources>
diff --git a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java
index 0a9050c..72f2d7e 100644
--- a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java
+++ b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java
@@ -90,8 +90,6 @@ public class LiveWallpaperListAdapter extends BaseAdapter implements ListAdapter
view = convertView;
}
- WallpaperPickerActivity.setWallpaperItemPaddingToZero((FrameLayout) view);
-
LiveWallpaperTile wallpaperInfo = mWallpapers.get(position);
wallpaperInfo.setView(view);
ImageView image = (ImageView) view.findViewById(R.id.wallpaper_image);
diff --git a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
index 7a4d48c..27e65aa 100644
--- a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
+++ b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java
@@ -126,8 +126,6 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements
view = convertView;
}
- WallpaperPickerActivity.setWallpaperItemPaddingToZero((FrameLayout) view);
-
ResolveInfo info = mThirdPartyWallpaperPickers.get(position).mResolveInfo;
TextView label = (TextView) view.findViewById(R.id.wallpaper_item_label);
label.setText(info.loadLabel(mPackageManager));
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
index cbed61b..d16fc31 100644
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -34,11 +34,9 @@ import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.PorterDuff;
-import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LevelListDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
@@ -95,7 +93,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
private OnClickListener mThumbnailOnClickListener;
private LinearLayout mWallpapersView;
- private View mWallpaperStrip;
+ private HorizontalScrollView mWallpaperScrollContainer;
private ActionMode.Callback mActionModeCallback;
private ActionMode mActionMode;
@@ -313,10 +311,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
}
}
- public void setWallpaperStripYOffset(float offset) {
- mWallpaperStrip.setPadding(0, 0, 0, (int) offset);
- }
-
/**
* shows the system wallpaper behind the window and hides the {@link
* #mCropView} if visible
@@ -369,9 +363,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
mCropView.setVisibility(View.INVISIBLE);
mProgressView = findViewById(R.id.loading);
-
-
- mWallpaperStrip = findViewById(R.id.wallpaper_strip);
+ mWallpaperScrollContainer = (HorizontalScrollView) findViewById(R.id.wallpaper_scroll_container);
mCropView.setTouchCallback(new CropView.TouchCallback() {
ViewPropertyAnimator mAnim;
@Override
@@ -379,15 +371,15 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
if (mAnim != null) {
mAnim.cancel();
}
- if (mWallpaperStrip.getAlpha() == 1f) {
+ if (mWallpaperScrollContainer.getAlpha() == 1f) {
mIgnoreNextTap = true;
}
- mAnim = mWallpaperStrip.animate();
+ mAnim = mWallpaperScrollContainer.animate();
mAnim.alpha(0f)
.setDuration(150)
.withEndAction(new Runnable() {
public void run() {
- mWallpaperStrip.setVisibility(View.INVISIBLE);
+ mWallpaperScrollContainer.setVisibility(View.INVISIBLE);
}
});
mAnim.setInterpolator(new AccelerateInterpolator(0.75f));
@@ -405,8 +397,8 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
if (mAnim != null) {
mAnim.cancel();
}
- mWallpaperStrip.setVisibility(View.VISIBLE);
- mAnim = mWallpaperStrip.animate();
+ mWallpaperScrollContainer.setVisibility(View.VISIBLE);
+ mAnim = mWallpaperScrollContainer.animate();
mAnim.alpha(1f)
.setDuration(150)
.setInterpolator(new DecelerateInterpolator(0.75f));
@@ -487,7 +479,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
LinearLayout masterWallpaperList = (LinearLayout) findViewById(R.id.master_wallpaper_list);
FrameLayout pickImageTile = (FrameLayout) getLayoutInflater().
inflate(R.layout.wallpaper_picker_image_picker_item, masterWallpaperList, false);
- setWallpaperItemPaddingToZero(pickImageTile);
masterWallpaperList.addView(pickImageTile, 0);
// Make its background the last photo taken on external storage
@@ -659,17 +650,14 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
}
private void initializeScrollForRtl() {
- final HorizontalScrollView scroll =
- (HorizontalScrollView) findViewById(R.id.wallpaper_scroll_container);
-
- if (scroll.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
- final ViewTreeObserver observer = scroll.getViewTreeObserver();
+ if (mWallpaperScrollContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ final ViewTreeObserver observer = mWallpaperScrollContainer.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
public void onGlobalLayout() {
LinearLayout masterWallpaperList =
(LinearLayout) findViewById(R.id.master_wallpaper_list);
- scroll.scrollTo(masterWallpaperList.getWidth(), 0);
- scroll.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+ mWallpaperScrollContainer.scrollTo(masterWallpaperList.getWidth(), 0);
+ mWallpaperScrollContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
}
@@ -696,10 +684,10 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
protected void onStop() {
super.onStop();
- mWallpaperStrip = findViewById(R.id.wallpaper_strip);
- if (mWallpaperStrip.getAlpha() < 1f) {
- mWallpaperStrip.setAlpha(1f);
- mWallpaperStrip.setVisibility(View.VISIBLE);
+ mWallpaperScrollContainer = (HorizontalScrollView) findViewById(R.id.wallpaper_scroll_container);
+ if (mWallpaperScrollContainer.getAlpha() < 1f) {
+ mWallpaperScrollContainer.setAlpha(1f);
+ mWallpaperScrollContainer.setVisibility(View.VISIBLE);
}
}
@@ -823,7 +811,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
final FrameLayout pickedImageThumbnail = (FrameLayout) getLayoutInflater().
inflate(R.layout.wallpaper_picker_item, mWallpapersView, false);
pickedImageThumbnail.setVisibility(View.GONE);
- setWallpaperItemPaddingToZero(pickedImageThumbnail);
mWallpapersView.addView(pickedImageThumbnail, 0);
// Load the thumbnail
@@ -886,11 +873,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
}
}
- static void setWallpaperItemPaddingToZero(FrameLayout frameLayout) {
- frameLayout.setPadding(0, 0, 0, 0);
- frameLayout.setForeground(new ZeroPaddingDrawable(frameLayout.getForeground()));
- }
-
private void addLongPressHandler(View v) {
v.setOnLongClickListener(mLongClickListener);
}
@@ -1089,20 +1071,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
return mSavedImages;
}
- static class ZeroPaddingDrawable extends LevelListDrawable {
- public ZeroPaddingDrawable(Drawable d) {
- super();
- addLevel(0, 0, d);
- setLevel(0);
- }
-
- @Override
- public boolean getPadding(Rect padding) {
- padding.set(0, 0, 0, 0);
- return true;
- }
- }
-
private static class SimpleWallpapersAdapter extends ArrayAdapter<WallpaperTileInfo> {
private final LayoutInflater mLayoutInflater;
@@ -1130,8 +1098,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
view = convertView;
}
- setWallpaperItemPaddingToZero((FrameLayout) view);
-
ImageView image = (ImageView) view.findViewById(R.id.wallpaper_image);
if (thumb != null) {
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperRootView.java b/WallpaperPicker/src/com/android/launcher3/WallpaperRootView.java
deleted file mode 100644
index ceaa043..0000000
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperRootView.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-package com.android.launcher3;
-
-import android.content.Context;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.widget.RelativeLayout;
-
-public class WallpaperRootView extends RelativeLayout {
- private final WallpaperPickerActivity a;
- public WallpaperRootView(Context context, AttributeSet attrs) {
- super(context, attrs);
- a = (WallpaperPickerActivity) context;
- }
- public WallpaperRootView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- a = (WallpaperPickerActivity) context;
- }
-
- protected boolean fitSystemWindows(Rect insets) {
- a.setWallpaperStripYOffset(insets.bottom);
- return true;
- }
-}