FORUMS
Remove All Ads from XDA

XML 101 - XML Modding Made Easy!

6,062 posts
Thanks Meter: 7,466
 
By Ticklefish, Recognized Themer on 5th November 2014, 05:01 PM
Post Reply Email Thread
17th May 2017, 05:51 PM |#601  
deewfrank's Avatar
Member
Temuco - Chile
Thanks Meter: 8
 
More
Quote:
Originally Posted by Ticklefish

Okay, your signal_cluster_view.xml contains this line:

Code:
<LinearLayout android:id="@id/mobile_signal_group" android:layout_width="wrap_content" android:layout_height="wrap_content" />
This is the line that controls the display of your signal icons and data icons. There's nothing much we can do with this line but, handily, there is a layout file called mobile_signal_group.xml which is worth a look at. That looks like this:

Code:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="@id/mobile_combo" android:layout_width="wrap_content" android:layout_height="wrap_content"
  xmlns:android="http://schemas.android.com/apk/res/android" xmlns:systemui="http://schemas.android.com/apk/res-auto">
    <com.android.systemui.statusbar.AnimatedImageView android:theme="@style/DualToneLightTheme" android:id="@id/mobile_signal" android:layout_width="wrap_content" android:layout_height="wrap_content" systemui:hasOverlappingRendering="false" />
    <com.android.systemui.statusbar.AnimatedImageView android:theme="@style/DualToneDarkTheme" android:id="@id/mobile_signal_dark" android:layout_width="wrap_content" android:layout_height="wrap_content" android:alpha="0.0" systemui:hasOverlappingRendering="false" />
    <ImageView android:id="@id/mobile_type" android:layout_width="wrap_content" android:layout_height="wrap_content" />
    <ImageView android:id="@id/mobile_roaming" android:paddingTop="1.5dip" android:paddingBottom="3.0dip" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="17.0dip" android:src="@drawable/stat_sys_roaming" android:scaleType="fitCenter" android:contentDescription="@string/accessibility_data_connection_roaming" android:paddingStart="22.0dip" />
</FrameLayout>
This uses a FrameLayout to display the signal icon (@id/mobile_signal and @id/mobile_signal_dark), data icon (@id/mobile_type) and roaming icon (@id/mobile_roaming). FrameLayouts display their contents on top of each other, like they're in a frame. That's why you see the data icon on top of the signal icon.

Try changing that FrameLayout to a LinearLayout and that should put the icons next to each other.

You may want to consider redrawing the icons though. These are now Android Vector Drawables which are XML files in the drawable. You can either edit the existing code in those files (complicated), replace the code with brand new code (less complicated but still takes time) or delete the XML files completely and create your own PNG files instead. These will need to be in the suitable drawable-?dpi folder and have the same filenames.

The above paragraph is simple but it does involve a bit of thought and time.

it works!!!!! thanks bro, the only thing is the data icon is showing on right side of signal, next to battery haha, any tip to move it to the r̶i̶g̶h̶t̶ left of the signal icon?
 
 
17th May 2017, 05:57 PM |#602  
Quote:
Originally Posted by deewfrank

it works!!!!! thanks bro, the only thing is the data icon is showing on right side of signal, next to battery haha, any tip to move it to the right of the signal icon?

So...the data icon is on the right side of the signal and you want to move it to the...right side of the signal?

If you want to move it to the left side of the icon, you just need to change the order of the lines inside that Layout. The line at the top will be displayed first, then the next line down and so on.
The Following User Says Thank You to Ticklefish For This Useful Post: [ View ] Gift Ticklefish Ad-Free
17th May 2017, 06:57 PM |#603  
deewfrank's Avatar
Member
Temuco - Chile
Thanks Meter: 8
 
More
Quote:
Originally Posted by Ticklefish

So...the data icon is on the right side of the signal and you want to move it to the...right side of the signal?

If you want to move it to the left side of the icon, you just need to change the order of the lines inside that Layout. The line at the top will be displayed first, then the next line down and so on.

thanks so much
finally... thanks for your help bro
The Following User Says Thank You to deewfrank For This Useful Post: [ View ] Gift deewfrank Ad-Free
18th May 2017, 04:36 AM |#604  
deewfrank's Avatar
Member
Temuco - Chile
Thanks Meter: 8
 
More
now im trying to edit this icons, but cant find any line with "signal" or something.... weird xD
you know what xml manage this icons? thanks <3
18th May 2017, 08:41 AM |#605  
Quote:
Originally Posted by deewfrank

now im trying to edit this icons, but cant find any line with "signal" or something.... weird xD
you know what xml manage this icons? thanks <3

It'll be something like "ic_gs_*.xml" in the drawable folder.

Sent from my Sony Xperia XA1 using XDA Labs
The Following User Says Thank You to Ticklefish For This Useful Post: [ View ] Gift Ticklefish Ad-Free
5th July 2017, 11:27 AM |#606  
Senior Member
Flag Milano / Horb am Neckar
Thanks Meter: 405
 
