mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 01:15:54 +03:00
Move test style Activity and layout to the new ui-style module
This commit is contained in:
parent
000b524b34
commit
bbbe76b91c
23 changed files with 124 additions and 76 deletions
|
@ -46,6 +46,9 @@ android {
|
|||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
29
library/ui-styles/src/debug/AndroidManifest.xml
Normal file
29
library/ui-styles/src/debug/AndroidManifest.xml
Normal 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>
|
|
@ -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 {
|
|
@ -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)
|
|
@ -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()
|
|
@ -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()
|
|
@ -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()
|
|
@ -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()
|
|
@ -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()
|
|
@ -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()
|
|
@ -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<ActivityDebugButtonStylesBinding>() {
|
||||
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)
|
||||
}
|
||||
}
|
22
library/ui-styles/src/debug/res/drawable/ic_debug_icon.xml
Normal file
22
library/ui-styles/src/debug/res/drawable/ic_debug_icon.xml
Normal 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>
|
|
@ -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" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.MaterialComponents.Button"
|
||||
|
@ -338,14 +338,14 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:text="Classic Disabled"
|
||||
app:icon="@drawable/ic_settings_x" />
|
||||
app:icon="@drawable/ic_debug_icon" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="OutlinedButton"
|
||||
app:icon="@drawable/ic_settings_x" />
|
||||
app:icon="@drawable/ic_debug_icon" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
|
@ -353,14 +353,14 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:text="OutlinedButton Disabled"
|
||||
app:icon="@drawable/ic_settings_x" />
|
||||
app:icon="@drawable/ic_debug_icon" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="TextButton"
|
||||
app:icon="@drawable/ic_settings_x" />
|
||||
app:icon="@drawable/ic_debug_icon" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
|
@ -368,14 +368,14 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:text="TextButton Disabled"
|
||||
app:icon="@drawable/ic_settings_x" />
|
||||
app:icon="@drawable/ic_debug_icon" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="UnelevatedButton"
|
||||
app:icon="@drawable/ic_settings_x" />
|
||||
app:icon="@drawable/ic_debug_icon" />
|
||||
|
||||
<Button
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
|
@ -383,7 +383,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:text="UnelevatedButton Disabled"
|
||||
app:icon="@drawable/ic_settings_x" />
|
||||
app:icon="@drawable/ic_debug_icon" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -457,12 +457,12 @@
|
|||
android:layout_gravity="end"
|
||||
android:layout_margin="16dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_settings_x" />
|
||||
android:src="@drawable/ic_debug_icon" />
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:menu="@menu/home_bottom_navigation" />
|
||||
app:menu="@menu/menu_debug" />
|
||||
|
||||
</LinearLayout>
|
||||
|
19
library/ui-styles/src/debug/res/menu/menu_debug.xml
Normal file
19
library/ui-styles/src/debug/res/menu/menu_debug.xml
Normal 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>
|
|
@ -1,2 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="im.vector.app.ui.styles"/>
|
||||
<manifest package="im.vector.lib.ui.styles"/>
|
|
@ -5,27 +5,6 @@
|
|||
<application>
|
||||
<activity android:name=".features.debug.TestLinkifyActivity" />
|
||||
<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>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -37,6 +37,13 @@ import im.vector.app.core.utils.toast
|
|||
import im.vector.app.databinding.ActivityDebugMenuBinding
|
||||
import im.vector.app.features.debug.sas.DebugSasEmojiActivity
|
||||
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 timber.log.Timber
|
||||
|
|
|
@ -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>
|
Loading…
Reference in a new issue