Search in sources :

Example 6 with ALPHA_INDEX_LAUNCHER_LOAD

use of com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD in project android_packages_apps_404Launcher by P-404.

the class Launcher method onCreate.

@Override
@TargetApi(Build.VERSION_CODES.S)
protected void onCreate(Bundle savedInstanceState) {
    // Only use a hard-coded cookie since we only want to trace this once.
    if (Utilities.ATLEAST_S) {
        Trace.beginAsyncSection(DISPLAY_WORKSPACE_TRACE_METHOD_NAME, DISPLAY_WORKSPACE_TRACE_COOKIE);
        Trace.beginAsyncSection(DISPLAY_ALL_APPS_TRACE_METHOD_NAME, DISPLAY_ALL_APPS_TRACE_COOKIE);
    }
    Object traceToken = TraceHelper.INSTANCE.beginSection(ON_CREATE_EVT, TraceHelper.FLAG_UI_EVENT);
    if (DEBUG_STRICT_MODE) {
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());
    }
    if (Utilities.IS_DEBUG_DEVICE && FeatureFlags.NOTIFY_CRASHES.get()) {
        final String notificationChannelId = "com.android.launcher3.Debug";
        final String notificationChannelName = "Debug";
        final String notificationTag = "Debug";
        final int notificationId = 0;
        NotificationManager notificationManager = getSystemService(NotificationManager.class);
        notificationManager.createNotificationChannel(new NotificationChannel(notificationChannelId, notificationChannelName, NotificationManager.IMPORTANCE_HIGH));
        Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> {
            String stackTrace = Log.getStackTraceString(throwable);
            Intent shareIntent = new Intent(Intent.ACTION_SEND);
            shareIntent.setType("text/plain");
            shareIntent.putExtra(Intent.EXTRA_TEXT, stackTrace);
            shareIntent = Intent.createChooser(shareIntent, null);
            PendingIntent sharePendingIntent = PendingIntent.getActivity(this, 0, shareIntent, PendingIntent.FLAG_UPDATE_CURRENT);
            Notification notification = new Notification.Builder(this, notificationChannelId).setSmallIcon(android.R.drawable.ic_menu_close_clear_cancel).setContentTitle("Launcher crash detected!").setStyle(new Notification.BigTextStyle().bigText(stackTrace)).addAction(android.R.drawable.ic_menu_share, "Share", sharePendingIntent).build();
            notificationManager.notify(notificationTag, notificationId, notification);
            Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
            if (defaultUncaughtExceptionHandler != null) {
                defaultUncaughtExceptionHandler.uncaughtException(thread, throwable);
            }
        });
    }
    super.onCreate(savedInstanceState);
    LauncherAppState app = LauncherAppState.getInstance(this);
    mOldConfig = new Configuration(getResources().getConfiguration());
    mModel = app.getModel();
    mRotationHelper = new RotationHelper(this);
    InvariantDeviceProfile idp = app.getInvariantDeviceProfile();
    initDeviceProfile(idp);
    idp.addOnChangeListener(this);
    mSharedPrefs = Utilities.getPrefs(this);
    mIconCache = app.getIconCache();
    mAccessibilityDelegate = createAccessibilityDelegate();
    mDragController = new LauncherDragController(this);
    mAllAppsController = new AllAppsTransitionController(this);
    mStateManager = new StateManager<>(this, NORMAL);
    mOnboardingPrefs = createOnboardingPrefs(mSharedPrefs);
    mAppWidgetManager = new WidgetManagerHelper(this);
    mAppWidgetHost = createAppWidgetHost();
    mAppWidgetHost.startListening();
    inflateRootView(R.layout.launcher);
    setupViews();
    crossFadeWithPreviousAppearance();
    mPopupDataProvider = new PopupDataProvider(this::updateNotificationDots);
    boolean internalStateHandled = ACTIVITY_TRACKER.handleCreate(this);
    if (internalStateHandled) {
        if (savedInstanceState != null) {
            // InternalStateHandler has already set the appropriate state.
            // We dont need to do anything.
            savedInstanceState.remove(RUNTIME_STATE);
        }
    }
    restoreState(savedInstanceState);
    mStateManager.reapplyState();
    if (savedInstanceState != null) {
        int[] pageIds = savedInstanceState.getIntArray(RUNTIME_STATE_CURRENT_SCREEN_IDS);
        if (pageIds != null) {
            mPagesToBindSynchronously = IntSet.wrap(pageIds);
        }
    }
    if (!mModel.addCallbacksAndLoad(this)) {
        if (!internalStateHandled) {
            // If we are not binding synchronously, show a fade in animation when
            // the first page bind completes.
            mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD).setValue(0);
        }
    }
    // For handling default keys
    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
    setContentView(getRootView());
    getRootView().dispatchInsets();
    // Listen for broadcasts
    registerReceiver(mScreenOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
    getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW, Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText));
    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onCreate(savedInstanceState);
    }
    mOverlayManager = getDefaultOverlay();
    PluginManagerWrapper.INSTANCE.get(this).addPluginListener(this, OverlayPlugin.class, false);
    mRotationHelper.initialize();
    TraceHelper.INSTANCE.endSection(traceToken);
    mUserChangedCallbackCloseable = UserCache.INSTANCE.get(this).addUserChangeListener(() -> getStateManager().goToState(NORMAL));
    if (Utilities.ATLEAST_R) {
        getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
    }
}
Also used : Configuration(android.content.res.Configuration) PropertyListBuilder(com.android.launcher3.anim.PropertyListBuilder) Notification(android.app.Notification) StrictMode(android.os.StrictMode) AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController) WidgetManagerHelper(com.android.launcher3.widget.WidgetManagerHelper) IntentFilter(android.content.IntentFilter) NotificationManager(android.app.NotificationManager) RotationHelper(com.android.launcher3.states.RotationHelper) PopupDataProvider(com.android.launcher3.popup.PopupDataProvider) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) NotificationChannel(android.app.NotificationChannel) DragObject(com.android.launcher3.DropTarget.DragObject) LauncherDragController(com.android.launcher3.dragndrop.LauncherDragController) PendingIntent(android.app.PendingIntent) TargetApi(android.annotation.TargetApi)