More
Hi

I have a problem with hiding a Preference (ListPreference - CheckBoxPreference) line in xml file.

I can't use android:visibility="gone" or "invisible" (it doesn't work)
I can't use android:layout_height="0.0dip" (it doesn't work)
I can't delete this line (crash recompiled app)

There is something other that I can do?
In smali folder there is nothing, so I can't use RemovePreference
5th July 2017, 09:15 PM |#607  
Quote:
Originally Posted by millo1978

Hi

I have a problem with hiding a Preference (ListPreference - CheckBoxPreference) line in xml file.

I can't use android:visibility="gone" or "invisible" (it doesn't work)
I can't use android:layout_height="0.0dip" (it doesn't work)
I can't delete this line (crash recompiled app)

There is something other that I can do?
In smali folder there is nothing, so I can't use RemovePreference

Hmm, what an interesting problem. Can you share the code please? I'll look into it and see what I can work out for you.

Sent from my Sony Xperia XA1 using XDA Labs
The Following User Says Thank You to Ticklefish For This Useful Post: [ View ] Gift Ticklefish Ad-Free
5th July 2017, 09:34 PM |#608  
Senior Member
Flag Milano / Horb am Neckar
Thanks Meter: 405
 
More
Quote:
Originally Posted by Ticklefish

Hmm, what an interesting problem. Can you share the code please? I'll look into it and see what I can work out for you.

https://mega.nz/#!BZhRiTYb!xNwFCM0So...6hQXK9KKGP3Ghk
Here there are my apk files: kangvip-res and KangVIPTools
These files go to framework folder.

I have problems with KangVIPTools.
Not simple to recompile...
Here I wrote how I made it.

res/xml/notification_settings and notification_settings_multi_sim
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
  xmlns:android="http://schemas.android.com/apk/res/android">
    <PreferenceScreen android:title="@string/statusbar_act_settings" android:key="statusbar_act_settings" android:summary="@string/statusbar_act_settings_summary">
        <intent android:persistent="false" android:action="com.kangvip.tools.StatusbarActSettings" />
    </PreferenceScreen>
  <ListPreference android:entries="@array/battery_icon_setting_entries" android:title="@string/battery_icon_title" android:key="battery_style_setting" android:dialogTitle="@string/battery_icon_title" android:entryValues="@array/battery_icon_setting_values" />
    <ListPreference android:entries="@array/battery_line_height_entries" android:title="@string/battery_line_height" android:key="battery_line_height" android:dialogTitle="@string/battery_line_height" android:entryValues="@array/battery_line_height_values" />
    <ListPreference android:entries="@array/entries_status_bar_traffic_style" android:title="@string/show_network_speed_title" android:key="status_bar_traffic_style" android:defaultValue="0" android:dialogTitle="@string/show_network_speed_title" android:entryValues="@array/values_status_bar_traffic_style" />
    <ListPreference android:entries="@array/entries_status_bar_icon_max" android:title="@string/status_bar_icon_max" android:key="status_bar_icon_max" android:defaultValue="5" android:dialogTitle="@string/status_bar_icon_max" android:entryValues="@array/values_status_bar_icon_max" />
    <ListPreference android:entries="@array/entries_k_temperature" android:title="@string/k_temperature" android:key="k_temperature_settings" android:defaultValue="0" android:dialogTitle="@string/k_temperature" android:entryValues="@array/values_k_temperature" />
    <ListPreference android:entries="@array/entries_status_bar_toolbox_mode" android:title="@string/status_bar_toolbox_mode" android:key="k_statusbar_toolbox_mode" android:defaultValue="0" android:dialogTitle="@string/statusbar_toolbox_mode_list" android:entryValues="@array/values_status_bar_toolbox_mode" />
    <ListPreference android:entries="@array/status_bar_signal_cluster_entries" android:title="@string/status_bar_signal_cluster" android:key="signal_cluster_style_setting" android:defaultValue="0" android:dialogTitle="@string/status_bar_signal_cluster" android:entryValues="@array/status_bar_signal_cluster_values" />
    <ListPreference android:entries="@array/status_bar_clock_style_entries" android:title="@string/status_bar_clock_style_title" android:key="status_bar_clock_style" android:dialogTitle="@string/status_bar_clock_style_title" android:entryValues="@array/status_bar_clock_style_values" />
    <ListPreference android:entries="@array/status_bar_time_week" android:title="@string/status_bar_time_week" android:key="status_bar_time_week" android:entryValues="@array/status_bar_time_week_values" />
    <CheckBoxPreference android:title="@string/status_bar_time_second" android:key="status_bar_time_second" android:defaultValue="true" android:summaryOn="@string/checkbox_on" android:summaryOff="@string/checkbox_off" />
    <ListPreference android:entries="@array/entries_ccl_style_multi_sim" android:title="@string/status_bar_carrier_label" android:key="custom_carrier_label" android:defaultValue="0" android:dialogTitle="@string/status_bar_carrier_label" android:entryValues="@array/values_ccl_style_multi_sim" />
    <PreferenceScreen android:title="@string/custom_carrier_label_one" android:key="custom_carrier_label_one" android:summary="@string/custom_carrier_label_summary" />
    <PreferenceScreen android:title="@string/custom_carrier_label_two" android:key="custom_carrier_label_two" android:summary="@string/custom_carrier_label_summary" />
    <ListPreference android:entries="@array/timedetail_entries" android:title="@string/timedetail_title" android:key="status_bar_time_detail" android:entryValues="@array/timedetail_entries_values" />
    <CheckBoxPreference android:title="@string/switch_signal_wifi_icon" android:key="switch_signal_wifi_icon" android:defaultValue="false" android:summaryOn="@string/checkbox_on" android:summaryOff="@string/checkbox_off" />
    <CheckBoxPreference android:title="@string/statusbar_show_lunar" android:key="statusbar_show_lunar" android:defaultValue="true" android:summaryOn="@string/checkbox_on" android:summaryOff="@string/checkbox_off" />
