Snap for 7856913 from dbf20d09bd to tm-release
Change-Id: I6f488e90d7be5bb23df4236c0f2ed59ec5ef86a6
This commit is contained in:
@@ -14,81 +14,93 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="@dimen/allset_page_margin_horizontal"
|
||||
android:paddingEnd="@dimen/allset_page_margin_horizontal"
|
||||
android:layoutDirection="locale"
|
||||
android:textDirection="locale">
|
||||
android:id="@+id/root_view"
|
||||
android:background="@color/all_set_page_background" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/allset_title_icon_margin_top"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:src="@drawable/ic_all_set"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextAppearance.GestureTutorial.Feedback.Title"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/allset_title_margin_top"
|
||||
app:layout_constraintTop_toBottomOf="@id/icon"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:gravity="start"
|
||||
android:text="@string/allset_title"/>
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/allset_page_margin_horizontal"
|
||||
android:layout_marginEnd="@dimen/allset_page_margin_horizontal"
|
||||
android:layoutDirection="locale"
|
||||
android:textDirection="locale"
|
||||
android:id="@+id/content_view"
|
||||
android:forceHasOverlappingRendering="false"
|
||||
android:fitsSystemWindows="true" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/TextAppearance.GestureTutorial.Feedback.Subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/allset_subtitle_margin_top"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintWidth_max="@dimen/allset_subtitle_width_max"
|
||||
android:gravity="start"
|
||||
android:text="@string/allset_description"/>
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/allset_title_icon_margin_top"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:src="@drawable/ic_all_set"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/navigation_settings_guideline_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.83" />
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextAppearance.GestureTutorial.Feedback.Title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/allset_title_margin_top"
|
||||
app:layout_constraintTop_toBottomOf="@id/icon"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:gravity="start"
|
||||
android:text="@string/allset_title"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/navigation_settings"
|
||||
style="@style/TextAppearance.GestureTutorial.LinkText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/navigation_settings_guideline_bottom"
|
||||
android:minHeight="48dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:text="@string/allset_navigation_settings" />
|
||||
<TextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/TextAppearance.GestureTutorial.Feedback.Subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/allset_subtitle_margin_top"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintWidth_max="@dimen/allset_subtitle_width_max"
|
||||
android:gravity="start"
|
||||
android:text="@string/allset_description"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/hint_guideline_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.94" />
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/navigation_settings_guideline_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.83" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hint"
|
||||
style="@style/TextAppearance.GestureTutorial.Feedback.Subtitle"
|
||||
android:textSize="14sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/hint_guideline_bottom"
|
||||
android:text="@string/allset_hint"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<TextView
|
||||
android:id="@+id/navigation_settings"
|
||||
style="@style/TextAppearance.GestureTutorial.LinkText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/navigation_settings_guideline_bottom"
|
||||
android:minHeight="48dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:text="@string/allset_navigation_settings" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/hint_guideline_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintGuide_percent="0.94" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hint"
|
||||
style="@style/TextAppearance.GestureTutorial.Feedback.Subtitle"
|
||||
android:textSize="14sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/hint_guideline_bottom"
|
||||
android:text="@string/allset_hint"/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -45,8 +45,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:outlineProvider="none"
|
||||
android:theme="@style/HomeScreenElementTheme" />
|
||||
android:outlineProvider="none" />
|
||||
|
||||
<include
|
||||
android:id="@+id/overview_actions_view"
|
||||
|
||||
@@ -22,4 +22,6 @@
|
||||
<color name="mock_webpage_url_bar">#202124</color>
|
||||
<color name="mock_webpage_url_bar_item">#3c4043</color>
|
||||
|
||||
<color name="all_set_page_background">#FF000000</color>
|
||||
|
||||
</resources>
|
||||
@@ -21,7 +21,7 @@
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:enforceNavigationBarContrast">false</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="android:windowBackground">#FF000000</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -72,4 +72,7 @@
|
||||
<color name="mock_webpage_top_bar">#e8eaed</color>
|
||||
<color name="mock_webpage_top_bar_item">#80868b</color>
|
||||
<color name="mock_webpage_page_text">#bdc1c6</color>
|
||||
|
||||
<color name="all_set_page_background">#FFFFFFFF</color>
|
||||
|
||||
</resources>
|
||||
@@ -161,6 +161,7 @@
|
||||
<dimen name="allset_title_icon_margin_top">32dp</dimen>
|
||||
<dimen name="allset_subtitle_margin_top">24dp</dimen>
|
||||
<dimen name="allset_subtitle_width_max">348dp</dimen>
|
||||
<dimen name="allset_swipe_up_shift">10dp</dimen>
|
||||
|
||||
<!-- All Apps Education tutorial -->
|
||||
<dimen name="swipe_edu_padding">8dp</dimen>
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:enforceNavigationBarContrast">false</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:windowBackground">#FFFFFFFF</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -439,9 +439,9 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
|
||||
4 - rotationChange);
|
||||
}
|
||||
}
|
||||
// TODO(b/196637509): don't do this for immersive apps.
|
||||
if (mDeviceProfile.isTaskbarPresentInApps) {
|
||||
bounds.bottom -= mDeviceProfile.taskbarSize;
|
||||
// Animate to above the taskbar.
|
||||
bounds.bottom -= target.contentInsets.bottom;
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ public final class WidgetsPredictionUpdateTask extends BaseModelUpdateTask {
|
||||
}
|
||||
} else {
|
||||
Map<ComponentKey, WidgetItem> widgetItems =
|
||||
allWidgets.values().stream().flatMap(List::stream)
|
||||
allWidgets.values().stream().flatMap(List::stream).distinct()
|
||||
.collect(Collectors.toMap(widget -> (ComponentKey) widget,
|
||||
widget -> widget));
|
||||
for (AppTarget app : mTargets) {
|
||||
|
||||
@@ -21,14 +21,20 @@ import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.TASKBAR_STASH_DURATION;
|
||||
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_HOME;
|
||||
import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_EXTRA_NAVIGATION_BAR;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.ColorInt;
|
||||
import android.graphics.Rect;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.TaskTransitionSpec;
|
||||
import android.view.View;
|
||||
import android.view.WindowManagerGlobal;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -36,6 +42,7 @@ import com.android.launcher3.BaseQuickstepLauncher;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.QuickstepTransitionManager;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
@@ -56,6 +63,7 @@ import com.android.quickstep.views.RecentsView;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -64,6 +72,8 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
|
||||
private static final String TAG = "TaskbarUIController";
|
||||
|
||||
private final BaseQuickstepLauncher mLauncher;
|
||||
|
||||
private final AnimatedFloat mIconAlignmentForResumedState =
|
||||
@@ -193,6 +203,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
mLauncher.getHotseat().setIconsAlpha(1f);
|
||||
mLauncher.setTaskbarUIController(null);
|
||||
mLauncher.removeOnDeviceProfileChangeListener(mProfileChangeListener);
|
||||
updateTaskTransitionSpec(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -367,6 +378,32 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
private void onStashedInAppChanged(DeviceProfile deviceProfile) {
|
||||
boolean taskbarStashedInApps = mControllers.taskbarStashController.isStashedInApp();
|
||||
deviceProfile.isTaskbarPresentInApps = !taskbarStashedInApps;
|
||||
updateTaskTransitionSpec(taskbarStashedInApps);
|
||||
}
|
||||
|
||||
private void updateTaskTransitionSpec(boolean taskbarIsHidden) {
|
||||
try {
|
||||
if (taskbarIsHidden) {
|
||||
// Clear custom task transition settings when the taskbar is stashed
|
||||
WindowManagerGlobal.getWindowManagerService().clearTaskTransitionSpec();
|
||||
} else {
|
||||
// Adjust task transition spec to account for taskbar being visible
|
||||
@ColorInt int taskAnimationBackgroundColor =
|
||||
mLauncher.getColor(R.color.taskbar_background);
|
||||
|
||||
TaskTransitionSpec customTaskAnimationSpec = new TaskTransitionSpec(
|
||||
taskAnimationBackgroundColor,
|
||||
Set.of(ITYPE_EXTRA_NAVIGATION_BAR)
|
||||
);
|
||||
WindowManagerGlobal.getWindowManagerService()
|
||||
.setTaskTransitionSpec(customTaskAnimationSpec);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// This shouldn't happen but if it does task animations won't look good until the
|
||||
// taskbar stashing state is changed.
|
||||
Log.e(TAG, "Failed to update task transition spec to account for new taskbar state",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,9 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_B
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SHOWING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_SHOWING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.DrawableRes;
|
||||
@@ -81,6 +83,7 @@ public class NavbarButtonsViewController {
|
||||
private static final int FLAG_DISABLE_HOME = 1 << 7;
|
||||
private static final int FLAG_DISABLE_RECENTS = 1 << 8;
|
||||
private static final int FLAG_DISABLE_BACK = 1 << 9;
|
||||
private static final int FLAG_NOTIFICATION_SHADE_EXPANDED = 1 << 10;
|
||||
|
||||
private static final int MASK_IME_SWITCHER_VISIBLE = FLAG_SWITCHER_SUPPORTED | FLAG_IME_VISIBLE;
|
||||
|
||||
@@ -98,6 +101,8 @@ public class NavbarButtonsViewController {
|
||||
|
||||
private final AnimatedFloat mTaskbarNavButtonTranslationY = new AnimatedFloat(
|
||||
this::updateNavButtonTranslationY);
|
||||
private final AnimatedFloat mNavButtonTranslationYMultiplier = new AnimatedFloat(
|
||||
this::updateNavButtonTranslationY);
|
||||
|
||||
// Initialized in init.
|
||||
private TaskbarControllers mControllers;
|
||||
@@ -120,6 +125,7 @@ public class NavbarButtonsViewController {
|
||||
mControllers = controllers;
|
||||
mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarSize;
|
||||
parseSystemUiFlags(sharedState.sysuiStateFlags);
|
||||
mNavButtonTranslationYMultiplier.value = 1;
|
||||
|
||||
mA11yLongClickListener = view -> {
|
||||
mControllers.navButtonController.onButtonClick(BUTTON_A11Y_LONG_CLICK);
|
||||
@@ -149,6 +155,11 @@ public class NavbarButtonsViewController {
|
||||
.getKeyguardBgTaskbar(),
|
||||
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0, AnimatedFloat.VALUE, 1, 0));
|
||||
|
||||
// Make sure to remove nav bar buttons translation when notification shade is expanded.
|
||||
mPropertyHolders.add(new StatePropertyHolder(mNavButtonTranslationYMultiplier,
|
||||
flags -> (flags & FLAG_NOTIFICATION_SHADE_EXPANDED) != 0, AnimatedFloat.VALUE,
|
||||
0, 1));
|
||||
|
||||
// Force nav buttons (specifically back button) to be visible during setup wizard.
|
||||
boolean isInSetup = !mContext.isUserSetupComplete();
|
||||
if (isThreeButtonNav || isInSetup) {
|
||||
@@ -176,12 +187,12 @@ public class NavbarButtonsViewController {
|
||||
}
|
||||
}
|
||||
|
||||
// Animate taskbar background when IME shows
|
||||
// Animate taskbar background when any of these flags are enabled
|
||||
int flagsToShowBg = FLAG_IME_VISIBLE | FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE
|
||||
| FLAG_NOTIFICATION_SHADE_EXPANDED;
|
||||
mPropertyHolders.add(new StatePropertyHolder(
|
||||
mControllers.taskbarDragLayerController.getNavbarBackgroundAlpha(),
|
||||
flags -> (flags & FLAG_IME_VISIBLE) != 0 ||
|
||||
(flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0,
|
||||
AnimatedFloat.VALUE, 1, 0));
|
||||
flags -> (flags & flagsToShowBg) != 0, AnimatedFloat.VALUE, 1, 0));
|
||||
|
||||
// Rotation button
|
||||
RotationButton rotationButton = new RotationButtonImpl(
|
||||
@@ -258,6 +269,9 @@ public class NavbarButtonsViewController {
|
||||
boolean isHomeDisabled = (sysUiStateFlags & SYSUI_STATE_HOME_DISABLED) != 0;
|
||||
boolean isRecentsDisabled = (sysUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0;
|
||||
boolean isBackDisabled = (sysUiStateFlags & SYSUI_STATE_BACK_DISABLED) != 0;
|
||||
int shadeExpandedFlags = SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
|
||||
| SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
||||
boolean isNotificationShadeExpanded = (sysUiStateFlags & shadeExpandedFlags) != 0;
|
||||
|
||||
// TODO(b/202218289) we're getting IME as not visible on lockscreen from system
|
||||
updateStateForFlag(FLAG_IME_VISIBLE, isImeVisible);
|
||||
@@ -266,6 +280,7 @@ public class NavbarButtonsViewController {
|
||||
updateStateForFlag(FLAG_DISABLE_HOME, isHomeDisabled);
|
||||
updateStateForFlag(FLAG_DISABLE_RECENTS, isRecentsDisabled);
|
||||
updateStateForFlag(FLAG_DISABLE_BACK, isBackDisabled);
|
||||
updateStateForFlag(FLAG_NOTIFICATION_SHADE_EXPANDED, isNotificationShadeExpanded);
|
||||
|
||||
if (mA11yButton != null) {
|
||||
// Only used in 3 button
|
||||
@@ -360,7 +375,8 @@ public class NavbarButtonsViewController {
|
||||
}
|
||||
|
||||
private void updateNavButtonTranslationY() {
|
||||
mNavButtonsView.setTranslationY(mTaskbarNavButtonTranslationY.value);
|
||||
mNavButtonsView.setTranslationY(mTaskbarNavButtonTranslationY.value
|
||||
* mNavButtonTranslationYMultiplier.value);
|
||||
}
|
||||
|
||||
private ImageView addButton(@DrawableRes int drawableId, @TaskbarButton int buttonType,
|
||||
|
||||
@@ -25,6 +25,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_Q
|
||||
import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_BOTTOM_TAPPABLE_ELEMENT;
|
||||
import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_EXTRA_NAVIGATION_BAR;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
@@ -328,10 +329,9 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
mControllers.navbarButtonsViewController.updateStateForSysuiFlags(systemUiStateFlags);
|
||||
mControllers.taskbarViewController.setImeIsVisible(
|
||||
mControllers.navbarButtonsViewController.isImeVisible());
|
||||
boolean panelExpanded = (systemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) != 0;
|
||||
boolean inSettings = (systemUiStateFlags & SYSUI_STATE_QUICK_SETTINGS_EXPANDED) != 0;
|
||||
mControllers.taskbarViewController.setNotificationShadeIsExpanded(
|
||||
panelExpanded || inSettings);
|
||||
int shadeExpandedFlags = SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
|
||||
| SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
||||
onNotificationShadeExpandChanged((systemUiStateFlags & shadeExpandedFlags) != 0);
|
||||
mControllers.taskbarViewController.setRecentsButtonDisabled(
|
||||
mControllers.navbarButtonsViewController.isRecentsDisabled());
|
||||
mControllers.stashedHandleViewController.setIsHomeButtonDisabled(
|
||||
@@ -341,6 +341,21 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
mControllers.taskbarScrimViewController.updateStateForSysuiFlags(systemUiStateFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the taskbar icons and background when the notication shade is expanded.
|
||||
*/
|
||||
private void onNotificationShadeExpandChanged(boolean isExpanded) {
|
||||
float alpha = isExpanded ? 0 : 1;
|
||||
AnimatorSet anim = new AnimatorSet();
|
||||
anim.play(mControllers.taskbarViewController.getTaskbarIconAlpha().getProperty(
|
||||
TaskbarViewController.ALPHA_INDEX_NOTIFICATION_EXPANDED).animateToValue(alpha));
|
||||
if (!isThreeButtonNav()) {
|
||||
anim.play(mControllers.taskbarDragLayerController.getNotificationShadeBgTaskbar()
|
||||
.animateToValue(alpha));
|
||||
}
|
||||
anim.start();
|
||||
}
|
||||
|
||||
public void onRotationProposal(int rotation, boolean isValid) {
|
||||
mControllers.rotationButtonController.onRotationProposal(rotation, isValid);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ public class TaskbarDragLayerController {
|
||||
private final AnimatedFloat mBgTaskbar = new AnimatedFloat(this::updateBackgroundAlpha);
|
||||
private final AnimatedFloat mBgNavbar = new AnimatedFloat(this::updateBackgroundAlpha);
|
||||
private final AnimatedFloat mKeyguardBgTaskbar = new AnimatedFloat(this::updateBackgroundAlpha);
|
||||
private final AnimatedFloat mNotificationShadeBgTaskbar = new AnimatedFloat(
|
||||
this::updateBackgroundAlpha);
|
||||
// Used to hide our background color when someone else (e.g. ScrimView) is handling it.
|
||||
private final AnimatedFloat mBgOverride = new AnimatedFloat(this::updateBackgroundAlpha);
|
||||
|
||||
@@ -65,6 +67,7 @@ public class TaskbarDragLayerController {
|
||||
|
||||
mBgTaskbar.value = 1;
|
||||
mKeyguardBgTaskbar.value = 1;
|
||||
mNotificationShadeBgTaskbar.value = 1;
|
||||
mBgOverride.value = 1;
|
||||
updateBackgroundAlpha();
|
||||
}
|
||||
@@ -95,6 +98,10 @@ public class TaskbarDragLayerController {
|
||||
return mKeyguardBgTaskbar;
|
||||
}
|
||||
|
||||
public AnimatedFloat getNotificationShadeBgTaskbar() {
|
||||
return mNotificationShadeBgTaskbar;
|
||||
}
|
||||
|
||||
public AnimatedFloat getOverrideBackgroundAlpha() {
|
||||
return mBgOverride;
|
||||
}
|
||||
@@ -105,7 +112,8 @@ public class TaskbarDragLayerController {
|
||||
|
||||
private void updateBackgroundAlpha() {
|
||||
final float bgNavbar = mBgNavbar.value;
|
||||
final float bgTaskbar = mBgTaskbar.value * mKeyguardBgTaskbar.value;
|
||||
final float bgTaskbar = mBgTaskbar.value * mKeyguardBgTaskbar.value
|
||||
* mNotificationShadeBgTaskbar.value;
|
||||
mTaskbarDragLayer.setTaskbarBackgroundAlpha(
|
||||
mBgOverride.value * Math.max(bgNavbar, bgTaskbar)
|
||||
);
|
||||
|
||||
@@ -115,16 +115,6 @@ public class TaskbarViewController {
|
||||
mTaskbarView.setTouchesEnabled(!isImeVisible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called when the notification shade is expanded, so we can hide taskbar icons as
|
||||
* well. Note that we are animating icons to appear / disappear.
|
||||
*/
|
||||
public void setNotificationShadeIsExpanded(boolean isNotificationShadeExpanded) {
|
||||
mTaskbarIconAlpha.getProperty(ALPHA_INDEX_NOTIFICATION_EXPANDED)
|
||||
.animateToValue(isNotificationShadeExpanded ? 0 : 1)
|
||||
.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called when the recents button is disabled, so we can hide taskbar icons as well.
|
||||
*/
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface InputConsumer {
|
||||
int TYPE_SCREEN_PINNED = 1 << 6;
|
||||
int TYPE_OVERVIEW_WITHOUT_FOCUS = 1 << 7;
|
||||
int TYPE_RESET_GESTURE = 1 << 8;
|
||||
int TYPE_OVERSCROLL = 1 << 9;
|
||||
int TYPE_PROGRESS_DELEGATE = 1 << 9;
|
||||
int TYPE_SYSUI_OVERLAY = 1 << 10;
|
||||
int TYPE_ONE_HANDED = 1 << 11;
|
||||
int TYPE_TASKBAR_STASH = 1 << 12;
|
||||
@@ -51,7 +51,7 @@ public interface InputConsumer {
|
||||
"TYPE_SCREEN_PINNED", // 6
|
||||
"TYPE_OVERVIEW_WITHOUT_FOCUS", // 7
|
||||
"TYPE_RESET_GESTURE", // 8
|
||||
"TYPE_OVERSCROLL", // 9
|
||||
"TYPE_PROGRESS_DELEGATE", // 9
|
||||
"TYPE_SYSUI_OVERLAY", // 10
|
||||
"TYPE_ONE_HANDED", // 11
|
||||
"TYPE_TASKBAR_STASH", // 12
|
||||
|
||||
@@ -86,6 +86,7 @@ import com.android.quickstep.inputconsumers.OneHandedModeInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.OtherActivityInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.OverviewInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.OverviewWithoutFocusInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.ProgressDelegateInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.ResetGestureInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.ScreenPinnedInputConsumer;
|
||||
import com.android.quickstep.inputconsumers.SysUiOverlayInputConsumer;
|
||||
@@ -114,6 +115,7 @@ import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Service connected by system-UI for handling touch interaction.
|
||||
@@ -290,6 +292,13 @@ public class TouchInteractionService extends Service
|
||||
public OverviewCommandHelper getOverviewCommandHelper() {
|
||||
return mOverviewCommandHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a proxy to bypass swipe up behavior
|
||||
*/
|
||||
public void setSwipeUpProxy(Function<GestureState, AnimatedFloat> proxy) {
|
||||
mSwipeUpProxyProvider = proxy != null ? proxy : (i -> null);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean sConnected = false;
|
||||
@@ -328,6 +337,7 @@ public class TouchInteractionService extends Service
|
||||
private DisplayManager mDisplayManager;
|
||||
|
||||
private TaskbarManager mTaskbarManager;
|
||||
private Function<GestureState, AnimatedFloat> mSwipeUpProxyProvider = i -> null;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@@ -636,6 +646,12 @@ public class TouchInteractionService extends Service
|
||||
|
||||
private InputConsumer newConsumer(GestureState previousGestureState,
|
||||
GestureState newGestureState, MotionEvent event) {
|
||||
AnimatedFloat progressProxy = mSwipeUpProxyProvider.apply(mGestureState);
|
||||
if (progressProxy != null) {
|
||||
return new ProgressDelegateInputConsumer(this, mTaskAnimationManager,
|
||||
mGestureState, mInputMonitorCompat, progressProxy);
|
||||
}
|
||||
|
||||
boolean canStartSystemGesture = mDeviceState.canStartSystemGesture();
|
||||
|
||||
if (!mDeviceState.isUserUnlocked()) {
|
||||
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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.quickstep.inputconsumers;
|
||||
|
||||
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
|
||||
import static com.android.launcher3.touch.BaseSwipeDetector.calculateDuration;
|
||||
import static com.android.launcher3.touch.SingleAxisSwipeDetector.DIRECTION_POSITIVE;
|
||||
import static com.android.launcher3.touch.SingleAxisSwipeDetector.VERTICAL;
|
||||
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
|
||||
import static com.android.quickstep.util.ActiveGestureLog.INTENT_EXTRA_LOG_TRACE_ID;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Point;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.testing.TestLogging;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.launcher3.touch.SingleAxisSwipeDetector;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.quickstep.AnimatedFloat;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.InputConsumer;
|
||||
import com.android.quickstep.MultiStateCallback;
|
||||
import com.android.quickstep.RecentsAnimationCallbacks;
|
||||
import com.android.quickstep.RecentsAnimationController;
|
||||
import com.android.quickstep.RecentsAnimationTargets;
|
||||
import com.android.quickstep.TaskAnimationManager;
|
||||
import com.android.systemui.shared.recents.model.ThumbnailData;
|
||||
import com.android.systemui.shared.system.InputMonitorCompat;
|
||||
|
||||
/**
|
||||
* Input consumer which delegates the swipe-progress handling
|
||||
*/
|
||||
public class ProgressDelegateInputConsumer implements InputConsumer,
|
||||
RecentsAnimationCallbacks.RecentsAnimationListener,
|
||||
SingleAxisSwipeDetector.Listener {
|
||||
|
||||
private static final float SWIPE_DISTANCE_THRESHOLD = 0.2f;
|
||||
|
||||
private static final String[] STATE_NAMES = DEBUG_STATES ? new String[3] : null;
|
||||
private static int getFlagForIndex(int index, String name) {
|
||||
if (DEBUG_STATES) {
|
||||
STATE_NAMES[index] = name;
|
||||
}
|
||||
return 1 << index;
|
||||
}
|
||||
|
||||
private static final int STATE_TARGET_RECEIVED =
|
||||
getFlagForIndex(0, "STATE_TARGET_RECEIVED");
|
||||
private static final int STATE_HANDLER_INVALIDATED =
|
||||
getFlagForIndex(1, "STATE_HANDLER_INVALIDATED");
|
||||
private static final int STATE_FLING_FINISHED =
|
||||
getFlagForIndex(2, "STATE_FLING_FINISHED");
|
||||
|
||||
private final Context mContext;
|
||||
private final TaskAnimationManager mTaskAnimationManager;
|
||||
private final GestureState mGestureState;
|
||||
private final InputMonitorCompat mInputMonitorCompat;
|
||||
private final MultiStateCallback mStateCallback;
|
||||
|
||||
private final Point mDisplaySize;
|
||||
private final SingleAxisSwipeDetector mSwipeDetector;
|
||||
|
||||
private final AnimatedFloat mProgress;
|
||||
|
||||
private boolean mDragStarted = false;
|
||||
|
||||
private RecentsAnimationController mRecentsAnimationController;
|
||||
private Boolean mFlingEndsOnHome;
|
||||
|
||||
public ProgressDelegateInputConsumer(Context context,
|
||||
TaskAnimationManager taskAnimationManager, GestureState gestureState,
|
||||
InputMonitorCompat inputMonitorCompat, AnimatedFloat progress) {
|
||||
mContext = context;
|
||||
mTaskAnimationManager = taskAnimationManager;
|
||||
mGestureState = gestureState;
|
||||
mInputMonitorCompat = inputMonitorCompat;
|
||||
mProgress = progress;
|
||||
|
||||
// Do not use DeviceProfile as the user data might be locked
|
||||
mDisplaySize = DisplayController.INSTANCE.get(context).getInfo().currentSize;
|
||||
|
||||
// Init states
|
||||
mStateCallback = new MultiStateCallback(STATE_NAMES);
|
||||
mStateCallback.runOnceAtState(STATE_TARGET_RECEIVED | STATE_HANDLER_INVALIDATED,
|
||||
this::endRemoteAnimation);
|
||||
mStateCallback.runOnceAtState(STATE_TARGET_RECEIVED | STATE_FLING_FINISHED,
|
||||
this::onFlingFinished);
|
||||
|
||||
mSwipeDetector = new SingleAxisSwipeDetector(mContext, this, VERTICAL);
|
||||
mSwipeDetector.setDetectableScrollConditions(DIRECTION_POSITIVE, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return TYPE_PROGRESS_DELEGATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMotionEvent(MotionEvent ev) {
|
||||
if (mFlingEndsOnHome == null) {
|
||||
mSwipeDetector.onTouchEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragStart(boolean start, float startDisplacement) {
|
||||
mDragStarted = true;
|
||||
TestLogging.recordEvent(TestProtocol.SEQUENCE_PILFER, "pilferPointers");
|
||||
mInputMonitorCompat.pilferPointers();
|
||||
Intent intent = mGestureState.getHomeIntent()
|
||||
.putExtra(INTENT_EXTRA_LOG_TRACE_ID, mGestureState.getGestureId());
|
||||
mTaskAnimationManager.startRecentsAnimation(mGestureState, intent, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDrag(float displacement) {
|
||||
if (mDisplaySize.y > 0) {
|
||||
mProgress.updateValue(displacement / -mDisplaySize.y);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDragEnd(float velocity) {
|
||||
final boolean willExit;
|
||||
if (mSwipeDetector.isFling(velocity)) {
|
||||
willExit = velocity < 0;
|
||||
} else {
|
||||
willExit = mProgress.value > SWIPE_DISTANCE_THRESHOLD;
|
||||
}
|
||||
float endValue = willExit ? 1 : 0;
|
||||
long duration = calculateDuration(velocity, endValue - mProgress.value);
|
||||
mFlingEndsOnHome = willExit;
|
||||
|
||||
ObjectAnimator anim = mProgress.animateToValue(endValue);
|
||||
anim.setDuration(duration).setInterpolator(scrollInterpolatorForVelocity(velocity));
|
||||
if (mRecentsAnimationController != null) {
|
||||
anim.addListener(AnimatorListeners.forSuccessCallback(
|
||||
() -> mStateCallback.setState(STATE_FLING_FINISHED)));
|
||||
}
|
||||
anim.start();
|
||||
}
|
||||
|
||||
private void onFlingFinished() {
|
||||
if (mRecentsAnimationController != null) {
|
||||
boolean endToRecents = mFlingEndsOnHome == null ? true : mFlingEndsOnHome;
|
||||
mRecentsAnimationController.finishController(endToRecents /* toRecents */,
|
||||
null /* callback */, false /* sendUserLeaveHint */);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationStart(RecentsAnimationController controller,
|
||||
RecentsAnimationTargets targets) {
|
||||
mRecentsAnimationController = controller;
|
||||
mStateCallback.setState(STATE_TARGET_RECEIVED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationCanceled(ThumbnailData thumbnailData) {
|
||||
mRecentsAnimationController = null;
|
||||
}
|
||||
|
||||
private void endRemoteAnimation() {
|
||||
onDragEnd(Float.MIN_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConsumerAboutToBeSwitched() {
|
||||
mStateCallback.setState(STATE_HANDLER_INVALIDATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowInterceptByParent() {
|
||||
return !mDragStarted;
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,28 @@
|
||||
*/
|
||||
package com.android.quickstep.interaction;
|
||||
|
||||
import static com.android.launcher3.Utilities.mapBoundToRange;
|
||||
import static com.android.launcher3.Utilities.mapRange;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager.RunningTaskInfo;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.ColorMatrix;
|
||||
import android.graphics.ColorMatrixColorFilter;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.RadialGradient;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader.TileMode;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -29,9 +47,12 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.quickstep.AnimatedFloat;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.TouchInteractionService.TISBinder;
|
||||
import com.android.quickstep.util.TISBindHelper;
|
||||
|
||||
@@ -49,13 +70,23 @@ public class AllSetActivity extends Activity {
|
||||
private static final String EXTRA_ACCENT_COLOR_DARK_MODE = "suwColorAccentDark";
|
||||
private static final String EXTRA_ACCENT_COLOR_LIGHT_MODE = "suwColorAccentLight";
|
||||
|
||||
private static final float HINT_BOTTOM_FACTOR = 1 - .94f;
|
||||
|
||||
private TISBindHelper mTISBindHelper;
|
||||
private TISBinder mBinder;
|
||||
|
||||
private final AnimatedFloat mSwipeProgress = new AnimatedFloat(this::onSwipeProgressUpdate);
|
||||
private BgDrawable mBackground;
|
||||
private View mContentView;
|
||||
private float mSwipeUpShift;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_allset);
|
||||
findViewById(R.id.root_view).setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
|
||||
int mode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
boolean isDarkTheme = mode == Configuration.UI_MODE_NIGHT_YES;
|
||||
@@ -65,6 +96,11 @@ public class AllSetActivity extends Activity {
|
||||
|
||||
((ImageView) findViewById(R.id.icon)).getDrawable().mutate().setTint(accentColor);
|
||||
|
||||
mBackground = new BgDrawable(this);
|
||||
findViewById(R.id.root_view).setBackground(mBackground);
|
||||
mContentView = findViewById(R.id.content_view);
|
||||
mSwipeUpShift = getResources().getDimension(R.dimen.allset_swipe_up_shift);
|
||||
|
||||
TextView tv = findViewById(R.id.navigation_settings);
|
||||
tv.setTextColor(accentColor);
|
||||
tv.setOnClickListener(v -> {
|
||||
@@ -86,19 +122,26 @@ public class AllSetActivity extends Activity {
|
||||
super.onResume();
|
||||
if (mBinder != null) {
|
||||
mBinder.getTaskbarManager().setSetupUIVisible(true);
|
||||
mBinder.setSwipeUpProxy(this::createSwipeUpProxy);
|
||||
}
|
||||
}
|
||||
|
||||
private void onTISConnected(TISBinder binder) {
|
||||
mBinder = binder;
|
||||
mBinder.getTaskbarManager().setSetupUIVisible(isResumed());
|
||||
mBinder.setSwipeUpProxy(isResumed() ? this::createSwipeUpProxy : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
clearBinderOverride();
|
||||
}
|
||||
|
||||
private void clearBinderOverride() {
|
||||
if (mBinder != null) {
|
||||
mBinder.getTaskbarManager().setSetupUIVisible(false);
|
||||
mBinder.setSwipeUpProxy(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +149,27 @@ public class AllSetActivity extends Activity {
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mTISBindHelper.onDestroy();
|
||||
clearBinderOverride();
|
||||
}
|
||||
|
||||
private AnimatedFloat createSwipeUpProxy(GestureState state) {
|
||||
if (!state.getHomeIntent().getComponent().getPackageName().equals(getPackageName())) {
|
||||
return null;
|
||||
}
|
||||
RunningTaskInfo rti = state.getRunningTask();
|
||||
if (rti == null || !rti.topActivity.equals(getComponentName())) {
|
||||
return null;
|
||||
}
|
||||
mSwipeProgress.updateValue(0);
|
||||
return mSwipeProgress;
|
||||
}
|
||||
|
||||
private void onSwipeProgressUpdate() {
|
||||
mBackground.setProgress(mSwipeProgress.value);
|
||||
float alpha = Utilities.mapBoundToRange(mSwipeProgress.value, 0, HINT_BOTTOM_FACTOR,
|
||||
1, 0, LINEAR);
|
||||
mContentView.setAlpha(alpha);
|
||||
mContentView.setTranslationY((alpha - 1) * mSwipeUpShift);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,4 +196,79 @@ public class AllSetActivity extends Activity {
|
||||
return super.performAccessibilityAction(host, action, args);
|
||||
}
|
||||
}
|
||||
|
||||
private static class BgDrawable extends Drawable {
|
||||
|
||||
private static final float START_SIZE_FACTOR = .5f;
|
||||
private static final float END_SIZE_FACTOR = 2;
|
||||
private static final float GRADIENT_END_PROGRESS = .5f;
|
||||
|
||||
private final Paint mPaint = new Paint();
|
||||
private final RadialGradient mMaskGrad;
|
||||
private final Matrix mMatrix = new Matrix();
|
||||
|
||||
private final ColorMatrix mColorMatrix = new ColorMatrix();
|
||||
private final ColorMatrixColorFilter mColorFilter =
|
||||
new ColorMatrixColorFilter(mColorMatrix);
|
||||
|
||||
private final int mColor;
|
||||
private float mProgress = 0;
|
||||
|
||||
BgDrawable(Context context) {
|
||||
mColor = context.getColor(R.color.all_set_page_background);
|
||||
mMaskGrad = new RadialGradient(0, 0, 1,
|
||||
new int[] {ColorUtils.setAlphaComponent(mColor, 0), mColor},
|
||||
new float[]{0, 1}, TileMode.CLAMP);
|
||||
|
||||
mPaint.setShader(mMaskGrad);
|
||||
mPaint.setColorFilter(mColorFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
if (mProgress <= 0) {
|
||||
canvas.drawColor(mColor);
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the progress to half the size only.
|
||||
float progress = mapBoundToRange(mProgress,
|
||||
0, GRADIENT_END_PROGRESS, 0, 1, LINEAR);
|
||||
Rect bounds = getBounds();
|
||||
float x = bounds.exactCenterX();
|
||||
float height = bounds.height();
|
||||
|
||||
float size = PointF.length(x, height);
|
||||
float radius = size * mapRange(progress, START_SIZE_FACTOR, END_SIZE_FACTOR);
|
||||
float y = mapRange(progress, height + radius , height / 2);
|
||||
mMatrix.setTranslate(x, y);
|
||||
mMatrix.postScale(radius, radius, x, y);
|
||||
mMaskGrad.setLocalMatrix(mMatrix);
|
||||
|
||||
// Change the alpha-addition-component (index 19) so that every pixel is updated
|
||||
// accordingly
|
||||
mColorMatrix.getArray()[19] = mapBoundToRange(mProgress, 0, 1, 0, -255, LINEAR);
|
||||
mColorFilter.setColorMatrix(mColorMatrix);
|
||||
|
||||
canvas.drawPaint(mPaint);
|
||||
}
|
||||
|
||||
public void setProgress(float progress) {
|
||||
if (mProgress != progress) {
|
||||
mProgress = progress;
|
||||
invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return PixelFormat.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int i) { }
|
||||
|
||||
@Override
|
||||
public void setColorFilter(ColorFilter colorFilter) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ public abstract class ButtonDropTarget extends TextView
|
||||
// We do not set the drawable in the xml as that inflates two drawables corresponding to
|
||||
// drawableLeft and drawableStart.
|
||||
mDrawable = getContext().getDrawable(resId).mutate();
|
||||
mDrawable.setBounds(0, 0, mDrawableSize, mDrawableSize);
|
||||
mDrawable.setTintList(getTextColors());
|
||||
centerIcon();
|
||||
setCompoundDrawablesRelative(mDrawable, null, null, null);
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ public abstract class ButtonDropTarget extends TextView
|
||||
}
|
||||
|
||||
final int top = to.top + (getMeasuredHeight() - height) / 2;
|
||||
final int bottom = top + height;
|
||||
final int bottom = top + height;
|
||||
|
||||
to.set(left, top, right, bottom);
|
||||
|
||||
@@ -290,6 +290,12 @@ public abstract class ButtonDropTarget extends TextView
|
||||
return to;
|
||||
}
|
||||
|
||||
private void centerIcon() {
|
||||
int x = mTextVisible ? 0
|
||||
: (getWidth() - getPaddingLeft() - getPaddingRight()) / 2 - mDrawableSize / 2;
|
||||
mDrawable.setBounds(x, 0, x + mDrawableSize, mDrawableSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mLauncher.getAccessibilityDelegate().handleAccessibleDrop(this, null, null);
|
||||
@@ -300,12 +306,19 @@ public abstract class ButtonDropTarget extends TextView
|
||||
if (mTextVisible != isVisible || !TextUtils.equals(newText, getText())) {
|
||||
mTextVisible = isVisible;
|
||||
setText(newText);
|
||||
centerIcon();
|
||||
setCompoundDrawablesRelative(mDrawable, null, null, null);
|
||||
int drawablePadding = mTextVisible ? mDrawablePadding : 0;
|
||||
setCompoundDrawablePadding(drawablePadding);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||
super.onSizeChanged(w, h, oldw, oldh);
|
||||
centerIcon();
|
||||
}
|
||||
|
||||
public void setToolTipLocation(int location) {
|
||||
mToolTipLocation = location;
|
||||
hideTooltip();
|
||||
|
||||
@@ -190,6 +190,7 @@ public class LoaderCursor extends CursorWrapper {
|
||||
String resourceName = itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT
|
||||
? getString(iconResourceIndex) : null;
|
||||
byte[] iconBlob = itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT
|
||||
|| itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT
|
||||
|| restoreFlag != 0
|
||||
? getBlob(iconIndex) : null;
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ public class FloatingIconView extends FrameLayout implements
|
||||
|
||||
// Manages loading the icon on a worker thread
|
||||
private static @Nullable IconLoadResult sIconLoadResult;
|
||||
private static long sFetchIconId = 0;
|
||||
private static long sRecycledFetchIconId = sFetchIconId;
|
||||
|
||||
public static final float SHAPE_PROGRESS_DURATION = 0.10f;
|
||||
private static final RectF sTmpRectF = new RectF();
|
||||
@@ -519,8 +521,13 @@ public class FloatingIconView extends FrameLayout implements
|
||||
IconLoadResult result = new IconLoadResult(info,
|
||||
btvIcon == null ? false : btvIcon.isThemed());
|
||||
|
||||
MODEL_EXECUTOR.getHandler().postAtFrontOfQueue(() ->
|
||||
getIconResult(l, v, info, position, btvIcon, result));
|
||||
final long fetchIconId = sFetchIconId++;
|
||||
MODEL_EXECUTOR.getHandler().postAtFrontOfQueue(() -> {
|
||||
if (fetchIconId < sRecycledFetchIconId) {
|
||||
return;
|
||||
}
|
||||
getIconResult(l, v, info, position, btvIcon, result);
|
||||
});
|
||||
|
||||
sIconLoadResult = result;
|
||||
return result;
|
||||
@@ -622,6 +629,7 @@ public class FloatingIconView extends FrameLayout implements
|
||||
mOnTargetChangeRunnable = null;
|
||||
mBadge = null;
|
||||
sTmpObjArray[0] = null;
|
||||
sRecycledFetchIconId = sFetchIconId;
|
||||
mIconLoadResult = null;
|
||||
mClipIconView.recycle();
|
||||
mBtvDrawable.setBackground(null);
|
||||
|
||||
Reference in New Issue
Block a user