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

Commit 052d237b authored by Pechetty Sravani (xWF)'s avatar Pechetty Sravani (xWF) Committed by Android (Google) Code Review
Browse files

Merge "Revert "Use an interface OnScreenWidgetMixin to add extra padding to...

Merge "Revert "Use an interface OnScreenWidgetMixin to add extra padding to FootPreference, IntroPreference, and TopIntroPreference"" into main
parents af966e53 3d89203f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -43,8 +43,7 @@ import java.net.URISyntaxException;
 * A custom preference acting as "footer" of a page. It has a field for icon and text. It is added
 * to screen as the last preference.
 */
public class FooterPreference extends Preference
        implements GroupSectionDividerMixin, OnScreenWidgetMixin {
public class FooterPreference extends Preference implements GroupSectionDividerMixin {
    private static final String TAG = "FooterPreference";

    public static final String KEY_FOOTER = "footer_preference";
+2 −4
Original line number Diff line number Diff line
@@ -31,9 +31,7 @@ constructor(
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0,
    defStyleRes: Int = 0,
) : Preference(context, attrs, defStyleAttr, defStyleRes),
    GroupSectionDividerMixin,
    OnScreenWidgetMixin {
) : Preference(context, attrs, defStyleAttr, defStyleRes), GroupSectionDividerMixin {

    private var isCollapsable: Boolean = true
    private var minLines: Int = DEFAULT_MIN_LINES
@@ -55,7 +53,7 @@ constructor(
            setCollapsable(isCollapsable)
            setMinLines(minLines)
            visibility = if (summary.isNullOrEmpty()) View.GONE else View.VISIBLE
            summary?.let { setText(summary.toString()) }
            setText(summary.toString())
            if (hyperlinkListener != null) {
                setHyperlinkListener(hyperlinkListener)
            }
+0 −25
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settingslib.widget

/**
 * A base interface to indicate that a widget is placed onto the screen.
 *
 * Widget implements this interface will be treated as on-screen widget and applied proper padding.
 */
interface OnScreenWidgetMixin
+0 −6
Original line number Diff line number Diff line
@@ -199,12 +199,6 @@ open class SettingsPreferenceGroupAdapter(preferenceGroup: PreferenceGroup) :
        return when {
            // This item handles edge to edge itself
            item is NormalPaddingMixin && item is GroupSectionDividerMixin -> 0 to 0
            // Item is placed directly on screen needs to have extra padding
            item is OnScreenWidgetMixin -> {
                val extraPadding = item.context.resources.getDimensionPixelSize(
                    R.dimen.settingslib_expressive_space_extrasmall4)
                mNormalPaddingStart + extraPadding to mNormalPaddingEnd + extraPadding
            }

            // According to mappingPreferenceGroup(), backgroundRes == 0 means this item is
            // GroupSectionDividerMixin or PreferenceCategory, which is design to have normal
+1 −3
Original line number Diff line number Diff line
@@ -31,9 +31,7 @@ constructor(
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0,
    defStyleRes: Int = 0,
) : Preference(context, attrs, defStyleAttr, defStyleRes),
    GroupSectionDividerMixin,
    OnScreenWidgetMixin {
) : Preference(context, attrs, defStyleAttr, defStyleRes), GroupSectionDividerMixin {

    private var isCollapsable: Boolean = false
    private var minLines: Int = 2