summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--res/layout-port/launcher.xml3
-rw-r--r--src/com/android/launcher3/AppsCustomizeTabHost.java15
-rw-r--r--src/com/android/launcher3/DragLayer.java22
-rw-r--r--src/com/android/launcher3/Insettable.java24
-rw-r--r--src/com/android/launcher3/Launcher.java3
-rw-r--r--src/com/android/launcher3/PagedView.java10
-rw-r--r--src/com/android/launcher3/Workspace.java11
8 files changed, 79 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..f830c66eb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+db_files
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index dd3ad47e4..9844a370c 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -27,8 +27,7 @@
<com.android.launcher3.DragLayer
android:id="@+id/drag_layer"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fitsSystemWindows="true">
+ android:layout_height="match_parent">
<!-- The workspace contains 5 screens of cells -->
<com.android.launcher3.Workspace
diff --git a/src/com/android/launcher3/AppsCustomizeTabHost.java b/src/com/android/launcher3/AppsCustomizeTabHost.java
index 71219cd57..8aef864b4 100644
--- a/src/com/android/launcher3/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher3/AppsCustomizeTabHost.java
@@ -22,6 +22,7 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -36,7 +37,7 @@ import android.widget.TextView;
import java.util.ArrayList;
public class AppsCustomizeTabHost extends TabHost implements LauncherTransitionable,
- TabHost.OnTabChangeListener {
+ TabHost.OnTabChangeListener, Insettable {
static final String LOG_TAG = "AppsCustomizeTabHost";
private static final String APPS_TAB_TAG = "APPS";
@@ -53,6 +54,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
private boolean mTransitioningToWorkspace;
private boolean mResetAfterTransition;
private Runnable mRelayoutAndMakeVisible;
+ private final Rect mInsets = new Rect();
public AppsCustomizeTabHost(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -86,6 +88,17 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
setContentTypeImmediate(AppsCustomizePagedView.ContentType.Widgets);
}
+ @Override
+ public void setInsets(Rect insets) {
+ mInsets.set(insets);
+ FrameLayout.LayoutParams flp = (LayoutParams) mContent.getLayoutParams();
+ flp.topMargin = insets.top;
+ flp.bottomMargin = insets.bottom;
+ flp.leftMargin = insets.left;
+ flp.rightMargin = insets.right;
+ mContent.setLayoutParams(flp);
+ }
+
/**
* Setup the tab host and create all necessary tabs.
*/
diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java
index be0d47b68..9c649edda 100644
--- a/src/com/android/launcher3/DragLayer.java
+++ b/src/com/android/launcher3/DragLayer.java
@@ -69,6 +69,8 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
public static final int ANIMATION_END_FADE_OUT = 1;
public static final int ANIMATION_END_REMAIN_VISIBLE = 2;
+ private final Rect mInsets = new Rect();
+
/**
* Used to create a new DragLayer from XML.
*
@@ -97,6 +99,26 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang
return mDragController.dispatchKeyEvent(event) || super.dispatchKeyEvent(event);
}
+ @Override
+ protected boolean fitSystemWindows(Rect insets) {
+ final int n = getChildCount();
+ for (int i = 0; i < n; i++) {
+ final View child = getChildAt(i);
+ final FrameLayout.LayoutParams flp = (FrameLayout.LayoutParams) child.getLayoutParams();
+ if (child instanceof Insettable) {
+ ((Insettable)child).setInsets(insets);
+ } else {
+ flp.topMargin += (insets.top - mInsets.top);
+ flp.leftMargin += (insets.left - mInsets.left);
+ flp.rightMargin += (insets.right - mInsets.right);
+ flp.bottomMargin += (insets.bottom - mInsets.bottom);
+ }
+ child.setLayoutParams(flp);
+ }
+ mInsets.set(insets);
+ return true; // I'll take it from here
+ }
+
private boolean isEventOverFolderTextRegion(Folder folder, MotionEvent ev) {
getDescendantRectRelativeToSelf(folder.getEditTextRegion(), mHitRect);
if (mHitRect.contains((int) ev.getX(), (int) ev.getY())) {
diff --git a/src/com/android/launcher3/Insettable.java b/src/com/android/launcher3/Insettable.java
new file mode 100644
index 000000000..1d2356c65
--- /dev/null
+++ b/src/com/android/launcher3/Insettable.java
@@ -0,0 +1,24 @@
+/*
+ * 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.graphics.Rect;
+
+public interface Insettable {
+
+ void setInsets(Rect insets);
+} \ No newline at end of file
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index bdd9add14..29c4e3eaf 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1103,7 +1103,8 @@ public class Launcher extends Activity
mDragLayer = (DragLayer) findViewById(R.id.drag_layer);
mWorkspace = (Workspace) mDragLayer.findViewById(R.id.workspace);
- mLauncherView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
+ mLauncherView.setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
mWorkspaceBackgroundDrawable = getResources().getDrawable(R.drawable.workspace_bg);
// Setup the drag layer
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 76c9a3205..bdb0d5819 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -260,6 +260,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
// Bouncer
private boolean mTopAlignPageWhenShrinkingForBouncer = false;
+ protected final Rect mInsets = new Rect();
+
public interface PageSwitchListener {
void onPageSwitch(View newPage, int newPageIndex);
}
@@ -798,7 +800,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
childWidth = widthSize - horizontalPadding;
- childHeight = heightSize - verticalPadding;
+ childHeight = heightSize - verticalPadding - mInsets.top - mInsets.bottom;
} else {
childWidthMode = MeasureSpec.EXACTLY;
@@ -873,17 +875,15 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
for (int i = startIndex; i != endIndex; i += delta) {
-
final View child = getPageAt(i);
LayoutParams lp = (LayoutParams) child.getLayoutParams();
int childTop;
-
if (lp.isFullScreenPage) {
childTop = offsetY;
} else {
- childTop = offsetY + getPaddingTop();
+ childTop = offsetY + getPaddingTop() + mInsets.top;
if (mCenterPagesVertically) {
- childTop += ((getViewportHeight() - verticalPadding) - child.getMeasuredHeight()) / 2;
+ childTop += (getViewportHeight() - mInsets.top - mInsets.bottom - verticalPadding - child.getMeasuredHeight()) / 2;
}
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index a8ca36b7d..3f63d743a 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -71,7 +71,8 @@ import java.util.Iterator;
*/
public class Workspace extends SmoothPagedView
implements DropTarget, DragSource, DragScroller, View.OnTouchListener,
- DragController.DragListener, LauncherTransitionable, ViewGroup.OnHierarchyChangeListener {
+ DragController.DragListener, LauncherTransitionable, ViewGroup.OnHierarchyChangeListener,
+ Insettable {
private static final String TAG = "Launcher.Workspace";
// Y rotation to apply to the workspace screens
@@ -318,6 +319,11 @@ public class Workspace extends SmoothPagedView
}
}
+ @Override
+ public void setInsets(Rect insets) {
+ mInsets.set(insets);
+ }
+
// estimate the size of a widget with spans hSpan, vSpan. return MAX_VALUE for each
// dimension if unsuccessful
public int[] estimateItemSize(int hSpan, int vSpan,
@@ -525,6 +531,9 @@ public class Workspace extends SmoothPagedView
CellLayout.LayoutParams lp = new CellLayout.LayoutParams(0, 0, spanX, spanY);
lp.canReorder = false;
lp.isFullscreen = true;
+ if (customContent instanceof Insettable) {
+ ((Insettable)customContent).setInsets(mInsets);
+ }
customScreen.addViewToCellLayout(customContent, 0, 0, lp, true);
mCustomContentCallbacks = callbacks;