diff --git a/examples/virtual-device-app/android/App/core/common/src/main/res/values/themes.xml b/examples/virtual-device-app/android/App/core/common/src/main/res/values/themes.xml index fcbe6bc78d57d4..a485b513217543 100644 --- a/examples/virtual-device-app/android/App/core/common/src/main/res/values/themes.xml +++ b/examples/virtual-device-app/android/App/core/common/src/main/res/values/themes.xml @@ -19,9 +19,4 @@ @color/color_background_secondary - \ No newline at end of file diff --git a/examples/virtual-device-app/android/App/core/ui/src/main/java/com/matter/virtual/device/app/core/ui/BaseFragment.kt b/examples/virtual-device-app/android/App/core/ui/src/main/java/com/matter/virtual/device/app/core/ui/BaseFragment.kt index 9a254643c1c0a2..f4ebea90286ec3 100644 --- a/examples/virtual-device-app/android/App/core/ui/src/main/java/com/matter/virtual/device/app/core/ui/BaseFragment.kt +++ b/examples/virtual-device-app/android/App/core/ui/src/main/java/com/matter/virtual/device/app/core/ui/BaseFragment.kt @@ -15,7 +15,6 @@ import androidx.fragment.app.activityViewModels import com.matter.virtual.device.app.core.common.EventObserver import com.matter.virtual.device.app.core.common.MatterSettings import com.matter.virtual.device.app.core.ui.databinding.LayoutAppbarBinding -import kotlin.math.abs import timber.log.Timber abstract class BaseFragment( @@ -50,16 +49,6 @@ abstract class BaseFragment( (activity as AppCompatActivity).setSupportActionBar(layoutAppBarBinding.toolbar) (activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true) - layoutAppBarBinding.appBarLayout.addOnOffsetChangedListener { appBarLayout, verticalOffset -> - var ratio = 0F - if (abs(verticalOffset) != 0) { - ratio = abs(verticalOffset).toFloat() / appBarLayout.totalScrollRange.toFloat() - } - - layoutAppBarBinding.collapseTitle.alpha = 1f - ratio * 2f + 0.1f - layoutAppBarBinding.toolbarTitle.alpha = (ratio - 0.5f) * 2f + 0.1f - } - layoutAppBarBinding.toolbarMoreMenuButton.setOnClickListener { Timber.d("More") showMoreMenuPopup(it) diff --git a/examples/virtual-device-app/android/App/core/ui/src/main/res/drawable/round_toggle_on_24.xml b/examples/virtual-device-app/android/App/core/ui/src/main/res/drawable/round_toggle_on_24.xml deleted file mode 100644 index d42714cc7696e0..00000000000000 --- a/examples/virtual-device-app/android/App/core/ui/src/main/res/drawable/round_toggle_on_24.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_appbar.xml b/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_appbar.xml index b612ae66d543d2..26495c18b9f9e6 100644 --- a/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_appbar.xml +++ b/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_appbar.xml @@ -5,75 +5,41 @@ + app:elevation="0dp"> - + android:layout_height="match_parent"> - + android:layout_height="match_parent"> - - - - - + android:layout_height="wrap_content" + android:textAlignment="viewStart" + android:textSize="@dimen/toolbar_title_text_size" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - - - + + + \ No newline at end of file diff --git a/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_space_bottom.xml b/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_bottom_space.xml similarity index 100% rename from examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_space_bottom.xml rename to examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_bottom_space.xml diff --git a/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_space_top.xml b/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_space_top.xml deleted file mode 100644 index 47421036d7f28c..00000000000000 --- a/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_space_top.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_title.xml b/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_title.xml deleted file mode 100644 index 7ad14914499681..00000000000000 --- a/examples/virtual-device-app/android/App/core/ui/src/main/res/layout/layout_title.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/virtual-device-app/android/App/core/ui/src/main/res/values/dimens.xml b/examples/virtual-device-app/android/App/core/ui/src/main/res/values/dimens.xml index 24bd23b54f6de7..f1879112b94146 100644 --- a/examples/virtual-device-app/android/App/core/ui/src/main/res/values/dimens.xml +++ b/examples/virtual-device-app/android/App/core/ui/src/main/res/values/dimens.xml @@ -1,17 +1,8 @@ - 350dp - 25sp 17sp 20dp - 60dp - 60dp - 20dp - 10sp - 24sp - - 44dp 12dp 25dp 20dp diff --git a/examples/virtual-device-app/android/App/feature/closure/src/main/res/layout/fragment_door_lock.xml b/examples/virtual-device-app/android/App/feature/closure/src/main/res/layout/fragment_door_lock.xml index 9caa1a2b67a48b..5c4807cbff7ef4 100644 --- a/examples/virtual-device-app/android/App/feature/closure/src/main/res/layout/fragment_door_lock.xml +++ b/examples/virtual-device-app/android/App/feature/closure/src/main/res/layout/fragment_door_lock.xml @@ -21,27 +21,20 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + - + - - - - + - + diff --git a/examples/virtual-device-app/android/App/feature/control/src/main/java/com/matter/virtual/device/app/feature/control/OnOffSwitchFragment.kt b/examples/virtual-device-app/android/App/feature/control/src/main/java/com/matter/virtual/device/app/feature/control/OnOffSwitchFragment.kt index 3b13eb0898e123..f5142bf0da3242 100644 --- a/examples/virtual-device-app/android/App/feature/control/src/main/java/com/matter/virtual/device/app/feature/control/OnOffSwitchFragment.kt +++ b/examples/virtual-device-app/android/App/feature/control/src/main/java/com/matter/virtual/device/app/feature/control/OnOffSwitchFragment.kt @@ -27,11 +27,8 @@ class OnOffSwitchFragment : override fun setupAppbar(): LayoutAppbarBinding = binding.appbar override fun setupUi() { - /** title icon */ - binding.onOffSwitchTitleLayout.titleIcon.setImageResource(matterSettings.device.deviceIconResId) - /** title text */ - binding.onOffSwitchTitleLayout.titleText.text = getString(matterSettings.device.deviceNameResId) + binding.appbar.toolbarTitle.text = getString(matterSettings.device.deviceNameResId) /** OnOff layout */ binding.onOffSwitchOnOffLayout.buttonData = diff --git a/examples/virtual-device-app/android/App/feature/control/src/main/res/layout/fragment_on_off_switch.xml b/examples/virtual-device-app/android/App/feature/control/src/main/res/layout/fragment_on_off_switch.xml index 1978e7c383f3d0..0635a23c87c9f2 100644 --- a/examples/virtual-device-app/android/App/feature/control/src/main/res/layout/fragment_on_off_switch.xml +++ b/examples/virtual-device-app/android/App/feature/control/src/main/res/layout/fragment_on_off_switch.xml @@ -1,11 +1,9 @@ - + - + android:layout_height="match_parent"> - + android:layout_marginTop="?attr/actionBarSize"> - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="wrap_content" + android:orientation="vertical"> + + + + + + + + + \ No newline at end of file diff --git a/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/LoadingFragment.kt b/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/LoadingFragment.kt index e5d768c3e790b7..244b3b668cf874 100644 --- a/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/LoadingFragment.kt +++ b/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/LoadingFragment.kt @@ -20,7 +20,6 @@ import com.matter.virtual.device.app.core.common.MatterSettings import com.matter.virtual.device.app.core.ui.SharedViewModel import com.matter.virtual.device.app.feature.main.databinding.FragmentLoadingBinding import dagger.hilt.android.AndroidEntryPoint -import kotlin.math.abs import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString @@ -57,16 +56,6 @@ class LoadingFragment : Fragment() { (activity as AppCompatActivity).setSupportActionBar(binding.toolbar) (activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true) - binding.appBarLayout.addOnOffsetChangedListener { appBarLayout, verticalOffset -> - var ratio = 0F - if (abs(verticalOffset) != 0) { - ratio = abs(verticalOffset).toFloat() / appBarLayout.totalScrollRange.toFloat() - } - - binding.collapseTitle.alpha = 1f - ratio * 2f + 0.1f - binding.toolbarTitle.alpha = (ratio - 0.5f) * 2f + 0.1f - } - val args: LoadingFragmentArgs by navArgs() this.matterSettings = Json.decodeFromString(args.setting) diff --git a/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MainFragment.kt b/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MainFragment.kt index 861bf01b257817..0365727b110d25 100644 --- a/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MainFragment.kt +++ b/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MainFragment.kt @@ -20,7 +20,6 @@ import com.matter.virtual.device.app.core.ui.SharedViewModel import com.matter.virtual.device.app.feature.main.databinding.FragmentMainBinding import com.matter.virtual.device.app.feature.main.model.Menu import dagger.hilt.android.AndroidEntryPoint -import kotlin.math.abs import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json @@ -55,16 +54,6 @@ class MainFragment : Fragment() { (activity as AppCompatActivity).setSupportActionBar(binding.toolbar) (activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true) - binding.appBarLayout.addOnOffsetChangedListener { appBarLayout, verticalOffset -> - var ratio = 0F - if (abs(verticalOffset) != 0) { - ratio = abs(verticalOffset).toFloat() / appBarLayout.totalScrollRange.toFloat() - } - - binding.collapseTitle.alpha = 1f - ratio * 2f + 0.1f - binding.toolbarTitle.alpha = (ratio - 0.5f) * 2f + 0.1f - } - viewModel.uiState.observe(viewLifecycleOwner) { uiState -> Timber.d("uiState:$uiState") when (uiState) { diff --git a/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/fragment_loading.xml b/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/fragment_loading.xml index a76061ed6ca8e4..0a16475314f70b 100644 --- a/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/fragment_loading.xml +++ b/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/fragment_loading.xml @@ -2,7 +2,7 @@ - @@ -10,121 +10,81 @@ + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + android:layout_height="match_parent"> - - - + android:layout_height="match_parent"> - - - - - - + android:layout_height="wrap_content" + android:text="@string/title_loading" + android:textAlignment="viewStart" + android:textSize="@dimen/toolbar_title_text_size" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + - + android:layout_marginTop="?attr/actionBarSize" + android:orientation="vertical"> - + android:layout_marginStart="@dimen/menu_item_side_space" + android:layout_marginTop="20dp" + android:layout_marginEnd="@dimen/menu_item_side_space" + android:background="@drawable/menu_item_bg"> - + android:layout_marginEnd="20dp" + android:layout_marginBottom="20dp" + android:indeterminate="true" + app:indicatorColor="@color/colorControlActivated" + app:layout_constraintBottom_toTopOf="@+id/loading_description" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - - - - - - - + + + + \ No newline at end of file diff --git a/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/fragment_main.xml b/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/fragment_main.xml index 724e9f21634261..2bbe9df759b809 100644 --- a/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/fragment_main.xml +++ b/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/fragment_main.xml @@ -2,103 +2,59 @@ - - - - - + android:layout_height="match_parent"> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - - - + android:layout_height="?attr/actionBarSize"> - + android:layout_height="match_parent"> - - - - - - + android:layout_height="wrap_content" + android:text="@string/title_main" + android:textAlignment="viewStart" + android:textSize="@dimen/toolbar_title_text_size" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + - + android:layout_marginTop="?attr/actionBarSize"> - - - - - - + android:orientation="vertical" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + diff --git a/examples/virtual-device-app/android/App/feature/qrcode/src/main/java/com/matter/virtual/device/app/feature/qrcode/QrcodeFragment.kt b/examples/virtual-device-app/android/App/feature/qrcode/src/main/java/com/matter/virtual/device/app/feature/qrcode/QrcodeFragment.kt index 6f220d7851453b..a6ea23ede767e6 100644 --- a/examples/virtual-device-app/android/App/feature/qrcode/src/main/java/com/matter/virtual/device/app/feature/qrcode/QrcodeFragment.kt +++ b/examples/virtual-device-app/android/App/feature/qrcode/src/main/java/com/matter/virtual/device/app/feature/qrcode/QrcodeFragment.kt @@ -14,11 +14,14 @@ import androidx.fragment.app.activityViewModels import androidx.fragment.app.viewModels import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs -import com.matter.virtual.device.app.core.common.* +import com.matter.virtual.device.app.core.common.DeepLink +import com.matter.virtual.device.app.core.common.EventObserver +import com.matter.virtual.device.app.core.common.MatterConstants +import com.matter.virtual.device.app.core.common.MatterSettings +import com.matter.virtual.device.app.core.common.QrcodeUtil import com.matter.virtual.device.app.core.ui.SharedViewModel import com.matter.virtual.device.app.feature.qrcode.databinding.FragmentQrcodeBinding import dagger.hilt.android.AndroidEntryPoint -import kotlin.math.abs import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString @@ -55,16 +58,6 @@ class QrcodeFragment : Fragment() { (activity as AppCompatActivity).setSupportActionBar(binding.toolbar) (activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true) - binding.appBarLayout.addOnOffsetChangedListener { appBarLayout, verticalOffset -> - var ratio = 0F - if (abs(verticalOffset) != 0) { - ratio = abs(verticalOffset).toFloat() / appBarLayout.totalScrollRange.toFloat() - } - - binding.collapseTitle.alpha = 1f - ratio * 2f + 0.1f - binding.toolbarTitle.alpha = (ratio - 0.5f) * 2f + 0.1f - } - val args: QrcodeFragmentArgs by navArgs() val matterSettings = Json.decodeFromString(args.setting) diff --git a/examples/virtual-device-app/android/App/feature/qrcode/src/main/res/layout/fragment_qrcode.xml b/examples/virtual-device-app/android/App/feature/qrcode/src/main/res/layout/fragment_qrcode.xml index 5bd72ce74776d5..0d141c97ed6836 100644 --- a/examples/virtual-device-app/android/App/feature/qrcode/src/main/res/layout/fragment_qrcode.xml +++ b/examples/virtual-device-app/android/App/feature/qrcode/src/main/res/layout/fragment_qrcode.xml @@ -9,86 +9,52 @@ type="com.matter.virtual.device.app.feature.qrcode.QrcodeViewModel" /> - + android:layout_height="match_parent"> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - - - + android:layout_height="match_parent"> - + android:layout_height="match_parent"> - - - - - - + android:layout_height="wrap_content" + android:text="@string/title_qrcode" + android:textAlignment="viewStart" + android:textSize="@dimen/toolbar_title_text_size" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + - + android:layout_marginTop="?attr/actionBarSize"> - + android:layout_height="match_parent" + android:orientation="vertical"> @@ -124,7 +89,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginVertical="@dimen/menu_item_text_margin_vertical" - android:layout_marginStart="@dimen/menu_item_image_margin_start" android:layout_marginEnd="@dimen/menu_item_text_margin_end" android:ellipsize="end" android:singleLine="true" @@ -235,24 +199,18 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/setup_pin_code_text" /> - - - - - - - + + + + + diff --git a/examples/virtual-device-app/android/App/feature/setup/src/main/java/com/matter/virtual/device/app/feature/setup/SetupFragment.kt b/examples/virtual-device-app/android/App/feature/setup/src/main/java/com/matter/virtual/device/app/feature/setup/SetupFragment.kt index 79ede035a2f506..adf4c869833acb 100644 --- a/examples/virtual-device-app/android/App/feature/setup/src/main/java/com/matter/virtual/device/app/feature/setup/SetupFragment.kt +++ b/examples/virtual-device-app/android/App/feature/setup/src/main/java/com/matter/virtual/device/app/feature/setup/SetupFragment.kt @@ -20,7 +20,6 @@ import com.matter.virtual.device.app.core.model.OnboardingType import com.matter.virtual.device.app.feature.setup.databinding.DialogSetupContinueBinding import com.matter.virtual.device.app.feature.setup.databinding.FragmentSetupBinding import dagger.hilt.android.AndroidEntryPoint -import kotlin.math.abs import kotlinx.coroutines.launch import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.decodeFromString @@ -57,16 +56,6 @@ class SetupFragment : Fragment() { (activity as AppCompatActivity).setSupportActionBar(binding.toolbar) (activity as AppCompatActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true) - binding.appBarLayout.addOnOffsetChangedListener { appBarLayout, verticalOffset -> - var ratio = 0F - if (abs(verticalOffset) != 0) { - ratio = abs(verticalOffset).toFloat() / appBarLayout.totalScrollRange.toFloat() - } - - binding.collapseTitle.alpha = 1f - ratio * 2f + 0.1f - binding.toolbarTitle.alpha = (ratio - 0.5f) * 2f + 0.1f - } - val args: SetupFragmentArgs by navArgs() this.matterSettings = Json.decodeFromString(args.setting) diff --git a/examples/virtual-device-app/android/App/feature/setup/src/main/res/layout/fragment_setup.xml b/examples/virtual-device-app/android/App/feature/setup/src/main/res/layout/fragment_setup.xml index 7bf2118df30ac5..c76a55d3f9dfde 100644 --- a/examples/virtual-device-app/android/App/feature/setup/src/main/res/layout/fragment_setup.xml +++ b/examples/virtual-device-app/android/App/feature/setup/src/main/res/layout/fragment_setup.xml @@ -2,290 +2,243 @@ - - - - - + android:layout_height="match_parent"> + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - - - + android:layout_height="?attr/actionBarSize"> - + android:layout_height="match_parent"> - - - - - - + android:layout_height="wrap_content" + android:text="@string/title_setup" + android:textAlignment="viewStart" + android:textSize="@dimen/toolbar_title_text_size" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + - + android:layout_marginTop="?attr/actionBarSize" + android:orientation="vertical"> - + android:layout_height="wrap_content" + android:layout_marginHorizontal="12dp" + android:background="@drawable/menu_item_bg" + android:gravity="center_vertical" + android:paddingStart="20dp" + android:paddingTop="12dp" + android:paddingEnd="20dp" + android:paddingBottom="12dp"> - + + + android:textAlignment="viewStart" + android:textSize="@dimen/device_item_value_text_size" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/setup_device_name_text" /> - + - + - - + - + + + + + + + - - - - - - - - + + - - - - - - - - - - - - - + + - - - - + android:layout_weight="1" + android:buttonTint="@color/textColor" + android:text="@string/wifi_ble" + android:textSize="@dimen/device_item_value_text_small_size" /> - + + - + + + + + + + + + - + - - - - - + + + - - + android:text="@string/save" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" /> +