Example 7 with ALPHA_INDEX_LAUNCHER_LOAD

use of com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD in project android_packages_apps_Launcher3 by crdroidandroid.

the class Launcher method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    Object traceToken = TraceHelper.INSTANCE.beginSection(ON_CREATE_EVT, TraceHelper.FLAG_UI_EVENT);
    if (DEBUG_STRICT_MODE) {
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());
    }
    if (Utilities.IS_DEBUG_DEVICE && FeatureFlags.NOTIFY_CRASHES.get()) {
        final String notificationChannelId = "com.android.launcher3.Debug";
        final String notificationChannelName = "Debug";
        final String notificationTag = "Debug";
        final int notificationId = 0;
        NotificationManager notificationManager = getSystemService(NotificationManager.class);
        notificationManager.createNotificationChannel(new NotificationChannel(notificationChannelId, notificationChannelName, NotificationManager.IMPORTANCE_HIGH));
        Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> {
            String stackTrace = Log.getStackTraceString(throwable);
            Intent shareIntent = new Intent(Intent.ACTION_SEND);
            shareIntent.setType("text/plain");
            shareIntent.putExtra(Intent.EXTRA_TEXT, stackTrace);
            shareIntent = Intent.createChooser(shareIntent, null);
            PendingIntent sharePendingIntent = PendingIntent.getActivity(this, 0, shareIntent, PendingIntent.FLAG_UPDATE_CURRENT);
            Notification notification = new Notification.Builder(this, notificationChannelId).setSmallIcon(android.R.drawable.ic_menu_close_clear_cancel).setContentTitle("Launcher crash detected!").setStyle(new Notification.BigTextStyle().bigText(stackTrace)).addAction(android.R.drawable.ic_menu_share, "Share", sharePendingIntent).build();
            notificationManager.notify(notificationTag, notificationId, notification);
            Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
            if (defaultUncaughtExceptionHandler != null) {
                defaultUncaughtExceptionHandler.uncaughtException(thread, throwable);
            }
        });
    }
    super.onCreate(savedInstanceState);
    LauncherAppState app = LauncherAppState.getInstance(this);
    mOldConfig = new Configuration(getResources().getConfiguration());
    mModel = app.getModel();
    mRotationHelper = new RotationHelper(this);
    InvariantDeviceProfile idp = app.getInvariantDeviceProfile();
    initDeviceProfile(idp);
    idp.addOnChangeListener(this);
    mSharedPrefs = Utilities.getPrefs(this);
    mIconCache = app.getIconCache();
    mAccessibilityDelegate = createAccessibilityDelegate();
    mDragController = new LauncherDragController(this);
    mAllAppsController = new AllAppsTransitionController(this);
    mStateManager = new StateManager<>(this, NORMAL);
    mOnboardingPrefs = createOnboardingPrefs(mSharedPrefs);
    mAppWidgetManager = new WidgetManagerHelper(this);
    mAppWidgetHost = createAppWidgetHost();
    mAppWidgetHost.startListening();
    inflateRootView(R.layout.launcher);
    setupViews();
    crossFadeWithPreviousAppearance();
    mPopupDataProvider = new PopupDataProvider(this::updateNotificationDots);
    boolean internalStateHandled = ACTIVITY_TRACKER.handleCreate(this);
    if (internalStateHandled) {
        if (savedInstanceState != null) {
            // InternalStateHandler has already set the appropriate state.
            // We dont need to do anything.
            savedInstanceState.remove(RUNTIME_STATE);
        }
    }
    restoreState(savedInstanceState);
    mStateManager.reapplyState();
    // We only load the page synchronously if the user rotates (or triggers a
    // configuration change) while launcher is in the foreground
    int currentScreen = PagedView.INVALID_PAGE;
    if (savedInstanceState != null) {
        currentScreen = savedInstanceState.getInt(RUNTIME_STATE_CURRENT_SCREEN, currentScreen);
    }
    mPageToBindSynchronously = currentScreen;
    if (!mModel.addCallbacksAndLoad(this)) {
        if (!internalStateHandled) {
            // If we are not binding synchronously, show a fade in animation when
            // the first page bind completes.
            mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD).setValue(0);
        }
    }
    // For handling default keys
    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
    setContentView(getRootView());
    getRootView().dispatchInsets();
    // Listen for broadcasts
    registerReceiver(mScreenOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
    getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW, Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText));
    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onCreate(savedInstanceState);
    }
    mOverlayManager = getDefaultOverlay();
    PluginManagerWrapper.INSTANCE.get(this).addPluginListener(this, OverlayPlugin.class, false);
    mRotationHelper.initialize();
    TraceHelper.INSTANCE.endSection(traceToken);
    mUserChangedCallbackCloseable = UserCache.INSTANCE.get(this).addUserChangeListener(() -> getStateManager().goToState(NORMAL));
    if (Utilities.ATLEAST_R) {
        getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
    }
}
Also used : Configuration(android.content.res.Configuration) PropertyListBuilder(com.android.launcher3.anim.PropertyListBuilder) Notification(android.app.Notification) StrictMode(android.os.StrictMode) AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController) WidgetManagerHelper(com.android.launcher3.widget.WidgetManagerHelper) IntentFilter(android.content.IntentFilter) NotificationManager(android.app.NotificationManager) RotationHelper(com.android.launcher3.states.RotationHelper) PopupDataProvider(com.android.launcher3.popup.PopupDataProvider) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) NotificationChannel(android.app.NotificationChannel) DragObject(com.android.launcher3.DropTarget.DragObject) LauncherDragController(com.android.launcher3.dragndrop.LauncherDragController) PendingIntent(android.app.PendingIntent)

