项目作者: Tim1802

项目描述 :
Super cool color selection seek bar for Android
高级语言: Kotlin
项目地址: git://github.com/Tim1802/TPColorSelectionSeekBar.git
创建时间: 2020-03-07T22:20:21Z
项目社区:https://github.com/Tim1802/TPColorSelectionSeekBar

开源协议:Apache License 2.0

下载


TPColorSelectionSeekBar

Default Style


Customized Style


Download

Make sure that you have added the JitPack repository to your root build.gradle file:

  1. allprojects {
  2. repositories {
  3. //All your other repositories ...
  4. maven { url 'https://jitpack.io' }
  5. }
  6. }

Add the dependency:

  1. dependencies {
  2. //All your other dependencies ...
  3. implementation 'com.github.Tim1802:TPColorSelectionSeekBar:v3.5.0'
  4. }

Usage

XML:

  1. <de.tpohrer.tpcolorselectionseekbar.TPColorSelectionSeekBar
  2. android:id="@+id/colorBar"
  3. android:layout_width="match_parent"
  4. android:layout_height="wrap_content"></de.tpohrer.tpcolorselectionseekbar.TPColorSelectionSeekBar>

Attributes:
| Attribute | Description | Default value(s) |
| ——————- |:——————-: | :——-:|
| app:colorBarCornerRadius=”8dp” | Corner radius of the bar(s) | 0px |
| app:colorBarHeight=”16dp” | Height of the bar(s) | 60px |
| app:colorBarBorderColor=”@color/barBorderColor” | Border color of the bar(s) | #000000 |
| app:colorBarColors=”@array/barColors” | Colors to be displayed in the bar | #000000, #FF0000, #FFFF00, #00FF00, #00FFFF, #0000FF, #FF00FF, #FFFFFF |
| app:thumbBorderColor=”@color/thumbBorderColor” | Border color of the thumbnail | #000000 |
| app:thumbFillColor=”@color/thumbFillColor” | Fill color of the thumbnail | #FF0000 |
| app:showAlphaBar=”true” | Possibility to select alpha value | false |
| app:isVertical=”true” | Possibility to display vertical bar(s) | false |

Listener for color change:

  1. colorBar.setColorSelectionChangedListener { color, viewId ->
  2. //TODO: do something with the new color
  3. }
  4. --- or ---
  5. private fun colorChangedListener (color: Int, viewId : Int) {
  6. //TODO: do something with the new color
  7. }
  8. colorBar.setColorSelectionChangedListener(::colorChangedListener)

Check out the sample project if you need help or get stuck!

What’s next?

Version Feature(s) Status
2.0.0 Possibility to select alpha value Done
3.0.0 Possibility to display vertical bar(s) Done
3.1.0 Support gravity Done
3.2.0 Smaller fixes Done
3.3.0 Replace interface callback with lambda Done
3.4.0 Update to latest Kotlin version Done
3.5.0 Fix display of color bar Done

Licence

  1. Copyright 2020 Tim Pohrer
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.



Thank you for using my library!


Found a bug or missing a feature?

Feel free to open an issue or create a pull-request