Skip to content

Commit 60c5164

Browse files
authored
fix(ui/PrimarySwitchPreference): address extra divider empty space [Expressive Design] (#79)
* fix(ui/PrimarySwitchPreference): address extra divider empty space [Expressive Design] In the expressive theme introduced in Android 16 (Baklava), the switch preference used in the SIM list activity contains additional space at the beginning of the parent layout causing the title (e.g., SIM name) and summary (e.g., next upcoming schedule) text views that precede it to wrap earlier. Signed-off-by: iusmac <iusico.maxim@libero.it> * SimListActivityTest: update golden screenshots for Roborazzi tests --------- Signed-off-by: iusmac <iusico.maxim@libero.it>
1 parent 22797d7 commit 60c5164

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/com/github/iusmac/sevensim/ui/components/PrimarySwitchPreference.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
import android.content.res.TypedArray;
2222
import android.util.AttributeSet;
2323
import android.view.MotionEvent;
24+
import android.view.View;
2425
import android.widget.Switch;
2526

2627
import androidx.annotation.Keep;
2728
import androidx.annotation.NonNull;
2829
import androidx.annotation.Nullable;
2930
import androidx.preference.PreferenceViewHolder;
3031

32+
import com.android.settingslib.widget.SettingsThemeHelper;
3133
import com.android.settingslib.widget.TwoTargetPreference;
3234

3335
import com.github.iusmac.sevensim.R;
@@ -97,6 +99,16 @@ public void onBindViewHolder(final PreferenceViewHolder holder) {
9799
mSwitch.setChecked(mChecked);
98100
mSwitch.setEnabled(mEnableSwitch);
99101
}
102+
103+
if (SettingsThemeHelper.isExpressiveTheme(holder.itemView.getContext())) {
104+
final View divider = holder.findViewById(
105+
com.android.settingslib.widget.preference.twotarget.R.id.two_target_divider);
106+
if (divider != null) {
107+
// Remove unnecessary padding at the start of the divider in the expressive theme
108+
divider.setPaddingRelative(0, divider.getPaddingTop(), divider.getPaddingEnd(),
109+
divider.getPaddingBottom());
110+
}
111+
}
100112
}
101113

102114
@Override
Loading
Loading

0 commit comments

Comments
 (0)