@@ -16,6 +16,9 @@ import com.shrikanthravi.collapsiblecalendarview.view.ExpandIconView
1616import com.shrikanthravi.collapsiblecalendarview.view.LockScrollView
1717import com.shrikanthravi.collapsiblecalendarview.view.OnSwipeTouchListener
1818import java.util.*
19+ import android.os.Build
20+
21+
1922
2023@SuppressLint(" ClickableViewAccessibility" )
2124abstract class UICalendar constructor(context : Context , attrs : AttributeSet ? = null , defStyleAttr : Int = 0 ) : ScrollView(context, attrs, defStyleAttr) {
@@ -100,7 +103,7 @@ abstract class UICalendar constructor(context: Context, attrs: AttributeSet? = n
100103 field = todayItemTextColor
101104 redraw()
102105 }
103- var todayItemBackgroundDrawable = resources.getDrawable(R .drawable.circle_black_stroke_background)
106+ var todayItemBackgroundDrawable = resources.getDrawable(com.shrikanthravi.collapsiblecalendarview. R .drawable.circle_black_stroke_background)
104107 set(todayItemBackgroundDrawable) {
105108 field = todayItemBackgroundDrawable
106109 redraw()
@@ -110,7 +113,7 @@ abstract class UICalendar constructor(context: Context, attrs: AttributeSet? = n
110113 field = selectedItemTextColor
111114 redraw()
112115 }
113- var selectedItemBackgroundDrawable = resources.getDrawable(R .drawable.circle_black_solid_background)
116+ var selectedItemBackgroundDrawable = resources.getDrawable(com.shrikanthravi.collapsiblecalendarview. R .drawable.circle_black_solid_background)
114117 set(selectedItemBackground) {
115118 field = selectedItemBackground
116119 redraw()
@@ -119,7 +122,7 @@ abstract class UICalendar constructor(context: Context, attrs: AttributeSet? = n
119122 /* *
120123 * This can be used to defined the left icon drawable other than predefined icon
121124 */
122- var buttonLeftDrawable = resources.getDrawable(R .drawable.left_icon)
125+ var buttonLeftDrawable = resources.getDrawable(com.shrikanthravi.collapsiblecalendarview. R .drawable.left_icon)
123126 set(buttonLeftDrawable) {
124127 field = buttonLeftDrawable
125128 mBtnPrevMonth.setImageDrawable(buttonLeftDrawable)
@@ -129,7 +132,7 @@ abstract class UICalendar constructor(context: Context, attrs: AttributeSet? = n
129132 /* *
130133 * This can be used to set the drawable for the right icon, other than predefined icon
131134 */
132- var buttonRightDrawable = resources.getDrawable(R .drawable.right_icon)
135+ var buttonRightDrawable = resources.getDrawable(com.shrikanthravi.collapsiblecalendarview. R .drawable.right_icon)
133136 set(buttonRightDrawable) {
134137 field = buttonRightDrawable
135138 mBtnNextMonth.setImageDrawable(buttonRightDrawable)
@@ -179,6 +182,15 @@ abstract class UICalendar constructor(context: Context, attrs: AttributeSet? = n
179182 }
180183 }
181184
185+ fun getCurrentLocale (context : Context ): Locale {
186+ return if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .N ) {
187+ context.resources.configuration.locales.get(0 )
188+ } else {
189+
190+ context.resources.configuration.locale
191+ }
192+ }
193+
182194 init {
183195 mInflater = LayoutInflater .from(context)
184196
@@ -207,7 +219,7 @@ abstract class UICalendar constructor(context: Context, attrs: AttributeSet? = n
207219 mScrollViewBody.setOnTouchListener(getSwipe(context))
208220 mScrollViewBody.setParams(getSwipe(context))
209221 val attributes = context.theme.obtainStyledAttributes(
210- attrs, R .styleable.UICalendar , defStyleAttr, 0 )
222+ attrs, com.shrikanthravi.collapsiblecalendarview. R .styleable.UICalendar , defStyleAttr, 0 )
211223 setAttributes(attributes)
212224 attributes.recycle()
213225 }
@@ -260,7 +272,7 @@ abstract class UICalendar constructor(context: Context, attrs: AttributeSet? = n
260272 selectedItemBackgroundDrawable = this .selectedItemBackgroundDrawable
261273 }
262274
263- var buttonLeftDrawable = attrs.getDrawable(R .styleable.UICalendar_buttonLeft_drawable )
275+ var buttonLeftDrawable = attrs.getDrawable(com.shrikanthravi.collapsiblecalendarview. R .styleable.UICalendar_buttonLeft_drawable )
264276 if (buttonLeftDrawable != null ) {
265277 buttonLeftDrawable = buttonLeftDrawable
266278 } else {
0 commit comments