[Android General] Grouxho:
Enable Night Light Mode

Night light mode is similar to blue light filter but you can select the intensity of the effect and you can set a time range when the mode is applied

It is a very simple mod.

1.- Decompile framework-res, edit bools.xml and set following boolean to true

<bool name="config_setColorTransformAccelerated">true</bool>

make sure that the next boolean is like the next one:

<item type="bool" name="config_nightDisplayAvailable">@bool/config_setColorTransformAccelerated</item>

if not, set config_nightDisplayAvailable to true

2.- Decompile SecSettings , go to res - xml and edit sec_display_settings.xml

After this line, for example

<SecSwitchPreference android:title= [MENTION=936943]string[/MENTION]/outdoor_mode_title" android:key="outdoor_mode" android:summary= [MENTION=936943]string[/MENTION]/outdoor_mode_summary" />

add this one:

<SecPreferenceScreen android:title="Night Mode" android:key="night_display" android:fragment="com.android.settings.display.NightDisplaySettings" />

Of course you can add the [MENTION=936943]string[/MENTION] way, but i am really lazy for these things. Anyway, in s7e only english languaje for the night light mode settings preferences is available.

3.- Decompile SystemUI.apk.

Long press in the tile will not work (in s7e does not work) and i have not time to fix it so, what i have done is to send us to the display settings where the above line in sec display settings xml was added allowing us to access to the mode preferences.

Go to smali - com - android -systemui - qs - tiles and edit NightDisplayTile.smali

replace getLongClickIntent()Landroid/content/Intent; method with this one

.method public getLongClickIntent()Landroid/content/Intent;
.locals 2

new-instance v0, Landroid/content/Intent;

const-string v1, "com.android.settings.DISPLAY_SETTINGS"

invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

return-object v0

.end method

Now, the tile drawable in s7 is very. I have attached a zip with 2 pngs.

Remove from res-drawables these 2 xml drawables

ic_qs_night_display_off.xml
ic_qs_night_display_on.xml

and put in the same folder the pngs in rar (or use other pngs if you like them more). For not to have problems with this i recommend you to compile the apk, then open both original and compiled with winrar and drag and drop from compiled to original both res folder and resources.ascr (this is to avoid fc because of changing the drawables, but you can do it to your own working way)

4.- Finally you have to enable the tile. As always ...

- For clean install roms the best way is to add the tile to SystemUI. In res-values-strings you will find . In this way if your users change of csc you will not have problems with enabling the tile.

<string name="quick_settings_tiles_default">Wifi,SoundMode,Bluetooth,RotationLo ....

Then add to it

<string name="quick_settings_tiles_default">[B][COLOR="RoyalBlue"]NightDisplay,[/COLOR][/B] GrxScreenRecord,Wifi,SoundMode,Bluetooth,RotationLo ....

- If you want to add it on an already installed rom you can do it easily by adding the tile name to your csc

<CscFeature_SystemUI_ConfigDefQuickSettingItem>Wifi,SilentMode,Bluetooth,RotationLock,Flashlight,AirplaneMode,PowerSaving,MobileData,Performance,BlueLightFilter,WifiHotsp

so, just add it to that line

<CscFeature_SystemUI_ConfigDefQuickSettingItem>[COLOR="royalblue"][B]NightDisplay, [/B][/COLOR]GrxScreenRecord, Wifi,SilentMode,Bluetooth,RotationLock,Flashlight,AirplaneMode,PowerSaving,MobileData,Performance,BlueLightFilter,WifiHotsp

you could also to try the first method (adding it to the ui string) and through any settings editor removing the key "sysui_qs_tiles" in settings secure and rebooting..

Enjoy.

NOTE for xda-admins: guys, you should improve the uploading of attachments, it is a pain.

NICER DRAWABLE thanks to [MENTION=4894290]diphons[/MENTION] here!!!! Please use it, art is not my best skill, in fact i have no that skill at all...