summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/PagedViewExtendedLayout.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2010-11-09 17:19:49 -0800
committerWinson Chung <winsonc@google.com>2010-11-10 11:46:26 -0800
commit45e1d6ec0a213a444d01466c3d4f1ded5508ed63 (patch)
tree277917556c14c91b5b4d0045f700b65cf2bef2a9 /src/com/android/launcher2/PagedViewExtendedLayout.java
parent0811495e242c0312ada9e7873fa290e503295500 (diff)
downloadandroid_packages_apps_Trebuchet-45e1d6ec0a213a444d01466c3d4f1ded5508ed63.tar.gz
android_packages_apps_Trebuchet-45e1d6ec0a213a444d01466c3d4f1ded5508ed63.tar.bz2
android_packages_apps_Trebuchet-45e1d6ec0a213a444d01466c3d4f1ded5508ed63.zip
Modifying wallpapers customization page to look like widgets.
- Disallowing touch handling when there are no children Change-Id: I925d6f1f862f8c7994a80c4eaacc80f8d59f6ab2
Diffstat (limited to 'src/com/android/launcher2/PagedViewExtendedLayout.java')
-rw-r--r--src/com/android/launcher2/PagedViewExtendedLayout.java71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/com/android/launcher2/PagedViewExtendedLayout.java b/src/com/android/launcher2/PagedViewExtendedLayout.java
new file mode 100644
index 000000000..52df9f1ed
--- /dev/null
+++ b/src/com/android/launcher2/PagedViewExtendedLayout.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 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.launcher2;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.widget.LinearLayout;
+
+/**
+ * The linear layout used strictly for the widget/wallpaper tab of the customization tray
+ */
+public class PagedViewExtendedLayout extends LinearLayout {
+ static final String TAG = "PagedViewWidgetLayout";
+
+ public PagedViewExtendedLayout(Context context) {
+ this(context, null);
+ }
+
+ public PagedViewExtendedLayout(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public PagedViewExtendedLayout(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ // We eat up the touch events here, since the PagedView (which uses the same swiping
+ // touch code as Workspace previously) uses onInterceptTouchEvent() to determine when
+ // the user is scrolling between pages. This means that if the pages themselves don't
+ // handle touch events, it gets forwarded up to PagedView itself, and it's own
+ // onTouchEvent() handling will prevent further intercept touch events from being called
+ // (it's the same view in that case). This is not ideal, but to prevent more changes,
+ // we just always mark the touch event as handled.
+ return super.onTouchEvent(event) || true;
+ }
+
+ @Override
+ protected boolean onSetAlpha(int alpha) {
+ return true;
+ }
+
+ @Override
+ public void setAlpha(float alpha) {
+ setChildrenAlpha(alpha);
+ super.setAlpha(alpha);
+ }
+
+ private void setChildrenAlpha(float alpha) {
+ final int childCount = getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ getChildAt(i).setAlpha(alpha);
+ }
+ }
+}