From 44d60d7e009a17634880f8f8c3b5969f2e2aa9ad Mon Sep 17 00:00:00 2001 From: Eliezer Graber Date: Mon, 24 Jan 2022 17:56:07 -0500 Subject: [PATCH] Update attribute names --- app/src/main/res/layout/activity_main.xml | 14 ++++----- .../date_time_input/xml/DateInputView.kt | 16 +++++----- .../date_time_input/xml/TimeInputView.kt | 14 ++++----- xml/src/main/res/values/attrs.xml | 30 +++++++++---------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 4ff36e7..225c73c 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -24,8 +24,8 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginHorizontal="16dp" - app:time_input_view_second_visibility="visible" - app:time_input_view_horizontal_bias=".5" /> + app:timeInputView_secondVisibility="visible" + app:timeInputView_horizontalBias=".5" /> + app:dateInputView_flowStyle="spread" + app:dateInputView_horizontalGap="6dp" + app:timeInputView_horizontalBias=".5" /> + app:timeInputView_secondVisibility="visible" + app:timeInputView_horizontalBias=".5" /> -1) { @@ -170,7 +170,7 @@ class DateInputView @JvmOverloads constructor( } val verticalGap = getDimensionPixelSize( - R.styleable.DateInputView_date_input_view_vertical_gap, + R.styleable.DateInputView_dateInputView_verticalGap, -1 ) if(verticalGap > -1) { @@ -178,22 +178,22 @@ class DateInputView @JvmOverloads constructor( } flowView.setHorizontalBias( - getFloat(R.styleable.DateInputView_date_input_view_horizontal_bias, 0F) + getFloat(R.styleable.DateInputView_dateInputView_horizontalBias, 0F) ) flowView.setVerticalBias( - getFloat(R.styleable.DateInputView_date_input_view_vertical_bias, 0F) + getFloat(R.styleable.DateInputView_dateInputView_verticalBias, 0F) ) flowView.setHorizontalStyle( - getInt(R.styleable.DateInputView_date_input_view_flow_style, Flow.CHAIN_SPREAD_INSIDE) + getInt(R.styleable.DateInputView_dateInputView_flowStyle, Flow.CHAIN_SPREAD_INSIDE) ) flowView.setHorizontalAlign( - getInt(R.styleable.DateInputView_date_input_view_flow_align, Flow.HORIZONTAL_ALIGN_START) + getInt(R.styleable.DateInputView_dateInputView_flowAlign, Flow.HORIZONTAL_ALIGN_START) ) - getDimensionPixelSize(R.styleable.DateInputView_date_input_view_error_margin_start, -1).let { margin -> + getDimensionPixelSize(R.styleable.DateInputView_dateInputView_errorMarginStart, -1).let { margin -> if(margin >= 0) { errorView.updateLayoutParams { marginStart = margin @@ -205,7 +205,7 @@ class DateInputView @JvmOverloads constructor( val monthNames = when( val resId = - getResourceId(R.styleable.DateInputView_date_input_view_month_names, -1) + getResourceId(R.styleable.DateInputView_dateInputView_monthNames, -1) ) { -1 -> generateLocalizedMonthNames() else -> resources.getStringArray(resId).toList() diff --git a/xml/src/main/kotlin/com/eygraber/date_time_input/xml/TimeInputView.kt b/xml/src/main/kotlin/com/eygraber/date_time_input/xml/TimeInputView.kt index a70c927..062bba6 100644 --- a/xml/src/main/kotlin/com/eygraber/date_time_input/xml/TimeInputView.kt +++ b/xml/src/main/kotlin/com/eygraber/date_time_input/xml/TimeInputView.kt @@ -185,7 +185,7 @@ class TimeInputView @JvmOverloads constructor( styledAttr(attrs, R.styleable.TimeInputView, R.attr.timeInputViewStyle) { val horizontalGap = getDimensionPixelSize( - R.styleable.TimeInputView_time_input_view_horizontal_gap, + R.styleable.TimeInputView_timeInputView_horizontalGap, -1 ) if(horizontalGap > -1) { @@ -193,7 +193,7 @@ class TimeInputView @JvmOverloads constructor( } val verticalGap = getDimensionPixelSize( - R.styleable.TimeInputView_time_input_view_vertical_gap, + R.styleable.TimeInputView_timeInputView_verticalGap, -1 ) if(verticalGap > -1) { @@ -201,19 +201,19 @@ class TimeInputView @JvmOverloads constructor( } flowView.setHorizontalBias( - getFloat(R.styleable.TimeInputView_time_input_view_horizontal_bias, 0F) + getFloat(R.styleable.TimeInputView_timeInputView_horizontalBias, 0F) ) flowView.setVerticalBias( - getFloat(R.styleable.TimeInputView_time_input_view_vertical_bias, 0F) + getFloat(R.styleable.TimeInputView_timeInputView_verticalBias, 0F) ) flowView.setHorizontalAlign( - getInt(R.styleable.TimeInputView_time_input_view_flow_align, Flow.HORIZONTAL_ALIGN_START) + getInt(R.styleable.TimeInputView_timeInputView_flowAlign, Flow.HORIZONTAL_ALIGN_START) ) val secondVisibility = when( - getInt(R.styleable.TimeInputView_time_input_view_second_visibility, View.VISIBLE) + getInt(R.styleable.TimeInputView_timeInputView_secondVisibility, View.VISIBLE) ) { 0 -> View.VISIBLE 1 -> View.INVISIBLE @@ -223,7 +223,7 @@ class TimeInputView @JvmOverloads constructor( secondGroupView.visibility = secondVisibility getDimensionPixelSize( - R.styleable.TimeInputView_time_input_view_error_margin_start, -1 + R.styleable.TimeInputView_timeInputView_errorMarginStart, -1 ).let { margin -> if(margin >= 0) { errorView.updateLayoutParams { diff --git a/xml/src/main/res/values/attrs.xml b/xml/src/main/res/values/attrs.xml index 851a78f..627137b 100644 --- a/xml/src/main/res/values/attrs.xml +++ b/xml/src/main/res/values/attrs.xml @@ -5,48 +5,48 @@ - + - + - + - + - - + + - - + + - + - + - + - - + + - - + +