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

Commit ee032aea authored by DvTonder's avatar DvTonder Committed by Patrick Schaaf
Browse files

Settings: Notification light(LED) settings

This commit adds the ability to configure the Notification light
color and pulse rate both for the default and a custom applications
list.

This work was done in collaboration with Marko Mihovilić (m1h4) who
wrote the initial implementation as a stand-alone application and
helped with the fixes below.

NOTE: Google Talk notifications originate from the "Google Services
Framework" so in order to override their settings you need to add
this package instead of the Google Talk package.

Patch set 2  - fixes the color returned from picker (remove alpha)
Patch set 3  - whitespace, formatting and minor code cleanup
Patch set 4  - fix derp in Notification light checkbox default
Patch set 5  - part 1 of the changes based on Danny's feedback
Patch set 6  - part 2 of the changes based on Danny's feedback
Patch set 7  - final tweaks to the layout, smaller icons etc.
Patch set 8  - adds the ability to test LED (thanks Marko)
             - Use long click to get the test option
             - most of Danny's suggested fixes
Patch set 9  - moves the test button to colorpicker
             - fixes the app picker dialog to load smoothly
             - minor string fixes to match google writing guidelines
Patch set 11 - switched to using a hashmap for string manipulation
             - minor string and whitespace cleanup
Patch set 12 - Use textUtil.join (thanks Danesh)
             - remove some orphaned code
             - don't refresh whole list on preference change
Patch set 13 - Fix preference not updating when testing before saving
             - Automatically dismiss test dialog after test
             - remove some dead code
             - some cleanup
             - remove ^M from files
Patch set 14 - Fix preference update after test, take #2
Patch set 15 - Fix NPE on empty settings
             - Sort application list by name
Patch set 16 - German translation
Patch set 17 - German translation update

Change-Id: I6837210367123bc02ea27a9b7b6b3cf80c738bf1
parent 7237f6ca
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1388,6 +1388,8 @@

        <activity android:name=".ApnEditor" />

        <activity android:name=".notificationlight.NotificationLightSettings" />

        <activity android:name="Settings$AnonymousStatsActivity"
                android:label="@string/anonymous_statistics_title"
                android:configChanges="orientation|keyboardHidden|screenSize"
+109 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2010 Daniel Nilsson
     Copyright (C) 2012 THe CyanogenMod 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. -->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <com.android.settings.notificationlight.ColorPickerView
        android:id="@+id/color_picker_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp" />

    <LinearLayout
        android:id="@+id/color_panel_view"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:layout_alignLeft="@id/color_picker_view"
        android:layout_alignRight="@id/color_picker_view"
        android:layout_below="@id/color_picker_view"
        android:layout_marginBottom="4dp"
        android:layout_marginTop="4dp"
        android:orientation="horizontal" >

        <com.android.settings.notificationlight.ColorPanelView
            android:id="@+id/old_color_panel"
            android:layout_width="0px"
            android:layout_height="fill_parent"
            android:layout_weight="0.5" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:gravity="center"
            android:text="@string/picker_arrow"
            android:textColor="#ffffff"
            android:textSize="20sp" />

        <com.android.settings.notificationlight.ColorPanelView
            android:id="@+id/new_color_panel"
            android:layout_width="0px"
            android:layout_height="fill_parent"
            android:layout_weight="0.5" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/speed_title_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/color_panel_view"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="4dp"
        android:orientation="vertical" >

        <View
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:background="@android:drawable/divider_horizontal_dark" />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:text="@string/pulse_speed_title"
            android:textAppearance="?android:attr/textAppearanceSmall" />

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingBottom="4dip" >

            <Spinner
                android:id="@+id/on_spinner"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

            <View
                android:layout_width="8dip"
                android:layout_height="fill_parent" />

            <Spinner
                android:id="@+id/off_spinner"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1" />
        </LinearLayout>
    </LinearLayout>

