-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Tonal badge style for main preference icons
- Loading branch information
Showing
3 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
app/src/main/java/cu/axel/smartdock/preferences/PreferenceHeader.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cu.axel.smartdock.preferences | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import androidx.preference.Preference | ||
import androidx.preference.PreferenceViewHolder | ||
import com.google.android.material.button.MaterialButton | ||
import cu.axel.smartdock.R | ||
|
||
class PreferenceHeader(private val context: Context, attrs: AttributeSet?) : Preference(context, attrs) { | ||
init { | ||
layoutResource = R.layout.preference_header | ||
} | ||
override fun onBindViewHolder(holder: PreferenceViewHolder) { | ||
super.onBindViewHolder(holder) | ||
val iconBtn = holder.findViewById(R.id.preference_icon_btn) as MaterialButton | ||
iconBtn.icon = icon | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:gravity="center_vertical" | ||
android:layout_marginStart="12dp" | ||
android:layout_marginEnd="12dp" | ||
android:layout_marginTop="3dp" | ||
android:layout_marginBottom="3dp" | ||
android:orientation="horizontal"> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/preference_icon_btn" | ||
style="?attr/materialIconButtonFilledTonalStyle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:clickable="false" /> | ||
|
||
<TextView | ||
android:id="@android:id/title" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="5dp" | ||
android:layout_weight="1.0" | ||
android:textAppearance="?attr/textAppearanceTitleMedium" /> | ||
</LinearLayout> |
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