niorgai/Android-Resource-Usage-Count

Resourse counter of style shows 0 despite being used

vbuberen opened this issue · 14 comments

When style is used in XML files via android:theme attribute inside styles.xml file plugin shows that style is used 0 times.

Plugin version 2.1

Did you try right-click on this item and Find Usage of it?
If it's really been used, try to reopen / edit this file to let the Usage-Count action run again.

Studio also can`t find usages although style is used in activity xml.
This is a style with color for ImageButton and it used as follows:

<ImageButton
                    android:id="@+id/button_twitter"
                    android:layout_width="48dp"
                    android:layout_height="48dp"
                    android:layout_marginLeft="@dimen/core_space"
                    android:src="@drawable/ic_twitter"
                    android:theme="@style/TwitterSharingButton" />

And style itself:

<style name="TwitterSharingButton" parent="Widget.AppCompat.Button.Colored">
        <item name="colorButtonNormal">@color/twitter_button_color</item>
</style>

It actually adds color for the button.

Well, If studio also can't find this, the plugin also can't find it.
And i don't know the reason why studio can't find it. sorry.

Yeah, kind of strange already created report to Google Issue Tracker about that stuff in Android Studio, because the style works - removing it from ImageButton above removes color from the button.

By the way, what's your studio version?

2.3.3 now. Will check on 3.0.0 beta and write back.

No...this plugin don't support 3.0 right now, i will try to support 3.0 after stable version published.
And i also use 2.3.3, this is a strange issue for Android Studio.

FYI, in version 3.0 Android Studio can find this usage, so everything should be fine. Won`t publish created report to Issue Tracker.

Can you try beta 6? It seems like have been fixed.

Version Info:

Android Studio 3.0 Beta 6
Build #AI-171.4333198, built on September 14, 2017
JRE: 1.8.0_152-release-915-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6

@niorgai As I mentioned earlier in Android Studio 3.0.0 (including Beta 6) IDE_ can find resourse usage. So after your update for the plugin to support Android Studio 3.0.0 it should work.

Yes. I know in Android Studio 3.0 IDE can find the usage.
I mean the plugin is working in 3.0 without update.

No, with Studio 3.0.0 Beta 6 on Windows 8.1 plugin doesn't work for me. It is turned on in Plugins section, but no counters on dimens, counters, colors at all. Tried to Invalidate cache\Restart, but no luck with that.

Well..After 3.0 stable release, i will try it on Windows.

Thanks, but you don`t have to do it - I will report about results right after stable release.