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

Commit 5897135d authored by Alex Avance's avatar Alex Avance
Browse files

Add a long press option to the status bar widgets to open the corresponding settings.

Rather than remove the imports, I added launch configurations for the two power
widgets in question.

Make WifiApButton point to general TetherSettings instead of directly to
WifiTetherSettings.

Change-Id: Ib09a9979d4de629907e95d53bffc730c9dddf2bd
parent 17b7a813
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -398,6 +398,12 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
                        }
                    }
                });
        mPowerWidget.setGlobalButtonOnLongClickListener(new View.OnLongClickListener() {
                   public boolean onLongClick(View v) {
                       animateCollapse();
                       return true;
                   }
               });

        mTicker = new MyTicker(context, sb);

+9 −0
Original line number Diff line number Diff line
@@ -43,6 +43,15 @@ public class AirplaneButton extends PowerButton {
        context.sendBroadcast(intent);
    }

    @Override
    protected boolean handleLongClick() {
        Intent intent = new Intent("android.settings.AIRPLANE_MODE_SETTINGS");
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mView.getContext().startActivity(intent);
        return true;
    }

    @Override
    protected List<Uri> getObservedUris() {
        return OBSERVED_URIS;
+11 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ package com.android.systemui.statusbar.powerwidget;
import com.android.systemui.R;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;

@@ -43,6 +44,16 @@ public class AutoRotateButton extends PowerButton {
        }
    }


    @Override
    protected boolean handleLongClick() {
        Intent intent = new Intent("android.settings.DISPLAY_SETTINGS");
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mView.getContext().startActivity(intent);
        return true;
    }

    @Override
    protected List<Uri> getObservedUris() {
        return OBSERVED_URIS;
+10 −1
Original line number Diff line number Diff line
@@ -105,10 +105,19 @@ public class BluetoothButton extends PowerButton {
    }

    @Override
    public void toggleState() {
    protected void toggleState() {
        sBluetoothState.toggleState(mView.getContext());
    }

    @Override
    protected boolean handleLongClick() {
        Intent intent = new Intent("android.settings.BLUETOOTH_SETTINGS");
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mView.getContext().startActivity(intent);
        return true;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        sBluetoothState.onActualStateChange(context, intent);
+10 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import com.android.systemui.R;

import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.IPowerManager;
@@ -106,6 +107,15 @@ public class BrightnessButton extends PowerButton {
        }
    }

    @Override
    protected boolean handleLongClick() {
        Intent intent = new Intent("android.settings.DISPLAY_SETTINGS");
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mView.getContext().startActivity(intent);
        return true;
    }

    @Override
    protected List<Uri> getObservedUris() {
        return OBSERVED_URIS;
Loading