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

Commit 8eeb7a07 authored by Amrit Ranjan's avatar Amrit Ranjan Committed by Bruno Martins
Browse files

TopLevelSettings: Fix homepage icons hiding on tablets



On tablets, the Settings homepage icons disappear in certain layouts
(specifically portrait mode) because the split-pane context reports a
smaller screen size, triggering phone behavior.

This patch forces icons to remain visible using a hybrid detection strategy:
1. Checks the `ro.build.characteristics` system property for "tablet".
2. Falls back to `smallestScreenWidthDp >= 600` via Application Context.

This ensures the UI is correct on devices that properly set the system
property, while maintaining a failsafe for other cases where the prop
is missing or defaults to "nosdcard".

Suggested-by: default avatarHarshit Jain <reach@harsh1998.dev>
Change-Id: I26731db13543e2612856b8df234dfad2dee0b4e1
Signed-off-by: default avatarAmrit Ranjan <arktiothome@gmail.com>
parent 0b837caf
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.view.WindowManager;

import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
@@ -221,7 +222,14 @@ public class TopLevelSettings extends DashboardFragment implements SplitLayoutLi
    public void onSplitLayoutChanged(boolean isRegularLayout) {
        iteratePreferences(preference -> {
            if (preference instanceof HomepagePreferenceLayout) {
                ((HomepagePreferenceLayout) preference).getHelper().setIconVisible(isRegularLayout);
                Context context = getContext();
                boolean isLargeScreen = SettingsThemeHelper.isTablet(context) ||
                        (context != null && context.getApplicationContext()
                                .getResources().getConfiguration().smallestScreenWidthDp >=
                                WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP);
                boolean visible = isRegularLayout || isLargeScreen;

                ((HomepagePreferenceLayout) preference).getHelper().setIconVisible(visible);
            }
        });
    }