diff --git a/vector/src/debug/AndroidManifest.xml b/vector/src/debug/AndroidManifest.xml index e8c44a87c2..debb2987ef 100644 --- a/vector/src/debug/AndroidManifest.xml +++ b/vector/src/debug/AndroidManifest.xml @@ -3,6 +3,12 @@ + + diff --git a/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMaterialThemeActivity.kt b/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMaterialThemeActivity.kt new file mode 100644 index 0000000000..475427fe85 --- /dev/null +++ b/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMaterialThemeActivity.kt @@ -0,0 +1,65 @@ +/* + * Copyright 2019 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.riotredesign.features.debug + +import android.os.Bundle +import android.view.Menu +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.google.android.material.snackbar.Snackbar +import im.vector.riotredesign.R +import im.vector.riotredesign.core.utils.toast +import kotlinx.android.synthetic.debug.activity_test_material_theme.* + +// Rendering is not the same with VectorBaseActivity +abstract class DebugMaterialThemeActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_test_material_theme) + + debugShowSnackbar.setOnClickListener { + Snackbar.make(debugMaterialCoordinator, "Snackbar!", Snackbar.LENGTH_SHORT) + .setAction("Action") { } + .show() + } + + debugShowToast.setOnClickListener { + toast("Toast") + } + + debugShowDialog.setOnClickListener { + AlertDialog.Builder(this) + .setMessage("Dialog content") + .setIcon(R.drawable.ic_settings_x) + .setPositiveButton("Positive", null) + .setNegativeButton("Negative", null) + .setNeutralButton("Neutral", null) + .show() + } + + debugShowBottomSheet.setOnClickListener { + BottomSheetDialogFragment().show(supportFragmentManager, "TAG") + } + } + + override fun onCreateOptionsMenu(menu: Menu): Boolean { + menuInflater.inflate(R.menu.vector_home, menu) + return true + } +} diff --git a/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMaterialThemeDarkActivity.kt b/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMaterialThemeDarkActivity.kt new file mode 100644 index 0000000000..bab2141790 --- /dev/null +++ b/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMaterialThemeDarkActivity.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2019 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.riotredesign.features.debug + +class DebugMaterialThemeDarkActivity : DebugMaterialThemeActivity() \ No newline at end of file diff --git a/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMaterialThemeLightActivity.kt b/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMaterialThemeLightActivity.kt new file mode 100644 index 0000000000..039d7c072a --- /dev/null +++ b/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMaterialThemeLightActivity.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2019 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.riotredesign.features.debug + +class DebugMaterialThemeLightActivity : DebugMaterialThemeActivity() \ No newline at end of file diff --git a/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMenuActivity.kt b/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMenuActivity.kt index 71185006f5..add4e2daf4 100644 --- a/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMenuActivity.kt +++ b/vector/src/debug/java/im/vector/riotredesign/features/debug/DebugMenuActivity.kt @@ -122,5 +122,16 @@ class DebugMenuActivity : VectorBaseActivity() { .build() ) } + + @OnClick(R.id.debug_test_material_theme_light) + fun testMaterialThemeLight() { + startActivity(Intent(this, DebugMaterialThemeLightActivity::class.java)) + } + + @OnClick(R.id.debug_test_material_theme_dark) + fun testMaterialThemeDark() { + startActivity(Intent(this, DebugMaterialThemeDarkActivity::class.java)) + } + } diff --git a/vector/src/debug/res/drawable/linear_divider.xml b/vector/src/debug/res/drawable/linear_divider.xml new file mode 100644 index 0000000000..954360298c --- /dev/null +++ b/vector/src/debug/res/drawable/linear_divider.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/vector/src/debug/res/layout/activity_debug_menu.xml b/vector/src/debug/res/layout/activity_debug_menu.xml index a6f95ab1b4..d1e85019f9 100644 --- a/vector/src/debug/res/layout/activity_debug_menu.xml +++ b/vector/src/debug/res/layout/activity_debug_menu.xml @@ -13,25 +13,40 @@ + android:padding="@dimen/layout_horizontal_margin" + android:showDividers="middle"> -