duplicateParentState works on one nested View but not another - Android Q&A, Help & Troubleshooting

I have two LinearLayouts that are focusable. Both of their backgrounds are set to a selector that loads an image when they are focused. When they are not focused the background is set to transparent. These both work perfectly fine.
Nested in each of these LinearLayouts is an ImageView whose src attribute is set to a selector. This selector also is set to an image when it is focused, and is set to transparent when it is not focused. Both of the ImageViews have duplicateParentState="true". The ImageView in the 'first' LinearLayout works as intended. It shows the image when it is focused, and is transparent when it is not focused. However the 'second' LinearLayout's ImageView does not work. It remains transparent and doesn't load the image. It seems to never properly inherit the focused state from the LinearLayout.
I have another similar section in another part of the app that has 4 of these LinearLayouts with nested ImageViews that do the same thing. Even there, only the first one receives the focused state from the parent properly. All of the others do not.
LinearLayouts and ImageViews:
Code:
<LinearLayout
android:background="@drawable/background_selector"
android:focusable="true"
android:focusableInTouchMode="true">
<ImageView
android:src="@drawable/image_selector"
android:duplicateParentState="true"/>
</LinearLayout>
<LinearLayout
android:background="@drawable/background_selector"
android:focusable="true"
android:focusableInTouchMode="true">
<ImageView
android:src="@drawable/image_selector"
android:duplicateParentState="true"/>
</LinearLayout>
LinearLayout's background selector:
Code:
<selector xmlns:android="">
<item android:drawable="@drawable/background" android:state_focused="true" />
<item android:drawable="@android:color/transparent" />
</selector>
ImageView's src selector:
Code:
<selector xmlns:android="">
<item android:drawable="@drawable/image" android:state_focused="true" />
<item android:drawabe="@android:color/transparent" />
</selector>
The background attributes on the LinearLayouts work perfectly fine, but the src attribute on the ImageView only works on the top LinearLayout.

Related

Font

