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

Unverified Commit 74db293b authored by AdrianDC's avatar AdrianDC Committed by Michael Bestas
Browse files

LEDs Brightness: Update the slider for M



 * Add notification details needed for M
 * Sync with some changes made in the Display Brightness dialog
 * Clean ic_settings indents with Settings ic_settings_24dp.xml

Change-Id: I8b6ac1920704f43f4776cbd3bdfb3d0ed8d223dc
Signed-off-by: default avatarAdrianDC <radian.dc@gmail.com>
parent e21273ec
Loading
Loading
Loading
Loading
+19 −20
Original line number Diff line number Diff line
<!-- Copyright (C) 2014 The Android Open Source Project
<!--
     Copyright (C) 2015 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
You may obtain a copy of the License at"+
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0


     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
android:height="24dp" android:viewportWidth="24.0"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">


    <path
        android:pathData="M19.4,13.0c0.0,-0.3 0.1,-0.6 0.1,-1.0s0.0,-0.7 -0.1,-1.0l2.1,-1.7c0.2,-0.2 0.2,-0.4 0.1,-0.6l-2.0,-3.5C19.5,5.1 19.3,5.0 19.0,5.1l-2.5,1.0c-0.5,-0.4 -1.1,-0.7 -1.7,-1.0l-0.4,-2.6C14.5,2.2 14.2,2.0 14.0,2.0l-4.0,0.0C9.8,2.0 9.5,2.2 9.5,2.4L9.1,5.1C8.5,5.3 8.0,5.7 7.4,6.1L5.0,5.1C4.7,5.0 4.5,5.1 4.3,5.3l-2.0,3.5C2.2,8.9 2.3,9.2 2.5,9.4L4.6,11.0c0.0,0.3 -0.1,0.6 -0.1,1.0s0.0,0.7 0.1,1.0l-2.1,1.7c-0.2,0.2 -0.2,0.4 -0.1,0.6l2.0,3.5C4.5,18.9 4.7,19.0 5.0,18.9l2.5,-1.0c0.5,0.4 1.1,0.7 1.7,1.0l0.4,2.6c0.0,0.2 0.2,0.4 0.5,0.4l4.0,0.0c0.2,0.0 0.5,-0.2 0.5,-0.4l0.4,-2.6c0.6,-0.3 1.2,-0.6 1.7,-1.0l2.5,1.0c0.2,0.1 0.5,0.0 0.6,-0.2l2.0,-3.5c0.1,-0.2 0.1,-0.5 -0.1,-0.6L19.4,13.0zM12.0,15.5c-1.9,0.0 -3.5,-1.6 -3.5,-3.5s1.6,-3.5 3.5,-3.5s3.5,1.6 3.5,3.5S13.9,15.5 12.0,15.5z"
     android:fillColor="#ffffffff"
     />

        android:fillColor="#ffffffff" />
</vector>
+6 −5
Original line number Diff line number Diff line
@@ -14,10 +14,9 @@
     limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
    android:paddingStart="16dp"
    android:paddingEnd="16dp"

    xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    style="@style/BrightnessDialogContainer">

    <com.android.systemui.settings.ToggleSlider
@@ -26,6 +25,8 @@
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        systemui:text="" />
        systemui:text=""
        android:contentDescription="@string/accessibility_notification_brightness"
        android:importantForAccessibility="no" />

</LinearLayout>
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
 * Copyright (c) 2009, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 *
 *     http://www.apache.org/licenses/LICENSE-2.0 
 *
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 */
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

    <!-- Content description of the light brightness slider (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_notification_brightness">Light brightness</string>

    <!-- Lights settings, LED notification -->
    <string name="led_notification_title">Light settings</string>
    <string name="led_notification_text">LED light enabled by settings</string>

</resources>
+24 −1
Original line number Diff line number Diff line
@@ -25,9 +25,12 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.UserHandle;
import android.provider.Settings;

import com.android.systemui.R;

import java.lang.Exception;
import java.util.ArrayList;

@@ -37,6 +40,9 @@ public class NotificationBrightnessController implements ToggleSlider.Listener {
    public static final int LIGHT_BRIGHTNESS_MINIMUM = 1;
    public static final int LIGHT_BRIGHTNESS_MAXIMUM = 255;

    // Minimum delay between LED notification updates
    private final static long LED_UPDATE_DELAY_MS = 250;

    private int mCurrentBrightness;
    private final int mMinimumBrightness;
    private final int mMaximumBrightness;
@@ -129,8 +135,18 @@ public class NotificationBrightnessController implements ToggleSlider.Listener {
        mNotificationBuilder = new Notification.Builder(mContext);

        mNotificationBundle.putBoolean(Notification.EXTRA_FORCE_SHOW_LIGHTS, true);
        mNotificationBuilder.setExtras(mNotificationBundle);
        mNotificationBuilder.setExtras(mNotificationBundle)
                .setContentTitle(mContext.getString(R.string.led_notification_title))
                .setContentText(mContext.getString(R.string.led_notification_text))
                .setSmallIcon(R.drawable.ic_settings)
                .setOngoing(true);
    }

    private Handler mLedHandler = new Handler() {
        public void handleMessage(Message msg) {
            updateNotification();
        }
    };

    public void addStateChangedCallback(BrightnessStateChangeCallback cb) {
        mChangeCallbacks.add(cb);
@@ -210,7 +226,14 @@ public class NotificationBrightnessController implements ToggleSlider.Listener {

    /** Fetch the brightness from the system settings and update the slider */
    private void updateNotification() {
        // Dampen rate of consecutive LED changes
        if (mLedHandler.hasMessages(0)) {
            return;
        }

        if (mNotificationAllow) {
            mLedHandler.sendEmptyMessageDelayed(0, LED_UPDATE_DELAY_MS);

            // Instead of canceling the notification, force it to update with the color.
            // Use a white light for a better preview of the brightness.
            int notificationColor = 0xFFFFFF | (mCurrentBrightness << 24);
+0 −4
Original line number Diff line number Diff line
@@ -17,11 +17,7 @@
package com.android.systemui.settings;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.Window;