File tree Expand file tree Collapse file tree 4 files changed +20
-15
lines changed
androidribbon/src/main/java/com/skydoves/androidribbon Expand file tree Collapse file tree 4 files changed +20
-15
lines changed Original file line number Diff line number Diff line change 9
9
![ gif0] ( https://user-images.githubusercontent.com/24237865/51105497-7873e680-182c-11e9-954a-1bf767d15312.gif ) ![ gif1] ( https://user-images.githubusercontent.com/24237865/51105671-fb953c80-182c-11e9-8288-7ce97d5474e8.gif )
10
10
11
11
## Download
12
- [ ![ Download] ( https://api.bintray.com/packages/devmagician/maven/androidribbon/images/download.svg ) ] ( https://bintray.com/devmagician/maven/androidribbon/_latestVersion )
12
+ [ ![ Download] ( https://api.bintray.com/packages/devmagician/maven/androidribbon/images/download.svg )] ( https://bintray.com/devmagician/maven/androidribbon/_latestVersion )
13
13
[ ![ Jitpack] ( https://jitpack.io/v/skydoves/AndroidRibbon.svg )] ( https://jitpack.io/#skydoves/AndroidRibbon )
14
14
### Gradle
15
15
And add a dependency code to your ** module** 's ` build.gradle ` file.
16
16
``` gradle
17
17
dependencies {
18
- implementation "com.github.skydoves:androidribbon:1.0.1 "
18
+ implementation "com.github.skydoves:androidribbon:1.0.2 "
19
19
}
20
20
```
21
21
@@ -58,14 +58,14 @@ new RibbonView.Builder(context)
58
58
### create using kotlin dsl
59
59
This is how to create ` RibbonView ` 's instance using kotlin dsl.
60
60
``` kotlin
61
- val ribbonView = ribbonView(context ) {
62
- text = " Android-Ribbon"
63
- textColor = Color .WHITE
64
- textSize = 13f
65
- textStyle = Typeface .BOLD
66
- ribbonRotation = - 45
67
- ribbonDrawable = ContextCompat .getDrawable(context, R .drawable.ribbon02)
68
- }
61
+ val ribbonView = ribbonView(this ) {
62
+ setText( " Android-Ribbon" )
63
+ setTextColor( Color .WHITE )
64
+ setTextSize( 13f )
65
+ setTextStyle( Typeface .BOLD )
66
+ setRibbonRotation( - 45 )
67
+ setRibbonDrawableResource( R .drawable.ribbon02)
68
+ }
69
69
```
70
70
71
71
## ShimmerRibbonView
Original file line number Diff line number Diff line change @@ -19,17 +19,17 @@ package com.skydoves.androidribbon
19
19
import android.content.Context
20
20
import android.content.res.TypedArray
21
21
import android.util.AttributeSet
22
- import android.widget.LinearLayout
23
22
import androidx.recyclerview.widget.LinearLayoutManager
24
23
import androidx.recyclerview.widget.RecyclerView
24
+ import com.skydoves.androidribbon.annotations.Dp
25
25
26
26
/* * RibbonRecyclerView helps to create [RecyclerView] that has [RibbonView] as items. */
27
27
@Suppress(" LiftReturnOrAssignment" )
28
28
class RibbonRecyclerView : RecyclerView , IRibbonList {
29
29
30
30
private val ribbonAdapter: RibbonRecyclerAdapter = RibbonRecyclerAdapter ()
31
- private var space = 3f
32
31
private var orientation = 1
32
+ @Dp private var space = 3f
33
33
34
34
constructor (context: Context ) : super (context) {
35
35
onCreate()
@@ -74,7 +74,7 @@ class RibbonRecyclerView : RecyclerView, IRibbonList {
74
74
private fun onCreate () {
75
75
when (orientation) {
76
76
0 -> layoutManager = LinearLayoutManager (context)
77
- 1 -> layoutManager = LinearLayoutManager (context, LinearLayout . HORIZONTAL , false )
77
+ 1 -> layoutManager = LinearLayoutManager (context, HORIZONTAL , false )
78
78
}
79
79
addItemDecoration(RibbonTagItemDecoration (space.dp2px(resources), orientation))
80
80
adapter = ribbonAdapter
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import android.util.AttributeSet
26
26
import android.view.Gravity
27
27
import androidx.annotation.ColorInt
28
28
import androidx.annotation.ColorRes
29
+ import androidx.annotation.DrawableRes
29
30
import androidx.appcompat.widget.AppCompatTextView
30
31
import androidx.core.content.ContextCompat
31
32
import com.skydoves.androidribbon.annotations.Dp
@@ -233,6 +234,10 @@ class RibbonView : AppCompatTextView, RibbonInterface {
233
234
this .ribbonDrawable = RibbonDrawable
234
235
}
235
236
237
+ fun setRibbonDrawableResource (@DrawableRes drawable : Int ): Builder = apply {
238
+ this .ribbonDrawable = ContextCompat .getDrawable(this .context, drawable)
239
+ }
240
+
236
241
fun setRibbonBackgroundColor (@ColorInt color : Int ): Builder = apply {
237
242
this .ribbonBackgroundColor = color
238
243
}
Original file line number Diff line number Diff line change 1
1
ext. versions = [
2
2
minSdk : 16 ,
3
3
compileSdk : 29 ,
4
- versionCode : 2 ,
5
- versionName : ' 1.0.1 ' ,
4
+ versionCode : 3 ,
5
+ versionName : ' 1.0.2 ' ,
6
6
7
7
gradleBuildTool : ' 3.5.3' ,
8
8
spotlessGradle : ' 3.26.1' ,
You can’t perform that action at this time.
0 commit comments