I'm trying to modfiy my notification dropdown area a bit, and I'm wondering if we have the following functionalities available on our Xperia's - I'm on V, but I'm guessing T and variants should be similar.
The first one would be to add a brightness slider. I based the code on a section from my Galaxy S2's status_bar_expanded.xml and the slider itself shows up, slides back and forth and whatnot, but doesn't actually affect the brightness level. There is a "brightness" id in res/values/ids.xml, which is referenced in the code in status_bar_expanded.xml, but like I said, nothing happens when using the slider. Any suggestions to get this to work?
The other thing that I wanted to try to emulate from my S2 is the way ongoing notifications are separated from "swipeable" notifications. Each gets its own section, separated by headers, with ongoing items such as music player controls on top and then normal, user-clearable items underneath. From digging around a bit in SystemUI, it seems like Xperia is more or less without this functionality and I'm probably out of luck, but I thought I would ask anyway.
Thanks in advance!!
I would be very interested in that brightness slider.
It's one thing to make the slider show by editing xml, in order to make it work you would also need the code for the function, i.e. smali. Not sure if that's as easy to port but there are SystemUI mods for other Xperia's, like serajr's that also have this.
Sent from my LT30p using xda app-developers app
TiMiN8R said:
It's one thing to make the slider show by editing xml, in order to make it work you would also need the code for the function, i.e. smali. Not sure if that's as easy to port but there are SystemUI mods for other Xperia's, like serajr's that also have this.
Sent from my LT30p using xda app-developers app
Click to expand...
Click to collapse
Huh, I wasn't expecting this thread to come back to life, lol.
There is a resource id called "brightness" in SystemUI's public.xml which I called to when I edited status_bar_expanded.xml (and this was with ICS). Now that this thread has popped back up I finally got around to looking at it again, and it looks like that id goes to SystemUI\smali\com\android\systemui\statusbar\tablet\SettingsView.smali. There's no equivalent file in statusbar\phone. I'm basically non-functional when it comes to smali, and it seems to be more than a simple matter of splicing a section of code from one place to another, so I guess I'm off the case for the time being.
Introduction
Remember a time when an unthemed popup popped up in an app, and you tried all that you could to change the colors of it, then found out it wasn't even in the app you spent hours on at the first place? Damn right I do!!! Wasted so much of my youth looking for things in the wrong place.
In this guide I will be going over a desktop application called "Android Device Monitor", and how to use it for theming. This program is not bound to theming, as it can help many ROM developers like locating a CP'd commit and forgot where to set a textColor was set in a dialog. For example: https://github.com/TeamBliss-LP/and...mmit/4f85ee62ab0db9d2a78b1bfeee32dfa17313e215.
The guide will also outline other methods to locate hardcoded colors on most apps, and this is not bounded by device. This will theoretically work on any device running Android, as long as you enable USB debugging on your device. So it should theoretically work on TouchWiz, AOSP, CM, Sense, LG Home, XperiaHome, etc...
Most importantly, if your friend comes over with a non-rooted phone, fret not, this DOES NOT require root. So! If you happen to stumble here from a link I requested you to follow, I'll assume you're either a themer, or you're a user of a theme. For users, this guide would be used to aid the themer when the themer does not have access to what you are seeing in an app due to differences in software/region bound software/firmware versions/custom ROMs. For themers, I hav known about this trick for a while but haven't gotten the time to write it - but this saves me precious time solving "unsolvable" issues, like during the days when we didn't have Setting's dashboard exposed (before the January 27th commit).
To understand how this works, we have to understand how Android system works. We can change many colors through colors.xml, but styles, layouts and java can also change colors. We have to remember this structure. Left is greater than the corresponding right.
Java > Layout > Styles > Colors
In this guide, I will be focusing on using ADM to locate colors/usages of resources within Layouts, thus allowing you to locate things within styles/colors.
ATTENTION
This guide is NOT 100% guaranteed.
As many third party apps like Google+ designs it's layout through the java, and the overall code of the application. Using Android Device Monitor, it is the first steps of beginning to theme.
This guide is meant to be a STARTING GROUND when you face any issue. I cannot guarantee any success, but this has helped me find out whether many things are hardcoded or not. So having this as a utility will greatly help a lot of people new to theming!
I also do NOT have access to a TW/Sense/LG Home/XH device, so if you have any issues (non-connection issues) with using ADM to trace your screen, please tell me. But theoretically, this should work on any device.
What is Android Device Monitor?
Android Device Monitor is a desktop application that traces the running programs of your device connected to your PC. You can use this to debug as it shows many useful information.
But for this guide, I will use it to show how to use it to take a screenshot XML dump of your phone's screen, and you can mouseover the elements of your screenshot on your screen to locate the layout of the app, or whatever is on your screen.
Wow! That sounds cool! How do I get it?
All you have to do is install the Android Studio package from Google, and you will get it preinstalled with it.
You can download Android Studio from this link: http://developer.android.com/sdk/index.html?gclid=CLWt6IX99MgCFRCpaQodrhwHng
Make sure you install the prerequisite packages once installing and setting up Android Studio. This includes the complete SDK.
If you would like to install just the SDK, that is possible too: https://developer.android.com/sdk/installing/index.html?pkg=tools
Make sure you install Android SDK Tools in the SDK Manager. Android Studio method is recommended as it comes with everything pre-installed once setting everything up.
Let's get started, shall we?
(*) Make sure you have installed adb/fastboot on your computer prior to continuing: http://forum.xda-developers.com/showthread.php?p=48915118
A great text editing tool is Notepad++, available here: https://notepad-plus-plus.org/
ON YOUR PHONE/TABLET
I will be using a Lollipop based CM ROM in this tutorial. Keep your device unplugged at this point.
First you have to enable Developer Options by going into About Device in Settings, then clicking the Build number 7 times. This enables Developer Options directly in the main menu of Settings.
Once activated, go into Developer Options
Scroll down until you see Android debugging, then activate that.
Plug your phone into the computer
At this point, a popup will appear on your device to verify the RSA fingerprint of your computer. Click Always Allow from this Computer.
ATTENTION: If you did not get a popup, adb is NOT installed correctly/your phone is not detected in ADB mode, or your computer does not have it set up properly. Follow my link above to get it set up quicker than using Android Studio's method. (*)
Once you agreed to the popup, then go to the screen where you want to see what the problem is. For example, you want to find out why there is a random white dialog when toggling GPS telling you to improve location accuracy.
Keep the screen turned on/turn on Stay Awake in Developer Options so it will keep your phone awake while plugged in. After this step, you have successfully finished using your phone.
ON YOUR COMPUTER
ATTENTION: If you already use Android Studio to build your theme, you can skip steps 2 and 3. Also to note, you can always use search and locate the "monitor.exe" file in your Android Studio directory, but that is too fussy, as it likes to error out a lot.
Open Android Studio, and create a new project, you need to Start a new Android Studio Project, follow all the steps till you click Finish.
You may or may not be greeted with a couple of popups, just dismiss them.
Once you get to a window with an available toolbar, click on Tools -> Android -> Android Device Monitor.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
ATTENTION: If you're running Android Studio 1.4.1 and above, click on the icon in the toolbar.
On first launch you will get this popup, click Proceed
Your phone will appear on the left, including all the processes and background services running on your phone.
Click on your device, and click on the Dump View Hierarchy for UI Automator icon, an icon that should be next to the camera, with three stacked phones.
At this point, the computer will dump whatever is on your screen, if your screen is off, it will dump a black screen, so you should have kept it awake.
Once complete, you will want to hover over the unidentifiable object on your screen. So if the white dialog (as mentioned previously) when toggling location is a bother, we hover over the screen's focused dialog, and click on it. When selected, the area has a red rectangle.
You will then see a table on the bottom right identifying all its attributes. But most importantly, you will want to see that it is actually in package ID com.google.android.gms (Google Play Services), so you must invert that/theme that.
You can see how the table above told me that the package ID was com.google.android.gms, and thus I was able to go find it in the decompiled APK of Google Play Services.
Also to note, resource-id is also a great way to start, as it tells you the app's layout object ID, which allows you to find it within the app's res/layout folder by using Notepad++ and the Find in Files section. If by any chance, you get no information at all, you should check the structure of the app on the top right, and locate within layouts folder as well. For example, if you see a FrameLayout and textView x2, you have identified the structure of the activity fragment of the app, and it MAY help you for layouts.
In my commit at the beginning of this thread, I was locating an unthemed black text in a dialog, and found out that the dialog's resource-id was "dpi_edit", so I searched in res/layout using N++'s Find in Files tool and found out that it was in this file: https://github.com/TeamBliss-LP/and...13e215/res/layout/alert_dialog_text_entry.xml. So I made the change to the textColor and pushed the commit to the source. Thus allowing users to have a visible DPI text color, even though we expected that the ?attr should work.
Demonstration on how to reverse locate a specific color
Let's find something specific using this trace method, so for example, I would like to find the background of the switch bar in Settings. Pretend I don't know how. So following my above steps, I'm able to reach this:
We see that under resource-id in the Node Detail box, it says: com.android.settings:id/switch_bar -- so we should search for switch_bar under res/layouts of com.android.settings (your decompiled settings).....
We go into Notepad++, and use the Find in Files feature (Search -> Find in Files) and type in the resource-id after ":id/", which is "switch_bar"
Click Find All and wait for it to finish. Afterwards, you will get a list of results with a hit. In this case, we have one result.
Double click on the result, and you will be greeted with a layout XML with the ID. In the XML you will see that you have a bunch of stuff there, so with some smarts and some logic on the same line, you can see if the background is set to a hardcoded hex (hardcoded meaning there's a hex code there, as you can't modify layouts in CMTE, or is it rerouted to another color)
We can see that the background was linked to a color variable, "switchbar_background", now change that in com.android.settings/res/values/colors.xml, then you tell me if I'm correct If you see something else in there, or are a ROM developer and trying to expose some values, replace the hardcoded hex to a rerouted color in the corresponding app's colors.xml, and you have successfully exposed it!
Troubleshooting
Q: There is an error every time I launch ADM again! What should I do?
A: The error is normal, just press OK and proceed. (This error in spoiler, if any others, message below)
Q: I keep getting a permission error with my device when I click the button and it doesn't draw my screenshot!
A: This happens when your device is extremely "dirty", a complete clean flash is required. In my case, I fastbooted stock and reflashed my custom ROM. You can try wiping data, as the permissions lie somewhere there.
Q: I still can't get my theme to theme the hardcoded thing, help!
A: As I said, this doesn't work for all cases, this is only a starting and ending ground to see if it is themable. If you can't find out what to do, then chances are you did everything you can!
Q: Any other tips?
A: If you really can't find it, but you have a specific color you want to get rid of, try using Photoshop's Eyedropper tool to pick out the color from the screenshot, then use Notepad++ to search for this color. You should find the hex from the color by clicking the color palette.
Q: What about using backgroundTint?
A: You can use this to target many white hardcoded (definite) backgrounds by adding a backgroundTint attribute, but this may affect other things, like the Paste tooltip will take on this backgroundTint thus you can't read the "Paste" text. But definitely, this is a great way to start targeting white backgrounds!
Q: I have more questions!
A: Post in the thread and tag me using @nicholaschum, I'm more likely to check if I get a notification.
XDA:DevDB Information
[GUIDE] Locating hidden values, random dialogs and hardcodes (AOSP/TW/Sense/XH), Theme for all devices (see above for details)
Contributors
nicholaschum
Version Information
Status: Stable
Created 2015-11-03
Last Updated 2015-11-06
Reserved
Reserved
Thanks.
Sent from my GT-I9100 using XDA Free mobile app
I always get a black screen on my PC. How can I solve it? My phone screen is always on.
Thank you for the guide.
starbucks2010 said:
I always get a black screen on my PC. How can I solve it? My phone screen is always on.
Thank you for the guide.
Click to expand...
Click to collapse
Hmm, that's a bit strange, because black screen is mainly when your screen is off, are you seeing the background processes of the app on the left of ADM?
Solved. Actually, I have to have the screen on in the moment I start to take the "screenshot" of my phone. It's ok now.
I'm still looking for that white contact detail background ...
PS. Do you know what it means class = android.widget.RelativeLayout ? It doesn't give too much details so I don't know where should I search for it?
Thank you.
starbucks2010 said:
Solved. Actually, I have to have the screen on in the moment I start to take the "screenshot" of my phone. It's ok now.
I'm still looking for that white contact detail background ...
PS. Do you know what it means class = android.widget.RelativeLayout ? It doesn't give too much details so I don't know where should I search for it?
Thank you.
Click to expand...
Click to collapse
That means that the layout is using a RelativeLayout. It's a type of layout configuration. You should use N++ to see if you can find that RelativeLayout, as not all xmls have that layout.
Sent from my Xperia Z3 Tablet Compact LTE using Tapatalk
Thank you, great guide!
For themers, this is the best guide and most useful, ever. It should be a sticky.
Thank you very much Nicolas.
Well, in the new version of Android Studio, there's no option for UI, Only Camera / Print, and other Monitor related options.
abo hani said:
Well, in the new version of Android Studio, there's no option for UI, Only Camera / Print, and other Monitor related options.
Click to expand...
Click to collapse
I'll take a look at this, I might make a standalone package if this is the case.
@abo hani, updated the guide with Android Studio 1.4.1 instructions to locate ADM. Once ADM launched, it works exactly the same way now.
Thank you so much. This is a perfect tool for somebody like me trying to catch up to all the great themers on here. At least I can help myself and ask better questions.
Thank you for this guide
Do you have any tips on how to make a transparent background transparent instead of grey? I have changed backgrounds edited pngs edited styles and manifests and still get a grey box on the light option
rickberg said:
Do you have any tips on how to make a transparent background transparent instead of grey? I have changed backgrounds edited pngs edited styles and manifests and still get a grey box on the light option
Click to expand...
Click to collapse
If a transparent background is already transparent, why are you changing it to grey? What changes are you making?
I worded that wrong im trying to make the apk transparent but it will not go transparent it goes to a grey i added Theme.Translucent to styles and manifest also changed background hexes on light to 00000000
Anyone knows from where is taken the color of the text in the search box? Is taken from the app itself of from somewhere else (SystemUI, framework, etc)? It drives me crazy this search text from SecGallery. Is always black on black.
Thank you.
nicholaschum said:
If a transparent background is already transparent, why are you changing it to grey? What changes are you making?
Click to expand...
Click to collapse
This is the color i get as background even though everythong is set to transparent
Sent from my SM-N920P using Tapatalk