Skip to content

Commit

Permalink
Merge pull request #5 from Trendyol/feature/dialogs-style-namings
Browse files Browse the repository at this point in the history
Feature/dialogs style namings
  • Loading branch information
bilgehankalkan authored Nov 25, 2019
2 parents cbfcb0b + 43e1c13 commit 95e64ef
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 27 deletions.
6 changes: 3 additions & 3 deletions libraries/dialogs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-1.png" width="240"/><img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-2.png" width="240"/>
<img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-1.png" width="240"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-2.png" width="240"/>

[![](https://jitpack.io/v/Trendyol/android-ui-components.svg)](https://jitpack.io/#Trendyol/android-ui-components) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
$dialogsVersion = dialogs-1.0.1 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

## Dialogs
Dialogs is a bunch of BottomSheetDialogs to use in app to show user an information, agreement or list.
Expand Down Expand Up @@ -33,7 +33,7 @@ Simple dialog to show information, error or text.
| ------------- |-------------|-------------| ------------- |
| `title` | String |Title of the dialog | "" |
| `showCloseButton` | Boolean | Close button visibility | false |
| `closeButtonListener` | (Dialog) -> Unit |Listener for close button. When clicked, dialog will dismiss and listener vill be invoked with dialog. | { } |
| `closeButtonListener` | (Dialog) -> Unit |Listener for close button. When clicked, dialog will dismiss and listener will be invoked with dialog. | { } |
| `content` | CharSequence | Content of a dialog | "" |
| `showContentAsHtml` | Boolean | If you provided `content` as Html and set this flag as true, content will be parsed as HTML. | false |
| `contentImage` | Int | Drawable resource id of an visual, will be shown on top of `content` | 0 |
Expand Down
2 changes: 1 addition & 1 deletion libraries/dialogs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'com.github.dcendents.android-maven'

group="com.trendyol.ui-components"
version="1.0.0"
version="1.0.1"

android {
compileSdkVersion 29
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class BaseBottomSheetDialog<DB : ViewDataBinding> : BottomSheetDialogFr

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NO_FRAME, R.style.BottomSheetDialogStyle)
setStyle(STYLE_NO_FRAME, R.style.Trendyol_UIComponents_Dialogs_BottomSheetDialogStyle)
}

override fun onCreateView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class DialogFragment internal constructor(

override fun setUpView() {
with(binding) {
binding.imageClose.setOnClickListener {
imageClose.setOnClickListener {
dismiss()
closeButtonListener?.invoke(this@DialogFragment)
}
binding.buttonLeft.setOnClickListener {
buttonLeft.setOnClickListener {
leftButtonClickListener?.invoke(this@DialogFragment)
}
buttonRight.setOnClickListener {
Expand Down
13 changes: 7 additions & 6 deletions libraries/dialogs/src/main/res/layout/fragment_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
</data>

<com.google.android.material.card.MaterialCardView
style="@style/PrimaryCard"
style="@style/Trendyol.UIComponents.Dialogs.PrimaryCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
android:layout_height="wrap_content">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -46,7 +45,7 @@

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textTitle"
style="@style/PrimaryText.Title"
style="@style/Trendyol.UIComponents.Dialogs.PrimaryText.Title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@{viewState.title}"
Expand Down Expand Up @@ -84,7 +83,7 @@

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textContent"
style="@style/PrimaryText.Body"
style="@style/Trendyol.UIComponents.Dialogs.PrimaryText.Body"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="@dimen/margin_dialog_outer"
Expand All @@ -109,6 +108,7 @@
app:layout_constraintTop_toBottomOf="@id/textContent"
tools:text="Cancel"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:textAllCaps="false"
app:strokeColor="?attr/colorAccent"/>

<com.google.android.material.button.MaterialButton
Expand All @@ -124,7 +124,8 @@
app:layout_constraintEnd_toEndOf="@id/guideEnd"
app:layout_constraintStart_toEndOf="@id/buttonLeft"
app:layout_constraintTop_toBottomOf="@id/textContent"
tools:text="OK"
android:textAllCaps="false"
tools:text="Ok"
android:visibility="visible"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
Expand Down
14 changes: 5 additions & 9 deletions libraries/dialogs/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="BottomSheetStyle" parent="@style/Widget.Design.BottomSheet.Modal">
<item name="android:background">@android:color/transparent</item>
</style>

<style name="BottomSheetDialogStyle" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
<style name="Trendyol.UIComponents.Dialogs.BottomSheetDialogStyle" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:colorBackground">@android:color/transparent</item>
Expand All @@ -17,23 +13,23 @@
<item name="state_collapsed">true</item>
</style>

<style name="PrimaryCard" parent="Widget.MaterialComponents.CardView">
<style name="Trendyol.UIComponents.Dialogs.PrimaryCard" parent="Widget.MaterialComponents.CardView">
<item name="cardCornerRadius">16dp</item>
<item name="cardElevation">2dp</item>
<item name="layout_behavior">android.support.design.widget.BottomSheetBehavior</item>
</style>

<style name="PrimaryText" parent="TextAppearance.AppCompat.Body1">
<style name="Trendyol.UIComponents.Dialogs.PrimaryText" parent="TextAppearance.AppCompat.Body1">
<item name="android:fontFamily">sans-serif</item>
<item name="android:textColor">#333333</item>
</style>

<style name="PrimaryText.Title">
<style name="Trendyol.UIComponents.Dialogs.PrimaryText.Title">
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textSize">14sp</item>
</style>

<style name="PrimaryText.Body">
<style name="Trendyol.UIComponents.Dialogs.PrimaryText.Body">
<item name="android:textColor">#666666</item>
<item name="android:textSize">14sp</item>
</style>
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.trendyol.uicomponents"
minSdkVersion 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class DialogsActivity : AppCompatActivity() {
showCloseButton = true
closeButtonListener = { showToast("Info dailog closed.") }
content = SpannableString.valueOf(getSpannableString())
contentImage = android.R.drawable.btn_plus
contentImage = R.mipmap.ic_launcher_round
}.showDialog(supportFragmentManager)
}

private fun showAgreementDialog() {
agreementDialog {
val dialog = agreementDialog {
title = "Agreement Dialog Sample"
leftButtonText = "Cancel"
rightButtonText = "Agree"
Expand All @@ -46,7 +46,9 @@ class DialogsActivity : AppCompatActivity() {
it.dismiss()
showToast("Left buttonClicked")
}
}.showDialog(supportFragmentManager)
}

dialog.showDialog(supportFragmentManager)
}

private fun getSpannableString(): SpannableStringBuilder =
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand Down

0 comments on commit 95e64ef

Please sign in to comment.