Browse Source

1.增加tag

FailedToRead 2 months ago
parent
commit
6073ed6610
1 changed files with 55 additions and 35 deletions
  1. 55 35
      1100_r48/Code/src/com/android/launcher3/Launcher.java

+ 55 - 35
1100_r48/Code/src/com/android/launcher3/Launcher.java

@@ -55,6 +55,7 @@ import android.animation.AnimatorListenerAdapter;
 import android.animation.AnimatorSet;
 import android.animation.ObjectAnimator;
 import android.animation.ValueAnimator;
+import android.annotation.SuppressLint;
 import android.annotation.TargetApi;
 import android.app.ActivityOptions;
 import android.appwidget.AppWidgetHostView;
@@ -70,6 +71,7 @@ import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
 import android.database.sqlite.SQLiteDatabase;
+import android.graphics.Color;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.CancellationSignal;
@@ -90,6 +92,7 @@ import android.view.View;
 import android.view.ViewGroup;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.animation.OvershootInterpolator;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import androidx.annotation.CallSuper;
@@ -256,9 +259,12 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
     private static final int ON_ACTIVITY_RESULT_ANIMATION_DELAY = 500;
 
     // How long to wait before the new-shortcut animation automatically pans the workspace
-    @VisibleForTesting public static final int NEW_APPS_PAGE_MOVE_DELAY = 500;
+    @VisibleForTesting
+    public static final int NEW_APPS_PAGE_MOVE_DELAY = 500;
     private static final int NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS = 5;
-    @Thunk @VisibleForTesting public static final int NEW_APPS_ANIMATION_DELAY = 500;
+    @Thunk
+    @VisibleForTesting
+    public static final int NEW_APPS_ANIMATION_DELAY = 500;
 
     private static final int APPS_VIEW_ALPHA_CHANNEL_INDEX = 1;
     private static final int SCRIM_VIEW_ALPHA_CHANNEL_INDEX = 0;
@@ -346,6 +352,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     private SafeCloseable mUserChangedCallbackCloseable;
 
+    @SuppressLint("ResourceType")
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         Object traceToken = TraceHelper.INSTANCE.beginSection(ON_CREATE_EVT,
@@ -428,8 +435,14 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
         setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
 
         setContentView(getRootView());
-        getRootView().dispatchInsets();
+        TextView tv = new TextView(this);
+        tv.setText("自定义Launcher3_1100r48");
+        tv.setTextColor(Color.RED);
+        tv.setTextSize(30);
 
+        getRootView().addView(tv);
+        getRootView().dispatchInsets();
+        tv.bringToFront();
         // Listen for broadcasts
         registerReceiver(mScreenOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
 
@@ -469,7 +482,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
     }
 
     protected LauncherOverlayManager getDefaultOverlay() {
-        return new LauncherOverlayManager() { };
+        return new LauncherOverlayManager() {
+        };
     }
 
     protected OnboardingPrefs createOnboardingPrefs(SharedPreferences sharedPrefs) {
@@ -803,7 +817,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     @Override
     public void onRequestPermissionsResult(int requestCode, String[] permissions,
-            int[] grantResults) {
+                                           int[] grantResults) {
         PendingRequestArgs pendingArgs = mPendingRequestArgs;
         if (requestCode == REQUEST_PERMISSION_CALL_PHONE && pendingArgs != null
                 && pendingArgs.getRequestCode() == REQUEST_PERMISSION_CALL_PHONE) {
@@ -927,7 +941,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
         DiscoveryBounce.showForHomeIfNeeded(this);
     }
 
-    protected void handlePendingActivityRequest() { }
+    protected void handlePendingActivityRequest() {
+    }
 
     private void logStopAndResume(int command) {
         if (mPendingExecutor != null) return;
@@ -938,7 +953,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
         StatsLogManager.StatsLogger logger = getStatsLogManager().logger();
         if (command == Action.Command.RESUME) {
             logger.withSrcState(LAUNCHER_STATE_BACKGROUND)
-                .withDstState(containerTypeToAtomState(mStateManager.getState().containerType));
+                    .withDstState(containerTypeToAtomState(mStateManager.getState().containerType));
             event = LAUNCHER_ONRESUME;
         } else { /* command == Action.Command.STOP */
             logger.withSrcState(containerTypeToAtomState(mStateManager.getState().containerType))
@@ -1196,7 +1211,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
      * @param data The intent describing the shortcut.
      */
     private void completeAddShortcut(Intent data, int container, int screenId, int cellX,
-            int cellY, PendingRequestArgs args) {
+                                     int cellY, PendingRequestArgs args) {
         if (args.getRequestCode() != REQUEST_CREATE_SHORTCUT
                 || args.getPendingIntent().getComponent() == null) {
             return;
@@ -1282,7 +1297,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
      */
     @Thunk
     void completeAddAppWidget(int appWidgetId, ItemInfo itemInfo,
-            AppWidgetHostView hostView, LauncherAppWidgetProviderInfo appWidgetInfo) {
+                              AppWidgetHostView hostView, LauncherAppWidgetProviderInfo appWidgetInfo) {
 
         if (appWidgetInfo == null) {
             appWidgetInfo = mAppWidgetManager.getLauncherAppWidgetInfo(appWidgetId);
@@ -1584,7 +1599,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     @Override
     public void startIntentSenderForResult(IntentSender intent, int requestCode,
-            Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) {
+                                           Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options) {
         if (requestCode != -1) {
             mPendingActivityRequestCode = requestCode;
         }
@@ -1602,7 +1617,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
      */
     @Override
     public void startSearch(String initialQuery, boolean selectInitialQuery,
-            Bundle appSearchData, boolean globalSearch) {
+                            Bundle appSearchData, boolean globalSearch) {
         if (appSearchData == null) {
             appSearchData = new Bundle();
             appSearchData.putString("source", "launcher-search");
@@ -1635,7 +1650,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
     }
 
     void addAppWidgetFromDropImpl(int appWidgetId, ItemInfo info, AppWidgetHostView boundWidget,
-            WidgetAddFlowHandler addFlowHandler) {
+                                  WidgetAddFlowHandler addFlowHandler) {
         if (LOGD) {
             Log.d(TAG, "Adding widget from drop");
         }
@@ -1643,7 +1658,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
     }
 
     void addAppWidgetImpl(int appWidgetId, ItemInfo info,
-            AppWidgetHostView boundWidget, WidgetAddFlowHandler addFlowHandler, int delay) {
+                          AppWidgetHostView boundWidget, WidgetAddFlowHandler addFlowHandler, int delay) {
         if (!addFlowHandler.startConfigActivity(this, appWidgetId, info,
                 REQUEST_CREATE_APPWIDGET)) {
             // If the configuration flow was not started, add the widget
@@ -1662,7 +1677,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
     }
 
     public void addPendingItem(PendingAddItemInfo info, int container, int screenId,
-            int[] cell, int spanX, int spanY) {
+                               int[] cell, int spanX, int spanY) {
         info.container = container;
         info.screenId = screenId;
         if (cell != null) {
@@ -1741,7 +1756,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
      * Creates and adds new folder to CellLayout
      */
     public FolderIcon addFolder(CellLayout layout, int container, final int screenId, int cellX,
-            int cellY) {
+                                int cellY) {
         final FolderInfo folderInfo = new FolderInfo();
 
         // Update the model
@@ -1760,18 +1775,20 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
     /**
      * Called when a workspace item is converted into a folder
      */
-    public void folderCreatedFromItem(Folder folder, WorkspaceItemInfo itemInfo){}
+    public void folderCreatedFromItem(Folder folder, WorkspaceItemInfo itemInfo) {
+    }
 
     /**
      * Called when a folder is converted into a workspace item
      */
-    public void folderConvertedToItem(Folder folder, WorkspaceItemInfo itemInfo) {}
+    public void folderConvertedToItem(Folder folder, WorkspaceItemInfo itemInfo) {
+    }
 
     /**
      * Unbinds the view for the specified item, and removes the item and all its children.
      *
-     * @param v the view being removed.
-     * @param itemInfo the {@link ItemInfo} for this view.
+     * @param v            the view being removed.
+     * @param itemInfo     the {@link ItemInfo} for this view.
      * @param deleteFromDb whether or not to delete this item from the db.
      */
     public boolean removeItem(View v, final ItemInfo itemInfo, boolean deleteFromDb) {
@@ -1891,7 +1908,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     @Override
     public boolean startActivitySafely(View v, Intent intent, ItemInfo item,
-            @Nullable String sourceContainer) {
+                                       @Nullable String sourceContainer) {
         if (!hasBeenResumed()) {
             // Workaround an issue where the WM launch animation is clobbered when finishing the
             // recents animation into launcher. Defer launching the activity until Launcher is
@@ -1970,6 +1987,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     /**
      * Sets the next page to bind synchronously on next bind.
+     *
      * @param page
      */
     public void setPageToBindSynchronously(int page) {
@@ -1983,7 +2001,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
     public int getPageToBindSynchronously() {
         if (mPageToBindSynchronously != PagedView.INVALID_PAGE) {
             return mPageToBindSynchronously;
-        } else  if (mWorkspace != null) {
+        } else if (mWorkspace != null) {
             return mWorkspace.getCurrentPage();
         } else {
             return 0;
@@ -2008,7 +2026,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     /**
      * Refreshes the shortcuts shown on the workspace.
-     *
+     * <p>
      * Implementation of the method from LauncherModel.Callbacks.
      */
     public void startBinding() {
@@ -2076,7 +2094,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     @Override
     public void bindAppsAdded(IntArray newScreens, ArrayList<ItemInfo> addNotAnimated,
-            ArrayList<ItemInfo> addAnimated) {
+                              ArrayList<ItemInfo> addAnimated) {
         // Add the new screens
         if (newScreens != null) {
             bindAddScreens(newScreens);
@@ -2097,7 +2115,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     /**
      * Bind the items start-end from the list.
-     *
+     * <p>
      * Implementation of the method from LauncherModel.Callbacks.
      */
     @Override
@@ -2205,7 +2223,8 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
     }
 
     @Override
-    public void bindPredictedItems(List<AppInfo> appInfos, IntArray ranks) { }
+    public void bindPredictedItems(List<AppInfo> appInfos, IntArray ranks) {
+    }
 
     /**
      * Add the views for a widget to the workspace.
@@ -2311,8 +2330,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
                     // update the UI.
                     item.restoreStatus = LauncherAppWidgetInfo.RESTORE_COMPLETED;
                     getModelWriter().updateItemInDatabase(item);
-                }
-                else if (item.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_UI_NOT_READY)
+                } else if (item.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_UI_NOT_READY)
                         && appWidgetInfo.configure != null) {
                     if (mAppWidgetManager.isAppWidgetRestored(item.appWidgetId)) {
                         item.restoreStatus = LauncherAppWidgetInfo.RESTORE_COMPLETED;
@@ -2420,7 +2438,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     /**
      * Callback saying that there aren't any more items to bind.
-     *
+     * <p>
      * Implementation of the method from LauncherModel.Callbacks.
      */
     public void finishBindingItems(int pageBoundFirst) {
@@ -2475,7 +2493,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     /**
      * Add the icons for all apps.
-     *
+     * <p>
      * Implementation of the method from LauncherModel.Callbacks.
      */
     @Override
@@ -2517,7 +2535,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
 
     /**
      * Update the state of a package, typically related to install state.
-     *
+     * <p>
      * Implementation of the method from LauncherModel.Callbacks.
      */
     @Override
@@ -2701,16 +2719,18 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
     }
 
     protected StateHandler<LauncherState>[] createStateHandlers() {
-        return new StateHandler[] { getAllAppsController(), getWorkspace() };
+        return new StateHandler[]{getAllAppsController(), getWorkspace()};
     }
 
     public TouchController[] createTouchControllers() {
-        return new TouchController[] {getDragController(), new AllAppsSwipeController(this)};
+        return new TouchController[]{getDragController(), new AllAppsSwipeController(this)};
     }
 
-    public void useFadeOutAnimationForLauncherStart(CancellationSignal signal) { }
+    public void useFadeOutAnimationForLauncherStart(CancellationSignal signal) {
+    }
 
-    public void onDragLayerHierarchyChanged() { }
+    public void onDragLayerHierarchyChanged() {
+    }
 
     @Override
     public void returnToHomescreen() {
@@ -2735,7 +2755,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
      * @see LauncherState#getOverviewScaleAndOffset(Launcher)
      */
     public float[] getNormalOverviewScaleAndOffset() {
-        return new float[] {NO_SCALE, NO_OFFSET};
+        return new float[]{NO_SCALE, NO_OFFSET};
     }
 
     public static Launcher getLauncher(Context context) {