rovo89 / XposedBridge

The Java part of the Xposed framework.
3.86k stars 1.1k forks source link

How to hook a TextView without id [XPOSED] #281

Closed MetaSpl0day closed 4 years ago

MetaSpl0day commented 4 years ago

Hi I hope you're fine :) To begin sorry if there are mistakes sometimes I'm french and I try to use good words ;)

So I try to edit Samsung Music text colors, and I succeed to change textcolor of some Textview who have an id in the xml files, but sometimes I find textviex who don't have id and I didn't find how to edit them.

An example of Textview that I want to edit (The text color) : <?xml version="1.0" encoding="utf-8"?> <com.samsung.android.app.musiclibrary.ui.widget.MusicTextView android:textSize="@dimen/full_player_title_sub_text" android:textColor="@color/full_player_title_sub_theme" android:gravity="center" android:focusable="false" android:layout_width="0.0dip" android:layout_height="0.0dip" android:minHeight="@dimen/full_player_title_sub_text_height" android:includeFontPadding="false" android:fontFamily="roboto-regular" music:maxFontLevel="large" music:textSizeDelta="@dimen/full_player_easymode_title_sub_text_delta" style="@style/Font.Roboto.Regular.Marquee" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:music="http://schemas.android.com/apk/res-auto" />

As you can see there is no id like "@+id/Artist" Thanks for help me and reading me :)

MetaSpl0day commented 4 years ago

Ok finally I found the solution : just for a TextView for example do TextView example = (TextView) liparam.view; and next you can do what you want (same for ImageView...)

wanam commented 4 years ago

If there's no way to hook the TextView resource by id, you can hook MusicTextView Class or whatever Samsung's implementation of TextView, do not hook base classes such TextView, this will lead to a performance degradation.