Move test style Activity and layout to the new ui-style module

This commit is contained in:
Benoit Marty 2021-06-15 14:48:45 +02:00
parent 000b524b34
commit bbbe76b91c
23 changed files with 124 additions and 76 deletions

View File

@ -46,6 +46,9 @@ android {
kotlinOptions { kotlinOptions {
jvmTarget = '1.8' jvmTarget = '1.8'
} }
buildFeatures {
viewBinding true
}
} }
dependencies { dependencies {

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="im.vector.lib.ui.styles">
<application>
<activity
android:name=".debug.DebugMaterialThemeLightDefaultActivity"
android:theme="@style/VectorMaterialThemeDebugLight" />
<activity
android:name=".debug.DebugMaterialThemeLightTestActivity"
android:theme="@style/VectorMaterialThemeDebugLight.Test" />
<activity
android:name=".debug.DebugMaterialThemeLightVectorActivity"
android:theme="@style/AppTheme.Light" />
<activity
android:name=".debug.DebugMaterialThemeDarkDefaultActivity"
android:theme="@style/VectorMaterialThemeDebugDark" />
<activity
android:name=".debug.DebugMaterialThemeDarkTestActivity"
android:theme="@style/VectorMaterialThemeDebugDark.Test" />
<activity
android:name=".debug.DebugMaterialThemeDarkVectorActivity"
android:theme="@style/AppTheme.Dark" />
<activity
android:name=".debug.DebugVectorButtonStylesActivity"
android:theme="@style/AppTheme.Light" />
</application>
</manifest>

View File

@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package im.vector.app.features.debug package im.vector.lib.ui.styles.debug
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import im.vector.app.databinding.ActivityTestMaterialThemeBinding import im.vector.lib.ui.styles.databinding.ActivityTestMaterialThemeBinding
class DebugBottomSheet : BottomSheetDialogFragment() { class DebugBottomSheet : BottomSheetDialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,16 +14,16 @@
* limitations under the License. * limitations under the License.
*/ */
package im.vector.app.features.debug package im.vector.lib.ui.styles.debug
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import im.vector.app.R import im.vector.lib.ui.styles.R
import im.vector.app.core.utils.toast import im.vector.lib.ui.styles.databinding.ActivityTestMaterialThemeBinding
import im.vector.app.databinding.ActivityTestMaterialThemeBinding
// Rendering is not the same with VectorBaseActivity // Rendering is not the same with VectorBaseActivity
abstract class DebugMaterialThemeActivity : AppCompatActivity() { abstract class DebugMaterialThemeActivity : AppCompatActivity() {
@ -46,14 +46,14 @@ abstract class DebugMaterialThemeActivity : AppCompatActivity() {
} }
views.debugShowToast.setOnClickListener { views.debugShowToast.setOnClickListener {
toast("Toast") Toast.makeText(this, "Toast", Toast.LENGTH_SHORT).show()
} }
views.debugShowDialog.setOnClickListener { views.debugShowDialog.setOnClickListener {
MaterialAlertDialogBuilder(this) MaterialAlertDialogBuilder(this)
.setTitle("Dialog title") .setTitle("Dialog title")
.setMessage("Dialog content") .setMessage("Dialog content")
.setIcon(R.drawable.ic_settings_x) .setIcon(R.drawable.ic_debug_icon)
.setPositiveButton("Positive", null) .setPositiveButton("Positive", null)
.setNegativeButton("Negative", null) .setNegativeButton("Negative", null)
.setNeutralButton("Neutral", null) .setNeutralButton("Neutral", null)

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,6 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
package im.vector.app.features.debug package im.vector.lib.ui.styles.debug
class DebugMaterialThemeDarkDefaultActivity : DebugMaterialThemeActivity() class DebugMaterialThemeDarkDefaultActivity : DebugMaterialThemeActivity()

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,6 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
package im.vector.app.features.debug package im.vector.lib.ui.styles.debug
class DebugMaterialThemeDarkTestActivity : DebugMaterialThemeActivity() class DebugMaterialThemeDarkTestActivity : DebugMaterialThemeActivity()

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,6 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
package im.vector.app.features.debug package im.vector.lib.ui.styles.debug
class DebugMaterialThemeDarkVectorActivity : DebugMaterialThemeActivity() class DebugMaterialThemeDarkVectorActivity : DebugMaterialThemeActivity()

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,6 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
package im.vector.app.features.debug package im.vector.lib.ui.styles.debug
class DebugMaterialThemeLightDefaultActivity : DebugMaterialThemeActivity() class DebugMaterialThemeLightDefaultActivity : DebugMaterialThemeActivity()

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,6 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
package im.vector.app.features.debug package im.vector.lib.ui.styles.debug
class DebugMaterialThemeLightTestActivity : DebugMaterialThemeActivity() class DebugMaterialThemeLightTestActivity : DebugMaterialThemeActivity()

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,6 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
package im.vector.app.features.debug package im.vector.lib.ui.styles.debug
class DebugMaterialThemeLightVectorActivity : DebugMaterialThemeActivity() class DebugMaterialThemeLightVectorActivity : DebugMaterialThemeActivity()

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -14,11 +14,17 @@
* limitations under the License. * 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 android.os.Bundle
import im.vector.app.databinding.ActivityDebugButtonStylesBinding import androidx.appcompat.app.AppCompatActivity
import im.vector.lib.ui.styles.databinding.ActivityDebugButtonStylesBinding
class DebugVectorButtonStylesActivity : VectorBaseActivity<ActivityDebugButtonStylesBinding>() { class DebugVectorButtonStylesActivity : AppCompatActivity() {
override fun getBinding() = ActivityDebugButtonStylesBinding.inflate(layoutInflater)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val views = ActivityDebugButtonStylesBinding.inflate(layoutInflater)
setContentView(views.root)
}
} }

View File

@ -0,0 +1,22 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M10,10m-2.455,0a2.455,2.455 0,1 1,4.91 0a2.455,2.455 0,1 1,-4.91 0"
android:strokeLineJoin="round"
android:strokeWidth="1.2"
android:fillColor="#00000000"
android:fillType="evenOdd"
android:strokeColor="#454545"
android:strokeLineCap="round"/>
<path
android:pathData="M16.055,12.455a1.35,1.35 0,0 0,0.27 1.489l0.049,0.049a1.636,1.636 0,1 1,-2.316 2.315l-0.049,-0.049a1.35,1.35 0,0 0,-1.489 -0.27,1.35 1.35,0 0,0 -0.818,1.236v0.139a1.636,1.636 0,0 1,-3.273 0v-0.074a1.35,1.35 0,0 0,-0.884 -1.235,1.35 1.35,0 0,0 -1.489,0.27l-0.049,0.049a1.636,1.636 0,1 1,-2.315 -2.316l0.049,-0.049a1.35,1.35 0,0 0,0.27 -1.489,1.35 1.35,0 0,0 -1.236,-0.818h-0.139a1.636,1.636 0,0 1,0 -3.273h0.074a1.35,1.35 0,0 0,1.235 -0.884,1.35 1.35,0 0,0 -0.27,-1.489l-0.049,-0.049a1.636,1.636 0,1 1,2.316 -2.315l0.049,0.049a1.35,1.35 0,0 0,1.489 0.27h0.065a1.35,1.35 0,0 0,0.819 -1.236v-0.139a1.636,1.636 0,0 1,3.272 0v0.074a1.35,1.35 0,0 0,0.819 1.235,1.35 1.35,0 0,0 1.489,-0.27l0.049,-0.049a1.636,1.636 0,1 1,2.315 2.316l-0.049,0.049a1.35,1.35 0,0 0,-0.27 1.489v0.065a1.35,1.35 0,0 0,1.236 0.819h0.139a1.636,1.636 0,0 1,0 3.272h-0.074a1.35,1.35 0,0 0,-1.235 0.819z"
android:strokeLineJoin="round"
android:strokeWidth="1.2"
android:fillColor="#00000000"
android:fillType="evenOdd"
android:strokeColor="#454545"
android:strokeLineCap="round"/>
</vector>

View File

@ -330,7 +330,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Classic" android:text="Classic"
app:icon="@drawable/ic_settings_x" /> app:icon="@drawable/ic_debug_icon" />
<Button <Button
style="@style/Widget.MaterialComponents.Button" style="@style/Widget.MaterialComponents.Button"
@ -338,14 +338,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:enabled="false" android:enabled="false"
android:text="Classic Disabled" android:text="Classic Disabled"
app:icon="@drawable/ic_settings_x" /> app:icon="@drawable/ic_debug_icon" />
<Button <Button
style="@style/Widget.MaterialComponents.Button.OutlinedButton" style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="OutlinedButton" android:text="OutlinedButton"
app:icon="@drawable/ic_settings_x" /> app:icon="@drawable/ic_debug_icon" />
<Button <Button
style="@style/Widget.MaterialComponents.Button.OutlinedButton" style="@style/Widget.MaterialComponents.Button.OutlinedButton"
@ -353,14 +353,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:enabled="false" android:enabled="false"
android:text="OutlinedButton Disabled" android:text="OutlinedButton Disabled"
app:icon="@drawable/ic_settings_x" /> app:icon="@drawable/ic_debug_icon" />
<Button <Button
style="@style/Widget.MaterialComponents.Button.TextButton" style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="TextButton" android:text="TextButton"
app:icon="@drawable/ic_settings_x" /> app:icon="@drawable/ic_debug_icon" />
<Button <Button
style="@style/Widget.MaterialComponents.Button.TextButton" style="@style/Widget.MaterialComponents.Button.TextButton"
@ -368,14 +368,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:enabled="false" android:enabled="false"
android:text="TextButton Disabled" android:text="TextButton Disabled"
app:icon="@drawable/ic_settings_x" /> app:icon="@drawable/ic_debug_icon" />
<Button <Button
style="@style/Widget.MaterialComponents.Button.UnelevatedButton" style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="UnelevatedButton" android:text="UnelevatedButton"
app:icon="@drawable/ic_settings_x" /> app:icon="@drawable/ic_debug_icon" />
<Button <Button
style="@style/Widget.MaterialComponents.Button.UnelevatedButton" style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
@ -383,7 +383,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:enabled="false" android:enabled="false"
android:text="UnelevatedButton Disabled" android:text="UnelevatedButton Disabled"
app:icon="@drawable/ic_settings_x" /> app:icon="@drawable/ic_debug_icon" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -457,12 +457,12 @@
android:layout_gravity="end" android:layout_gravity="end"
android:layout_margin="16dp" android:layout_margin="16dp"
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:src="@drawable/ic_settings_x" /> android:src="@drawable/ic_debug_icon" />
<com.google.android.material.bottomnavigation.BottomNavigationView <com.google.android.material.bottomnavigation.BottomNavigationView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:menu="@menu/home_bottom_navigation" /> app:menu="@menu/menu_debug" />
</LinearLayout> </LinearLayout>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="HardcodedText">
<item
android:id="@+id/menuDebug1"
android:icon="@drawable/ic_debug_icon"
android:title="Edit"
app:showAsAction="never" />
<item
android:id="@+id/menuDebug2"
android:icon="@drawable/ic_debug_icon"
android:title="Send"
app:showAsAction="always" />
</menu>

View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest package="im.vector.app.ui.styles"/> <manifest package="im.vector.lib.ui.styles"/>

View File

@ -5,27 +5,6 @@
<application> <application>
<activity android:name=".features.debug.TestLinkifyActivity" /> <activity android:name=".features.debug.TestLinkifyActivity" />
<activity android:name=".features.debug.sas.DebugSasEmojiActivity" /> <activity android:name=".features.debug.sas.DebugSasEmojiActivity" />
<activity
android:name=".features.debug.DebugMaterialThemeLightDefaultActivity"
android:theme="@style/VectorMaterialThemeDebugLight" />
<activity
android:name=".features.debug.DebugMaterialThemeLightTestActivity"
android:theme="@style/VectorMaterialThemeDebugLight.Test" />
<activity
android:name=".features.debug.DebugMaterialThemeLightVectorActivity"
android:theme="@style/AppTheme.Light" />
<activity
android:name=".features.debug.DebugMaterialThemeDarkDefaultActivity"
android:theme="@style/VectorMaterialThemeDebugDark" />
<activity
android:name=".features.debug.DebugMaterialThemeDarkTestActivity"
android:theme="@style/VectorMaterialThemeDebugDark.Test" />
<activity
android:name=".features.debug.DebugMaterialThemeDarkVectorActivity"
android:theme="@style/AppTheme.Dark" />
<activity
android:name=".features.debug.DebugVectorButtonStylesActivity"
android:theme="@style/AppTheme.Light" />
</application> </application>
</manifest> </manifest>

View File

@ -37,6 +37,13 @@ import im.vector.app.core.utils.toast
import im.vector.app.databinding.ActivityDebugMenuBinding import im.vector.app.databinding.ActivityDebugMenuBinding
import im.vector.app.features.debug.sas.DebugSasEmojiActivity import im.vector.app.features.debug.sas.DebugSasEmojiActivity
import im.vector.app.features.qrcode.QrCodeScannerActivity import im.vector.app.features.qrcode.QrCodeScannerActivity
import im.vector.lib.ui.styles.debug.DebugMaterialThemeDarkDefaultActivity
import im.vector.lib.ui.styles.debug.DebugMaterialThemeDarkTestActivity
import im.vector.lib.ui.styles.debug.DebugMaterialThemeDarkVectorActivity
import im.vector.lib.ui.styles.debug.DebugMaterialThemeLightDefaultActivity
import im.vector.lib.ui.styles.debug.DebugMaterialThemeLightTestActivity
import im.vector.lib.ui.styles.debug.DebugMaterialThemeLightVectorActivity
import im.vector.lib.ui.styles.debug.DebugVectorButtonStylesActivity
import org.matrix.android.sdk.internal.crypto.verification.qrcode.toQrCodeData import org.matrix.android.sdk.internal.crypto.verification.qrcode.toQrCodeData
import timber.log.Timber import timber.log.Timber

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menuDebug1"
android:icon="@drawable/ic_edit"
android:title="@string/edit"
app:showAsAction="never" />
<item
android:id="@+id/menuDebug2"
android:icon="@drawable/ic_send"
android:title="@string/send"
app:showAsAction="always" />
</menu>