</RelativeLayout>
+71 −0
Original line number Diff line number Diff line
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/app_light_pref"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:focusable="true"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:gravity="center_vertical"
    android:background="?android:attr/selectableItemBackground" >

    <ImageView
        android:id="@+android:id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="4dip"
        android:maxWidth="36dip"
        android:maxHeight="36dip"
        android:adjustViewBounds="true"
        android:layout_gravity="center" />

    <RelativeLayout
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_margin="4dip"
        android:layout_weight="1">

        <TextView android:id="@+android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:ellipsize="marquee"
            android:fadingEdge="horizontal" />

        <TextView android:id="@+android:id/summary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@android:id/title"
            android:layout_alignLeft="@android:id/title"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="?android:attr/textColorSecondary"
            android:maxLines="1" />
    </RelativeLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/textViewTimeOnValue"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:textAppearance="?android:attr/textAppearanceSmall" />

        <TextView
            android:id="@+id/textViewTimeOffValue"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:textAppearance="?android:attr/textAppearanceSmall" />
    </LinearLayout>

    <ImageView
        android:id="@+id/light_color"
        android:layout_width="32dip"
        android:layout_height="wrap_content"
        android:layout_gravity="center" />

</LinearLayout>
 No newline at end of file
+11 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/textViewName"
    android:paddingLeft="4dp"
    android:paddingRight="4dp"
    android:paddingTop="8dp"
    android:paddingBottom="8dp"
    android:textAppearance="?android:attr/textAppearanceMedium" >

</TextView>
 No newline at end of file
+34 −1
Original line number Diff line number Diff line
@@ -597,7 +597,6 @@
    <string name="vibrate_in_silent_title" msgid="3897968069156767036">"Im Lautlos-Modus vibrieren"</string>
    <string name="vibrate_on_ring_title" msgid="40343855247989536">"Vibrieren und klingeln"</string>
    <string name="notification_sound_title" msgid="312032901303146002">"Standardbenachrichtigung"</string>
    <string name="notification_pulse_title" msgid="1247988024534030629">"Benachrichtigungslicht"</string>
    <string name="incoming_call_volume_title" msgid="8073714801365904099">"Klingelton"</string>
    <string name="notification_volume_title" msgid="2012640760341080408">"Benachrichtigung"</string>
    <string name="checkbox_notification_same_as_incoming_call" msgid="1073644356290338921">"Lautstärke für eingehende Anrufe für Benachrichtigungen verwenden"</string>
@@ -2021,4 +2020,38 @@
    <string name="storage_switch_summary_off">Benutze SD-Karte für Apps und Medien</string>
    <string name="storage_switch_unavailable">Dieses Gerät hat keinen erweiterten internen Speicher</string>

    <!-- Display settings screen, notification light settings -->
    <string name="notification_pulse_title">Benachrichtigungslicht</string>
    <string name="notification_light_general_title">Allgemein</string>
    <string name="notification_light_applist_title">Apps</string>
    <string name="notification_light_default_value">Standard</string>
    <string name="notification_light_use_custom">App-Anpassung</string>
    <string name="notification_light_enabled">Farben anpassen</string>
    <string name="notification_light_disabled">Farben nicht anpassen</string>

    <!-- Notification light dialogs -->
    <string name="edit_light_settings">Farbeinstellungen ändern</string>
    <string name="pulse_speed_title">Pulsdauer und Geschwindigkeit</string>
    <string name="picker_arrow"></string>
    <string name="default_time">Normal</string>
    <string name="custom_time">Angepasst</string>
    <string name="dialog_test">Test</string>
    <string name="dialog_delete_title">Löschen</string>
    <string name="dialog_delete_message">Anpassung für diese App entfernen?</string>
    <string name="dialog_test_message">Display abschalten, um diese Einstellung zu testen.</string>
    <string name="dialog_test_button">Abbrechen</string>

    <!-- Values for the notification light pulse spinners -->
    <string name="pulse_length_always_on">Immer an</string>
    <string name="pulse_length_very_short">Sehr kurz</string>
    <string name="pulse_length_short">Kurz</string>
    <string name="pulse_length_normal">Normal</string>
    <string name="pulse_length_long">Lang</string>
    <string name="pulse_length_very_long">Sehr lang</string>
    <string name="pulse_speed_very_fast">Sehr schnell</string>
    <string name="pulse_speed_fast">Schnell</string>
    <string name="pulse_speed_normal">Normal</string>
    <string name="pulse_speed_slow">Langsam</string>
    <string name="pulse_speed_very_slow">Sehr langsam</string>

</resources>
Loading