Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83f76835 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixing custom widgets support:" into ub-launcher3-master

parents 971b1a05 952e63d0
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -143,4 +143,19 @@
    <declare-styleable name="RecyclerViewFastScroller">
        <attr name="canThumbDetach" format="boolean" />
    </declare-styleable>

    <declare-styleable name="CustomAppWidgetProviderInfo">
        <attr name="providerId" format="integer" />

        <attr name="android:label" />
        <attr name="android:initialLayout" />
        <attr name="android:icon" />
        <attr name="android:previewImage" />
        <attr name="android:resizeMode" />

        <attr name="numRows" />
        <attr name="numColumns" />
        <attr name="numMinRows" format="integer" />
        <attr name="numMinColumns" format="integer" />
    </declare-styleable>
</resources>
+0 −1
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@
    <dimen name="vert_drop_target_horizontal_gap">14dp</dimen>

<!-- App Widget resize frame -->
    <dimen name="default_widget_padding">8dp</dimen>
    <dimen name="widget_handle_margin">13dp</dimen>
    <dimen name="resize_frame_background_padding">24dp</dimen>

+16 −20
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
<!--
     Copyright (C) 2017 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
@@ -14,22 +15,17 @@
     limitations under the License.
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <FrameLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="#ffff0000" />

    <FrameLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="#ff00ff00" />

</LinearLayout>
 No newline at end of file
<widgets>
    <!-- Sample widget definition
        <widget
            android:label="My custom widget"
            android:initialLayout="@layout/sample_widget_layout"
            android:icon="@drawable/ic_launcher_home"
            android:resizeMode="horizontal|vertical"
            launcher:numRows="2"
            launcher:numColumns="3"
            launcher:numMinRows="1"
            launcher:numMinColumns="2"
            launcher:providerId="1" />
    -->
</widgets>
 No newline at end of file
+2 −9
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Rect;
import android.util.AttributeSet;
@@ -126,14 +125,8 @@ public class AppWidgetResizeFrame extends FrameLayout
        mMinHSpan = info.minSpanX;
        mMinVSpan = info.minSpanY;

        if (!info.isCustomWidget) {
        mWidgetPadding = AppWidgetHostView.getDefaultPaddingForWidget(getContext(),
                widgetView.getAppWidgetInfo().provider, null);
        } else {
            Resources r = getContext().getResources();
            int padding = r.getDimensionPixelSize(R.dimen.default_widget_padding);
            mWidgetPadding = new Rect(padding, padding, padding, padding);
        }

        if (mResizeMode == AppWidgetProviderInfo.RESIZE_HORIZONTAL) {
            mDragHandles[INDEX_TOP].setVisibility(GONE);
+0 −14
Original line number Diff line number Diff line
package com.android.launcher3;

public interface CustomAppWidget {
    public String getLabel();
    public int getPreviewImage();
    public int getIcon();
    public int getWidgetLayout();

    public int getSpanX();
    public int getSpanY();
    public int getMinSpanX();
    public int getMinSpanY();
    public int getResizeMode();
}
Loading