|
4 | 4 |
|
5 | 5 | import android.os.Bundle; |
6 | 6 | import android.text.TextUtils; |
| 7 | +import android.util.TypedValue; |
7 | 8 | import android.view.View; |
8 | 9 |
|
9 | 10 | import androidx.annotation.NonNull; |
|
28 | 29 | import io.github.muntashirakon.AppManager.profiles.struct.AppsBaseProfile; |
29 | 30 | import io.github.muntashirakon.AppManager.profiles.struct.BaseProfile; |
30 | 31 | import io.github.muntashirakon.AppManager.rules.RulesTypeSelectionDialogFragment; |
| 32 | +import io.github.muntashirakon.AppManager.settings.M3PreferenceGroupDecoration; |
31 | 33 | import io.github.muntashirakon.AppManager.users.UserInfo; |
32 | 34 | import io.github.muntashirakon.AppManager.users.Users; |
33 | 35 | import io.github.muntashirakon.AppManager.utils.ArrayUtils; |
@@ -61,6 +63,27 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat |
61 | 63 | recyclerView.setFitsSystemWindows(true); |
62 | 64 | recyclerView.setClipToPadding(false); |
63 | 65 | UiUtils.applyWindowInsetsAsPadding(recyclerView, false, true); |
| 66 | + |
| 67 | + // Use M3 design for preference cards |
| 68 | + float m3CornerRadius; |
| 69 | + float m3CornerRadiusInner; |
| 70 | + TypedValue typedValue = new TypedValue(); |
| 71 | + if (requireContext().getTheme().resolveAttribute(io.github.muntashirakon.ui.R.attr.listItemCornerRadius, typedValue, true)) { |
| 72 | + m3CornerRadius = typedValue.getDimension(getResources().getDisplayMetrics()); |
| 73 | + } else { |
| 74 | + throw new RuntimeException("?attr/listItemCornerRadius not defined."); |
| 75 | + } |
| 76 | + if (requireContext().getTheme().resolveAttribute(io.github.muntashirakon.ui.R.attr.listItemCornerRadiusInner, typedValue, true)) { |
| 77 | + m3CornerRadiusInner = typedValue.getDimension(getResources().getDisplayMetrics()); |
| 78 | + } else { |
| 79 | + throw new RuntimeException("?attr/listItemCornerRadiusInner not defined."); |
| 80 | + } |
| 81 | + |
| 82 | + // Apply the decorator with the specific radius |
| 83 | + recyclerView.addItemDecoration(new M3PreferenceGroupDecoration(m3CornerRadius, m3CornerRadiusInner)); |
| 84 | + |
| 85 | + // Remove old style line dividers |
| 86 | + setDivider(null); |
64 | 87 | } |
65 | 88 |
|
66 | 89 | @Override |
|
0 commit comments