lancher3 图标和hotseat

长按图标变大

dimens.xml

    <!--  When dragging an item, how much bigger (fixed dps) the dragged view
          should be. If 0, it will not be scaled at all. -->
    <dimen name="dragViewScale">55dp</dimen>

代码处理

DragView.java

    public DragView(Launcher launcher, Bitmap bitmap, int registrationX, int registrationY,
            int left, int top, int width, int height, final float initialScale) {
        super(launcher);
        mDragLayer = launcher.getDragLayer();
        mInitialScale = initialScale;
        final Resources res = getResources();
        final float offsetX = res.getDimensionPixelSize(R.dimen.dragViewOffsetX);
        final float offsetY = res.getDimensionPixelSize(R.dimen.dragViewOffsetY);
        final float scaleDps = res.getDimensionPixelSize(R.dimen.dragViewScale);
        final float scale = (width + scaleDps) / width;

...

如果是文件夹图标

packages\apps\Launcher3\src\com\android\launcher3\Workspace.java

void addInScreen(View child, long container, long screenId, int x, int y, int spanX, int spanY,
            boolean insert, boolean computeXYFromRank) {

...

//  if (!(child instanceof Folder)) {

        if (true) {
            child.setHapticFeedbackEnabled(false);
            child.setOnLongClickListener(mLongClickListener);
        }

...

}

============================

hotseat  增加或减少

DynamicGrid.java

class DeviceProfile {

...

numHotseatIcons = 7;//Math.round(invDistWeightedInterpolate(minWidth, minHeight, points));  设为 7 个图标

...


}

hotseat背景设置hotseat.xml

<com.android.launcher3.Hotseat
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
    android:background="#80ffffff">
    <com.android.launcher3.CellLayout
        android:id="@+id/layout"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="center" />
</com.android.launcher3.Hotseat>


添加小部件(由于4.4 launcher3在系统里的权限少了,Launcher3默认拿不到系统BIND_APPWIDGET权限,因此无法预置AppWidget。
如果要预置AppWidget,需要Launcher3获取到系统权限,因此要修改Launcher3的Android.mk,增加LOCAL_CERTIFICATE := shared  LOCAL_PRIVILEGED_MODULE := true,这样build出来的Launcher3.apk会生成到/system/priv-app目录下,可以预置appwidget。

或者以下方案:

在RK的方案中,发现即使是default_workspace.xml 写了添加的小部件,结果还是没有显示出来的。

index b198937..8f76c82 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2297,7 +2297,7 @@
         android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:label="@string/permlab_bindGadget"
         android:description="@string/permdesc_bindGadget"
-        android:protectionLevel="signature|system" />
+        android:protectionLevel="normal" />
 
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 7e1442d..d62435c 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1822,13 +1822,12 @@ public class LauncherModel extends BroadcastReceiver {
                                 String savedProvider = c.getString(appWidgetProviderIndex);
 
                                 id = c.getLong(idIndex);
-
                                 final AppWidgetProviderInfo provider =
                                         widgets.getAppWidgetInfo(appWidgetId);
 
-                                if (!isSafeMode && (provider == null || provider.provider == null ||
+                                if ( (provider == null || provider.provider == null ||
                                         provider.provider.getPackageName() == null)) {
-                                    String log = "Deleting widget that isn't installed anymore: id="
+                                    String log = provider+"Deleting widget that isn't installed anymore: id="
                                         + id + " appWidgetId=" + appWidgetId;
                                     Log.e(TAG, log);
                                     Launcher.addDumpLog(TAG, log, false);

make android


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值