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
package com.ercnksgl.customcomponent.custom | |
import android.content.Context | |
import android.util.AttributeSet | |
import android.view.LayoutInflater | |
import android.widget.Space | |
import androidx.annotation.DrawableRes | |
import androidx.appcompat.widget.AppCompatEditText | |
import androidx.appcompat.widget.AppCompatImageView | |
import androidx.appcompat.widget.AppCompatTextView |
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
<?xml version="1.0" encoding="utf-8"?> | |
<merge xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
tools:layout_height="wrap_content" | |
tools:layout_width="match_parent" | |
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"> | |
<androidx.appcompat.widget.AppCompatTextView | |
android:id="@+id/titleTextView" |
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
<resources xmlns:tools="http://schemas.android.com/tools"> | |
. | |
. | |
. | |
. | |
<style name="EditTextStyle" parent="Widget.AppCompat.EditText"> | |
<item name="android:background">@drawable/bg_edittext</item> | |
<item name="android:textColor">@color/color_red_300</item> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<declare-styleable name="CustomTextView"> | |
<attr name="android:title" /> | |
<attr name="startIcon" format="reference"/> | |
<attr name="customEditTextStartIconStyle" format="reference" /> | |
<attr name="customEditTextStyle" format="reference" /> | |
</declare-styleable> | |
</resources> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="com.ercnksgl.customcomponent.MainActivity"> | |
<com.ercnksgl.customcomponent.custom.CustomEditText | |
android:id="@+id/customEditText" |
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
import android.text.Spanned | |
import androidx.core.text.HtmlCompat | |
class TextCustomizer { | |
class Builder(private val allText: String) { | |
private val parts = arrayListOf<Pair<String, Customize>>() | |
fun addTextToReplace(part: String, customize: Customize)= apply { |
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
import android.content.Context | |
import androidx.annotation.ColorRes | |
import androidx.core.content.ContextCompat | |
/** | |
* Set font types and color to customize text. | |
*/ | |
data class Customize( | |
var hexColor: Int? = null, | |
val isItalic: Boolean = false, |
NewerOlder