Is there a way to change the color of the font on your phone? Also what do i need to click in font installer to change all my fonts not just some fonts? Tia
Sent from my EVO using xda premium
wileout said:
Is there a way to change the color of the font on your phone? Also what do i need to click in font installer to change all my fonts not just some fonts? Tia
Sent from my EVO using xda premium
Click to expand...
Click to collapse
I don't know about the color part, but if you hit menu on the main screen of font installer then preferences, you can choose which fonts to overwrite/ replace. Hope that helps. Make a backup I guess in case you don't like the way something looks when you're done.
ducky1131 said:
I don't know about the color part, but if you hit menu on the main screen of font installer then preferences, you can choose which fonts to overwrite/ replace. Hope that helps. Make a backup I guess in case you don't like the way something looks when you're done.
Click to expand...
Click to collapse
Yea figured that part about changing fonts right I typed this up...still wanna know if I change colors tho lol
Sent from my EVO using xda premium
Well you will first need to decompile the framework apk's and edit the text color on those as many apps call to framework-res.apk/com.htc.resources.apk for text color then where you don't see changes you will need to decompile the particular apk associated with the place you like to change it. For example, statusbar related text is found in SystemUI.apk. Once you decompile it go to the color folder and you will see list_item_primary_text.xml, open it and you will see
Code:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="[COLOR="red"]@color/primary_text_disable"[/COLOR] />
<item android:color="[COLOR="Red"]@android:color/primary_text_dark[/COLOR]" />
</selector>
notice the sections marked in red.
The first one @color/primary_text_disable tells you that the color code is coming from within the app so go to /res/values/colors.xml and open it. you will see the following code
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="status_bar_recents_app_label_color">#ffffffff</color>
<color name="notification_list_shadow_top">#80000000</color>
<color name="white">#ffffffff</color>
<color name="black">#ff000000</color>
<color name="half_white">#7fffffff</color>
<color name="half_black">#7f000000</color>
[COLOR="red"]<color name="primary_text_disable">#ff4c4c4c</color>[/COLOR]
<color name="secondary_text_disable">#ff4c4c4c</color>
<color name="multiply_color">#ffbdff67</color>
</resources>
here is the color code its referring to. Now you can either change the color code here or you can just change android:color="@color/primary_text_disable" to android:color="colorcodehere" (example ff000000)
Now notice the <item android:color="@android:color/primary_text_dark" /> on the first code...this tells us that the code is being called upon from the framework.
You can also change "@android:color/primary_text_dark" to "colorcodehere" or to "@color/primary_text_disable" to make the color reference internal in the app.
There are many different ways to get the changes you want...some changes are a bit harder as they are coded through smali.
I suggest you start with a non-framework apk and make the color references internal.
Hope this helps
eg1122 said:
Well you will first need to decompile the framework apk's and edit the text color on those as many apps call to framework-res.apk/com.htc.resources.apk for text color then where you don't see changes you will need to decompile the particular apk associated with the place you like to change it. For example, statusbar related text is found in SystemUI.apk. Once you decompile it go to the color folder and you will see list_item_primary_text.xml, open it and you will see
Code:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="[COLOR="red"]@color/primary_text_disable"[/COLOR] />
<item android:color="[COLOR="Red"]@android:color/primary_text_dark[/COLOR]" />
</selector>
notice the sections marked in red.
The first one @color/primary_text_disable tells you that the color code is coming from within the app so go to /res/values/colors.xml and open it. you will see the following code
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="status_bar_recents_app_label_color">#ffffffff</color>
<color name="notification_list_shadow_top">#80000000</color>
<color name="white">#ffffffff</color>
<color name="black">#ff000000</color>
<color name="half_white">#7fffffff</color>
<color name="half_black">#7f000000</color>
[COLOR="red"]<color name="primary_text_disable">#ff4c4c4c</color>[/COLOR]
<color name="secondary_text_disable">#ff4c4c4c</color>
<color name="multiply_color">#ffbdff67</color>
</resources>
here is the color code its referring to. Now you can either change the color code here or you can just change android:color="@color/primary_text_disable" to android:color="colorcodehere" (example ff000000)
Now notice the <item android:color="@android:color/primary_text_dark" /> on the first code...this tells us that the code is being called upon from the framework.
You can also change "@android:color/primary_text_dark" to "colorcodehere" or to "@color/primary_text_disable" to make the color reference internal in the app.
There are many different ways to get the changes you want...some changes are a bit harder as they are coded through smali.
I suggest you start with a non-framework apk and make the color references internal.
Hope this helps
Click to expand...
Click to collapse
Thanks bro that helps a ton now to just go thru and do it to each one of my 100 apps lmao
Sent from my EVO using xda premium

[Solved] Icon Package: Links for replacement are wrong.

