Skip to content
Snippets Groups Projects
Verified Commit 7ae4a4be authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fix crashes

parent 80fc81de
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@
package de.kuschku.quasseldroid.util.ui.view
import android.content.Context
import android.graphics.drawable.LayerDrawable
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
......@@ -29,6 +30,7 @@ import androidx.appcompat.widget.AppCompatImageView
import butterknife.BindView
import butterknife.ButterKnife
import de.kuschku.quasseldroid.R
import de.kuschku.quasseldroid.util.helper.styledAttributes
import de.kuschku.quasseldroid.util.helper.use
class BannerView : FrameLayout {
......@@ -50,9 +52,17 @@ class BannerView : FrameLayout {
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) :
super(context, attrs, defStyleAttr) {
LayoutInflater.from(context).inflate(R.layout.widget_banner, this, true)
val content = LayoutInflater.from(context).inflate(R.layout.widget_banner, this, true)
ButterKnife.bind(this)
context.theme.styledAttributes(R.attr.colorBackgroundSnackbar,
R.attr.selectableItemBackground) {
content.background = LayerDrawable(arrayOf(
getDrawable(0),
getDrawable(1)
))
}
context.theme.obtainStyledAttributes(attrs, R.styleable.BannerView, 0, 0).use {
if (it.hasValue(R.styleable.BannerView_icon))
icon.setImageResource(it.getResourceId(R.styleable.BannerView_icon, 0))
......
......@@ -22,9 +22,9 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_banner"
android:baselineAligned="false"
android:clipToPadding="false"
android:id="@android:id/content"
android:focusable="true"
android:orientation="vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingLeft"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment