From bbbe76b91c09dae68c8560c11705d77a1d74d2dd Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 15 Jun 2021 14:48:45 +0200 Subject: [PATCH] Move test style Activity and layout to the new ui-style module --- library/ui-styles/build.gradle | 3 ++ .../ui-styles/src/debug/AndroidManifest.xml | 29 +++++++++++++++++++ .../lib/ui/styles}/debug/DebugBottomSheet.kt | 4 +-- .../debug/DebugMaterialThemeActivity.kt | 14 ++++----- .../DebugMaterialThemeDarkDefaultActivity.kt | 4 +-- .../DebugMaterialThemeDarkTestActivity.kt | 4 +-- .../DebugMaterialThemeDarkVectorActivity.kt | 4 +-- .../DebugMaterialThemeLightDefaultActivity.kt | 4 +-- .../DebugMaterialThemeLightTestActivity.kt | 4 +-- .../DebugMaterialThemeLightVectorActivity.kt | 4 +-- .../debug/DebugVectorButtonStylesActivity.kt | 18 ++++++++---- .../src/debug/res/drawable/ic_debug_icon.xml | 22 ++++++++++++++ .../src/debug/res/drawable/linear_divider.xml | 0 .../layout/activity_debug_button_styles.xml | 0 .../layout/activity_test_material_theme.xml | 20 ++++++------- .../src/debug/res/layout/debug_text_view.xml | 0 .../src/debug/res/menu/menu_debug.xml | 19 ++++++++++++ .../src/debug/res/values/debug_styles.xml | 0 .../ui-styles/src/main/AndroidManifest.xml | 2 +- .../src/release/res/values/styles.xml | 0 vector/src/debug/AndroidManifest.xml | 21 -------------- .../app/features/debug/DebugMenuActivity.kt | 7 +++++ vector/src/debug/res/menu/menu_debug.xml | 17 ----------- 23 files changed, 124 insertions(+), 76 deletions(-) create mode 100644 library/ui-styles/src/debug/AndroidManifest.xml rename {vector/src/debug/java/im/vector/app/features => library/ui-styles/src/debug/java/im/vector/lib/ui/styles}/debug/DebugBottomSheet.kt (90%) rename {vector/src/debug/java/im/vector/app/features => library/ui-styles/src/debug/java/im/vector/lib/ui/styles}/debug/DebugMaterialThemeActivity.kt (87%) rename {vector/src/debug/java/im/vector/app/features => library/ui-styles/src/debug/java/im/vector/lib/ui/styles}/debug/DebugMaterialThemeDarkDefaultActivity.kt (89%) rename {vector/src/debug/java/im/vector/app/features => library/ui-styles/src/debug/java/im/vector/lib/ui/styles}/debug/DebugMaterialThemeDarkTestActivity.kt (89%) rename {vector/src/debug/java/im/vector/app/features => library/ui-styles/src/debug/java/im/vector/lib/ui/styles}/debug/DebugMaterialThemeDarkVectorActivity.kt (89%) rename {vector/src/debug/java/im/vector/app/features => library/ui-styles/src/debug/java/im/vector/lib/ui/styles}/debug/DebugMaterialThemeLightDefaultActivity.kt (89%) rename {vector/src/debug/java/im/vector/app/features => library/ui-styles/src/debug/java/im/vector/lib/ui/styles}/debug/DebugMaterialThemeLightTestActivity.kt (89%) rename {vector/src/debug/java/im/vector/app/features => library/ui-styles/src/debug/java/im/vector/lib/ui/styles}/debug/DebugMaterialThemeLightVectorActivity.kt (89%) rename {vector/src/debug/java/im/vector/app/features => library/ui-styles/src/debug/java/im/vector/lib/ui/styles}/debug/DebugVectorButtonStylesActivity.kt (53%) create mode 100644 library/ui-styles/src/debug/res/drawable/ic_debug_icon.xml rename {vector => library/ui-styles}/src/debug/res/drawable/linear_divider.xml (100%) rename {vector => library/ui-styles}/src/debug/res/layout/activity_debug_button_styles.xml (100%) rename {vector => library/ui-styles}/src/debug/res/layout/activity_test_material_theme.xml (97%) rename {vector => library/ui-styles}/src/debug/res/layout/debug_text_view.xml (100%) create mode 100644 library/ui-styles/src/debug/res/menu/menu_debug.xml rename {vector => library/ui-styles}/src/debug/res/values/debug_styles.xml (100%) rename {vector => library/ui-styles}/src/release/res/values/styles.xml (100%) delete mode 100644 vector/src/debug/res/menu/menu_debug.xml diff --git a/library/ui-styles/build.gradle b/library/ui-styles/build.gradle index f3e9ee9991..8010786a17 100644 --- a/library/ui-styles/build.gradle +++ b/library/ui-styles/build.gradle @@ -46,6 +46,9 @@ android { kotlinOptions { jvmTarget = '1.8' } + buildFeatures { + viewBinding true + } } dependencies { diff --git a/library/ui-styles/src/debug/AndroidManifest.xml b/library/ui-styles/src/debug/AndroidManifest.xml new file mode 100644 index 0000000000..b0c32f3975 --- /dev/null +++ b/library/ui-styles/src/debug/AndroidManifest.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + diff --git a/vector/src/debug/java/im/vector/app/features/debug/DebugBottomSheet.kt b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugBottomSheet.kt similarity index 90% rename from vector/src/debug/java/im/vector/app/features/debug/DebugBottomSheet.kt rename to library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugBottomSheet.kt index 0ac9a894ae..f5f69b1db4 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/DebugBottomSheet.kt +++ b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugBottomSheet.kt @@ -14,14 +14,14 @@ * limitations under the License. */ -package im.vector.app.features.debug +package im.vector.lib.ui.styles.debug import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.google.android.material.bottomsheet.BottomSheetDialogFragment -import im.vector.app.databinding.ActivityTestMaterialThemeBinding +import im.vector.lib.ui.styles.databinding.ActivityTestMaterialThemeBinding class DebugBottomSheet : BottomSheetDialogFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { diff --git a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeActivity.kt b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeActivity.kt similarity index 87% rename from vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeActivity.kt rename to library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeActivity.kt index 69dc683bf3..492b359105 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeActivity.kt +++ b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 New Vector Ltd + * Copyright (c) 2021 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,16 +14,16 @@ * limitations under the License. */ -package im.vector.app.features.debug +package im.vector.lib.ui.styles.debug import android.os.Bundle import android.view.Menu +import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.snackbar.Snackbar -import im.vector.app.R -import im.vector.app.core.utils.toast -import im.vector.app.databinding.ActivityTestMaterialThemeBinding +import im.vector.lib.ui.styles.R +import im.vector.lib.ui.styles.databinding.ActivityTestMaterialThemeBinding // Rendering is not the same with VectorBaseActivity abstract class DebugMaterialThemeActivity : AppCompatActivity() { @@ -46,14 +46,14 @@ abstract class DebugMaterialThemeActivity : AppCompatActivity() { } views.debugShowToast.setOnClickListener { - toast("Toast") + Toast.makeText(this, "Toast", Toast.LENGTH_SHORT).show() } views.debugShowDialog.setOnClickListener { MaterialAlertDialogBuilder(this) .setTitle("Dialog title") .setMessage("Dialog content") - .setIcon(R.drawable.ic_settings_x) + .setIcon(R.drawable.ic_debug_icon) .setPositiveButton("Positive", null) .setNegativeButton("Negative", null) .setNeutralButton("Neutral", null) diff --git a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkDefaultActivity.kt b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeDarkDefaultActivity.kt similarity index 89% rename from vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkDefaultActivity.kt rename to library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeDarkDefaultActivity.kt index 7e014577de..d24ceb6ede 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkDefaultActivity.kt +++ b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeDarkDefaultActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 New Vector Ltd + * Copyright (c) 2021 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,6 @@ * limitations under the License. */ -package im.vector.app.features.debug +package im.vector.lib.ui.styles.debug class DebugMaterialThemeDarkDefaultActivity : DebugMaterialThemeActivity() diff --git a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkTestActivity.kt b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeDarkTestActivity.kt similarity index 89% rename from vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkTestActivity.kt rename to library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeDarkTestActivity.kt index 4a1ed04f6a..fea1f27dae 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkTestActivity.kt +++ b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeDarkTestActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 New Vector Ltd + * Copyright (c) 2021 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,6 @@ * limitations under the License. */ -package im.vector.app.features.debug +package im.vector.lib.ui.styles.debug class DebugMaterialThemeDarkTestActivity : DebugMaterialThemeActivity() diff --git a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkVectorActivity.kt b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeDarkVectorActivity.kt similarity index 89% rename from vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkVectorActivity.kt rename to library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeDarkVectorActivity.kt index 6ac27aed45..379d55d006 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeDarkVectorActivity.kt +++ b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeDarkVectorActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 New Vector Ltd + * Copyright (c) 2021 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,6 @@ * limitations under the License. */ -package im.vector.app.features.debug +package im.vector.lib.ui.styles.debug class DebugMaterialThemeDarkVectorActivity : DebugMaterialThemeActivity() diff --git a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightDefaultActivity.kt b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeLightDefaultActivity.kt similarity index 89% rename from vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightDefaultActivity.kt rename to library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeLightDefaultActivity.kt index f6327e363b..57f172bdc3 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightDefaultActivity.kt +++ b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeLightDefaultActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 New Vector Ltd + * Copyright (c) 2021 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,6 @@ * limitations under the License. */ -package im.vector.app.features.debug +package im.vector.lib.ui.styles.debug class DebugMaterialThemeLightDefaultActivity : DebugMaterialThemeActivity() diff --git a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightTestActivity.kt b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeLightTestActivity.kt similarity index 89% rename from vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightTestActivity.kt rename to library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeLightTestActivity.kt index ae6c1dd68c..d3a6c757fb 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightTestActivity.kt +++ b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeLightTestActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 New Vector Ltd + * Copyright (c) 2021 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,6 @@ * limitations under the License. */ -package im.vector.app.features.debug +package im.vector.lib.ui.styles.debug class DebugMaterialThemeLightTestActivity : DebugMaterialThemeActivity() diff --git a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightVectorActivity.kt b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeLightVectorActivity.kt similarity index 89% rename from vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightVectorActivity.kt rename to library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeLightVectorActivity.kt index b4fb3c1cc8..3fafa61421 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/DebugMaterialThemeLightVectorActivity.kt +++ b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugMaterialThemeLightVectorActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 New Vector Ltd + * Copyright (c) 2021 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,6 @@ * limitations under the License. */ -package im.vector.app.features.debug +package im.vector.lib.ui.styles.debug class DebugMaterialThemeLightVectorActivity : DebugMaterialThemeActivity() diff --git a/vector/src/debug/java/im/vector/app/features/debug/DebugVectorButtonStylesActivity.kt b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugVectorButtonStylesActivity.kt similarity index 53% rename from vector/src/debug/java/im/vector/app/features/debug/DebugVectorButtonStylesActivity.kt rename to library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugVectorButtonStylesActivity.kt index 783a2a3eb5..55c86d6c80 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/DebugVectorButtonStylesActivity.kt +++ b/library/ui-styles/src/debug/java/im/vector/lib/ui/styles/debug/DebugVectorButtonStylesActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021 New Vector Ltd + * Copyright (c) 2021 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,17 @@ * limitations under the License. */ -package im.vector.app.features.debug +package im.vector.lib.ui.styles.debug -import im.vector.app.core.platform.VectorBaseActivity -import im.vector.app.databinding.ActivityDebugButtonStylesBinding +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import im.vector.lib.ui.styles.databinding.ActivityDebugButtonStylesBinding -class DebugVectorButtonStylesActivity : VectorBaseActivity() { - override fun getBinding() = ActivityDebugButtonStylesBinding.inflate(layoutInflater) +class DebugVectorButtonStylesActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val views = ActivityDebugButtonStylesBinding.inflate(layoutInflater) + setContentView(views.root) + } } diff --git a/library/ui-styles/src/debug/res/drawable/ic_debug_icon.xml b/library/ui-styles/src/debug/res/drawable/ic_debug_icon.xml new file mode 100644 index 0000000000..08af7d6539 --- /dev/null +++ b/library/ui-styles/src/debug/res/drawable/ic_debug_icon.xml @@ -0,0 +1,22 @@ + + + + diff --git a/vector/src/debug/res/drawable/linear_divider.xml b/library/ui-styles/src/debug/res/drawable/linear_divider.xml similarity index 100% rename from vector/src/debug/res/drawable/linear_divider.xml rename to library/ui-styles/src/debug/res/drawable/linear_divider.xml diff --git a/vector/src/debug/res/layout/activity_debug_button_styles.xml b/library/ui-styles/src/debug/res/layout/activity_debug_button_styles.xml similarity index 100% rename from vector/src/debug/res/layout/activity_debug_button_styles.xml rename to library/ui-styles/src/debug/res/layout/activity_debug_button_styles.xml diff --git a/vector/src/debug/res/layout/activity_test_material_theme.xml b/library/ui-styles/src/debug/res/layout/activity_test_material_theme.xml similarity index 97% rename from vector/src/debug/res/layout/activity_test_material_theme.xml rename to library/ui-styles/src/debug/res/layout/activity_test_material_theme.xml index c228377b98..20ad972096 100644 --- a/vector/src/debug/res/layout/activity_test_material_theme.xml +++ b/library/ui-styles/src/debug/res/layout/activity_test_material_theme.xml @@ -330,7 +330,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Classic" - app:icon="@drawable/ic_settings_x" /> + app:icon="@drawable/ic_debug_icon" />