RK:Launcher3 禁用快捷方式、禁用壁纸小控件、隐藏指定应用图标

 

1.Android7.1  禁用快捷方式

  https://www.jianshu.com/p/d5370946c672?utm_campaign=haruki  墨香带你学Launcher之(六)--拖拽

diff --git a/packages/apps/Launcher3/src/com/android/launcher3/CellLayout.java b/packages/apps/Launcher3/src/com/android/launcher3/CellLayout.java
old mode 100644
new mode 100755
index 57fd0e7..3a05448
--- a/packages/apps/Launcher3/src/com/android/launcher3/CellLayout.java
+++ b/packages/apps/Launcher3/src/com/android/launcher3/CellLayout.java
@@ -2390,7 +2390,7 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
         } else if (noShuffleSolution.isSolution) {
             finalSolution = noShuffleSolution;
         }
-
+        finalSolution = null;
         if (mode == MODE_SHOW_REORDER_HINT) {
             if (finalSolution != null) {
                 beginOrAdjustReorderPreviewAnimations(finalSolution, dragView, 0,

2.Android5.1 Launcher长按,隐藏壁纸、小控件

diff --git a/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java b/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
index f6049e8..a4a3a02 100755
--- a/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
+++ b/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
@@ -140,7 +140,7 @@ public class Launcher extends Activity
                    View.OnTouchListener, PageSwitchListener, LauncherProviderChangeListener {
     static final String TAG = "Launcher";
     static final float ALL_APPS_ALPHA = 0f;
-    static final boolean LOGD = false;
+    static final boolean LOGD = true;
 
     static final boolean PROFILE_STARTUP = false;
     static final boolean DEBUG_WIDGETS = false;
@@ -1404,6 +1404,7 @@ public class Launcher extends Activity
 
         mOverviewPanel = (ViewGroup) findViewById(R.id.overview_panel);
         View widgetButton = findViewById(R.id.widget_button);
+		widgetButton.setVisibility(View.GONE);
         widgetButton.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View arg0) {
@@ -1415,6 +1416,7 @@ public class Launcher extends Activity
         widgetButton.setOnTouchListener(getHapticFeedbackTouchListener());
 
         View wallpaperButton = findViewById(R.id.wallpaper_button);
+		wallpaperButton.setVisibility(View.GONE);
         wallpaperButton.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View arg0) {

3.Android5.1 Launcher3 隐藏指定应用图标  

https://blog.csdn.net/paullovazxq/article/details/52154468 Android5.1 Launcher3 隐藏指定应用图标 西门萝卜

  3.1.直接改清单文件 

-                <category android:name="android.intent.category.LAUNCHER" />
+                <!--<category android:name="android.intent.category.LAUNCHER" />-->

  3.2.loadAllApps()方法,其中将所有应用的信息添加到数组

     boolean startActivitySafely(View v, Intent intent, Object tag) {
         boolean success = false;
diff --git a/packages/apps/Launcher3/src/com/android/launcher3/LauncherModel.java b/packages/apps/Launcher3/src/com/android/launcher3/LauncherModel.java
index 28670f4..3af9a68 100755
--- a/packages/apps/Launcher3/src/com/android/launcher3/LauncherModel.java
+++ b/packages/apps/Launcher3/src/com/android/launcher3/LauncherModel.java
@@ -2887,7 +2887,12 @@ public class LauncherModel extends BroadcastReceiver
                 // Create the ApplicationInfos
                 for (int i = 0; i < apps.size(); i++) {
                     LauncherActivityInfoCompat app = apps.get(i);
+					//Log.d("gatsby","packageName->"+apps.get(i).getApplicationInfo().packageName);
                     // This builds the icon bitmaps.
+						
+					if("com.android.providers.downloads.ui".equals(apps.get(i).getApplicationInfo().packageName)){
+					continue;
+					}
                     mBgAllAppsList.add(new AppInfo(mContext, app, user, mIconCache, mLabelCache));
                 }

  

  

posted @ 2020-09-01 14:35  CrushGirl  阅读(836)  评论(0编辑  收藏  举报