Merge "Initial changes to tweak layout." into ub-launcher3-calgary
This commit is contained in:
@@ -44,7 +44,8 @@
|
|||||||
android:id="@+id/hotseat"
|
android:id="@+id/hotseat"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="right" />
|
android:layout_gravity="right"
|
||||||
|
launcher:layout_ignoreInsets="true" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/drop_target_bar"
|
android:id="@+id/drop_target_bar"
|
||||||
@@ -56,7 +57,7 @@
|
|||||||
|
|
||||||
<com.android.launcher3.pageindicators.PageIndicatorCaretLandscape
|
<com.android.launcher3.pageindicators.PageIndicatorCaretLandscape
|
||||||
android:id="@+id/page_indicator"
|
android:id="@+id/page_indicator"
|
||||||
android:layout_width="48dp"
|
android:layout_width="@dimen/dynamic_grid_page_indicator_height"
|
||||||
android:layout_height="@dimen/dynamic_grid_page_indicator_height"
|
android:layout_height="@dimen/dynamic_grid_page_indicator_height"
|
||||||
android:layout_gravity="bottom|left"/>
|
android:layout_gravity="bottom|left"/>
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,8 @@
|
|||||||
<include layout="@layout/hotseat"
|
<include layout="@layout/hotseat"
|
||||||
android:id="@+id/hotseat"
|
android:id="@+id/hotseat"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
launcher:layout_ignoreInsets="true" />
|
||||||
|
|
||||||
<include layout="@layout/overview_panel"
|
<include layout="@layout/overview_panel"
|
||||||
android:id="@+id/overview_panel"
|
android:id="@+id/overview_panel"
|
||||||
|
|||||||
@@ -44,7 +44,8 @@
|
|||||||
<include layout="@layout/hotseat"
|
<include layout="@layout/hotseat"
|
||||||
android:id="@+id/hotseat"
|
android:id="@+id/hotseat"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
launcher:layout_ignoreInsets="true" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/drop_target_bar"
|
android:id="@+id/drop_target_bar"
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="@dimen/container_bounds_inset"
|
|
||||||
android:paddingTop="@dimen/container_bounds_inset"
|
|
||||||
launcher:revealBackground="@drawable/quantum_panel_shape">
|
launcher:revealBackground="@drawable/quantum_panel_shape">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
@@ -62,12 +60,10 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/all_apps_search_bar_height"
|
android:layout_height="@dimen/all_apps_search_bar_height"
|
||||||
android:layout_gravity="center|top"
|
android:layout_gravity="center|top"
|
||||||
android:paddingLeft="@dimen/container_fastscroll_thumb_max_width"
|
android:paddingTop="@dimen/all_apps_search_bar_margin_top"
|
||||||
android:paddingRight="@dimen/container_fastscroll_thumb_max_width"
|
|
||||||
android:gravity="center|bottom"
|
android:gravity="center|bottom"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:saveEnabled="false"
|
android:saveEnabled="false">
|
||||||
android:paddingTop="@dimen/all_apps_search_bar_margin_top" >
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|||||||
@@ -21,8 +21,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:paddingTop="@dimen/all_apps_icon_top_bottom_padding"
|
|
||||||
android:paddingBottom="@dimen/all_apps_icon_top_bottom_padding"
|
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
launcher:iconDisplay="all_apps" />
|
launcher:iconDisplay="all_apps"
|
||||||
|
launcher:centerVertically="true" />
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
android:id="@+id/widgets_view"
|
android:id="@+id/widgets_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:paddingTop="@dimen/container_bounds_inset"
|
|
||||||
android:paddingBottom="@dimen/container_bounds_inset"
|
|
||||||
android:descendantFocusability="afterDescendants"
|
android:descendantFocusability="afterDescendants"
|
||||||
launcher:revealBackground="@drawable/quantum_panel_shape_dark"
|
launcher:revealBackground="@drawable/quantum_panel_shape_dark"
|
||||||
android:theme="@style/WidgetContainerTheme">
|
android:theme="@style/WidgetContainerTheme">
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2009 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>
|
|
||||||
<!-- Container -->
|
|
||||||
<dimen name="container_max_width">736dp</dimen>
|
|
||||||
</resources>
|
|
||||||
@@ -15,21 +15,15 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
<!-- Container -->
|
|
||||||
<dimen name="container_min_margin">16dp</dimen>
|
|
||||||
|
|
||||||
<!-- All Apps -->
|
<!-- All Apps -->
|
||||||
<dimen name="all_apps_grid_view_start_margin">0dp</dimen>
|
<dimen name="all_apps_grid_view_start_margin">0dp</dimen>
|
||||||
<dimen name="all_apps_grid_section_text_size">26sp</dimen>
|
<dimen name="all_apps_grid_section_text_size">26sp</dimen>
|
||||||
<dimen name="all_apps_icon_top_bottom_padding">12dp</dimen>
|
|
||||||
<dimen name="all_apps_background_canvas_width">850dp</dimen>
|
<dimen name="all_apps_background_canvas_width">850dp</dimen>
|
||||||
<dimen name="all_apps_background_canvas_height">525dp</dimen>
|
<dimen name="all_apps_background_canvas_height">525dp</dimen>
|
||||||
<dimen name="all_apps_icon_width_gap">36dp</dimen>
|
|
||||||
|
|
||||||
<!-- Widget tray -->
|
<!-- Widget tray -->
|
||||||
<dimen name="widget_section_indent">56dp</dimen>
|
<dimen name="widget_section_indent">56dp</dimen>
|
||||||
|
|
||||||
|
|
||||||
<!-- DragController -->
|
<!-- DragController -->
|
||||||
<dimen name="drag_flingToDeleteMinVelocity">-1000dp</dimen>
|
<dimen name="drag_flingToDeleteMinVelocity">-1000dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
<!-- All Apps -->
|
<!-- All Apps -->
|
||||||
<dimen name="all_apps_button_scale_down">8dp</dimen>
|
<dimen name="all_apps_button_scale_down">8dp</dimen>
|
||||||
<dimen name="all_apps_search_bar_height">54dp</dimen>
|
<dimen name="all_apps_search_bar_height">54dp</dimen>
|
||||||
<dimen name="all_apps_icon_top_bottom_padding">14dp</dimen>
|
|
||||||
<dimen name="all_apps_empty_search_message_top_offset">64dp</dimen>
|
<dimen name="all_apps_empty_search_message_top_offset">64dp</dimen>
|
||||||
<dimen name="all_apps_empty_search_bg_top_offset">180dp</dimen>
|
<dimen name="all_apps_empty_search_bg_top_offset">180dp</dimen>
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2016 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>
|
|
||||||
<!-- Container -->
|
|
||||||
<dimen name="container_max_width">736dp</dimen>
|
|
||||||
</resources>
|
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
</attr>
|
</attr>
|
||||||
<attr name="deferShadowGeneration" format="boolean" />
|
<attr name="deferShadowGeneration" format="boolean" />
|
||||||
<attr name="customShadows" format="boolean" />
|
<attr name="customShadows" format="boolean" />
|
||||||
|
<attr name="centerVertically" format="boolean" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<!-- PagedView specific attributes. These attributes are used to customize
|
<!-- PagedView specific attributes. These attributes are used to customize
|
||||||
|
|||||||
+16
-14
@@ -16,20 +16,26 @@
|
|||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
<!-- Dynamic Grid -->
|
<!-- Dynamic Grid -->
|
||||||
<dimen name="dynamic_grid_edge_margin">6dp</dimen>
|
<dimen name="dynamic_grid_edge_margin">8dp</dimen>
|
||||||
<dimen name="dynamic_grid_page_indicator_height">24dp</dimen>
|
<dimen name="dynamic_grid_page_indicator_height">28dp</dimen>
|
||||||
<dimen name="dynamic_grid_page_indicator_line_height">1dp</dimen>
|
<dimen name="dynamic_grid_page_indicator_line_height">1dp</dimen>
|
||||||
<dimen name="dynamic_grid_page_indicator_extra_touch_height">12dp</dimen>
|
<dimen name="dynamic_grid_page_indicator_extra_touch_height">12dp</dimen>
|
||||||
<dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen>
|
<dimen name="dynamic_grid_page_indicator_gutter_width_left_nav_bar">38dp</dimen>
|
||||||
<dimen name="dynamic_grid_workspace_page_spacing">8dp</dimen>
|
<dimen name="dynamic_grid_page_indicator_gutter_width_right_nav_bar">48dp</dimen>
|
||||||
|
<dimen name="dynamic_grid_icon_drawable_padding">8dp</dimen>
|
||||||
<dimen name="dynamic_grid_overview_min_icon_zone_height">80dp</dimen>
|
<dimen name="dynamic_grid_overview_min_icon_zone_height">80dp</dimen>
|
||||||
<dimen name="dynamic_grid_overview_max_icon_zone_height">120dp</dimen>
|
<dimen name="dynamic_grid_overview_max_icon_zone_height">120dp</dimen>
|
||||||
<dimen name="dynamic_grid_overview_bar_item_width">80dp</dimen>
|
<dimen name="dynamic_grid_overview_bar_item_width">80dp</dimen>
|
||||||
<dimen name="dynamic_grid_overview_bar_spacer_width">20dp</dimen>
|
<dimen name="dynamic_grid_overview_bar_spacer_width">25dp</dimen>
|
||||||
|
<dimen name="dynamic_grid_hotseat_height">88dp</dimen>
|
||||||
|
<dimen name="dynamic_grid_hotseat_top_padding">12dp</dimen>
|
||||||
|
<dimen name="dynamic_grid_hotseat_gutter_width">24dp</dimen>
|
||||||
<dimen name="dynamic_grid_workspace_top_padding">12dp</dimen>
|
<dimen name="dynamic_grid_workspace_top_padding">12dp</dimen>
|
||||||
|
<dimen name="dynamic_grid_workspace_page_spacing">8dp</dimen>
|
||||||
<!-- Minimum space between workspace and hotseat in spring loaded mode -->
|
<!-- Minimum space between workspace and hotseat in spring loaded mode -->
|
||||||
<dimen name="dynamic_grid_min_spring_loaded_space">8dp</dimen>
|
<dimen name="dynamic_grid_min_spring_loaded_space">8dp</dimen>
|
||||||
|
<dimen name="dynamic_grid_container_land_left_padding">118dp</dimen>
|
||||||
|
<dimen name="dynamic_grid_container_land_right_padding">66dp</dimen>
|
||||||
|
|
||||||
<!-- Drop target bar -->
|
<!-- Drop target bar -->
|
||||||
<dimen name="dynamic_grid_drop_target_size">48dp</dimen>
|
<dimen name="dynamic_grid_drop_target_size">48dp</dimen>
|
||||||
@@ -54,28 +60,23 @@
|
|||||||
<dimen name="container_fastscroll_popup_size">72dp</dimen>
|
<dimen name="container_fastscroll_popup_size">72dp</dimen>
|
||||||
<dimen name="container_fastscroll_popup_text_size">48dp</dimen>
|
<dimen name="container_fastscroll_popup_text_size">48dp</dimen>
|
||||||
|
|
||||||
<item name="container_margin" format="fraction" type="fraction">0%</item>
|
|
||||||
<dimen name="container_min_margin">8dp</dimen>
|
|
||||||
<dimen name="container_max_width">0dp</dimen>
|
|
||||||
|
|
||||||
<!-- All Apps -->
|
<!-- All Apps -->
|
||||||
<dimen name="all_apps_button_scale_down">0dp</dimen>
|
<dimen name="all_apps_button_scale_down">0dp</dimen>
|
||||||
<dimen name="all_apps_grid_view_start_margin">0dp</dimen>
|
<dimen name="all_apps_grid_view_start_margin">0dp</dimen>
|
||||||
<dimen name="all_apps_grid_section_y_offset">8dp</dimen>
|
<dimen name="all_apps_grid_section_y_offset">8dp</dimen>
|
||||||
<dimen name="all_apps_grid_section_text_size">24sp</dimen>
|
<dimen name="all_apps_grid_section_text_size">24sp</dimen>
|
||||||
<dimen name="all_apps_search_bar_height">60dp</dimen>
|
<dimen name="all_apps_search_bar_height">60dp</dimen>
|
||||||
<dimen name="all_apps_search_bar_margin_top">5dp</dimen>
|
<dimen name="all_apps_search_bar_margin_top">12dp</dimen>
|
||||||
<dimen name="all_apps_search_bar_icon_margin_right">4dp</dimen>
|
<dimen name="all_apps_search_bar_icon_margin_right">4dp</dimen>
|
||||||
<dimen name="all_apps_search_bar_icon_margin_top">1dp</dimen>
|
<dimen name="all_apps_search_bar_icon_margin_top">1dp</dimen>
|
||||||
<dimen name="all_apps_icon_top_bottom_padding">8dp</dimen>
|
|
||||||
<dimen name="all_apps_icon_width_gap">24dp</dimen>
|
|
||||||
<dimen name="all_apps_list_bottom_padding">8dp</dimen>
|
<dimen name="all_apps_list_bottom_padding">8dp</dimen>
|
||||||
<dimen name="all_apps_empty_search_message_top_offset">40dp</dimen>
|
<dimen name="all_apps_empty_search_message_top_offset">40dp</dimen>
|
||||||
<dimen name="all_apps_empty_search_bg_top_offset">144dp</dimen>
|
<dimen name="all_apps_empty_search_bg_top_offset">144dp</dimen>
|
||||||
<dimen name="all_apps_background_canvas_width">700dp</dimen>
|
<dimen name="all_apps_background_canvas_width">700dp</dimen>
|
||||||
<dimen name="all_apps_background_canvas_height">475dp</dimen>
|
<dimen name="all_apps_background_canvas_height">475dp</dimen>
|
||||||
<dimen name="all_apps_caret_stroke_width">2dp</dimen>
|
<dimen name="all_apps_caret_stroke_width">2dp</dimen>
|
||||||
<dimen name="all_apps_caret_inset">8dp</dimen>
|
<dimen name="all_apps_caret_size">13dp</dimen>
|
||||||
|
<dimen name="all_apps_caret_workspace_offset">4dp</dimen>
|
||||||
|
|
||||||
<!-- Search bar in All Apps -->
|
<!-- Search bar in All Apps -->
|
||||||
<dimen name="all_apps_header_max_elevation">3dp</dimen>
|
<dimen name="all_apps_header_max_elevation">3dp</dimen>
|
||||||
@@ -85,6 +86,7 @@
|
|||||||
<dimen name="all_apps_divider_margin_vertical">8dp</dimen>
|
<dimen name="all_apps_divider_margin_vertical">8dp</dimen>
|
||||||
|
|
||||||
<dimen name="all_apps_bezel_swipe_height">24dp</dimen>
|
<dimen name="all_apps_bezel_swipe_height">24dp</dimen>
|
||||||
|
|
||||||
<!-- Widget tray -->
|
<!-- Widget tray -->
|
||||||
<dimen name="widget_preview_label_vertical_padding">8dp</dimen>
|
<dimen name="widget_preview_label_vertical_padding">8dp</dimen>
|
||||||
<dimen name="widget_preview_label_horizontal_padding">8dp</dimen>
|
<dimen name="widget_preview_label_horizontal_padding">8dp</dimen>
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package com.android.launcher3;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.InsetDrawable;
|
import android.graphics.drawable.InsetDrawable;
|
||||||
@@ -32,12 +31,16 @@ import com.android.launcher3.config.FeatureFlags;
|
|||||||
/**
|
/**
|
||||||
* A base container view, which supports resizing.
|
* A base container view, which supports resizing.
|
||||||
*/
|
*/
|
||||||
public abstract class BaseContainerView extends FrameLayout {
|
public abstract class BaseContainerView extends FrameLayout
|
||||||
|
implements DeviceProfile.LauncherLayoutChangeListener {
|
||||||
|
|
||||||
protected final int mHorizontalPadding;
|
protected int mContainerPaddingLeft;
|
||||||
|
protected int mContainerPaddingRight;
|
||||||
|
protected int mContainerPaddingTop;
|
||||||
|
protected int mContainerPaddingBottom;
|
||||||
|
|
||||||
private final InsetDrawable mRevealDrawable;
|
private InsetDrawable mRevealDrawable;
|
||||||
private final ColorDrawable mDrawable;
|
protected final Drawable mBaseDrawable;
|
||||||
|
|
||||||
private View mRevealView;
|
private View mRevealView;
|
||||||
private View mContent;
|
private View mContent;
|
||||||
@@ -53,31 +56,32 @@ public abstract class BaseContainerView extends FrameLayout {
|
|||||||
public BaseContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
|
public BaseContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
|
|
||||||
Launcher launcher = Launcher.getLauncher(context);
|
|
||||||
int width = launcher.getDeviceProfile().availableWidthPx;
|
|
||||||
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
|
|
||||||
this instanceof AllAppsContainerView &&
|
|
||||||
!launcher.getDeviceProfile().isVerticalBarLayout()) {
|
|
||||||
mHorizontalPadding = 0;
|
|
||||||
} else {
|
|
||||||
mHorizontalPadding = DeviceProfile.getContainerPadding(context, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && this instanceof AllAppsContainerView) {
|
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && this instanceof AllAppsContainerView) {
|
||||||
mDrawable = new ColorDrawable();
|
mBaseDrawable = new ColorDrawable();
|
||||||
mRevealDrawable = new InsetDrawable(mDrawable,
|
|
||||||
mHorizontalPadding, 0, mHorizontalPadding, 0);
|
|
||||||
} else {
|
} else {
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs,
|
TypedArray a = context.obtainStyledAttributes(attrs,
|
||||||
R.styleable.BaseContainerView, defStyleAttr, 0);
|
R.styleable.BaseContainerView, defStyleAttr, 0);
|
||||||
mRevealDrawable = new InsetDrawable(
|
mBaseDrawable = a.getDrawable(R.styleable.BaseContainerView_revealBackground);
|
||||||
a.getDrawable(R.styleable.BaseContainerView_revealBackground),
|
|
||||||
mHorizontalPadding, 0, mHorizontalPadding, 0);
|
|
||||||
mDrawable = null;
|
|
||||||
a.recycle();
|
a.recycle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAttachedToWindow() {
|
||||||
|
super.onAttachedToWindow();
|
||||||
|
|
||||||
|
DeviceProfile grid = Launcher.getLauncher(getContext()).getDeviceProfile();
|
||||||
|
grid.addLauncherLayoutChangedListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow();
|
||||||
|
|
||||||
|
DeviceProfile grid = Launcher.getLauncher(getContext()).getDeviceProfile();
|
||||||
|
grid.removeLauncherLayoutChangedListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
@@ -85,16 +89,16 @@ public abstract class BaseContainerView extends FrameLayout {
|
|||||||
mContent = findViewById(R.id.main_content);
|
mContent = findViewById(R.id.main_content);
|
||||||
mRevealView = findViewById(R.id.reveal_view);
|
mRevealView = findViewById(R.id.reveal_view);
|
||||||
|
|
||||||
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && this instanceof AllAppsContainerView) {
|
updatePaddings();
|
||||||
mRevealView.setBackground(mRevealDrawable);
|
}
|
||||||
} else {
|
|
||||||
mRevealView.setBackground(mRevealDrawable.getConstantState().newDrawable());
|
|
||||||
mContent.setBackground(mRevealDrawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We let the content have a intent background, but still have full width.
|
@Override
|
||||||
// This allows the scroll bar to be used responsive outside the background bounds as well.
|
public void onLauncherLayoutChanged() {
|
||||||
mContent.setPadding(0, 0, 0, 0);
|
updatePaddings();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRevealDrawableColor(int color) {
|
||||||
|
((ColorDrawable) mBaseDrawable).setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final View getContentView() {
|
public final View getContentView() {
|
||||||
@@ -105,7 +109,35 @@ public abstract class BaseContainerView extends FrameLayout {
|
|||||||
return mRevealView;
|
return mRevealView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRevealDrawableColor(int color) {
|
private void updatePaddings() {
|
||||||
mDrawable.setColor(color);
|
Context context = getContext();
|
||||||
|
Launcher launcher = Launcher.getLauncher(context);
|
||||||
|
|
||||||
|
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
|
||||||
|
this instanceof AllAppsContainerView &&
|
||||||
|
!launcher.getDeviceProfile().isVerticalBarLayout()) {
|
||||||
|
mContainerPaddingLeft = mContainerPaddingRight = 0;
|
||||||
|
mContainerPaddingTop = mContainerPaddingBottom = 0;
|
||||||
|
} else {
|
||||||
|
DeviceProfile grid = launcher.getDeviceProfile();
|
||||||
|
int[] padding = grid.getContainerPadding(context);
|
||||||
|
mContainerPaddingLeft = padding[0] + grid.edgeMarginPx;
|
||||||
|
mContainerPaddingRight = padding[1] + grid.edgeMarginPx;
|
||||||
|
if (!launcher.getDeviceProfile().isVerticalBarLayout()) {
|
||||||
|
mContainerPaddingTop = mContainerPaddingBottom = grid.edgeMarginPx;
|
||||||
|
} else {
|
||||||
|
mContainerPaddingTop = mContainerPaddingBottom = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mRevealDrawable = new InsetDrawable(mBaseDrawable,
|
||||||
|
mContainerPaddingLeft, mContainerPaddingTop, mContainerPaddingRight,
|
||||||
|
mContainerPaddingBottom);
|
||||||
|
mRevealView.setBackground(mRevealDrawable);
|
||||||
|
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && this instanceof AllAppsContainerView) {
|
||||||
|
// Skip updating the content background
|
||||||
|
} else {
|
||||||
|
mContent.setBackground(mRevealDrawable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.content.res.Resources.Theme;
|
|||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@@ -66,6 +67,7 @@ public class BubbleTextView extends TextView
|
|||||||
|
|
||||||
private final Launcher mLauncher;
|
private final Launcher mLauncher;
|
||||||
private Drawable mIcon;
|
private Drawable mIcon;
|
||||||
|
private final boolean mCenterVertically;
|
||||||
private final Drawable mBackground;
|
private final Drawable mBackground;
|
||||||
private OnLongClickListener mOnLongClickListener;
|
private OnLongClickListener mOnLongClickListener;
|
||||||
private final CheckLongPressHelper mLongPressHelper;
|
private final CheckLongPressHelper mLongPressHelper;
|
||||||
@@ -119,9 +121,11 @@ public class BubbleTextView extends TextView
|
|||||||
if (display == DISPLAY_WORKSPACE) {
|
if (display == DISPLAY_WORKSPACE) {
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.iconTextSizePx);
|
||||||
} else if (display == DISPLAY_ALL_APPS) {
|
} else if (display == DISPLAY_ALL_APPS) {
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.allAppsIconTextSizeSp);
|
setTextSize(TypedValue.COMPLEX_UNIT_PX, grid.allAppsIconTextSizePx);
|
||||||
|
setCompoundDrawablePadding(grid.allAppsIconDrawablePaddingPx);
|
||||||
defaultIconSize = grid.allAppsIconSizePx;
|
defaultIconSize = grid.allAppsIconSizePx;
|
||||||
}
|
}
|
||||||
|
mCenterVertically = a.getBoolean(R.styleable.BubbleTextView_centerVertically, false);
|
||||||
|
|
||||||
mIconSize = a.getDimensionPixelSize(R.styleable.BubbleTextView_iconSizeOverride,
|
mIconSize = a.getDimensionPixelSize(R.styleable.BubbleTextView_iconSizeOverride,
|
||||||
defaultIconSize);
|
defaultIconSize);
|
||||||
@@ -427,6 +431,19 @@ public class BubbleTextView extends TextView
|
|||||||
mSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
|
mSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
if (mCenterVertically) {
|
||||||
|
Paint.FontMetrics fm = getPaint().getFontMetrics();
|
||||||
|
int cellHeightPx = mIconSize + getCompoundDrawablePadding() +
|
||||||
|
(int) Math.ceil(fm.bottom - fm.top);
|
||||||
|
int height = MeasureSpec.getSize(heightMeasureSpec);
|
||||||
|
setPadding(getPaddingLeft(), (height - cellHeightPx) / 2, getPaddingRight(),
|
||||||
|
getPaddingBottom());
|
||||||
|
}
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDetachedFromWindow() {
|
protected void onDetachedFromWindow() {
|
||||||
super.onDetachedFromWindow();
|
super.onDetachedFromWindow();
|
||||||
|
|||||||
@@ -29,13 +29,18 @@ import android.view.Gravity;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewGroup.LayoutParams;
|
import android.view.ViewGroup.LayoutParams;
|
||||||
import android.view.ViewGroup.MarginLayoutParams;
|
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import com.android.launcher3.config.FeatureFlags;
|
import com.android.launcher3.config.FeatureFlags;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class DeviceProfile {
|
public class DeviceProfile {
|
||||||
|
|
||||||
|
public interface LauncherLayoutChangeListener {
|
||||||
|
void onLauncherLayoutChanged();
|
||||||
|
}
|
||||||
|
|
||||||
public final InvariantDeviceProfile inv;
|
public final InvariantDeviceProfile inv;
|
||||||
|
|
||||||
// Device properties
|
// Device properties
|
||||||
@@ -68,13 +73,18 @@ public class DeviceProfile {
|
|||||||
private int desiredWorkspaceLeftRightMarginPx;
|
private int desiredWorkspaceLeftRightMarginPx;
|
||||||
public final int edgeMarginPx;
|
public final int edgeMarginPx;
|
||||||
public final Rect defaultWidgetPadding;
|
public final Rect defaultWidgetPadding;
|
||||||
private final int pageIndicatorHeightPx;
|
|
||||||
private final int defaultPageSpacingPx;
|
private final int defaultPageSpacingPx;
|
||||||
private final int topWorkspacePadding;
|
private final int topWorkspacePadding;
|
||||||
private float dragViewScale;
|
private float dragViewScale;
|
||||||
public float workspaceSpringLoadShrinkFactor;
|
public float workspaceSpringLoadShrinkFactor;
|
||||||
public final int workspaceSpringLoadedBottomSpace;
|
public final int workspaceSpringLoadedBottomSpace;
|
||||||
|
|
||||||
|
// Page indicator
|
||||||
|
private final int pageIndicatorHeightPx;
|
||||||
|
private final int pageIndicatorLandGutterLeftNavBarPx;
|
||||||
|
private final int pageIndicatorLandGutterRightNavBarPx;
|
||||||
|
private final int pageIndicatorLandWorkspaceOffsetPx;
|
||||||
|
|
||||||
// Workspace icons
|
// Workspace icons
|
||||||
public int iconSizePx;
|
public int iconSizePx;
|
||||||
public int iconTextSizePx;
|
public int iconTextSizePx;
|
||||||
@@ -96,17 +106,30 @@ public class DeviceProfile {
|
|||||||
public int hotseatCellHeightPx;
|
public int hotseatCellHeightPx;
|
||||||
public int hotseatIconSizePx;
|
public int hotseatIconSizePx;
|
||||||
private int hotseatBarHeightPx;
|
private int hotseatBarHeightPx;
|
||||||
|
private int hotseatBarTopPaddingPx;
|
||||||
|
private int hotseatLandGutterPx;
|
||||||
|
|
||||||
// All apps
|
// All apps
|
||||||
public int allAppsNumCols;
|
public int allAppsNumCols;
|
||||||
public int allAppsNumPredictiveCols;
|
public int allAppsNumPredictiveCols;
|
||||||
public int allAppsButtonVisualSize;
|
public int allAppsButtonVisualSize;
|
||||||
public final int allAppsIconSizePx;
|
public int allAppsIconSizePx;
|
||||||
public final float allAppsIconTextSizeSp;
|
public int allAppsIconDrawablePaddingPx;
|
||||||
|
public float allAppsIconTextSizePx;
|
||||||
|
|
||||||
|
// Containers
|
||||||
|
private final int containerLeftPaddingPx;
|
||||||
|
private final int containerRightPaddingPx;
|
||||||
|
|
||||||
// Drop Target
|
// Drop Target
|
||||||
public int dropTargetBarSizePx;
|
public int dropTargetBarSizePx;
|
||||||
|
|
||||||
|
// Insets
|
||||||
|
private Rect mInsets = new Rect();
|
||||||
|
|
||||||
|
// Listeners
|
||||||
|
private ArrayList<LauncherLayoutChangeListener> mListeners = new ArrayList<>();
|
||||||
|
|
||||||
public DeviceProfile(Context context, InvariantDeviceProfile inv,
|
public DeviceProfile(Context context, InvariantDeviceProfile inv,
|
||||||
Point minSize, Point maxSize,
|
Point minSize, Point maxSize,
|
||||||
int width, int height, boolean isLandscape) {
|
int width, int height, boolean isLandscape) {
|
||||||
@@ -130,9 +153,15 @@ public class DeviceProfile {
|
|||||||
this.getClass().getName());
|
this.getClass().getName());
|
||||||
defaultWidgetPadding = AppWidgetHostView.getDefaultPaddingForWidget(context, cn, null);
|
defaultWidgetPadding = AppWidgetHostView.getDefaultPaddingForWidget(context, cn, null);
|
||||||
edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
|
edgeMarginPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_edge_margin);
|
||||||
desiredWorkspaceLeftRightMarginPx = 2 * edgeMarginPx;
|
desiredWorkspaceLeftRightMarginPx = edgeMarginPx;
|
||||||
pageIndicatorHeightPx =
|
pageIndicatorHeightPx =
|
||||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_height);
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_height);
|
||||||
|
pageIndicatorLandGutterLeftNavBarPx = res.getDimensionPixelSize(
|
||||||
|
R.dimen.dynamic_grid_page_indicator_gutter_width_left_nav_bar);
|
||||||
|
pageIndicatorLandWorkspaceOffsetPx =
|
||||||
|
res.getDimensionPixelSize(R.dimen.all_apps_caret_workspace_offset);
|
||||||
|
pageIndicatorLandGutterRightNavBarPx = res.getDimensionPixelSize(
|
||||||
|
R.dimen.dynamic_grid_page_indicator_gutter_width_right_nav_bar);
|
||||||
defaultPageSpacingPx =
|
defaultPageSpacingPx =
|
||||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_page_spacing);
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_workspace_page_spacing);
|
||||||
topWorkspacePadding =
|
topWorkspacePadding =
|
||||||
@@ -152,12 +181,14 @@ public class DeviceProfile {
|
|||||||
dropTargetBarSizePx = res.getDimensionPixelSize(R.dimen.dynamic_grid_drop_target_size);
|
dropTargetBarSizePx = res.getDimensionPixelSize(R.dimen.dynamic_grid_drop_target_size);
|
||||||
workspaceSpringLoadedBottomSpace =
|
workspaceSpringLoadedBottomSpace =
|
||||||
res.getDimensionPixelSize(R.dimen.dynamic_grid_min_spring_loaded_space);
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_min_spring_loaded_space);
|
||||||
|
hotseatBarHeightPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_height);
|
||||||
// AllApps uses the original non-scaled icon text size
|
hotseatBarTopPaddingPx =
|
||||||
allAppsIconTextSizeSp = inv.iconTextSize;
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_top_padding);
|
||||||
|
hotseatLandGutterPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_gutter_width);
|
||||||
// AllApps uses the original non-scaled icon size
|
containerLeftPaddingPx =
|
||||||
allAppsIconSizePx = Utilities.pxFromDp(inv.iconSize, dm);
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_container_land_left_padding);
|
||||||
|
containerRightPaddingPx =
|
||||||
|
res.getDimensionPixelSize(R.dimen.dynamic_grid_container_land_right_padding);
|
||||||
|
|
||||||
// Determine sizes.
|
// Determine sizes.
|
||||||
widthPx = width;
|
widthPx = width;
|
||||||
@@ -175,6 +206,18 @@ public class DeviceProfile {
|
|||||||
computeAllAppsButtonSize(context);
|
computeAllAppsButtonSize(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addLauncherLayoutChangedListener(LauncherLayoutChangeListener listener) {
|
||||||
|
if (!mListeners.contains(listener)) {
|
||||||
|
mListeners.add(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeLauncherLayoutChangedListener(LauncherLayoutChangeListener listener) {
|
||||||
|
if (mListeners.contains(listener)) {
|
||||||
|
mListeners.remove(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the exact visual footprint of the all apps button, taking into account scaling
|
* Determine the exact visual footprint of the all apps button, taking into account scaling
|
||||||
* and internal padding of the drawable.
|
* and internal padding of the drawable.
|
||||||
@@ -208,6 +251,9 @@ public class DeviceProfile {
|
|||||||
iconTextSizePx = (int) (Utilities.pxFromSp(inv.iconTextSize, dm) * scale);
|
iconTextSizePx = (int) (Utilities.pxFromSp(inv.iconTextSize, dm) * scale);
|
||||||
iconDrawablePaddingPx = drawablePadding;
|
iconDrawablePaddingPx = drawablePadding;
|
||||||
hotseatIconSizePx = (int) (Utilities.pxFromDp(inv.hotseatIconSize, dm) * scale);
|
hotseatIconSizePx = (int) (Utilities.pxFromDp(inv.hotseatIconSize, dm) * scale);
|
||||||
|
allAppsIconSizePx = iconSizePx;
|
||||||
|
allAppsIconDrawablePaddingPx = iconDrawablePaddingPx;
|
||||||
|
allAppsIconTextSizePx = iconTextSizePx;
|
||||||
|
|
||||||
// Calculate the actual text height
|
// Calculate the actual text height
|
||||||
Paint textPaint = new Paint();
|
Paint textPaint = new Paint();
|
||||||
@@ -220,7 +266,6 @@ public class DeviceProfile {
|
|||||||
dragViewScale = (iconSizePx + scaleDps) / iconSizePx;
|
dragViewScale = (iconSizePx + scaleDps) / iconSizePx;
|
||||||
|
|
||||||
// Hotseat
|
// Hotseat
|
||||||
hotseatBarHeightPx = iconSizePx + 4 * edgeMarginPx;
|
|
||||||
hotseatCellWidthPx = iconSizePx;
|
hotseatCellWidthPx = iconSizePx;
|
||||||
hotseatCellHeightPx = iconSizePx;
|
hotseatCellHeightPx = iconSizePx;
|
||||||
|
|
||||||
@@ -247,20 +292,15 @@ public class DeviceProfile {
|
|||||||
folderIconPreviewPadding = res.getDimensionPixelSize(R.dimen.folder_preview_padding);
|
folderIconPreviewPadding = res.getDimensionPixelSize(R.dimen.folder_preview_padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateInsets(Rect insets) {
|
||||||
|
mInsets.set(insets);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param recyclerViewWidth the available width of the AllAppsRecyclerView
|
* @param recyclerViewWidth the available width of the AllAppsRecyclerView
|
||||||
*/
|
*/
|
||||||
public void updateAppsViewNumCols(Resources res, int recyclerViewWidth) {
|
public void updateAppsViewNumCols() {
|
||||||
int appsViewLeftMarginPx =
|
allAppsNumCols = allAppsNumPredictiveCols = inv.numColumns;
|
||||||
res.getDimensionPixelSize(R.dimen.all_apps_grid_view_start_margin);
|
|
||||||
int allAppsCellWidthGap =
|
|
||||||
res.getDimensionPixelSize(R.dimen.all_apps_icon_width_gap);
|
|
||||||
int availableAppsWidthPx = (recyclerViewWidth > 0) ? recyclerViewWidth : availableWidthPx;
|
|
||||||
int numAppsCols = (availableAppsWidthPx + allAppsCellWidthGap - appsViewLeftMarginPx) /
|
|
||||||
(allAppsIconSizePx + allAppsCellWidthGap);
|
|
||||||
int numPredictiveAppCols = Math.max(inv.minAllAppsPredictionColumns, numAppsCols);
|
|
||||||
allAppsNumCols = numAppsCols;
|
|
||||||
allAppsNumPredictiveCols = numPredictiveAppCols;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the width and height of the search bar, ignoring any padding. */
|
/** Returns the width and height of the search bar, ignoring any padding. */
|
||||||
@@ -309,9 +349,13 @@ public class DeviceProfile {
|
|||||||
public Rect getWorkspacePadding(Rect recycle) {
|
public Rect getWorkspacePadding(Rect recycle) {
|
||||||
Rect padding = recycle == null ? new Rect() : recycle;
|
Rect padding = recycle == null ? new Rect() : recycle;
|
||||||
if (isVerticalBarLayout()) {
|
if (isVerticalBarLayout()) {
|
||||||
// in case of isVerticalBarLayout, the hotseat is always on the right and the drop
|
if (mInsets.left > 0) {
|
||||||
// target bar is on the left, independent of the layout direction.
|
padding.set(mInsets.left + pageIndicatorLandGutterLeftNavBarPx, 0,
|
||||||
padding.set(dropTargetBarSizePx, edgeMarginPx, hotseatBarHeightPx, edgeMarginPx);
|
hotseatBarHeightPx + hotseatLandGutterPx - mInsets.left, 2 * edgeMarginPx);
|
||||||
|
} else {
|
||||||
|
padding.set(pageIndicatorLandGutterRightNavBarPx, 0,
|
||||||
|
hotseatBarHeightPx + hotseatLandGutterPx, 2 * edgeMarginPx);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
int paddingBottom = hotseatBarHeightPx + pageIndicatorHeightPx;
|
int paddingBottom = hotseatBarHeightPx + pageIndicatorHeightPx;
|
||||||
if (isTablet) {
|
if (isTablet) {
|
||||||
@@ -331,10 +375,10 @@ public class DeviceProfile {
|
|||||||
availablePaddingX / 2, paddingBottom + availablePaddingY / 2);
|
availablePaddingX / 2, paddingBottom + availablePaddingY / 2);
|
||||||
} else {
|
} else {
|
||||||
// Pad the top and bottom of the workspace with search/hotseat bar sizes
|
// Pad the top and bottom of the workspace with search/hotseat bar sizes
|
||||||
padding.set(desiredWorkspaceLeftRightMarginPx - defaultWidgetPadding.left,
|
padding.set(desiredWorkspaceLeftRightMarginPx,
|
||||||
topWorkspacePadding,
|
topWorkspacePadding,
|
||||||
desiredWorkspaceLeftRightMarginPx - defaultWidgetPadding.right,
|
desiredWorkspaceLeftRightMarginPx,
|
||||||
paddingBottom);
|
hotseatBarHeightPx + pageIndicatorHeightPx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return padding;
|
return padding;
|
||||||
@@ -389,7 +433,7 @@ public class DeviceProfile {
|
|||||||
return visibleChildren;
|
return visibleChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void layout(Launcher launcher) {
|
public void layout(Launcher launcher, boolean notifyListeners) {
|
||||||
FrameLayout.LayoutParams lp;
|
FrameLayout.LayoutParams lp;
|
||||||
boolean hasVerticalBarLayout = isVerticalBarLayout();
|
boolean hasVerticalBarLayout = isVerticalBarLayout();
|
||||||
final boolean isLayoutRtl = Utilities.isRtl(launcher.getResources());
|
final boolean isLayoutRtl = Utilities.isRtl(launcher.getResources());
|
||||||
@@ -400,18 +444,19 @@ public class DeviceProfile {
|
|||||||
lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams();
|
lp = (FrameLayout.LayoutParams) searchBar.getLayoutParams();
|
||||||
lp.width = searchBarBounds.x;
|
lp.width = searchBarBounds.x;
|
||||||
lp.height = searchBarBounds.y;
|
lp.height = searchBarBounds.y;
|
||||||
lp.topMargin = edgeMarginPx;
|
lp.topMargin = mInsets.top + edgeMarginPx;
|
||||||
searchBar.setLayoutParams(lp);
|
searchBar.setLayoutParams(lp);
|
||||||
|
|
||||||
// Layout the workspace
|
// Layout the workspace
|
||||||
PagedView workspace = (PagedView) launcher.findViewById(R.id.workspace);
|
PagedView workspace = (PagedView) launcher.findViewById(R.id.workspace);
|
||||||
Rect padding = getWorkspacePadding(null);
|
Rect workspacePadding = getWorkspacePadding(null);
|
||||||
workspace.setPadding(padding.left, padding.top, padding.right, padding.bottom);
|
workspace.setPadding(workspacePadding.left, workspacePadding.top, workspacePadding.right,
|
||||||
|
workspacePadding.bottom);
|
||||||
workspace.setPageSpacing(getWorkspacePageSpacing());
|
workspace.setPageSpacing(getWorkspacePageSpacing());
|
||||||
|
|
||||||
View qsbContainer = launcher.getQsbContainer();
|
View qsbContainer = launcher.getQsbContainer();
|
||||||
lp = (FrameLayout.LayoutParams) qsbContainer.getLayoutParams();
|
lp = (FrameLayout.LayoutParams) qsbContainer.getLayoutParams();
|
||||||
lp.topMargin = padding.top;
|
lp.topMargin = mInsets.top + workspacePadding.top;
|
||||||
qsbContainer.setLayoutParams(lp);
|
qsbContainer.setLayoutParams(lp);
|
||||||
|
|
||||||
// Layout the hotseat
|
// Layout the hotseat
|
||||||
@@ -428,26 +473,29 @@ public class DeviceProfile {
|
|||||||
// Vertical hotseat -- The hotseat is fixed in the layout to be on the right of the
|
// Vertical hotseat -- The hotseat is fixed in the layout to be on the right of the
|
||||||
// screen regardless of RTL
|
// screen regardless of RTL
|
||||||
lp.gravity = Gravity.RIGHT;
|
lp.gravity = Gravity.RIGHT;
|
||||||
lp.width = hotseatBarHeightPx;
|
lp.width = hotseatBarHeightPx + mInsets.left + mInsets.right;
|
||||||
lp.height = LayoutParams.MATCH_PARENT;
|
lp.height = LayoutParams.MATCH_PARENT;
|
||||||
hotseat.findViewById(R.id.layout).setPadding(0, 2 * edgeMarginPx, 0, 2 * edgeMarginPx);
|
hotseat.findViewById(R.id.layout).setPadding(0, 2 * edgeMarginPx, 0, 2 * edgeMarginPx);
|
||||||
|
hotseat.setPadding(mInsets.left, 0, mInsets.right, 0);
|
||||||
} else if (isTablet) {
|
} else if (isTablet) {
|
||||||
// Pad the hotseat with the workspace padding calculated above
|
// Pad the hotseat with the workspace padding calculated above
|
||||||
lp.gravity = Gravity.BOTTOM;
|
lp.gravity = Gravity.BOTTOM;
|
||||||
lp.width = LayoutParams.MATCH_PARENT;
|
lp.width = LayoutParams.MATCH_PARENT;
|
||||||
lp.height = hotseatBarHeightPx;
|
lp.height = hotseatBarHeightPx + mInsets.bottom;
|
||||||
hotseat.findViewById(R.id.layout).setPadding(
|
hotseat.findViewById(R.id.layout).setPadding(
|
||||||
hotseatAdjustment + padding.left, 0,
|
hotseatAdjustment + workspacePadding.left, 0,
|
||||||
hotseatAdjustment + padding.right, 2 * edgeMarginPx);
|
hotseatAdjustment + workspacePadding.right, 2 * edgeMarginPx);
|
||||||
|
hotseat.setPadding(0, hotseatBarTopPaddingPx, 0, mInsets.bottom);
|
||||||
} else {
|
} else {
|
||||||
// For phones, layout the hotseat without any bottom margin
|
// For phones, layout the hotseat without any bottom margin
|
||||||
// to ensure that we have space for the folders
|
// to ensure that we have space for the folders
|
||||||
lp.gravity = Gravity.BOTTOM;
|
lp.gravity = Gravity.BOTTOM;
|
||||||
lp.width = LayoutParams.MATCH_PARENT;
|
lp.width = LayoutParams.MATCH_PARENT;
|
||||||
lp.height = hotseatBarHeightPx;
|
lp.height = hotseatBarHeightPx + mInsets.bottom;
|
||||||
hotseat.findViewById(R.id.layout).setPadding(
|
hotseat.findViewById(R.id.layout).setPadding(
|
||||||
hotseatAdjustment + padding.left, 0,
|
hotseatAdjustment + workspacePadding.left, 0,
|
||||||
hotseatAdjustment + padding.right, 0);
|
hotseatAdjustment + workspacePadding.right, 0);
|
||||||
|
hotseat.setPadding(0, hotseatBarTopPaddingPx, 0, mInsets.bottom);
|
||||||
}
|
}
|
||||||
hotseat.setLayoutParams(lp);
|
hotseat.setLayoutParams(lp);
|
||||||
|
|
||||||
@@ -455,11 +503,21 @@ public class DeviceProfile {
|
|||||||
View pageIndicator = launcher.findViewById(R.id.page_indicator);
|
View pageIndicator = launcher.findViewById(R.id.page_indicator);
|
||||||
if (pageIndicator != null) {
|
if (pageIndicator != null) {
|
||||||
lp = (FrameLayout.LayoutParams) pageIndicator.getLayoutParams();
|
lp = (FrameLayout.LayoutParams) pageIndicator.getLayoutParams();
|
||||||
if (!hasVerticalBarLayout) {
|
if (isVerticalBarLayout()) {
|
||||||
|
if (mInsets.left > 0) {
|
||||||
|
lp.leftMargin = mInsets.left + pageIndicatorLandGutterLeftNavBarPx -
|
||||||
|
lp.width - pageIndicatorLandWorkspaceOffsetPx;
|
||||||
|
} else if (mInsets.right > 0) {
|
||||||
|
lp.leftMargin = pageIndicatorLandGutterRightNavBarPx - lp.width -
|
||||||
|
pageIndicatorLandWorkspaceOffsetPx;
|
||||||
|
}
|
||||||
|
lp.bottomMargin = workspacePadding.bottom;
|
||||||
|
} else {
|
||||||
// Put the page indicators above the hotseat
|
// Put the page indicators above the hotseat
|
||||||
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||||
lp.width = LayoutParams.WRAP_CONTENT;
|
lp.width = LayoutParams.WRAP_CONTENT;
|
||||||
lp.bottomMargin = hotseatBarHeightPx;
|
lp.height = pageIndicatorHeightPx;
|
||||||
|
lp.bottomMargin = hotseatBarHeightPx + mInsets.bottom;
|
||||||
}
|
}
|
||||||
pageIndicator.setLayoutParams(lp);
|
pageIndicator.setLayoutParams(lp);
|
||||||
}
|
}
|
||||||
@@ -468,7 +526,7 @@ public class DeviceProfile {
|
|||||||
ViewGroup overviewMode = launcher.getOverviewPanel();
|
ViewGroup overviewMode = launcher.getOverviewPanel();
|
||||||
if (overviewMode != null) {
|
if (overviewMode != null) {
|
||||||
lp = (FrameLayout.LayoutParams) overviewMode.getLayoutParams();
|
lp = (FrameLayout.LayoutParams) overviewMode.getLayoutParams();
|
||||||
lp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
lp.gravity = Gravity.LEFT | Gravity.BOTTOM;
|
||||||
|
|
||||||
int visibleChildCount = getVisibleChildCount(overviewMode);
|
int visibleChildCount = getVisibleChildCount(overviewMode);
|
||||||
int totalItemWidth = visibleChildCount * overviewModeBarItemWidthPx;
|
int totalItemWidth = visibleChildCount * overviewModeBarItemWidthPx;
|
||||||
@@ -476,30 +534,15 @@ public class DeviceProfile {
|
|||||||
|
|
||||||
lp.width = Math.min(availableWidthPx, maxWidth);
|
lp.width = Math.min(availableWidthPx, maxWidth);
|
||||||
lp.height = getOverviewModeButtonBarHeight();
|
lp.height = getOverviewModeButtonBarHeight();
|
||||||
|
// Center the overview buttons on the workspace page
|
||||||
|
lp.leftMargin = workspacePadding.left + (availableWidthPx -
|
||||||
|
workspacePadding.left - workspacePadding.right - lp.width) / 2;
|
||||||
overviewMode.setLayoutParams(lp);
|
overviewMode.setLayoutParams(lp);
|
||||||
|
}
|
||||||
|
|
||||||
if (lp.width > totalItemWidth && visibleChildCount > 1) {
|
if (notifyListeners) {
|
||||||
// We have enough space. Lets add some margin too.
|
for (int i = mListeners.size() - 1; i >= 0; i--) {
|
||||||
int margin = (lp.width - totalItemWidth) / (visibleChildCount-1);
|
mListeners.get(i).onLauncherLayoutChanged();
|
||||||
View lastChild = null;
|
|
||||||
|
|
||||||
// Set margin of all visible children except the last visible child
|
|
||||||
for (int i = 0; i < visibleChildCount; i++) {
|
|
||||||
if (lastChild != null) {
|
|
||||||
MarginLayoutParams clp = (MarginLayoutParams) lastChild.getLayoutParams();
|
|
||||||
if (isLayoutRtl) {
|
|
||||||
clp.leftMargin = margin;
|
|
||||||
} else {
|
|
||||||
clp.rightMargin = margin;
|
|
||||||
}
|
|
||||||
lastChild.setLayoutParams(clp);
|
|
||||||
lastChild = null;
|
|
||||||
}
|
|
||||||
View thisChild = overviewMode.getChildAt(i);
|
|
||||||
if (thisChild.getVisibility() != View.GONE) {
|
|
||||||
lastChild = thisChild;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -517,17 +560,20 @@ public class DeviceProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final int getContainerPadding(Context context, int availableWidth) {
|
/**
|
||||||
|
* @return the left/right paddings for all containers.
|
||||||
|
*/
|
||||||
|
public final int[] getContainerPadding(Context context) {
|
||||||
Resources res = context.getResources();
|
Resources res = context.getResources();
|
||||||
|
|
||||||
int maxSize = res.getDimensionPixelSize(R.dimen.container_max_width);
|
// No paddings for portrait phone
|
||||||
int minMargin = res.getDimensionPixelSize(R.dimen.container_min_margin);
|
if (isPhone && !isVerticalBarLayout()) {
|
||||||
|
return new int[] {0, 0};
|
||||||
if (maxSize > 0) {
|
|
||||||
return Math.max(minMargin, (availableWidth - maxSize) / 2);
|
|
||||||
} else {
|
|
||||||
return Math.max(minMargin,
|
|
||||||
(int) res.getFraction(R.fraction.container_margin, availableWidth, 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In landscape, we just match the vertical display width
|
||||||
|
int containerWidth = heightPx;
|
||||||
|
int padding = (availableWidthPx - containerWidth) / 2;
|
||||||
|
return new int[]{ padding, padding };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto;
|
|||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||||
|
|
||||||
public class Hotseat extends FrameLayout
|
public class Hotseat extends FrameLayout
|
||||||
implements UserEventDispatcher.LaunchSourceProvider, Insettable {
|
implements UserEventDispatcher.LaunchSourceProvider {
|
||||||
|
|
||||||
private CellLayout mContent;
|
private CellLayout mContent;
|
||||||
|
|
||||||
@@ -48,9 +48,6 @@ public class Hotseat extends FrameLayout
|
|||||||
@ViewDebug.ExportedProperty(category = "launcher")
|
@ViewDebug.ExportedProperty(category = "launcher")
|
||||||
private final boolean mHasVerticalHotseat;
|
private final boolean mHasVerticalHotseat;
|
||||||
|
|
||||||
@ViewDebug.ExportedProperty(category = "launcher")
|
|
||||||
private Rect mInsets = new Rect();
|
|
||||||
|
|
||||||
@ViewDebug.ExportedProperty(category = "launcher")
|
@ViewDebug.ExportedProperty(category = "launcher")
|
||||||
private int mBackgroundColor;
|
private int mBackgroundColor;
|
||||||
@ViewDebug.ExportedProperty(category = "launcher")
|
@ViewDebug.ExportedProperty(category = "launcher")
|
||||||
@@ -180,28 +177,6 @@ public class Hotseat extends FrameLayout
|
|||||||
targetParent.containerType = LauncherLogProto.HOTSEAT;
|
targetParent.containerType = LauncherLogProto.HOTSEAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Overridden so that the background color extends behind the navigation buttons.
|
|
||||||
@Override
|
|
||||||
public void setInsets(Rect insets) {
|
|
||||||
int rightInset = insets.right - mInsets.right;
|
|
||||||
int bottomInset = insets.bottom - mInsets.bottom;
|
|
||||||
mInsets.set(insets);
|
|
||||||
LayoutParams lp = (LayoutParams) getLayoutParams();
|
|
||||||
if (mHasVerticalHotseat) {
|
|
||||||
setPadding(getPaddingLeft(), getPaddingTop(),
|
|
||||||
getPaddingRight() + rightInset, getPaddingBottom());
|
|
||||||
if (lp.width != LayoutParams.MATCH_PARENT && lp.width != LayoutParams.WRAP_CONTENT) {
|
|
||||||
lp.width += rightInset;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(),
|
|
||||||
getPaddingBottom() + bottomInset);
|
|
||||||
if (lp.height != LayoutParams.MATCH_PARENT && lp.height != LayoutParams.WRAP_CONTENT) {
|
|
||||||
lp.height += bottomInset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateColor(ExtractedColors extractedColors, boolean animate) {
|
public void updateColor(ExtractedColors extractedColors, boolean animate) {
|
||||||
if (!mHasVerticalHotseat) {
|
if (!mHasVerticalHotseat) {
|
||||||
int color = extractedColors.getColor(ExtractedColors.HOTSEAT_INDEX, Color.TRANSPARENT);
|
int color = extractedColors.getColor(ExtractedColors.HOTSEAT_INDEX, Color.TRANSPARENT);
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public class IconCache {
|
|||||||
private static final String EMPTY_CLASS_NAME = ".";
|
private static final String EMPTY_CLASS_NAME = ".";
|
||||||
|
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
private static final boolean DEBUG_IGNORE_CACHE = false;
|
||||||
|
|
||||||
private static final int LOW_RES_SCALE_FACTOR = 5;
|
private static final int LOW_RES_SCALE_FACTOR = 5;
|
||||||
|
|
||||||
@@ -552,7 +553,7 @@ public class IconCache {
|
|||||||
mCache.put(cacheKey, entry);
|
mCache.put(cacheKey, entry);
|
||||||
|
|
||||||
// Check the DB first.
|
// Check the DB first.
|
||||||
if (!getEntryFromDB(cacheKey, entry, useLowResIcon)) {
|
if (!getEntryFromDB(cacheKey, entry, useLowResIcon) || DEBUG_IGNORE_CACHE) {
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
entry.icon = Utilities.createBadgedIconBitmap(
|
entry.icon = Utilities.createBadgedIconBitmap(
|
||||||
mIconProvider.getIcon(info, mIconDpi), info.getUser(),
|
mIconProvider.getIcon(info, mIconDpi), info.getUser(),
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public class InvariantDeviceProfile {
|
|||||||
/**
|
/**
|
||||||
* The minimum number of predicted apps in all apps.
|
* The minimum number of predicted apps in all apps.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
int minAllAppsPredictionColumns;
|
int minAllAppsPredictionColumns;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,11 +104,6 @@ public class InvariantDeviceProfile {
|
|||||||
|
|
||||||
InvariantDeviceProfile(String n, float w, float h, int r, int c, int fr, int fc, int maapc,
|
InvariantDeviceProfile(String n, float w, float h, int r, int c, int fr, int fc, int maapc,
|
||||||
float is, float its, int hs, float his, int dlId) {
|
float is, float its, int hs, float his, int dlId) {
|
||||||
// Ensure that we have an odd number of hotseat items (since we need to place all apps)
|
|
||||||
if (hs % 2 == 0) {
|
|
||||||
throw new RuntimeException("All Device Profiles must have an odd number of hotseat spaces");
|
|
||||||
}
|
|
||||||
|
|
||||||
name = n;
|
name = n;
|
||||||
minWidthDps = w;
|
minWidthDps = w;
|
||||||
minHeightDps = h;
|
minHeightDps = h;
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ public class Launcher extends Activity
|
|||||||
setContentView(R.layout.launcher);
|
setContentView(R.layout.launcher);
|
||||||
|
|
||||||
setupViews();
|
setupViews();
|
||||||
mDeviceProfile.layout(this);
|
mDeviceProfile.layout(this, false /* notifyListeners */);
|
||||||
mExtractedColors = new ExtractedColors();
|
mExtractedColors = new ExtractedColors();
|
||||||
loadExtractedColorsAndColorItems();
|
loadExtractedColorsAndColorItems();
|
||||||
|
|
||||||
@@ -521,6 +521,11 @@ public class Launcher extends Activity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onInsetsChanged(Rect insets) {
|
||||||
|
mDeviceProfile.updateInsets(insets);
|
||||||
|
mDeviceProfile.layout(this, true /* notifyListeners */);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this after onCreate to set or clear overlay.
|
* Call this after onCreate to set or clear overlay.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class LauncherRootView extends InsettableFrameLayout {
|
|||||||
@TargetApi(23)
|
@TargetApi(23)
|
||||||
@Override
|
@Override
|
||||||
protected boolean fitSystemWindows(Rect insets) {
|
protected boolean fitSystemWindows(Rect insets) {
|
||||||
|
boolean rawInsetsChanged = !mInsets.equals(insets);
|
||||||
mDrawSideInsetBar = (insets.right > 0 || insets.left > 0) &&
|
mDrawSideInsetBar = (insets.right > 0 || insets.left > 0) &&
|
||||||
(!Utilities.ATLEAST_MARSHMALLOW ||
|
(!Utilities.ATLEAST_MARSHMALLOW ||
|
||||||
getContext().getSystemService(ActivityManager.class).isLowRamDevice());
|
getContext().getSystemService(ActivityManager.class).isLowRamDevice());
|
||||||
@@ -61,6 +62,12 @@ public class LauncherRootView extends InsettableFrameLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rawInsetsChanged) {
|
||||||
|
// Update the grid again
|
||||||
|
Launcher launcher = Launcher.getLauncher(getContext());
|
||||||
|
launcher.onInsetsChanged(insets);
|
||||||
|
}
|
||||||
|
|
||||||
return true; // I'll take it from here
|
return true; // I'll take it from here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class ShortcutAndWidgetContainer extends ViewGroup {
|
|||||||
if (child instanceof LauncherAppWidgetHostView) {
|
if (child instanceof LauncherAppWidgetHostView) {
|
||||||
// Widgets have their own padding, so skip
|
// Widgets have their own padding, so skip
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, center the icon
|
// Otherwise, center the icon/folder
|
||||||
int cHeight = getCellContentHeight();
|
int cHeight = getCellContentHeight();
|
||||||
int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
|
int cellPaddingY = (int) Math.max(0, ((lp.height - cHeight) / 2f));
|
||||||
int cellPaddingX = (int) (grid.edgeMarginPx / 2f);
|
int cellPaddingX = (int) (grid.edgeMarginPx / 2f);
|
||||||
|
|||||||
@@ -53,11 +53,9 @@ import android.view.MotionEvent;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewDebug;
|
import android.view.ViewDebug;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewGroup.LayoutParams;
|
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.view.animation.DecelerateInterpolator;
|
import android.view.animation.DecelerateInterpolator;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
import android.widget.Space;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.launcher3.Launcher.CustomContentCallbacks;
|
import com.android.launcher3.Launcher.CustomContentCallbacks;
|
||||||
@@ -366,16 +364,7 @@ public class Workspace extends PagedView
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInsets(Rect insets) {
|
public void setInsets(Rect insets) {
|
||||||
int extraLeftPadding = insets.left - mInsets.left;
|
|
||||||
mInsets.set(insets);
|
mInsets.set(insets);
|
||||||
if (extraLeftPadding != 0) {
|
|
||||||
/**
|
|
||||||
* Initial layout assumes that the insets is on the right,
|
|
||||||
* {@link DeviceProfile#getWorkspacePadding()}. Compensate for the difference.
|
|
||||||
*/
|
|
||||||
setPadding(getPaddingLeft() + extraLeftPadding, getPaddingTop(),
|
|
||||||
getPaddingRight() - extraLeftPadding, getPaddingBottom());
|
|
||||||
}
|
|
||||||
|
|
||||||
CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID);
|
CellLayout customScreen = getScreenWithId(CUSTOM_CONTENT_SCREEN_ID);
|
||||||
if (customScreen != null) {
|
if (customScreen != null) {
|
||||||
@@ -1517,12 +1506,15 @@ public class Workspace extends PagedView
|
|||||||
/**
|
/**
|
||||||
* Moves the Hotseat UI in the provided direction.
|
* Moves the Hotseat UI in the provided direction.
|
||||||
* @param direction the direction to move the workspace
|
* @param direction the direction to move the workspace
|
||||||
* @param translation the amound of shift.
|
* @param translation the amount of shift.
|
||||||
* @param alpha the alpha for the hotseat page
|
* @param alpha the alpha for the hotseat page
|
||||||
*/
|
*/
|
||||||
public void setHotseatTranslationAndAlpha(Direction direction, float translation, float alpha) {
|
public void setHotseatTranslationAndAlpha(Direction direction, float translation, float alpha) {
|
||||||
Property<View, Float> property = direction.viewProperty;
|
Property<View, Float> property = direction.viewProperty;
|
||||||
property.set(mPageIndicator, translation);
|
// Skip the page indicator movement in the vertical bar layout
|
||||||
|
if (direction != Direction.Y || !mLauncher.getDeviceProfile().isVerticalBarLayout()) {
|
||||||
|
property.set(mPageIndicator, translation);
|
||||||
|
}
|
||||||
property.set(mLauncher.getHotseat(), translation);
|
property.set(mLauncher.getHotseat(), translation);
|
||||||
setHotseatAlphaAtIndex(alpha, direction.ordinal());
|
setHotseatAlphaAtIndex(alpha, direction.ordinal());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -347,12 +347,10 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
|
|||||||
int widthPx = MeasureSpec.getSize(widthMeasureSpec);
|
int widthPx = MeasureSpec.getSize(widthMeasureSpec);
|
||||||
int heightPx = MeasureSpec.getSize(heightMeasureSpec);
|
int heightPx = MeasureSpec.getSize(heightMeasureSpec);
|
||||||
updatePaddingsAndMargins(widthPx, heightPx);
|
updatePaddingsAndMargins(widthPx, heightPx);
|
||||||
mContentBounds.set(mHorizontalPadding, 0, widthPx - mHorizontalPadding, heightPx);
|
mContentBounds.set(mContainerPaddingLeft, 0, widthPx - mContainerPaddingRight, heightPx);
|
||||||
|
|
||||||
DeviceProfile grid = mLauncher.getDeviceProfile();
|
DeviceProfile grid = mLauncher.getDeviceProfile();
|
||||||
int availableWidth = (!mContentBounds.isEmpty() ? mContentBounds.width() : widthPx)
|
grid.updateAppsViewNumCols();
|
||||||
- 2 * mAppsRecyclerView.getMaxScrollbarWidth();
|
|
||||||
grid.updateAppsViewNumCols(getResources(), availableWidth);
|
|
||||||
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
|
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
|
||||||
if (mNumAppsPerRow != grid.inv.numColumns ||
|
if (mNumAppsPerRow != grid.inv.numColumns ||
|
||||||
mNumPredictedAppsPerRow != grid.inv.numColumns) {
|
mNumPredictedAppsPerRow != grid.inv.numColumns) {
|
||||||
@@ -368,9 +366,9 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
|
|||||||
getResources().getDimensionPixelSize(
|
getResources().getDimensionPixelSize(
|
||||||
R.dimen.container_fastscroll_thumb_max_width);
|
R.dimen.container_fastscroll_thumb_max_width);
|
||||||
mSearchContainer.setPadding(
|
mSearchContainer.setPadding(
|
||||||
rvPadding - mHorizontalPadding + thumbMaxWidth,
|
rvPadding - mContainerPaddingLeft + thumbMaxWidth,
|
||||||
mSearchContainer.getPaddingTop(),
|
mSearchContainer.getPaddingTop(),
|
||||||
rvPadding - mHorizontalPadding + thumbMaxWidth,
|
rvPadding - mContainerPaddingRight + thumbMaxWidth,
|
||||||
mSearchContainer.getPaddingBottom());
|
mSearchContainer.getPaddingBottom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -383,7 +381,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
|
|||||||
// Update the number of items in the grid before we measure the view
|
// Update the number of items in the grid before we measure the view
|
||||||
// TODO: mSectionNamesMargin is currently 0, but also account for it,
|
// TODO: mSectionNamesMargin is currently 0, but also account for it,
|
||||||
// if it's enabled in the future.
|
// if it's enabled in the future.
|
||||||
grid.updateAppsViewNumCols(getResources(), availableWidth);
|
grid.updateAppsViewNumCols();
|
||||||
if (mNumAppsPerRow != grid.allAppsNumCols ||
|
if (mNumAppsPerRow != grid.allAppsNumCols ||
|
||||||
mNumPredictedAppsPerRow != grid.allAppsNumPredictiveCols) {
|
mNumPredictedAppsPerRow != grid.allAppsNumPredictiveCols) {
|
||||||
mNumAppsPerRow = grid.allAppsNumCols;
|
mNumAppsPerRow = grid.allAppsNumCols;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.content.Intent;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Point;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.support.v4.view.accessibility.AccessibilityEventCompat;
|
import android.support.v4.view.accessibility.AccessibilityEventCompat;
|
||||||
@@ -37,6 +38,8 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.android.launcher3.AppInfo;
|
import com.android.launcher3.AppInfo;
|
||||||
import com.android.launcher3.BubbleTextView;
|
import com.android.launcher3.BubbleTextView;
|
||||||
|
import com.android.launcher3.CellLayout;
|
||||||
|
import com.android.launcher3.DeviceProfile;
|
||||||
import com.android.launcher3.Launcher;
|
import com.android.launcher3.Launcher;
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
import com.android.launcher3.Utilities;
|
import com.android.launcher3.Utilities;
|
||||||
@@ -331,7 +334,9 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
|
|||||||
private final boolean mIsRtl;
|
private final boolean mIsRtl;
|
||||||
|
|
||||||
// Section drawing
|
// Section drawing
|
||||||
|
@Deprecated
|
||||||
private final int mSectionNamesMargin;
|
private final int mSectionNamesMargin;
|
||||||
|
@Deprecated
|
||||||
private final int mSectionHeaderOffset;
|
private final int mSectionHeaderOffset;
|
||||||
private final Paint mSectionTextPaint;
|
private final Paint mSectionTextPaint;
|
||||||
|
|
||||||
@@ -452,6 +457,14 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
|
|||||||
icon.setLongPressTimeout(ViewConfiguration.get(parent.getContext())
|
icon.setLongPressTimeout(ViewConfiguration.get(parent.getContext())
|
||||||
.getLongPressTimeout());
|
.getLongPressTimeout());
|
||||||
icon.setOnFocusChangeListener(mIconFocusListener);
|
icon.setOnFocusChangeListener(mIconFocusListener);
|
||||||
|
|
||||||
|
// Ensure the all apps icon height matches the workspace icons
|
||||||
|
DeviceProfile profile = mLauncher.getDeviceProfile();
|
||||||
|
Point cellSize = profile.getCellSize();
|
||||||
|
GridLayoutManager.LayoutParams lp =
|
||||||
|
(GridLayoutManager.LayoutParams) icon.getLayoutParams();
|
||||||
|
lp.height = cellSize.y;
|
||||||
|
icon.setLayoutParams(lp);
|
||||||
return new ViewHolder(icon);
|
return new ViewHolder(icon);
|
||||||
}
|
}
|
||||||
case VIEW_TYPE_EMPTY_SEARCH:
|
case VIEW_TYPE_EMPTY_SEARCH:
|
||||||
|
|||||||
@@ -120,10 +120,9 @@ public class AllAppsRecyclerView extends BaseRecyclerView
|
|||||||
// Icons
|
// Icons
|
||||||
BubbleTextView icon = (BubbleTextView) adapter.onCreateViewHolder(this,
|
BubbleTextView icon = (BubbleTextView) adapter.onCreateViewHolder(this,
|
||||||
AllAppsGridAdapter.VIEW_TYPE_ICON).mContent;
|
AllAppsGridAdapter.VIEW_TYPE_ICON).mContent;
|
||||||
icon.applyDummyInfo();
|
int iconHeight = icon.getLayoutParams().height;
|
||||||
icon.measure(widthMeasureSpec, heightMeasureSpec);
|
mViewHeights.put(AllAppsGridAdapter.VIEW_TYPE_ICON, iconHeight);
|
||||||
mViewHeights.put(AllAppsGridAdapter.VIEW_TYPE_ICON, icon.getMeasuredHeight());
|
mViewHeights.put(AllAppsGridAdapter.VIEW_TYPE_PREDICTION_ICON, iconHeight);
|
||||||
mViewHeights.put(AllAppsGridAdapter.VIEW_TYPE_PREDICTION_ICON, icon.getMeasuredHeight());
|
|
||||||
|
|
||||||
// Search divider
|
// Search divider
|
||||||
View searchDivider = adapter.onCreateViewHolder(this,
|
View searchDivider = adapter.onCreateViewHolder(this,
|
||||||
|
|||||||
@@ -298,6 +298,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
|||||||
mShiftCurrent = progress;
|
mShiftCurrent = progress;
|
||||||
float alpha = calcAlphaAllApps(progress);
|
float alpha = calcAlphaAllApps(progress);
|
||||||
float workspaceHotseatAlpha = 1 - alpha;
|
float workspaceHotseatAlpha = 1 - alpha;
|
||||||
|
float interpolation = mAccelInterpolator.getInterpolation(workspaceHotseatAlpha);
|
||||||
|
|
||||||
int color = (Integer) mEvaluator.evaluate(mDecelInterpolator.getInterpolation(alpha),
|
int color = (Integer) mEvaluator.evaluate(mDecelInterpolator.getInterpolation(alpha),
|
||||||
mHotseatBackgroundColor, mAllAppsBackgroundColor);
|
mHotseatBackgroundColor, mAllAppsBackgroundColor);
|
||||||
@@ -306,14 +307,13 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
|||||||
mAppsView.setTranslationY(progress);
|
mAppsView.setTranslationY(progress);
|
||||||
mWorkspace.setWorkspaceYTranslationAndAlpha(
|
mWorkspace.setWorkspaceYTranslationAndAlpha(
|
||||||
PARALLAX_COEFFICIENT * (-mShiftRange + progress),
|
PARALLAX_COEFFICIENT * (-mShiftRange + progress),
|
||||||
mAccelInterpolator.getInterpolation(workspaceHotseatAlpha));
|
interpolation);
|
||||||
if (!mLauncher.getDeviceProfile().isVerticalBarLayout()) {
|
if (mLauncher.getDeviceProfile().isVerticalBarLayout()) {
|
||||||
mWorkspace.setHotseatTranslationAndAlpha(Direction.Y, -mShiftRange + progress,
|
mWorkspace.setHotseatTranslationAndAlpha(Direction.Y,
|
||||||
mAccelInterpolator.getInterpolation(workspaceHotseatAlpha));
|
PARALLAX_COEFFICIENT * (-mShiftRange + progress), interpolation);
|
||||||
} else {
|
} else {
|
||||||
mWorkspace.setHotseatTranslationAndAlpha(Direction.Y,
|
mWorkspace.setHotseatTranslationAndAlpha(Direction.Y,
|
||||||
PARALLAX_COEFFICIENT * (-mShiftRange + progress),
|
-mShiftRange + progress, interpolation);
|
||||||
mAccelInterpolator.getInterpolation(workspaceHotseatAlpha));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ public class CaretDrawable extends Drawable {
|
|||||||
|
|
||||||
private Paint mPaint = new Paint();
|
private Paint mPaint = new Paint();
|
||||||
private Path mPath = new Path();
|
private Path mPath = new Path();
|
||||||
private int mInset;
|
|
||||||
|
|
||||||
public CaretDrawable(Context context) {
|
public CaretDrawable(Context context) {
|
||||||
final Resources res = context.getResources();
|
final Resources res = context.getResources();
|
||||||
@@ -47,8 +46,6 @@ public class CaretDrawable extends Drawable {
|
|||||||
mPaint.setStyle(Paint.Style.STROKE);
|
mPaint.setStyle(Paint.Style.STROKE);
|
||||||
mPaint.setStrokeCap(Paint.Cap.SQUARE);
|
mPaint.setStrokeCap(Paint.Cap.SQUARE);
|
||||||
mPaint.setStrokeJoin(Paint.Join.MITER);
|
mPaint.setStrokeJoin(Paint.Join.MITER);
|
||||||
|
|
||||||
mInset = res.getDimensionPixelSize(R.dimen.all_apps_caret_inset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -57,10 +54,10 @@ public class CaretDrawable extends Drawable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final float width = getBounds().width();
|
final float width = getBounds().width() - mPaint.getStrokeWidth();
|
||||||
final float height = getBounds().height();
|
final float height = getBounds().height() - mPaint.getStrokeWidth();
|
||||||
final float left = getBounds().left;
|
final float left = getBounds().left + (mPaint.getStrokeWidth() / 2);
|
||||||
final float top = getBounds().top;
|
final float top = getBounds().top + (mPaint.getStrokeWidth() / 2);
|
||||||
|
|
||||||
final float verticalInset = (height / 4);
|
final float verticalInset = (height / 4);
|
||||||
final float caretHeight = (height - (verticalInset * 2));
|
final float caretHeight = (height - (verticalInset * 2));
|
||||||
@@ -95,9 +92,4 @@ public class CaretDrawable extends Drawable {
|
|||||||
public void setColorFilter(ColorFilter cf) {
|
public void setColorFilter(ColorFilter cf) {
|
||||||
// no-op
|
// no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBounds(int left, int top, int right, int bottom) {
|
|
||||||
super.setBounds(left + mInset, top + mInset, right - mInset, bottom - mInset);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,13 +16,19 @@
|
|||||||
package com.android.launcher3.pageindicators;
|
package com.android.launcher3.pageindicators;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
import com.android.launcher3.Launcher;
|
import com.android.launcher3.Launcher;
|
||||||
|
import com.android.launcher3.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simply draws the caret drawable in the center. Used for the landscape layout.
|
* Simply draws the caret drawable bottom-right aligned in the view. This ensures that we can have
|
||||||
|
* a view with as large an area as we want (for touching) while maintaining a caret of size
|
||||||
|
* all_apps_caret_size. Used only for the landscape layout.
|
||||||
*/
|
*/
|
||||||
public class PageIndicatorCaretLandscape extends PageIndicator {
|
public class PageIndicatorCaretLandscape extends PageIndicator {
|
||||||
// all apps pull up handle drawable.
|
// all apps pull up handle drawable.
|
||||||
@@ -38,23 +44,24 @@ public class PageIndicatorCaretLandscape extends PageIndicator {
|
|||||||
public PageIndicatorCaretLandscape(Context context, AttributeSet attrs, int defStyle) {
|
public PageIndicatorCaretLandscape(Context context, AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
|
|
||||||
setCaretDrawable(new CaretDrawable(context));
|
int caretSize = context.getResources().getDimensionPixelSize(R.dimen.all_apps_caret_size);
|
||||||
|
CaretDrawable caretDrawable = new CaretDrawable(context);
|
||||||
|
caretDrawable.setBounds(0, 0, caretSize, caretSize);
|
||||||
|
setCaretDrawable(caretDrawable);
|
||||||
|
|
||||||
Launcher l = (Launcher) context;
|
Launcher l = (Launcher) context;
|
||||||
setOnTouchListener(l.getHapticFeedbackTouchListener());
|
setOnTouchListener(l.getHapticFeedbackTouchListener());
|
||||||
setOnClickListener(l);
|
setOnClickListener(l);
|
||||||
setOnFocusChangeListener(l.mFocusHandler);
|
setOnFocusChangeListener(l.mFocusHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
||||||
super.onLayout(changed, left, top, right, bottom);
|
|
||||||
int size = bottom - top;
|
|
||||||
int l = (right - left) / 2 - size / 2;
|
|
||||||
getCaretDrawable().setBounds(l, 0, l + size, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
|
Rect drawableBounds = getCaretDrawable().getBounds();
|
||||||
|
int count = canvas.save();
|
||||||
|
canvas.translate(getWidth() - drawableBounds.width(),
|
||||||
|
getHeight() - drawableBounds.height());
|
||||||
getCaretDrawable().draw(canvas);
|
getCaretDrawable().draw(canvas);
|
||||||
|
canvas.restoreToCount(count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ public class PageIndicatorLineCaret extends PageIndicator {
|
|||||||
private final int mLineHeight;
|
private final int mLineHeight;
|
||||||
private final Rect mTouchHitRect = new Rect();
|
private final Rect mTouchHitRect = new Rect();
|
||||||
private final int mTouchExtensionHeight;
|
private final int mTouchExtensionHeight;
|
||||||
|
private final int mCaretSizePx;
|
||||||
|
private final int mCaretWorkspaceOffsetPx;
|
||||||
|
|
||||||
private static final Property<PageIndicatorLineCaret, Integer> PAINT_ALPHA
|
private static final Property<PageIndicatorLineCaret, Integer> PAINT_ALPHA
|
||||||
= new Property<PageIndicatorLineCaret, Integer>(Integer.class, "paint_alpha") {
|
= new Property<PageIndicatorLineCaret, Integer>(Integer.class, "paint_alpha") {
|
||||||
@@ -123,14 +125,18 @@ public class PageIndicatorLineCaret extends PageIndicator {
|
|||||||
|
|
||||||
public PageIndicatorLineCaret(Context context, AttributeSet attrs, int defStyle) {
|
public PageIndicatorLineCaret(Context context, AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
|
|
||||||
|
Resources res = context.getResources();
|
||||||
mLinePaint = new Paint();
|
mLinePaint = new Paint();
|
||||||
mLinePaint.setAlpha(0);
|
mLinePaint.setAlpha(0);
|
||||||
|
mCaretSizePx = res.getDimensionPixelSize(R.dimen.all_apps_caret_size);
|
||||||
|
mCaretWorkspaceOffsetPx = res.getDimensionPixelSize(
|
||||||
|
R.dimen.all_apps_caret_workspace_offset);
|
||||||
|
|
||||||
mLauncher = (Launcher) context;
|
mLauncher = (Launcher) context;
|
||||||
setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
|
setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
|
||||||
setOnClickListener(mLauncher);
|
setOnClickListener(mLauncher);
|
||||||
setOnFocusChangeListener(mLauncher.mFocusHandler);
|
setOnFocusChangeListener(mLauncher.mFocusHandler);
|
||||||
Resources res = context.getResources();
|
|
||||||
setCaretDrawable(new CaretDrawable(context));
|
setCaretDrawable(new CaretDrawable(context));
|
||||||
mLineHeight = res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_line_height);
|
mLineHeight = res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_line_height);
|
||||||
mTouchExtensionHeight = res.getDimensionPixelSize(
|
mTouchExtensionHeight = res.getDimensionPixelSize(
|
||||||
@@ -140,9 +146,9 @@ public class PageIndicatorLineCaret extends PageIndicator {
|
|||||||
@Override
|
@Override
|
||||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||||
super.onLayout(changed, left, top, right, bottom);
|
super.onLayout(changed, left, top, right, bottom);
|
||||||
int size = bottom - top;
|
// Top/center align the caret in the page indicator space
|
||||||
int l = (right - left) / 2 - size / 2;
|
int l = (right - left) / 2 - mCaretSizePx / 2;
|
||||||
getCaretDrawable().setBounds(l, 0, l + size, size);
|
getCaretDrawable().setBounds(l, mCaretWorkspaceOffsetPx, l + mCaretSizePx, mCaretSizePx);
|
||||||
|
|
||||||
// The touch area is expanded below this view by #mTouchExtensionHeight
|
// The touch area is expanded below this view by #mTouchExtensionHeight
|
||||||
// which extends to the top of the hotseat.
|
// which extends to the top of the hotseat.
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import android.content.Context;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.InsetDrawable;
|
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView.State;
|
import android.support.v7.widget.RecyclerView.State;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@@ -32,7 +31,6 @@ import android.widget.Toast;
|
|||||||
import com.android.launcher3.BaseContainerView;
|
import com.android.launcher3.BaseContainerView;
|
||||||
import com.android.launcher3.CellLayout;
|
import com.android.launcher3.CellLayout;
|
||||||
import com.android.launcher3.DeleteDropTarget;
|
import com.android.launcher3.DeleteDropTarget;
|
||||||
import com.android.launcher3.DeviceProfile;
|
|
||||||
import com.android.launcher3.DragSource;
|
import com.android.launcher3.DragSource;
|
||||||
import com.android.launcher3.DropTarget.DragObject;
|
import com.android.launcher3.DropTarget.DragObject;
|
||||||
import com.android.launcher3.folder.Folder;
|
import com.android.launcher3.folder.Folder;
|
||||||
@@ -62,6 +60,9 @@ public class WidgetsContainerView extends BaseContainerView
|
|||||||
private DragController mDragController;
|
private DragController mDragController;
|
||||||
private IconCache mIconCache;
|
private IconCache mIconCache;
|
||||||
|
|
||||||
|
private final Rect mTmpBgPaddingRect = new Rect();
|
||||||
|
private final Rect mTmpRect = new Rect();
|
||||||
|
|
||||||
/* Recycler view related member variables */
|
/* Recycler view related member variables */
|
||||||
private WidgetsRecyclerView mRecyclerView;
|
private WidgetsRecyclerView mRecyclerView;
|
||||||
private WidgetsListAdapter mAdapter;
|
private WidgetsListAdapter mAdapter;
|
||||||
@@ -97,18 +98,24 @@ public class WidgetsContainerView extends BaseContainerView
|
|||||||
mRecyclerView = (WidgetsRecyclerView) getContentView().findViewById(R.id.widgets_list_view);
|
mRecyclerView = (WidgetsRecyclerView) getContentView().findViewById(R.id.widgets_list_view);
|
||||||
mRecyclerView.setAdapter(mAdapter);
|
mRecyclerView.setAdapter(mAdapter);
|
||||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
}
|
||||||
|
|
||||||
Rect bgPadding = new Rect();
|
@Override
|
||||||
getRevealView().getBackground().getPadding(bgPadding);
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
getRevealView().getBackground().getPadding(mTmpBgPaddingRect);
|
||||||
if (Utilities.isRtl(getResources())) {
|
if (Utilities.isRtl(getResources())) {
|
||||||
getContentView().setPadding(0, bgPadding.top,
|
getContentView().setPadding(0, mTmpBgPaddingRect.top, mTmpBgPaddingRect.right,
|
||||||
bgPadding.right, bgPadding.bottom);
|
mTmpBgPaddingRect.bottom);
|
||||||
mRecyclerView.updateBackgroundPadding(new Rect(bgPadding.left, 0, 0, 0));
|
mTmpRect.set(mTmpBgPaddingRect.left, 0, 0, 0);
|
||||||
|
mRecyclerView.updateBackgroundPadding(mTmpRect);
|
||||||
} else {
|
} else {
|
||||||
getContentView().setPadding(bgPadding.left, bgPadding.top,
|
getContentView().setPadding(mTmpBgPaddingRect.left, mTmpBgPaddingRect.top, 0,
|
||||||
0, bgPadding.bottom);
|
mTmpBgPaddingRect.bottom);
|
||||||
mRecyclerView.updateBackgroundPadding(new Rect(0, 0, bgPadding.right, 0));
|
mTmpRect.set(0, 0, mTmpBgPaddingRect.right, 0);
|
||||||
|
mRecyclerView.updateBackgroundPadding(mTmpRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user