Skip to content

Commit

Permalink
Tapadoo#168: Added LayoutParam checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kpmmmurphy committed Feb 27, 2019
1 parent 23a9b01 commit b30332c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions alerter/src/main/java/com/tapadoo/alerter/Alert.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ class Alert @JvmOverloads constructor(context: Context, attrs: AttributeSet? = n
var contentGravity: Int
get() = (llAlertBackground?.layoutParams as FrameLayout.LayoutParams).gravity
set(contentGravity) {
val paramsTitle = tvTitle?.layoutParams as LinearLayout.LayoutParams
paramsTitle.gravity = contentGravity
val paramsTitle = tvTitle?.layoutParams as? LinearLayout.LayoutParams
paramsTitle?.gravity = contentGravity
tvTitle?.layoutParams = paramsTitle

val paramsText = tvText?.layoutParams as LinearLayout.LayoutParams
paramsText.gravity = contentGravity
val paramsText = tvText?.layoutParams as? LinearLayout.LayoutParams
paramsText?.gravity = contentGravity
tvText?.layoutParams = paramsText
}

Expand Down
5 changes: 2 additions & 3 deletions alerter/src/main/res/layout/alerter_alert_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
tools:visibility="visible">

<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false">

Expand Down Expand Up @@ -54,11 +54,10 @@
android:visibility="invisible"
tools:visibility="visible" />


</FrameLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.tapadoo.alerter_demo.base

import android.graphics.Typeface
import android.os.Bundle
import android.view.Gravity
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import android.view.View
Expand Down

0 comments on commit b30332c

Please sign in to comment.