2014-09-22 45 views
0

guyz我再需要一點點幫助與發射器的圖標主題化:對啓動圖標主題化

這是在ADWLauncher

static Drawable getIcon(PackageManager manager, Context context, ActivityInfo activityInfo) { 
     String themePackage=AlmostNexusSettingsHelper.getThemePackageName(context, Launcher.THEME_DEFAULT); 
     Drawable icon = null; 
     if(themePackage.equals(Launcher.THEME_DEFAULT)){ 
      icon = Utilities.createIconThumbnail(activityInfo.loadIcon(manager), context); 
     }else{ 
      // get from theme 
      Resources themeResources = null; 
      if(AlmostNexusSettingsHelper.getThemeIcons(context)){ 
       activityInfo.name=activityInfo.name.toLowerCase().replace(".", "_"); 
       try { 
        themeResources = manager.getResourcesForApplication(themePackage); 
       } catch (NameNotFoundException e) { 
        //e.printStackTrace(); 
       } 
       if(themeResources!=null){ 
        int resource_id = themeResources.getIdentifier(activityInfo.name, "drawable", themePackage); 
        if(resource_id!=0){ 
         icon=themeResources.getDrawable(resource_id); 
        } 

        // use IconShader 
        if(icon==null){ 
         if (compiledIconShaderName==null || 
          compiledIconShaderName.compareTo(themePackage)!=0){ 
          compiledIconShader = null; 
          resource_id = themeResources.getIdentifier("shader", "xml", themePackage); 
          if(resource_id!=0){ 
           XmlResourceParser xpp = themeResources.getXml(resource_id); 
           compiledIconShader = IconShader.parseXml(xpp); 
          } 
         } 

         if(compiledIconShader!=null){ 
          icon = Utilities.createIconThumbnail(activityInfo.loadIcon(manager), context); 
          try { 
           icon = IconShader.processIcon(icon, compiledIconShader); 
          } catch (Exception e) {} 
         } 
        } 
       } 
      } 

      if(icon==null){ 
       icon = Utilities.createIconThumbnail(activityInfo.loadIcon(manager), context); 
      }else{ 
       icon = Utilities.createIconThumbnail(icon, context); 
      } 
     } 
     return icon; 
    } 

改變LauncherModel.java圖標的方法,但沒有這樣的方法在LauncherModel中,而是它在IconCache中(它不在ADWLauncher中)(https://android.googlesource.com/platform/packages/apps/Launcher2/+/master/src/com/android/launcher2/IconCache.java) 我該如何編輯iconcache.java來實現它?

回答

0

如果你想改變你的啓動器圖標,你應該看看我的項目就是這樣。 https://github.com/slightfoot/android-launcher-badges

+0

日Thnx,我會檢查出來,但我想補充ADW的主題化包裝的兼容性:對 我添加了大部分,只具有與該圖標麻煩: -/ – 2014-09-22 21:01:42

+0

我在想,也許我shud,刪除iconcache系統,並像在ADWLauncher中那樣做,但它是我的最後手段,因爲它會影響應用程序效率 – 2014-09-22 21:09:46