[Android General] Grouxho:
Guide - Move status bar views to right - left or center on fly

With this mod you can move statusbar views to left, right or center position without duplicating or tripling views or objects.

You can set different positions on the lock screen and the user screen. You can sort views out inside any of the containers.

For this mod you will need to use my mod control app, GrxSettings. (https://github.com/Grouxho/GrxSettingsV2 . In demo and guide folder you will find how to set it up quickly)

Limitations:

- In this version i have not dettached battery text from battery icon. I just move battery container.

- Notification icons will be always on left (right in RTL). Stock notification icons container sometimes leaves the gap corresponding to an icon on the right side, so it does not look nice if you move the area to the center side for example.

I have kept as it is the clock animation in Lock Screen.

Quick guide:

The attached code is from my device, s7e oreo stock, but it also works in s9 ports. Well, if you understand the logic of this mod it is easy to adapt to other devices.

- download attached zip Compare provided original and modded layouts.

As you know, in status_bar.xml you can control views when we are in user screen, in keyguard_status_bar.xml we can control the views when we are in lock screen.

So, we need 3 containers in both layouts.

In status_bar.xml i have added left_container linear layout and center_container linear layout. As right side container we will use system_icons container.

In lock screen (keyguard_status_bar.xml) the left container will be keyguard_notification_icon_area_inner. I have added a center container (center_container, linearlayout) and as right container we use again system_icons container.

As i want to control both status bars what i have done is to embed original system_icons in keyguard_status_bar.xml.

We need the views to be inside one of the 3 containers on boot before we apply the mod, so, i have included in system_icons xml both clock and an existing knox text view (knoxCustomStatusBarText).

To make all the views positions combinations to have the best looking possible, i have changed Carrier text view with to wrap_content. I have also changed some paddings (start and end).

Finally, to the mod will work with view´s tags, so, I have added a tag to all views i am going to control

- Once you have set the layout, extract from the mod folder inside the attached file, keeping the paths) both GrxSettings.smali and StatusBar$GrxObserver.smali and place them in their places.

- Now, compare provided modded smalies with their corresponding smalies. You will find inside the modded smalies the changes to be done by looking for ###

The guide is embedded inside those smalies and it is quite easy to do.

- Finally you need to set GrxSettings apk

In the attached file you will find all the resources you need to do the mod. You only need to add a navigation screen and to add 2 preferences, one for lock screen and the other one for user screen.

HOW TO ADD NEW VIEWS TO THE MOD

Really easy:

- Add the view to status_bar and/or keyguard_status_bar.xml. Use any of the 3 containers as initial position for boots and clean installs.

- Add a tag to the view, by code or in xml as in this guide

- Add the option to the preferences arraus (this is view title and view tag in values array) in grxsettings app and do not forget to add it to the default value

values are separated by | and the format is easy: view1_tag;position|view2_tag;position|... where postion is 0 (left), 1 (center) or 2 (right)

- Add the default value string to GrxSettings.smali

If you are not on clean install, then, you should build new grx settings app, and to run it. double click on preferences to reset the pref to default value and reboot the phone (with new modded ui)

If you already had this mode done, after building grxsettings app, , just go to the preference and double tap for new default value to be reset. Reboot and done. Since that moment the mod will work on fly.