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

Unverified Commit 7acddfad authored by DroidFreak32's avatar DroidFreak32 Committed by Michael Bestas
Browse files

RotationLockTile: Open LineageParts rotation settings

Current long press action opens up AOSP rotation settings which does
not allow us to configure the 0, 90, 180 and 270 degree rotation

Change-Id: I00c163cbde84a10b7f61acaade3cf086dc4c7a6d
parent 60f94835
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -63,6 +63,9 @@ public class RotationLockTile extends QSTileImpl<BooleanState> implements

    private static final String EMPTY_SECONDARY_STRING = "";

    private static final String ROTATION_SETTINGS =
            "org.lineageos.lineageparts.DISPLAY_ROTATION";

    private final Icon mIcon =
            maybeLoadResourceIcon(com.android.internal.R.drawable.ic_qs_auto_rotate);
    private final RotationLockController mController;
@@ -70,6 +73,7 @@ public class RotationLockTile extends QSTileImpl<BooleanState> implements
    private final BatteryController mBatteryController;
    private final UserSettingObserver mSetting;
    private final boolean mAllowRotationResolver;
    private final boolean mAdvancedRotationSettingsEnabled;

    @Inject
    public RotationLockTile(
@@ -109,6 +113,8 @@ public class RotationLockTile extends QSTileImpl<BooleanState> implements
        mBatteryController.observe(getLifecycle(), this);
        mAllowRotationResolver = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_allowRotationResolver);
        mAdvancedRotationSettingsEnabled = mContext.getResources().getBoolean(
                org.lineageos.platform.internal.R.bool.config_enableAdvancedRotationSettings);
    }

    @Override
@@ -128,8 +134,12 @@ public class RotationLockTile extends QSTileImpl<BooleanState> implements

    @Override
    public Intent getLongClickIntent() {
        if (mAdvancedRotationSettingsEnabled) {
            return new Intent(ROTATION_SETTINGS);
        } else {
            return new Intent(Settings.ACTION_AUTO_ROTATE_SETTINGS);
        }
    }

    @Override
    protected void handleClick(@Nullable Expandable expandable) {