</PreferenceScreen>
at the end I have ListPreference and 2 CheckBoxPreference that I want to hide...
but I'm not able to do this
Maybe there is something in source code that I don't have.
In smali folder there is nothing.
6th July 2017, 12:19 AM |#609  
Quote:
Originally Posted by millo1978

https://mega.nz/#!BZhRiTYb!xNwFCM0So...6hQXK9KKGP3Ghk
Here there are my apk files: kangvip-res and KangVIPTools
These files go to framework folder.

I have problems with KangVIPTools.
Not simple to recompile...
Here I wrote how I made it.

res/xml/notification_settings and notification_settings_multi_sim

at the end I have ListPreference and 2 CheckBoxPreference that I want to hide...
but I'm not able to do this
Maybe there is something in source code that I don't have.
In smali folder there is nothing.

I haven't done much with Preferences in XML so I don't know the answer. So I had to do some research.

Changing the visibility, layout_width and layout_height only works on what Google describe as 'Views'. Preferences aren't Views, so those attributes are completely ignored.
Preferences do have their own unique attributes but there doesn't seem to be any specifically to change whether they're visible or not.
It's worth adding the attribute "android:enabled="false"" to the lines. This might stop the Preferences from showing...or it might not.

If that doesn't work, it's worth deleting each Preference line individually and seeing if they all cause a FC or if it's just one of them. Failing that you may have to track down the relevant bit of smali and edit that.
That's a bit more involved as you'll have to find the hex reference for the android:key from each line, then find where that reference is used in the smali. It's theoretically possible though.

Sorry it's not a definite answer but I'm pretty sure we can work this out!

Sent from my Sony Xperia XA1 using XDA Labs
The Following User Says Thank You to Ticklefish For This Useful Post: [ View ] Gift Ticklefish Ad-Free
6th July 2017, 11:15 AM |#610  
Senior Member
Flag Milano / Horb am Neckar
Thanks Meter: 405
 
More
Quote:
Originally Posted by Ticklefish

...
It's worth adding the attribute "android:enabled="false"" to the lines. This might stop the Preferences from showing...or it might not.
...

I tested it...
The lines are now in gray...
Not the Solution (hide) ...but good!

I can't delete these lines... always FC.
I deleted one line at a time... all these 3 lines get FC.

But I'm happy with gray (unselectable) solution.

Test go on
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2017-07-06-11-06-55.png
Views:	40
Size:	118.7 KB
ID:	4203076  
6th July 2017, 05:34 PM |#611  
Senior Member
Flag Milano / Horb am Neckar
Thanks Meter: 405
 
More
I solved with a magic

Code:
...
    <PreferenceScreen android:enabled="false" android:title="" android:summary="">
	<ListPreference android:enabled="false" android:entries="@array/timedetail_entries" android:title="@string/timedetail_title" android:key="status_bar_time_detail" android:entryValues="@array/timedetail_entries_values" />
	<CheckBoxPreference android:enabled="false" android:title="@string/switch_signal_wifi_icon" android:key="switch_signal_wifi_icon" android:defaultValue="false" android:summaryOn="@string/checkbox_on" android:summaryOff="@string/checkbox_off" />
	<CheckBoxPreference android:enabled="false" android:title="@string/statusbar_show_lunar" android:key="statusbar_show_lunar" android:defaultValue="true" android:summaryOn="@string/checkbox_on" android:summaryOff="@string/checkbox_off" />
    </PreferenceScreen>
...
3 lines in one

With no title and summary ("") ... all blank ... unselectable

It isn't the Solution, but an acceptable solution.

We hide the dust under the carpet
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2017-07-06-17-21-10.png
Views:	146
Size:	118.4 KB
ID:	4203404  
The Following User Says Thank You to millo1978 For This Useful Post: [ View ] Gift millo1978 Ad-Free
Post Reply Subscribe to Thread

Tags
center, clock, statusbar, tutorial, xml

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes