Skip to content

Commit

Permalink
Merge pull request #2 from akndmr/bugfix/view-source-margin-issue
Browse files Browse the repository at this point in the history
Fix view source margin issue
  • Loading branch information
akndmr authored Dec 3, 2022
2 parents d933642 + 9926701 commit a002919
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 4 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
<activity
android:name=".ui.SampleUsageActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.AiryActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,27 @@ class SampleUsageActivity : AppCompatActivity() {
listOf(
TextAttribute.Text(text = "Info AirySnackbar with top margin 16dp and no icon"),
IconAttribute.NoIcon,
SizeAttribute.Margin(top = 16, unit = SizeUnit.DP)
SizeAttribute.Margin(top = 16, unit = SizeUnit.DP),
AnimationAttribute.SlideInOut
)
).show()
}

buttonCustom.setOnClickListener {
AirySnackbar.make(
source = AirySnackbarSource.ActivitySource(activity = this@SampleUsageActivity),
type = Type.Custom(bgColor = R.color.cabbage),
source = AirySnackbarSource.ViewSource(view = binding.buttonCustom),
type = Type.Custom(bgColor = R.color.teal_700),
attributes =
listOf(
TextAttribute.Text(text = "Custom color bg and custom icon with tint AirySnackbar"),
TextAttribute.TextColor(textColor = R.color.lavander),
TextAttribute.TextColor(textColor = R.color.black),
IconAttribute.Icon(iconRes = R.drawable.ic_custom),
IconAttribute.IconColor(iconTint = R.color.teal_200)
IconAttribute.IconColor(iconTint = R.color.teal_200),
SizeAttribute.Margin(left = 24, right = 24, unit = SizeUnit.DP),
SizeAttribute.Padding(top = 12, bottom = 12, unit = SizeUnit.DP),
RadiusAttribute.Radius(radius = 8f),
GravityAttribute.Top,
AnimationAttribute.FadeInOut
)
).show()
}
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/java/com/akndmr/library/AirySnackbar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ class AirySnackbar(
"Could not find a parent view for ${AirySnackbar::class.java.simpleName}."
)

(parent.layoutParams as LinearLayout.LayoutParams).apply {
gravity = Gravity.TOP or Gravity.CENTER_HORIZONTAL
(parent.layoutParams as? LinearLayout.LayoutParams)?.let { params ->
params.gravity = Gravity.TOP or Gravity.CENTER_HORIZONTAL
}

val snackBarView = LayoutInflater.from(view.context).inflate(
Expand Down

0 comments on commit a002919

Please sign in to comment.