Example 8 with ALPHA_INDEX_LAUNCHER_LOAD

use of com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD in project android_packages_apps_Launcher3 by crdroidandroid.

the class Launcher method finishFirstPageBind.

@Override
public void finishFirstPageBind(final ViewOnDrawExecutor executor) {
    AlphaProperty property = mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD);
    if (property.getValue() < 1) {
        ObjectAnimator anim = ObjectAnimator.ofFloat(property, MultiValueAlpha.VALUE, 1);
        if (executor != null) {
            anim.addListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    executor.onLoadAnimationCompleted();
                }
            });
        }
        anim.start();
    } else if (executor != null) {
        executor.onLoadAnimationCompleted();
    }
}
Also used : AlphaProperty(com.android.launcher3.util.MultiValueAlpha.AlphaProperty) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) ObjectAnimator(android.animation.ObjectAnimator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Example 9 with ALPHA_INDEX_LAUNCHER_LOAD

use of com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD in project android_packages_apps_Trebuchet by LineageOS.

the class Launcher method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    Object traceToken = TraceHelper.INSTANCE.beginSection(ON_CREATE_EVT, TraceHelper.FLAG_UI_EVENT);
    if (DEBUG_STRICT_MODE) {
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build());
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());
    }
    super.onCreate(savedInstanceState);
    LauncherAppState app = LauncherAppState.getInstance(this);
    mOldConfig = new Configuration(getResources().getConfiguration());
    mModel = app.getModel();
    mRotationHelper = new RotationHelper(this);
    InvariantDeviceProfile idp = app.getInvariantDeviceProfile();
    initDeviceProfile(idp);
    idp.addOnChangeListener(this);
    mSharedPrefs = Utilities.getPrefs(this);
    mIconCache = app.getIconCache();
    mAccessibilityDelegate = new LauncherAccessibilityDelegate(this);
    mDragController = new DragController(this);
    mAllAppsController = new AllAppsTransitionController(this);
    mStateManager = new StateManager<>(this, NORMAL);
    mOnboardingPrefs = createOnboardingPrefs(mSharedPrefs);
    mAppWidgetManager = new WidgetManagerHelper(this);
    mAppWidgetHost = new LauncherAppWidgetHost(this, appWidgetId -> getWorkspace().removeWidget(appWidgetId));
    mAppWidgetHost.startListening();
    inflateRootView(R.layout.launcher);
    setupViews();
    mPopupDataProvider = new PopupDataProvider(this::updateNotificationDots);
    mAppTransitionManager = LauncherAppTransitionManager.newInstance(this);
    mAppTransitionManager.registerRemoteAnimations();
    boolean internalStateHandled = ACTIVITY_TRACKER.handleCreate(this);
    if (internalStateHandled) {
        if (savedInstanceState != null) {
            // InternalStateHandler has already set the appropriate state.
            // We dont need to do anything.
            savedInstanceState.remove(RUNTIME_STATE);
        }
    }
    restoreState(savedInstanceState);
    mStateManager.reapplyState();
    // We only load the page synchronously if the user rotates (or triggers a
    // configuration change) while launcher is in the foreground
    int currentScreen = PagedView.INVALID_PAGE;
    if (savedInstanceState != null) {
        currentScreen = savedInstanceState.getInt(RUNTIME_STATE_CURRENT_SCREEN, currentScreen);
    }
    mPageToBindSynchronously = currentScreen;
    if (!mModel.addCallbacksAndLoad(this)) {
        if (!internalStateHandled) {
            // If we are not binding synchronously, show a fade in animation when
            // the first page bind completes.
            mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD).setValue(0);
        }
    }
    // For handling default keys
    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
    setContentView(getRootView());
    getRootView().dispatchInsets();
    // Listen for broadcasts
    registerReceiver(mScreenOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
    getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW, Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText));
    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onCreate(savedInstanceState);
    }
    mOverlayManager = getDefaultOverlay();
    PluginManagerWrapper.INSTANCE.get(this).addPluginListener(this, OverlayPlugin.class, false);
    mRotationHelper.initialize();
    mStateManager.addStateListener(new StateListener<LauncherState>() {

        @Override
        public void onStateTransitionComplete(LauncherState finalState) {
            float alpha = 1f - mCurrentAssistantVisibility;
            if (finalState == NORMAL) {
                mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
            } else if (finalState == OVERVIEW || finalState == OVERVIEW_PEEK) {
                mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
                mScrimView.getAlphaProperty(SCRIM_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
            } else {
                mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(1f);
                mScrimView.getAlphaProperty(SCRIM_VIEW_ALPHA_CHANNEL_INDEX).setValue(1f);
            }
        }
    });
    TraceHelper.INSTANCE.endSection(traceToken);
    mUserChangedCallbackCloseable = UserCache.INSTANCE.get(this).addUserChangeListener(() -> getStateManager().goToState(NORMAL));
}
Also used : Bundle(android.os.Bundle) AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController) ViewOnDrawExecutor(com.android.launcher3.util.ViewOnDrawExecutor) TestProtocol(com.android.launcher3.testing.TestProtocol) PendingAddWidgetInfo(com.android.launcher3.widget.PendingAddWidgetInfo) AccessibilityManagerCompat(com.android.launcher3.compat.AccessibilityManagerCompat) CustomActionsPopup(com.android.launcher3.keyboard.CustomActionsPopup) CONFIG_ORIENTATION(android.content.pm.ActivityInfo.CONFIG_ORIENTATION) OVERVIEW(com.android.launcher3.LauncherState.OVERVIEW) TYPE_WINDOW_STATE_CHANGED(android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) Process(android.os.Process) NO_OFFSET(com.android.launcher3.LauncherState.NO_OFFSET) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) LauncherAtom(com.android.launcher3.logger.LauncherAtom) Target(com.android.launcher3.userevent.nano.LauncherLogProto.Target) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) OVERVIEW_PEEK(com.android.launcher3.LauncherState.OVERVIEW_PEEK) TargetApi(android.annotation.TargetApi) Log(android.util.Log) PrintWriter(java.io.PrintWriter) ALPHA_INDEX_LAUNCHER_LOAD(com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD) KeyboardShortcutInfo(android.view.KeyboardShortcutInfo) IntentFilter(android.content.IntentFilter) AllAppsStore(com.android.launcher3.allapps.AllAppsStore) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) UserCache(com.android.launcher3.pm.UserCache) LauncherAccessibilityDelegate(com.android.launcher3.accessibility.LauncherAccessibilityDelegate) StringRes(androidx.annotation.StringRes) Nullable(androidx.annotation.Nullable) ActivityTracker(com.android.launcher3.util.ActivityTracker) Stream(java.util.stream.Stream) ShortcutUtil(com.android.launcher3.util.ShortcutUtil) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) ItemInfoMatcher(com.android.launcher3.util.ItemInfoMatcher) DiscoveryBounce(com.android.launcher3.allapps.DiscoveryBounce) QsbContainerView(com.android.launcher3.qsb.QsbContainerView) NORMAL(com.android.launcher3.LauncherState.NORMAL) TextKeyListener(android.text.method.TextKeyListener) PackageManagerHelper(com.android.launcher3.util.PackageManagerHelper) TYPE_REBIND_SAFE(com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE) ViewGroupFocusHelper(com.android.launcher3.keyboard.ViewGroupFocusHelper) FileLog(com.android.launcher3.logging.FileLog) FloatingSurfaceView(com.android.launcher3.views.FloatingSurfaceView) UserEventDispatcher(com.android.launcher3.logging.UserEventDispatcher) FLAG_NON_INTERACTIVE(com.android.launcher3.LauncherState.FLAG_NON_INTERACTIVE) SystemUiController(com.android.launcher3.util.SystemUiController) Supplier(java.util.function.Supplier) AppLaunchTracker(com.android.launcher3.model.AppLaunchTracker) ArrayList(java.util.ArrayList) FLAG_MULTI_PAGE(com.android.launcher3.LauncherState.FLAG_MULTI_PAGE) IntentSender(android.content.IntentSender) REQUEST_NONE(com.android.launcher3.states.RotationHelper.REQUEST_NONE) AppWidgetHostView(android.appwidget.AppWidgetHostView) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) PendingRequestArgs(com.android.launcher3.util.PendingRequestArgs) Toast(android.widget.Toast) TYPE_ALL(com.android.launcher3.AbstractFloatingView.TYPE_ALL) Menu(android.view.Menu) DragObject(com.android.launcher3.DropTarget.DragObject) SystemShortcut(com.android.launcher3.popup.SystemShortcut) PluginListener(com.android.systemui.plugins.PluginListener) PopupDataProvider(com.android.launcher3.popup.PopupDataProvider) IntArray(com.android.launcher3.util.IntArray) Parcelable(android.os.Parcelable) ActivityContext(com.android.launcher3.views.ActivityContext) DragController(com.android.launcher3.dragndrop.DragController) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) StateManager(com.android.launcher3.statemanager.StateManager) TextUtils(android.text.TextUtils) FeatureFlags(com.android.launcher3.config.FeatureFlags) CallSuper(androidx.annotation.CallSuper) ItemClickHandler(com.android.launcher3.touch.ItemClickHandler) AppWidgetManager(android.appwidget.AppWidgetManager) ComponentCallbacks2(android.content.ComponentCallbacks2) TouchController(com.android.launcher3.util.TouchController) FolderGridOrganizer(com.android.launcher3.folder.FolderGridOrganizer) SharedPreferences(android.content.SharedPreferences) FLAG_CLOSE_POPUPS(com.android.launcher3.LauncherState.FLAG_CLOSE_POPUPS) TestLogging(com.android.launcher3.testing.TestLogging) Configuration(android.content.res.Configuration) ComponentKey(com.android.launcher3.util.ComponentKey) AlphaProperty(com.android.launcher3.util.MultiValueAlpha.AlphaProperty) LAUNCHER_ONSTOP(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONSTOP) LauncherOverlayCallbacks(com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlayCallbacks) INSTALL(com.android.launcher3.popup.SystemShortcut.INSTALL) ValueAnimator(android.animation.ValueAnimator) DotInfo(com.android.launcher3.dot.DotInfo) Callbacks(com.android.launcher3.model.BgDataModel.Callbacks) PackageManager(android.content.pm.PackageManager) SPRING_LOADED_EXIT_DELAY(com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY) LAUNCHER_STATE_BACKGROUND(com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND) Animator(android.animation.Animator) StateListener(com.android.launcher3.statemanager.StateManager.StateListener) IconCache(com.android.launcher3.icons.IconCache) OptionsPopupView(com.android.launcher3.views.OptionsPopupView) SPRING_LOADED(com.android.launcher3.LauncherState.SPRING_LOADED) WidgetsFullSheet(com.android.launcher3.widget.WidgetsFullSheet) ActivityOptions(android.app.ActivityOptions) KeyboardShortcutGroup(android.view.KeyboardShortcutGroup) RotationHelper(com.android.launcher3.states.RotationHelper) OverlayPlugin(com.android.systemui.plugins.OverlayPlugin) FolderInfo(com.android.launcher3.model.data.FolderInfo) View(android.view.View) NO_SCALE(com.android.launcher3.LauncherState.NO_SCALE) PromiseAppInfo(com.android.launcher3.model.data.PromiseAppInfo) AllAppsSwipeController(com.android.launcher3.touch.AllAppsSwipeController) LauncherExterns(com.android.systemui.plugins.shared.LauncherExterns) PinRequestHelper(com.android.launcher3.pm.PinRequestHelper) Predicate(java.util.function.Predicate) ObjectAnimator(android.animation.ObjectAnimator) Collection(java.util.Collection) CancellationSignal(android.os.CancellationSignal) PendingAppWidgetHostView(com.android.launcher3.widget.PendingAppWidgetHostView) BroadcastReceiver(android.content.BroadcastReceiver) PluginManagerWrapper(com.android.launcher3.uioverrides.plugins.PluginManagerWrapper) ViewGroup(android.view.ViewGroup) MultiValueAlpha(com.android.launcher3.util.MultiValueAlpha) SparseArray(android.util.SparseArray) List(java.util.List) ALL_APPS(com.android.launcher3.LauncherState.ALL_APPS) Utilities.postAsyncCallback(com.android.launcher3.Utilities.postAsyncCallback) NotificationListener(com.android.launcher3.notification.NotificationListener) WIDGETS(com.android.launcher3.popup.SystemShortcut.WIDGETS) ActivityNotFoundException(android.content.ActivityNotFoundException) REQUEST_LOCK(com.android.launcher3.states.RotationHelper.REQUEST_LOCK) WidgetHostViewLoader(com.android.launcher3.widget.WidgetHostViewLoader) CONFIG_UI_MODE(android.content.pm.ActivityInfo.CONFIG_UI_MODE) AllAppsContainerView(com.android.launcher3.allapps.AllAppsContainerView) LineageUtils(com.android.launcher3.lineage.LineageUtils) Themes(com.android.launcher3.util.Themes) ModelWriter(com.android.launcher3.model.ModelWriter) Folder(com.android.launcher3.folder.Folder) CONFIG_SCREEN_SIZE(android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE) Context(android.content.Context) KeyEvent(android.view.KeyEvent) AppInfo(com.android.launcher3.model.data.AppInfo) ActivityResultInfo(com.android.launcher3.util.ActivityResultInfo) WidgetAddFlowHandler(com.android.launcher3.widget.WidgetAddFlowHandler) TYPE_SNACKBAR(com.android.launcher3.AbstractFloatingView.TYPE_SNACKBAR) LauncherOverlay(com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlay) ItemInfo(com.android.launcher3.model.data.ItemInfo) FolderIcon(com.android.launcher3.folder.FolderIcon) CustomWidgetManager(com.android.launcher3.widget.custom.CustomWidgetManager) Intent(android.content.Intent) HashMap(java.util.HashMap) UiThreadHelper(com.android.launcher3.util.UiThreadHelper) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow) HashSet(java.util.HashSet) FLAG_DRAG_AND_DROP(com.android.launcher3.InstallShortcutReceiver.FLAG_DRAG_AND_DROP) MotionEvent(android.view.MotionEvent) AnimatorSet(android.animation.AnimatorSet) DragLayer(com.android.launcher3.dragndrop.DragLayer) Build(android.os.Build) StatsLogManager.containerTypeToAtomState(com.android.launcher3.logging.StatsLogManager.containerTypeToAtomState) Action(com.android.launcher3.userevent.nano.LauncherLogProto.Action) ContainerType(com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType) TYPE_ICON_SURFACE(com.android.launcher3.AbstractFloatingView.TYPE_ICON_SURFACE) LayoutInflater(android.view.LayoutInflater) StatefulActivity(com.android.launcher3.statemanager.StatefulActivity) PackageUserKey(com.android.launcher3.util.PackageUserKey) SafeCloseable(com.android.launcher3.util.SafeCloseable) WidgetListRowEntry(com.android.launcher3.widget.WidgetListRowEntry) APP_INFO(com.android.launcher3.popup.SystemShortcut.APP_INFO) WidgetManagerHelper(com.android.launcher3.widget.WidgetManagerHelper) OnboardingPrefs(com.android.launcher3.util.OnboardingPrefs) PropertyListBuilder(com.android.launcher3.anim.PropertyListBuilder) StatsLogManager(com.android.launcher3.logging.StatsLogManager) PendingAddShortcutInfo(com.android.launcher3.widget.PendingAddShortcutInfo) LoggerUtils.newContainerTarget(com.android.launcher3.logging.LoggerUtils.newContainerTarget) StrictMode(android.os.StrictMode) OvershootInterpolator(android.view.animation.OvershootInterpolator) LauncherOverlayManager(com.android.systemui.plugins.shared.LauncherOverlayManager) FileDescriptor(java.io.FileDescriptor) StateHandler(com.android.launcher3.statemanager.StateManager.StateHandler) ScrimView(com.android.launcher3.views.ScrimView) Thunk(com.android.launcher3.util.Thunk) VisibleForTesting(androidx.annotation.VisibleForTesting) DragView(com.android.launcher3.dragndrop.DragView) TraceHelper(com.android.launcher3.util.TraceHelper) LAUNCHER_ONRESUME(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONRESUME) IntentFilter(android.content.IntentFilter) Configuration(android.content.res.Configuration) RotationHelper(com.android.launcher3.states.RotationHelper) PropertyListBuilder(com.android.launcher3.anim.PropertyListBuilder) PopupDataProvider(com.android.launcher3.popup.PopupDataProvider) StrictMode(android.os.StrictMode) AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController) DragController(com.android.launcher3.dragndrop.DragController) WidgetManagerHelper(com.android.launcher3.widget.WidgetManagerHelper) DragObject(com.android.launcher3.DropTarget.DragObject) LauncherAccessibilityDelegate(com.android.launcher3.accessibility.LauncherAccessibilityDelegate)

