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

Commit c1244464 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

feat: Fix widgets padding

parent 31f97db0
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -3,8 +3,9 @@
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginHorizontal="4dp"
    android:layout_marginVertical="8dp"
    android:layout_marginHorizontal="@dimen/widget_page_all_padding"
    android:layout_marginVertical="@dimen/widget_page_all_padding"
    android:paddingTop="@dimen/widget_page_all_padding"
    app:blurCornerRadius="15dp">

    <LinearLayout
@@ -31,7 +32,7 @@

            <GridLayout
                android:id="@+id/suggestedAppGrid"
                android:layout_width="match_parent"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:animateLayoutChanges="true"
+2 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
    <dimen name="grid_folder_content_padding">12dp</dimen>
    <dimen name="grid_folder_footer_height">32dp</dimen>
    <dimen name="widget_page_inset_padding">10dp</dimen>
    <dimen name="widget_page_all_padding">4dp</dimen>

    <dimen name="settingslib_preferred_minimum_touch_target">48dp</dimen>
</resources>
+5 −1
Original line number Diff line number Diff line
@@ -22,12 +22,16 @@ import android.appwidget.AppWidgetHost
import android.appwidget.AppWidgetHostView
import android.appwidget.AppWidgetProviderInfo
import android.content.Context
import com.android.launcher3.R

class BlissAppWidgetHost(val context: Context) : AppWidgetHost(context, WIDGET_HOST_ID) {
    private val widgetsDbHelper = WidgetsDbHelper.getInstance(context)

    fun createView(widgetId: Int, widgetInfo: AppWidgetProviderInfo): AppWidgetHostView {
        return createView(context, widgetId, widgetInfo).apply { setPaddingRelative(8, 24, 8, 24) }
        return createView(context, widgetId, widgetInfo).apply {
            val widgetPadding = resources.getDimensionPixelSize(R.dimen.widget_page_all_padding)
            setPaddingRelative(8, widgetPadding, 8, widgetPadding)
        }
    }

    @SuppressLint("NewApi")
+3 −3
Original line number Diff line number Diff line
@@ -67,9 +67,9 @@
            android:id="@+id/swipe_search_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="8dp"
            android:paddingHorizontal="8dp"
            android:paddingVertical="10dp"
            android:layout_marginVertical="@dimen/widget_page_all_padding"
            android:layout_marginHorizontal="@dimen/widget_page_all_padding"
            android:paddingVertical="@dimen/widget_page_all_padding"
            android:visibility="gone">

            <LinearLayout
+4 −1
Original line number Diff line number Diff line
@@ -431,9 +431,12 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
    private void updateCellLayoutMeasures() {
        Rect padding = mLauncher.getDeviceProfile().cellLayoutPaddingPx;
        mWorkspaceScreens.forEach(cellLayout -> {
            int widgetPadding = getResources().getDimensionPixelSize(R.dimen.widget_page_all_padding);
            int paddingTop = (cellLayout == mWorkspaceScreens.get(FIRST_SCREEN_ID))? 0 : padding.top;
            int paddingBottom = (cellLayout == mWorkspaceScreens.get(FIRST_SCREEN_ID))? 0 : padding.bottom;
            cellLayout.setPadding(padding.left, paddingTop, padding.right, paddingBottom);
            int paddingLeft = (cellLayout == mWorkspaceScreens.get(FIRST_SCREEN_ID))? widgetPadding : padding.left;
            int paddingRight = (cellLayout == mWorkspaceScreens.get(FIRST_SCREEN_ID))? widgetPadding : padding.right;
            cellLayout.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
            cellLayout.setSpaceBetweenCellLayoutsPx(getPageSpacing() / 4);
        });
    }