From 5b3aaee15b6eb848fe5908530b6cdcadc2f19f64 Mon Sep 17 00:00:00 2001 From: bilgehan kalkan Date: Mon, 25 Nov 2019 01:02:54 +0300 Subject: [PATCH 1/2] Rename dialogs style names to prevent overrides on usages. Update sample activity for dialogs. --- .../uicomponents/dialogs/BaseBottomSheetDialog.kt | 2 +- .../uicomponents/dialogs/DialogFragment.kt | 4 ++-- .../src/main/res/layout/fragment_dialog.xml | 13 +++++++------ libraries/dialogs/src/main/res/values/styles.xml | 14 +++++--------- sample/build.gradle | 2 +- .../com/trendyol/uicomponents/DialogsActivity.kt | 8 +++++--- sample/src/main/res/values/styles.xml | 2 +- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/BaseBottomSheetDialog.kt b/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/BaseBottomSheetDialog.kt index 8bb5c25a..5526c668 100644 --- a/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/BaseBottomSheetDialog.kt +++ b/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/BaseBottomSheetDialog.kt @@ -23,7 +23,7 @@ abstract class BaseBottomSheetDialog : 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( diff --git a/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/DialogFragment.kt b/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/DialogFragment.kt index 682788c6..6b978751 100644 --- a/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/DialogFragment.kt +++ b/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/DialogFragment.kt @@ -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 { diff --git a/libraries/dialogs/src/main/res/layout/fragment_dialog.xml b/libraries/dialogs/src/main/res/layout/fragment_dialog.xml index 79bbc76b..ebf564f5 100644 --- a/libraries/dialogs/src/main/res/layout/fragment_dialog.xml +++ b/libraries/dialogs/src/main/res/layout/fragment_dialog.xml @@ -11,10 +11,9 @@ + android:layout_height="wrap_content"> diff --git a/libraries/dialogs/src/main/res/values/styles.xml b/libraries/dialogs/src/main/res/values/styles.xml index 3d60f0b0..85711d66 100644 --- a/libraries/dialogs/src/main/res/values/styles.xml +++ b/libraries/dialogs/src/main/res/values/styles.xml @@ -1,11 +1,7 @@ - - - - - - - diff --git a/sample/build.gradle b/sample/build.gradle index c9c42de4..86200054 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -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 diff --git a/sample/src/main/java/com/trendyol/uicomponents/DialogsActivity.kt b/sample/src/main/java/com/trendyol/uicomponents/DialogsActivity.kt index a24147db..11f8fdf1 100644 --- a/sample/src/main/java/com/trendyol/uicomponents/DialogsActivity.kt +++ b/sample/src/main/java/com/trendyol/uicomponents/DialogsActivity.kt @@ -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" @@ -46,7 +46,9 @@ class DialogsActivity : AppCompatActivity() { it.dismiss() showToast("Left buttonClicked") } - }.showDialog(supportFragmentManager) + } + + dialog.showDialog(supportFragmentManager) } private fun getSpannableString(): SpannableStringBuilder = diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml index 5885930d..74b1ae5e 100644 --- a/sample/src/main/res/values/styles.xml +++ b/sample/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ -