Delete all* references to launcher clings.
Launcher clings are dead. Delete all the code and resources associated with them. * Did not delete the actual code the marks the cling as dismissed since it's used in db upgrade and backup/restore paths. Figured we probably want to keep that. Change-Id: I28841b4a430187b62b239afeb64bee81a798e259 Fixes: 29461092
This commit is contained in:
parent
8b9cb08b02
commit
932eb8313c
Binary file not shown.
Before Width: | Height: | Size: 1023 B |
Binary file not shown.
Before Width: | Height: | Size: 750 B |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.4 KiB |
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:launcher="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/longpress_cling"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
launcher:layout_ignoreInsets="true"
|
||||
android:background="@color/cling_scrim_background"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/cling_content"
|
||||
android:layout_width="360dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/cling_bg" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:launcher="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/longpress_cling"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
launcher:layout_ignoreInsets="true"
|
||||
android:background="@color/cling_scrim_background" >
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/cling_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:background="@drawable/cling_bg"
|
||||
android:tag="crop_bg_top_and_sides" />
|
||||
|
||||
</FrameLayout>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:launcher="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/longpress_cling"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
launcher:layout_ignoreInsets="true"
|
||||
android:background="@color/cling_scrim_background"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/cling_content"
|
||||
android:layout_width="360dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/cling_bg" />
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,43 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="24dp"
|
||||
android:paddingTop="36dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="36dp"
|
||||
android:paddingRight="36dp"
|
||||
android:text="@string/workspace_cling_longpress_title"
|
||||
android:textColor="#E1000000"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:paddingLeft="36dp"
|
||||
android:paddingRight="36dp"
|
||||
android:text="@string/workspace_cling_longpress_description"
|
||||
android:textColor="#99000000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/cling_dismiss_longpress_info"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginTop="27dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:text="@string/workspace_cling_longpress_dismiss"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,54 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="24dp"
|
||||
android:paddingTop="36dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:paddingLeft="36dp"
|
||||
android:paddingRight="36dp"
|
||||
android:text="@string/first_run_cling_title"
|
||||
android:textColor="#E1000000"
|
||||
android:textSize="34sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5.3dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingLeft="36dp"
|
||||
android:paddingRight="36dp"
|
||||
android:text="@string/workspace_cling_longpress_title"
|
||||
android:textColor="#E1000000"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="36dp"
|
||||
android:paddingRight="36dp"
|
||||
android:text="@string/workspace_cling_longpress_description"
|
||||
android:textColor="#99000000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/cling_dismiss_longpress_info"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginTop="27dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:text="@string/workspace_cling_longpress_dismiss"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -26,14 +26,6 @@
|
|||
<dimen name="all_apps_background_canvas_height">525dp</dimen>
|
||||
<dimen name="all_apps_icon_width_gap">36dp</dimen>
|
||||
|
||||
<!-- Cling -->
|
||||
<dimen name="cling_migration_logo_height">400dp</dimen>
|
||||
<dimen name="cling_migration_logo_width">274dp</dimen>
|
||||
<dimen name="cling_migration_bg_size">600dp</dimen>
|
||||
<dimen name="cling_migration_bg_shift">-300dp</dimen>
|
||||
<dimen name="cling_migration_content_margin">64dp</dimen>
|
||||
<dimen name="cling_migration_content_width">280dp</dimen>
|
||||
|
||||
<!-- Widget tray -->
|
||||
<dimen name="widget_section_indent">56dp</dimen>
|
||||
|
||||
|
|
|
@ -22,8 +22,4 @@
|
|||
<dimen name="all_apps_empty_search_message_top_offset">64dp</dimen>
|
||||
<dimen name="all_apps_empty_search_bg_top_offset">180dp</dimen>
|
||||
|
||||
<!-- Cling -->
|
||||
<dimen name="cling_migration_content_margin">96dp</dimen>
|
||||
<dimen name="cling_migration_content_width">320dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
over the delete target or the info target -->
|
||||
<color name="delete_target_hover_tint">#FFC1C1C1</color>
|
||||
<color name="uninstall_target_hover_tint">#FFF0592B</color>
|
||||
<color name="cling_scrim_background">#80000000</color>
|
||||
|
||||
<color name="focused_background">#80c6c5c5</color>
|
||||
|
||||
|
|
|
@ -121,24 +121,6 @@
|
|||
<!-- Description for a new page on homescreen[CHAR_LIMIT=none] -->
|
||||
<string name="workspace_new_page">New home screen page</string>
|
||||
|
||||
<!-- Clings -->
|
||||
<!-- The title text for the workspace cling [CHAR_LIMIT=30] -->
|
||||
<string name="first_run_cling_title">Welcome</string>
|
||||
<!-- The title text for the migration cling [CHAR_LIMIT=30] -->
|
||||
<string name="migration_cling_title">Copy your app icons</string>
|
||||
<!-- The description of what migration does [CHAR_LIMIT=70] -->
|
||||
<string name="migration_cling_description">Import icons and folders from your old Home screens?</string>
|
||||
<!-- The description of the button to migrate apps from another launcher [CHAR_LIMIT=30] -->
|
||||
<string name="migration_cling_copy_apps">COPY ICONS</string>
|
||||
<!-- The description of the button to use the default launcher layout [CHAR_LIMIT=30] -->
|
||||
<string name="migration_cling_use_default">START FRESH</string>
|
||||
<!-- The title text for workspace longpress action [CHAR_LIMIT=40] -->
|
||||
<string name="workspace_cling_longpress_title">Wallpapers, widgets, & settings</string>
|
||||
<!-- The description of how to use the workspace [CHAR_LIMIT=70] -->
|
||||
<string name="workspace_cling_longpress_description">Touch & hold background to customize</string>
|
||||
<!-- The description of the button to dismiss the cling [CHAR_LIMIT=30] -->
|
||||
<string name="workspace_cling_longpress_dismiss">GOT IT</string>
|
||||
|
||||
<!-- Folder accessibility -->
|
||||
<!-- The format string for when a folder is opened, speaks the dimensions -->
|
||||
<string name="folder_opened">Folder opened, <xliff:g id="width" example="5">%1$d</xliff:g> by <xliff:g id="height" example="3">%2$d</xliff:g></string>
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public class BorderCropDrawable extends Drawable {
|
||||
|
||||
private final Drawable mChild;
|
||||
private final Rect mBoundsShift;
|
||||
private final Rect mPadding;
|
||||
|
||||
BorderCropDrawable(Drawable child, boolean cropLeft,
|
||||
boolean cropTop, boolean cropRight, boolean cropBottom) {
|
||||
mChild = child;
|
||||
|
||||
mBoundsShift = new Rect();
|
||||
mPadding = new Rect();
|
||||
mChild.getPadding(mPadding);
|
||||
|
||||
if (cropLeft) {
|
||||
mBoundsShift.left = -mPadding.left;
|
||||
mPadding.left = 0;
|
||||
}
|
||||
if (cropTop) {
|
||||
mBoundsShift.top = -mPadding.top;
|
||||
mPadding.top = 0;
|
||||
}
|
||||
if (cropRight) {
|
||||
mBoundsShift.right = mPadding.right;
|
||||
mPadding.right = 0;
|
||||
}
|
||||
if (cropBottom) {
|
||||
mBoundsShift.bottom = mPadding.bottom;
|
||||
mPadding.bottom = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBoundsChange(Rect bounds) {
|
||||
mChild.setBounds(
|
||||
bounds.left + mBoundsShift.left,
|
||||
bounds.top + mBoundsShift.top,
|
||||
bounds.right + mBoundsShift.right,
|
||||
bounds.bottom + mBoundsShift.bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getPadding(Rect padding) {
|
||||
padding.set(mPadding);
|
||||
return (padding.left | padding.top | padding.right | padding.bottom) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
mChild.draw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return mChild.getOpacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
mChild.setAlpha(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorFilter(ColorFilter cf) {
|
||||
mChild.setColorFilter(cf);
|
||||
}
|
||||
}
|
|
@ -293,8 +293,6 @@ public class Launcher extends Activity
|
|||
/** Maps launcher activity components to their list of shortcut ids. */
|
||||
private MultiHashMap<ComponentKey, String> mDeepShortcutMap = new MultiHashMap<>();
|
||||
|
||||
private LauncherClings mClings;
|
||||
|
||||
private View.OnTouchListener mHapticFeedbackTouchListener;
|
||||
|
||||
// Related to the auto-advancing of widgets
|
||||
|
@ -3362,18 +3360,6 @@ public class Launcher extends Activity
|
|||
return anim;
|
||||
}
|
||||
|
||||
public void onLauncherClingShown() {
|
||||
// When a launcher cling appears, it should cover the underlying layers, so their focus
|
||||
// should be blocked.
|
||||
if (mDragLayer.getDescendantFocusability() != ViewGroup.FOCUS_BLOCK_DESCENDANTS) {
|
||||
mDragLayer.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
|
||||
}
|
||||
}
|
||||
|
||||
public void onLauncherClingDismissed() {
|
||||
mDragLayer.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
|
||||
}
|
||||
|
||||
public void enterSpringLoadedDragMode() {
|
||||
if (LOGD) Log.d(TAG, String.format("enterSpringLoadedDragMode [mState=%s", mState.name()));
|
||||
if (isStateSpringLoaded()) {
|
||||
|
@ -3994,8 +3980,7 @@ public class Launcher extends Activity
|
|||
|
||||
private boolean canRunNewAppsAnimation() {
|
||||
long diff = System.currentTimeMillis() - mDragController.getLastGestureUpTime();
|
||||
return diff > (NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS * 1000)
|
||||
&& (mClings == null || !mClings.isVisible());
|
||||
return diff > (NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS * 1000);
|
||||
}
|
||||
|
||||
private ValueAnimator createNewAppBounceAnimation(View v, int i) {
|
||||
|
@ -4369,42 +4354,6 @@ public class Launcher extends Activity
|
|||
}
|
||||
}
|
||||
|
||||
public void dismissIntroScreen() {
|
||||
markIntroScreenDismissed();
|
||||
if (showFirstRunActivity()) {
|
||||
// We delay hiding the intro view until the first run activity is showing. This
|
||||
// avoids a blip.
|
||||
mWorkspace.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDragLayer.dismissOverlayView();
|
||||
showFirstRunClings();
|
||||
}
|
||||
}, ACTIVITY_START_DELAY);
|
||||
} else {
|
||||
mDragLayer.dismissOverlayView();
|
||||
showFirstRunClings();
|
||||
}
|
||||
changeWallpaperVisiblity(true);
|
||||
}
|
||||
|
||||
private void markIntroScreenDismissed() {
|
||||
SharedPreferences.Editor editor = mSharedPrefs.edit();
|
||||
editor.putBoolean(INTRO_SCREEN_DISMISSED, true);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@Thunk void showFirstRunClings() {
|
||||
// The two first run cling paths are mutually exclusive, if the launcher is preinstalled
|
||||
// on the device, then we always show the first run cling experience (or if there is no
|
||||
// launcher2). Otherwise, we prompt the user upon started for migration
|
||||
LauncherClings launcherClings = new LauncherClings(this);
|
||||
if (launcherClings.shouldShowFirstRunOrMigrationClings()) {
|
||||
mClings = launcherClings;
|
||||
launcherClings.showLongPressCling(true);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: These method should be a part of LauncherSearchCallback
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public ItemInfo createAppDragInfo(Intent appLaunchIntent) {
|
||||
|
|
|
@ -16,192 +16,12 @@
|
|||
|
||||
package com.android.launcher3;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnKeyListener;
|
||||
import android.view.View.OnLongClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import com.android.launcher3.util.Thunk;
|
||||
|
||||
public class LauncherClings implements OnClickListener, OnKeyListener {
|
||||
@Deprecated
|
||||
public class LauncherClings {
|
||||
private static final String WORKSPACE_CLING_DISMISSED_KEY = "cling_gel.workspace.dismissed";
|
||||
|
||||
private static final String TAG_CROP_TOP_AND_SIDES = "crop_bg_top_and_sides";
|
||||
|
||||
private static final int SHOW_CLING_DURATION = 250;
|
||||
private static final int DISMISS_CLING_DURATION = 200;
|
||||
|
||||
@Thunk Launcher mLauncher;
|
||||
private LayoutInflater mInflater;
|
||||
@Thunk boolean mIsVisible;
|
||||
|
||||
/** Ctor */
|
||||
public LauncherClings(Launcher launcher) {
|
||||
mLauncher = launcher;
|
||||
mInflater = LayoutInflater.from(mLauncher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.cling_dismiss_longpress_info) {
|
||||
dismissLongPressCling();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
if (event.isPrintingKey()) {
|
||||
// Should ignore all printing keys, otherwise they come to the search box.
|
||||
return true;
|
||||
}
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
// Menu key goes to the overview mode similar to longpress, therefore it needs to
|
||||
// dismiss the clings.
|
||||
dismissLongPressCling();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void showLongPressCling(boolean showWelcome) {
|
||||
mIsVisible = true;
|
||||
ViewGroup root = (ViewGroup) mLauncher.findViewById(R.id.launcher);
|
||||
View cling = mInflater.inflate(R.layout.longpress_cling, root, false);
|
||||
|
||||
cling.setOnLongClickListener(new OnLongClickListener() {
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
mLauncher.showOverviewMode(true);
|
||||
dismissLongPressCling();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
final ViewGroup content = (ViewGroup) cling.findViewById(R.id.cling_content);
|
||||
mInflater.inflate(showWelcome ? R.layout.longpress_cling_welcome_content
|
||||
: R.layout.longpress_cling_content, content);
|
||||
final View button = content.findViewById(R.id.cling_dismiss_longpress_info);
|
||||
button.setOnClickListener(this);
|
||||
button.setOnKeyListener(this);
|
||||
|
||||
if (TAG_CROP_TOP_AND_SIDES.equals(content.getTag())) {
|
||||
Drawable bg = new BorderCropDrawable(mLauncher.getResources().getDrawable(R.drawable.cling_bg),
|
||||
true, true, true, false);
|
||||
content.setBackground(bg);
|
||||
}
|
||||
|
||||
mLauncher.onLauncherClingShown();
|
||||
root.addView(cling);
|
||||
|
||||
if (showWelcome) {
|
||||
// This is the first cling being shown. No need to animate.
|
||||
return;
|
||||
}
|
||||
|
||||
// Animate
|
||||
content.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
|
||||
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
content.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
|
||||
ObjectAnimator anim;
|
||||
if (TAG_CROP_TOP_AND_SIDES.equals(content.getTag())) {
|
||||
content.setTranslationY(-content.getMeasuredHeight());
|
||||
anim = LauncherAnimUtils.ofFloat(content, View.TRANSLATION_Y, 0);
|
||||
} else {
|
||||
content.setScaleX(0);
|
||||
content.setScaleY(0);
|
||||
PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1);
|
||||
PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1);
|
||||
anim = LauncherAnimUtils.ofPropertyValuesHolder(content, scaleX, scaleY);
|
||||
}
|
||||
|
||||
anim.setDuration(SHOW_CLING_DURATION);
|
||||
anim.setInterpolator(new LogDecelerateInterpolator(100, 0));
|
||||
anim.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Thunk void dismissLongPressCling() {
|
||||
Runnable dismissCb = new Runnable() {
|
||||
public void run() {
|
||||
final View cling = mLauncher.findViewById(R.id.longpress_cling);
|
||||
// To catch cases where siblings of top-level views are made invisible, just check whether
|
||||
// the cling is directly set to GONE before dismissing it.
|
||||
if (cling != null && cling.getVisibility() != View.GONE) {
|
||||
final Runnable cleanUpClingCb = new Runnable() {
|
||||
public void run() {
|
||||
cling.setVisibility(View.GONE);
|
||||
mLauncher.getSharedPrefs().edit()
|
||||
.putBoolean(WORKSPACE_CLING_DISMISSED_KEY, true)
|
||||
.apply();
|
||||
mIsVisible = false;
|
||||
mLauncher.onLauncherClingDismissed();
|
||||
}
|
||||
};
|
||||
cling.animate().alpha(0).setDuration(DISMISS_CLING_DURATION)
|
||||
.withEndAction(cleanUpClingCb);
|
||||
}
|
||||
}
|
||||
};
|
||||
mLauncher.getWorkspace().post(dismissCb);
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return mIsVisible;
|
||||
}
|
||||
|
||||
/** Returns whether the clings are enabled or should be shown */
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
private boolean areClingsEnabled() {
|
||||
// disable clings when running in a test harness
|
||||
if(ActivityManager.isRunningInTestHarness()) return false;
|
||||
|
||||
// Disable clings for accessibility when explore by touch is enabled
|
||||
final AccessibilityManager a11yManager = (AccessibilityManager) mLauncher.getSystemService(
|
||||
Launcher.ACCESSIBILITY_SERVICE);
|
||||
if (a11yManager.isTouchExplorationEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Restricted secondary users (child mode) will potentially have very few apps
|
||||
// seeded when they start up for the first time. Clings won't work well with that
|
||||
if (Utilities.ATLEAST_JB_MR2) {
|
||||
UserManager um = (UserManager) mLauncher.getSystemService(Context.USER_SERVICE);
|
||||
Bundle restrictions = um.getUserRestrictions();
|
||||
if (restrictions.getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (Settings.Secure.getInt(mLauncher.getContentResolver(),
|
||||
Settings.Secure.SKIP_FIRST_USE_HINTS, 0) == 1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean shouldShowFirstRunOrMigrationClings() {
|
||||
return areClingsEnabled() &&
|
||||
!mLauncher.getSharedPrefs().getBoolean(WORKSPACE_CLING_DISMISSED_KEY, false);
|
||||
}
|
||||
|
||||
public static void markFirstRunClingDismissed(Context ctx) {
|
||||
Utilities.getPrefs(ctx).edit()
|
||||
.putBoolean(WORKSPACE_CLING_DISMISSED_KEY, true)
|
||||
|
|
Loading…
Reference in New Issue