Fix crash on default theme

This commit is contained in:
Benoit Marty 2021-06-15 19:19:17 +02:00
parent a67f8ca4dc
commit 0590acd31a
11 changed files with 159 additions and 17 deletions

View File

@ -21,9 +21,20 @@
<activity
android:name=".debug.DebugMaterialThemeDarkVectorActivity"
android:theme="@style/AppTheme.Dark" />
<activity
android:name=".debug.DebugVectorButtonStylesActivity"
android:name=".debug.DebugVectorButtonStylesLightActivity"
android:theme="@style/AppTheme.Light" />
<activity
android:name=".debug.DebugVectorButtonStylesDarkActivity"
android:theme="@style/AppTheme.Dark" />
<activity
android:name=".debug.DebugVectorTextViewLightActivity"
android:theme="@style/AppTheme.Light" />
<activity
android:name=".debug.DebugVectorTextViewDarkActivity"
android:theme="@style/AppTheme.Dark" />
</application>
</manifest>

View File

@ -20,7 +20,7 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import im.vector.lib.ui.styles.databinding.ActivityDebugButtonStylesBinding
class DebugVectorButtonStylesActivity : AppCompatActivity() {
abstract class DebugVectorButtonStylesActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

View File

@ -0,0 +1,19 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.lib.ui.styles.debug
class DebugVectorButtonStylesDarkActivity : DebugVectorButtonStylesActivity()

View File

@ -0,0 +1,19 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.lib.ui.styles.debug
class DebugVectorButtonStylesLightActivity : DebugVectorButtonStylesActivity()

View File

@ -0,0 +1,31 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.lib.ui.styles.debug
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import im.vector.lib.ui.styles.databinding.ActivityDebugTextViewBinding
// Rendering is not the same with VectorBaseActivity
abstract class DebugVectorTextViewActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val views = ActivityDebugTextViewBinding.inflate(layoutInflater)
setContentView(views.root)
}
}

View File

@ -0,0 +1,19 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.lib.ui.styles.debug
class DebugVectorTextViewDarkActivity : DebugVectorTextViewActivity()

View File

@ -0,0 +1,19 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.lib.ui.styles.debug
class DebugVectorTextViewLightActivity : DebugVectorTextViewActivity()

View File

@ -441,16 +441,6 @@
</com.google.android.material.card.MaterialCardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text views" />
<include
layout="@layout/debug_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@ -43,7 +43,10 @@ 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 im.vector.lib.ui.styles.debug.DebugVectorButtonStylesDarkActivity
import im.vector.lib.ui.styles.debug.DebugVectorButtonStylesLightActivity
import im.vector.lib.ui.styles.debug.DebugVectorTextViewDarkActivity
import im.vector.lib.ui.styles.debug.DebugVectorTextViewLightActivity
import org.matrix.android.sdk.internal.crypto.verification.qrcode.toQrCodeData
import timber.log.Timber
@ -78,8 +81,17 @@ class DebugMenuActivity : VectorBaseActivity<ActivityDebugMenuBinding>() {
private fun setupViews() {
views.debugTestTextViewLink.setOnClickListener { testTextViewLink() }
views.debugOpenButtonStyles.setOnClickListener {
startActivity(Intent(this, DebugVectorButtonStylesActivity::class.java))
views.debugOpenButtonStylesLight.setOnClickListener {
startActivity(Intent(this, DebugVectorButtonStylesLightActivity::class.java))
}
views.debugOpenButtonStylesDark.setOnClickListener {
startActivity(Intent(this, DebugVectorButtonStylesDarkActivity::class.java))
}
views.debugTestTextViewLight.setOnClickListener {
startActivity(Intent(this, DebugVectorTextViewLightActivity::class.java))
}
views.debugTestTextViewDark.setOnClickListener {
startActivity(Intent(this, DebugVectorTextViewDarkActivity::class.java))
}
views.debugShowSasEmoji.setOnClickListener { showSasEmoji() }
views.debugTestNotification.setOnClickListener { testNotification() }

View File

@ -66,6 +66,20 @@
android:text="Vector" />
</LinearLayout>
<Button
android:id="@+id/debug_open_button_styles_light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="See button light" />
<Button
android:id="@+id/debug_test_text_view_light"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_margin="8dp"
android:layout_weight="1"
android:text="Text Views Light" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -101,10 +115,18 @@
</LinearLayout>
<Button
android:id="@+id/debug_open_button_styles"
android:id="@+id/debug_test_text_view_dark"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_margin="8dp"
android:layout_weight="1"
android:text="Text Views Dark" />
<Button
android:id="@+id/debug_open_button_styles_dark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="See button styles" />
android:text="See button dark" />
<Button
android:id="@+id/debug_show_sas_emoji"