-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from side-codes/develop
Release v0.4.0
- Loading branch information
Showing
23 changed files
with
415 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
andcolorpicker/src/main/java/codes/side/andcolorpicker/view/set/ColorPickerSeekBarSet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package codes.side.andcolorpicker.view.set | ||
|
||
import android.content.Context | ||
import android.os.Build | ||
import android.util.AttributeSet | ||
import android.widget.LinearLayout | ||
import android.widget.TextView | ||
import androidx.annotation.StringRes | ||
import codes.side.andcolorpicker.group.PickerGroup | ||
import codes.side.andcolorpicker.model.Color | ||
|
||
abstract class ColorPickerSeekBarSet<C : Color> @JvmOverloads constructor( | ||
context: Context, | ||
attrs: AttributeSet? = null, | ||
defStyle: Int = 0 | ||
) : LinearLayout( | ||
context, | ||
attrs, | ||
defStyle | ||
) { | ||
companion object { | ||
private const val TAG = "ColorPickerSeekBarSet" | ||
internal const val defaultTextAppearance = android.R.style.TextAppearance_Material_Caption | ||
} | ||
|
||
val pickerGroup = PickerGroup<C>() | ||
|
||
init { | ||
orientation = VERTICAL | ||
init(attrs) | ||
} | ||
|
||
private fun init(attrs: AttributeSet? = null) { | ||
//val typedArray = context.theme.obtainStyledAttributes( | ||
// attrs, | ||
// R.styleable.ColorPickerSeekBarSet, | ||
// 0, | ||
// 0 | ||
//) | ||
|
||
//typedArray.recycle() | ||
} | ||
|
||
protected fun addLabel(@StringRes titleResId: Int) { | ||
addView( | ||
TextView( | ||
context | ||
).also { | ||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { | ||
@Suppress("DEPRECATION") | ||
it.setTextAppearance( | ||
context, | ||
defaultTextAppearance | ||
) | ||
} else { | ||
it.setTextAppearance(defaultTextAppearance) | ||
} | ||
it.setText(titleResId) | ||
} | ||
) | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
andcolorpicker/src/main/java/codes/side/andcolorpicker/view/set/RGBColorPickerSeekBarSet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package codes.side.andcolorpicker.view.set | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import codes.side.andcolorpicker.model.IntegerRGBColor | ||
import codes.side.andcolorpicker.rgb.RGBColorPickerSeekBar | ||
|
||
class RGBColorPickerSeekBarSet @JvmOverloads constructor( | ||
context: Context, | ||
attrs: AttributeSet? = null, | ||
defStyle: Int = 0 | ||
) : ColorPickerSeekBarSet<IntegerRGBColor>( | ||
context, | ||
attrs, | ||
defStyle | ||
) { | ||
init { | ||
RGBColorPickerSeekBar.Mode.values().forEach { rgbMode -> | ||
addLabel(rgbMode.nameStringResId) | ||
val picker = | ||
RGBColorPickerSeekBar( | ||
context | ||
).also { | ||
it.mode = rgbMode | ||
} | ||
pickerGroup.registerPicker(picker) | ||
addView(picker) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.