Example 10 with ALPHA_INDEX_LAUNCHER_LOAD

use of com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD in project android_packages_apps_Launcher3 by AOSPA.

the class Launcher method onInitialBindComplete.

@Override
@TargetApi(Build.VERSION_CODES.S)
public void onInitialBindComplete(IntSet boundPages, RunnableList pendingTasks) {
    mSynchronouslyBoundPages = boundPages;
    mPagesToBindSynchronously = new IntSet();
    clearPendingBinds();
    ViewOnDrawExecutor executor = new ViewOnDrawExecutor(pendingTasks);
    mPendingExecutor = executor;
    if (!isInState(ALL_APPS)) {
        mAppsView.getAppsStore().enableDeferUpdates(AllAppsStore.DEFER_UPDATES_NEXT_DRAW);
        pendingTasks.add(() -> mAppsView.getAppsStore().disableDeferUpdates(AllAppsStore.DEFER_UPDATES_NEXT_DRAW));
    }
    AlphaProperty property = mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD);
    if (property.getValue() < 1) {
        ObjectAnimator anim = ObjectAnimator.ofFloat(property, MultiValueAlpha.VALUE, 1);
        anim.addListener(AnimatorListeners.forEndCallback(executor::onLoadAnimationCompleted));
        anim.start();
    } else {
        executor.onLoadAnimationCompleted();
    }
    executor.attachTo(this);
    if (Utilities.ATLEAST_S) {
        Trace.endAsyncSection(DISPLAY_WORKSPACE_TRACE_METHOD_NAME, DISPLAY_WORKSPACE_TRACE_COOKIE);
    }
}
Also used : AlphaProperty(com.android.launcher3.util.MultiValueAlpha.AlphaProperty) IntSet(com.android.launcher3.util.IntSet) ObjectAnimator(android.animation.ObjectAnimator) ViewOnDrawExecutor(com.android.launcher3.util.ViewOnDrawExecutor) TargetApi(android.annotation.TargetApi)

Aggregations

TargetApi (android.annotation.TargetApi)10 ObjectAnimator (android.animation.ObjectAnimator)9 AlphaProperty (com.android.launcher3.util.MultiValueAlpha.AlphaProperty)9 Intent (android.content.Intent)7 IntentFilter (android.content.IntentFilter)7 Configuration (android.content.res.Configuration)7 StrictMode (android.os.StrictMode)7 DragObject (com.android.launcher3.DropTarget.DragObject)7 AllAppsTransitionController (com.android.launcher3.allapps.AllAppsTransitionController)7 PropertyListBuilder (com.android.launcher3.anim.PropertyListBuilder)7 PopupDataProvider (com.android.launcher3.popup.PopupDataProvider)7 RotationHelper (com.android.launcher3.states.RotationHelper)7 Animator (android.animation.Animator)5 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5 ValueAnimator (android.animation.ValueAnimator)5 Notification (android.app.Notification)5 NotificationChannel (android.app.NotificationChannel)5 NotificationManager (android.app.NotificationManager)5 PendingIntent (android.app.PendingIntent)5 ViewOnDrawExecutor (com.android.launcher3.util.ViewOnDrawExecutor)5