Edit: SOLVED by searching others' appfilters.
Hi!
I have a Nexus 10, and love it. There are, however, a few things that annoy me more or less, but none of them is caused by Google or Samsung. The device is awesome. It's just that the app drawer contains many 3rd party app icons that were created before the high-res times.
Since the app drawer is a rather central thing to Android, I decided to do something about it.
I'm a total noob, so I thought that creating a theme all by myself would be too much of an effort - I decided to modify an existing package instead. I took this icon package, appended it, and used it with Nova Launcher: http://forum.xda-developers.com/showthread.php?t=2053625
This is what I did:
Added a 144x144 PNG icon to res/drawable-xxhdpi for each app.
Added lines of code to res/xml/appfilter.xml, which you can see below. Within ComponentInfo{} I wrote the APK name first, then a slash, and then the activity that is shown by the Nova activity widget activity chooser.
About 95% of the replacements worked fine, one example would be this:
Code:
<item component="ComponentInfo{com.sand.airdroid/com.sand.airdroid.Splash}" drawable="airdroid" />
These are the lines that did not work:
Code:
<item component="ComponentInfo{org.ebookdroid/ui.library.RecentActivity}" drawable="books" />
<item component="ComponentInfo{gpc.myweb.hinet.net.PopupWeb/PopupWeb_Browser}" drawable="browser" />
<item component="ComponentInfo{com.android.calculator2/Calculator}" drawable="calc" />
<item component="ComponentInfo{com.google.android.diskusage/SelectActivity}" drawable="disk" />
<item component="ComponentInfo{com.inisoft.mediaplayer.a/tivity.MainActivity}" drawable="dice" />
<item component="ComponentInfo{com.ivona.tts/WelcomeActivity}" drawable="ivts" />
<item component="ComponentInfo{com.bel.android.dspmanager/activity.DSPManager}" drawable="dsp" />
Can help me with this?
(The items that do not work are: EBookDroid, Floating Browser, (Stock Calculator), DiskUsage, Dice Player, Ivona TTS (Engine), Mantano Reader, DSP Manager.
Cheers
ping
Edit: FYI
The corrected lines
Code:
<item component="ComponentInfo{org.ebookdroid/org.ebookdroid.ui.library.RecentActivity}" drawable="books" />
<item component="ComponentInfo{gpc.myweb.hinet.net.PopupWeb/gpc.myweb.hinet.net.PopupWeb.PopupWeb_Default}" drawable="browser" />
<item component="ComponentInfo{com.android.calculator2/com.android.calculator2.Calculator}" drawable="calc" />
<item component="ComponentInfo{com.google.android.diskusage/com.google.android.diskusage.SelectActivity}" drawable="disk" />
<item component="ComponentInfo{com.inisoft.mediaplayer.a/com.inisoft.mediaplayer.a.SplashActivity}" drawable="dice" />
<item component="ComponentInfo{com.ivona.tts/com.ivona.tts.WelcomeActivity}" drawable="ivts" />
<item component="ComponentInfo{com.bel.android.dspmanager/com.bel.android.dspmanager.activity.DSPManager}" drawable="dsp" />

[Q] change Apk Background Problem

Hello to all of you
First, I want to say my English sucks... sor....
I want to ask you some problem
I want change my settings's background.
it's style.xml backgrounds reference framework-res Theme
but I don't want change theme default background
because other apk also reference this theme
I want only change settings background
who can help me...
and can i do this? I edit settings style.xml Red lines are my edits
</style>
<style name="Theme.Holo" parent="@*android:style/Theme.DeviceDefault.Light" />
<item name="windowbackground">@*android:drawable/senc_myimg</item>
<style name="Theme.Holo.NoActionBar" parent="@*android:style/Theme.DeviceDefault.Light.NoActionBar" />
<style name="Theme.Holo.Dialog" parent="@*android:style/Theme.DeviceDefault.Light.Dialog" />
<style name="Theme.Holo.DialogWhenLarge" parent="@*android:style/Theme.DeviceDefault.Light.DialogWhenLarge">
<item name="android:directionality">true</item>
The last question @drawable/XXXXX AND @*drawable/xxxxx OR @*/@android:drawble/xxxx Difference

change Apk Background Problem.. HELP!

Hello to all of you
First, I want to say my English sucks... sor....
I want to ask you some problem
I want change my settings's background.
it's style.xml backgrounds reference framework-res Theme
but I don't want change theme default background
because other apk also reference this theme
I want only change settings background
who can help me...
and can i do this? I edit settings style.xml Red lines are my edits
</style>
<style name="Theme.Holo" parent="@*android:style/Theme.DeviceDefault.Light" />
<item name="windowbackground">@*android:drawable/senc_myimg</item>
<style name="Theme.Holo.NoActionBar" parent="@*android:style/Theme.DeviceDefault.Light.NoActionBar" />
<style name="Theme.Holo.Dialog" parent="@*android:style/Theme.DeviceDefault.Light.Dialog" />
<style name="Theme.Holo.DialogWhenLarge" parent="@*android:style/Theme.DeviceDefault.Light.DialogWhenLarge">
<item name="android:directionality">true</item>
The last question @drawable/XXXXX AND @*drawable/xxxxx OR @*/@android:drawble/xxxx Difference

Statusbar Speed Indicator

I wanted to have network speed indicator besides the Time on the Statusbar. There seems enough space to accomodate the speed indicator.
I have found network_speed_view code in 3 places in the miuisystemui.apk.
I) layout/system_icons.xml:
<com.android.systemui.statusbar.NetworkSpeedView android:textAppearance="@style/TextAppearance.StatusBar.Carrier" android:gravity="end|center" android:id="@id/network_speed_view" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
II) values/ids.xml:
<item type="id" name="network_speed_view">false</item>
III) public.xml:
<public type="id" name="network_speed_view" id="0x7f0a01b4" />
Is there any way to edit miuisystemui.apk to show it on statusbar? Can anyone guide me on this?
I am on Poco F1 MiUi 10 8.10.18 Beta.

Categories

Resources