Add different background for top unit in converter for visibility
This commit is contained in:
parent
bbf6ba12c6
commit
619b2660d3
|
@ -14,9 +14,7 @@ import com.simplemobiletools.calculator.helpers.DOT
|
||||||
import com.simplemobiletools.calculator.helpers.NumberFormatHelper
|
import com.simplemobiletools.calculator.helpers.NumberFormatHelper
|
||||||
import com.simplemobiletools.calculator.helpers.converters.Converter
|
import com.simplemobiletools.calculator.helpers.converters.Converter
|
||||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||||
import com.simplemobiletools.commons.extensions.applyColorFilter
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.extensions.getProperPrimaryColor
|
|
||||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
|
||||||
import com.simplemobiletools.commons.models.RadioItem
|
import com.simplemobiletools.commons.models.RadioItem
|
||||||
import me.grantland.widget.AutofitHelper
|
import me.grantland.widget.AutofitHelper
|
||||||
import kotlin.reflect.KMutableProperty0
|
import kotlin.reflect.KMutableProperty0
|
||||||
|
@ -46,8 +44,8 @@ class ConverterView @JvmOverloads constructor(
|
||||||
|
|
||||||
binding.swapButton.setOnClickListener { switch() }
|
binding.swapButton.setOnClickListener { switch() }
|
||||||
|
|
||||||
binding.topUnitName.setClickListenerForUnitSelector(::topUnit, ::bottomUnit)
|
binding.topUnitHolder.setClickListenerForUnitSelector(::topUnit, ::bottomUnit)
|
||||||
binding.bottomUnitName.setClickListenerForUnitSelector(::bottomUnit, ::topUnit)
|
binding.bottomUnitHolder.setClickListenerForUnitSelector(::bottomUnit, ::topUnit)
|
||||||
|
|
||||||
updateColors()
|
updateColors()
|
||||||
}
|
}
|
||||||
|
@ -75,6 +73,7 @@ class ConverterView @JvmOverloads constructor(
|
||||||
binding.bottomUnitName,
|
binding.bottomUnitName,
|
||||||
ColorStateList.valueOf(context.getProperPrimaryColor())
|
ColorStateList.valueOf(context.getProperPrimaryColor())
|
||||||
)
|
)
|
||||||
|
binding.topUnitHolder.setBackgroundColor(context.getProperBackgroundColor().lightenColor())
|
||||||
|
|
||||||
binding.swapButton.applyColorFilter(context.getProperPrimaryColor())
|
binding.swapButton.applyColorFilter(context.getProperPrimaryColor())
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,25 +5,34 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/top_unit_name"
|
android:id="@+id/top_unit_holder"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginTop="@dimen/small_margin"
|
|
||||||
android:layout_marginBottom="@dimen/small_margin"
|
|
||||||
android:layout_marginStart="@dimen/activity_margin"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:textSize="@dimen/big_text_size"
|
|
||||||
app:drawableEndCompat="@drawable/ic_arrow_drop_down_vector" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/top_unit_text"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:paddingStart="@dimen/activity_margin"
|
||||||
android:textAlignment="viewEnd"
|
android:paddingEnd="@dimen/activity_margin"
|
||||||
android:layout_weight="2"
|
android:orientation="vertical"
|
||||||
android:textSize="@dimen/display_text_size" />
|
android:layout_weight="3">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/top_unit_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginTop="@dimen/small_margin"
|
||||||
|
android:layout_marginBottom="@dimen/small_margin"
|
||||||
|
android:layout_marginStart="@dimen/activity_margin"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textSize="@dimen/big_text_size"
|
||||||
|
app:drawableEndCompat="@drawable/ic_arrow_drop_down_vector" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/top_unit_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:textSize="@dimen/display_text_size" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/swap_button"
|
android:id="@+id/swap_button"
|
||||||
|
@ -35,24 +44,33 @@
|
||||||
android:layout_weight="0.5"
|
android:layout_weight="0.5"
|
||||||
android:src="@drawable/ic_swap_vertical_vector" />
|
android:src="@drawable/ic_swap_vertical_vector" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/bottom_unit_name"
|
android:id="@+id/bottom_unit_holder"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_gravity="start|center_vertical"
|
|
||||||
android:layout_marginStart="@dimen/activity_margin"
|
|
||||||
android:layout_marginBottom="@dimen/small_margin"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:textSize="@dimen/big_text_size"
|
|
||||||
app:drawableEndCompat="@drawable/ic_arrow_drop_down_vector" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/bottom_unit_text"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="true"
|
android:paddingStart="@dimen/activity_margin"
|
||||||
android:textAlignment="viewEnd"
|
android:paddingEnd="@dimen/activity_margin"
|
||||||
android:layout_weight="2"
|
android:orientation="vertical"
|
||||||
android:textSize="@dimen/display_text_size" />
|
android:layout_weight="3">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/bottom_unit_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_gravity="start|center_vertical"
|
||||||
|
android:layout_marginStart="@dimen/activity_margin"
|
||||||
|
android:layout_marginBottom="@dimen/small_margin"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textSize="@dimen/big_text_size"
|
||||||
|
app:drawableEndCompat="@drawable/ic_arrow_drop_down_vector" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/bottom_unit_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:textSize="@dimen/display_text_size" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</com.simplemobiletools.calculator.views.ConverterView>
|
</com.simplemobiletools.calculator.views.ConverterView>
|
||||||
|
|
Loading…
Reference in New Issue