2018-01-24 15:38:25 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2018 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.app.ActivityOptions;
|
2018-01-31 15:18:11 -08:00
|
|
|
import android.content.Context;
|
2018-01-24 15:38:25 -08:00
|
|
|
import android.graphics.Rect;
|
|
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
|
2018-06-27 15:47:49 -07:00
|
|
|
import com.android.launcher3.util.ResourceBasedOverride;
|
|
|
|
|
|
2018-01-24 15:38:25 -08:00
|
|
|
/**
|
|
|
|
|
* Manages the opening and closing app transitions from Launcher.
|
|
|
|
|
*/
|
2018-06-27 15:47:49 -07:00
|
|
|
public class LauncherAppTransitionManager implements ResourceBasedOverride {
|
2018-01-24 15:38:25 -08:00
|
|
|
|
2018-01-31 15:18:11 -08:00
|
|
|
public static LauncherAppTransitionManager newInstance(Context context) {
|
2018-06-27 15:47:49 -07:00
|
|
|
return Overrides.getObject(LauncherAppTransitionManager.class,
|
2018-01-31 15:18:11 -08:00
|
|
|
context, R.string.app_transition_manager_class);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-16 18:06:23 -07:00
|
|
|
public ActivityOptions getActivityLaunchOptions(Launcher launcher, View v) {
|
2019-01-25 15:10:18 -08:00
|
|
|
int left = 0, top = 0;
|
|
|
|
|
int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
|
|
|
|
|
if (v instanceof BubbleTextView) {
|
|
|
|
|
// Launch from center of icon, not entire view
|
|
|
|
|
Drawable icon = ((BubbleTextView) v).getIcon();
|
|
|
|
|
if (icon != null) {
|
|
|
|
|
Rect bounds = icon.getBounds();
|
|
|
|
|
left = (width - bounds.width()) / 2;
|
|
|
|
|
top = v.getPaddingTop();
|
|
|
|
|
width = bounds.width();
|
|
|
|
|
height = bounds.height();
|
2018-01-24 15:38:25 -08:00
|
|
|
}
|
|
|
|
|
}
|
2019-01-25 15:10:18 -08:00
|
|
|
return ActivityOptions.makeClipRevealAnimation(v, left, top, width, height);
|
2018-01-24 15:38:25 -08:00
|
|
|
}
|
2019-06-12 13:33:51 -07:00
|
|
|
|
|
|
|
|
public boolean supportsAdaptiveIconAnimation() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2019-06-20 11:34:14 -07:00
|
|
|
|
2019-10-30 22:35:09 -07:00
|
|
|
/**
|
|
|
|
|
* Registers remote animations for certain system transitions.
|
|
|
|
|
*/
|
|
|
|
|
public void registerRemoteAnimations() {
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Unregisters all remote animations.
|
|
|
|
|
*/
|
|
|
|
|
public void unregisterRemoteAnimations() {
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
2018-01-24 15:38:25 -08:00
|
|
|
}
|