diff --git a/xml-inflater/src/main/java/com/itsaky/androidide/inflater/internal/adapters/AbsSeekBarAttrAdapter.kt b/xml-inflater/src/main/java/com/itsaky/androidide/inflater/internal/adapters/AbsSeekBarAttrAdapter.kt new file mode 100644 index 000000000..3ed7c23a9 --- /dev/null +++ b/xml-inflater/src/main/java/com/itsaky/androidide/inflater/internal/adapters/AbsSeekBarAttrAdapter.kt @@ -0,0 +1,56 @@ +/* + * This file is part of AndroidIDE. + * + * AndroidIDE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AndroidIDE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with AndroidIDE. If not, see . + */ + +package com.itsaky.androidide.inflater.internal.adapters + +import android.widget.AbsSeekBar +import com.itsaky.androidide.inflater.IAttribute +import com.itsaky.androidide.inflater.IView + +/** + * Attribute adapter for [AbsSeekBar]. + * + * @author Akash Yadav + */ +abstract class AbsSeekBarAttrAdapter : ProgressBarAttrAdapter() { + + override fun apply(view: IView, attribute: IAttribute): Boolean { + return doApply(view, attribute) { + _, + context, + _, + _, + name, + value -> + var applied = true + + when (name) { + "thumbTint" -> thumbTintList = parseColorStateList(context, value) + "thumbTintMode" -> thumbTintMode = parsePorterDuffMode(value) + "tickMarkTint" -> tickMarkTintList = parseColorStateList(context, value) + "tickMarkTintMode" -> tickMarkTintMode = parsePorterDuffMode(value) + else -> applied = false + } + + if (!applied) { + applied = super.apply(view, attribute) + } + + return@doApply applied + } + } +} diff --git a/xml-inflater/src/main/java/com/itsaky/androidide/inflater/internal/adapters/ProgressBarAttrAdapter.kt b/xml-inflater/src/main/java/com/itsaky/androidide/inflater/internal/adapters/ProgressBarAttrAdapter.kt index fe274f22a..88a057bf6 100644 --- a/xml-inflater/src/main/java/com/itsaky/androidide/inflater/internal/adapters/ProgressBarAttrAdapter.kt +++ b/xml-inflater/src/main/java/com/itsaky/androidide/inflater/internal/adapters/ProgressBarAttrAdapter.kt @@ -32,7 +32,7 @@ import com.itsaky.androidide.inflater.internal.LayoutFile * @author Akash Yadav */ @AttributeAdapter(ProgressBar::class) -class ProgressBarAttrAdapter : ViewAttrAdapter() { +open class ProgressBarAttrAdapter : ViewAttrAdapter() { override fun apply(view: IView, attribute: IAttribute): Boolean { return doApply(view, attribute) {