ZieIony / Carbon

Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.

Home Page:https://androidreclib.wordpress.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can ViewPagerIndicator have custom colors?

ildar2 opened this issue · comments

I've seen you mention, that circle colors can be colored with carbon_tint attribute, but can you set separate colors for inactive circles?

Currently no. The entire widget uses the same state of the specified color selector for all circles. I guess I could change this behavior so the selected circle is drawn using selected state and others using enabled state.

done - you can now use selected/enabled/disabled states of tint selector to tint selected dots properly

I'm not sure how to use it, I've tries setting app:carbon_tint="@drawable/boarding_indicator_colors" to this with many variations of state_enabled, state_selected, state_checked:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:color="@color/colorPrimary"
        android:state_enabled="true"
        android:state_selected="true" />
    <item
        android:color="@color/red"
        android:state_enabled="true"
        android:state_selected="false" />
    <item
        android:color="@color/viewpager_indicator_not_active" />
</selector>

But the result is always the same: selected is filled with red and others are just outlined by the same red color

Update: I actually don't see your changes in the sources for 0.15.2 version...

The change is in the repository. It's not released yet and I can't change existing releases. You can test the current commit using JitPack or by cloning and building the library by yourself. If you don't want to spend too much time with that, you can wait for the release. I'm quite busy, so it most likely won't happen today, but later this week.

I finally found a bit of time to release this fix. It should be available in Maven soon.

Got these errors after updating to 0.15.3:
AAPT2 error: check logs for details
error: failed linking references.

error: resource android:attr/dialogCornerRadius not found.
Message{kind=ERROR, text=error: resource android:attr/dialogCornerRadius not found., sources=[C:\Android\user_home\caches\transforms-1\files-1.1\appcompat-v7-28.0.0-rc02.aar\1384d64f9802592414a56e330946b77a\res\values-v28\values-v28.xml:9:5-12:13], original message=, tool name=Optional.of(AAPT)}
error: resource android:attr/fontVariationSettings not found.
Message{kind=ERROR, text=error: resource android:attr/fontVariationSettings not found., sources=[C:\Android\user_home\caches\transforms-1\files-1.1\appcompat-v7-28.0.0-rc02.aar\1384d64f9802592414a56e330946b77a\res\values\values.xml:1304:5-69], original message=, tool name=Optional.of(AAPT)}
error: resource android:attr/ttcIndex not found.
Message{kind=ERROR, text=error: resource android:attr/ttcIndex not found., sources=[C:\Android\user_home\caches\transforms-1\files-1.1\appcompat-v7-28.0.0-rc02.aar\1384d64f9802592414a56e330946b77a\res\values\values.xml:1304:5-69], original message=, tool name=Optional.of(AAPT)}

Tried updating support library version to 28.0.0-rc01, but with no result

These attributes are no longer present in Android support library. One of the other libraries you're using is not compatible with support 28. This issue seems to be well known: crosswalk-project/cordova-plugin-crosswalk-webview#205