From 7c28c37d0b7b696988930ee2609b47ad2ae6a71b Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 10 Oct 2023 13:28:43 +0200 Subject: [PATCH] Improved touch size of some buttons --- .../fragment/ScheduleMeetingFragment.kt | 19 ++- .../viewmodel/ScheduleMeetingViewModel.kt | 58 +++++++ .../res/color/primary_button_label_color.xml | 9 +- .../color/secondary_button_label_color.xml | 9 +- .../shape_squircle_main2_100_background.xml | 5 + .../res/layout/chat_conversation_fragment.xml | 15 +- app/src/main/res/layout/contact_fragment.xml | 4 +- .../layout/contact_new_or_edit_fragment.xml | 8 +- .../res/layout/history_contact_fragment.xml | 5 +- .../res/layout/meeting_schedule_fragment.xml | 157 +++++++++++++++++- app/src/main/res/values/strings.xml | 5 + 11 files changed, 272 insertions(+), 22 deletions(-) create mode 100644 app/src/main/java/org/linphone/ui/main/meetings/viewmodel/ScheduleMeetingViewModel.kt create mode 100644 app/src/main/res/drawable/shape_squircle_main2_100_background.xml diff --git a/app/src/main/java/org/linphone/ui/main/meetings/fragment/ScheduleMeetingFragment.kt b/app/src/main/java/org/linphone/ui/main/meetings/fragment/ScheduleMeetingFragment.kt index 7ecd7b349..aa73a368e 100644 --- a/app/src/main/java/org/linphone/ui/main/meetings/fragment/ScheduleMeetingFragment.kt +++ b/app/src/main/java/org/linphone/ui/main/meetings/fragment/ScheduleMeetingFragment.kt @@ -24,9 +24,11 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.annotation.UiThread +import androidx.lifecycle.ViewModelProvider import androidx.navigation.fragment.findNavController import org.linphone.databinding.MeetingScheduleFragmentBinding import org.linphone.ui.main.fragment.GenericFragment +import org.linphone.ui.main.meetings.viewmodel.ScheduleMeetingViewModel import org.linphone.utils.Event @UiThread @@ -37,6 +39,8 @@ class ScheduleMeetingFragment : GenericFragment() { private lateinit var binding: MeetingScheduleFragmentBinding + private lateinit var viewModel: ScheduleMeetingViewModel + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -48,7 +52,7 @@ class ScheduleMeetingFragment : GenericFragment() { override fun goBack(): Boolean { sharedViewModel.closeSlidingPaneEvent.value = Event(true) - // If not done, when going back to ConversationsFragment this fragment will be created again + // If not done, when going back to MeetingsList this fragment will be created again return findNavController().popBackStack() } @@ -56,5 +60,18 @@ class ScheduleMeetingFragment : GenericFragment() { super.onViewCreated(view, savedInstanceState) binding.lifecycleOwner = viewLifecycleOwner + + viewModel = requireActivity().run { + ViewModelProvider(this)[ScheduleMeetingViewModel::class.java] + } + binding.viewModel = viewModel + + sharedViewModel.isSlidingPaneSlideable.observe(viewLifecycleOwner) { slideable -> + viewModel.showBackButton.value = slideable + } + + binding.setBackClickListener { + goBack() + } } } diff --git a/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/ScheduleMeetingViewModel.kt b/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/ScheduleMeetingViewModel.kt new file mode 100644 index 000000000..4d4e4f7d7 --- /dev/null +++ b/app/src/main/java/org/linphone/ui/main/meetings/viewmodel/ScheduleMeetingViewModel.kt @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2010-2023 Belledonne Communications SARL. + * + * This file is part of linphone-android + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.linphone.ui.main.meetings.viewmodel + +import androidx.annotation.UiThread +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel + +class ScheduleMeetingViewModel @UiThread constructor() : ViewModel() { + companion object { + private const val TAG = "[Schedule Meeting ViewModel]" + } + + val showBackButton = MutableLiveData() + + val isBroadcastSelected = MutableLiveData() + + val showBroadcastHelp = MutableLiveData() + + init { + isBroadcastSelected.value = false + showBroadcastHelp.value = false + } + + @UiThread + fun selectMeeting() { + isBroadcastSelected.value = false + showBroadcastHelp.value = false + } + + @UiThread + fun selectBroadcast() { + isBroadcastSelected.value = true + showBroadcastHelp.value = true + } + + @UiThread + fun closeBroadcastHelp() { + showBroadcastHelp.value = false + } +} diff --git a/app/src/main/res/color/primary_button_label_color.xml b/app/src/main/res/color/primary_button_label_color.xml index 67ab79f0d..04316885a 100644 --- a/app/src/main/res/color/primary_button_label_color.xml +++ b/app/src/main/res/color/primary_button_label_color.xml @@ -1,6 +1,9 @@ - - - + + + diff --git a/app/src/main/res/color/secondary_button_label_color.xml b/app/src/main/res/color/secondary_button_label_color.xml index 564ff89c6..b1a6e427d 100644 --- a/app/src/main/res/color/secondary_button_label_color.xml +++ b/app/src/main/res/color/secondary_button_label_color.xml @@ -1,6 +1,9 @@ - - - + + + diff --git a/app/src/main/res/drawable/shape_squircle_main2_100_background.xml b/app/src/main/res/drawable/shape_squircle_main2_100_background.xml new file mode 100644 index 000000000..c0c2b3b43 --- /dev/null +++ b/app/src/main/res/drawable/shape_squircle_main2_100_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/chat_conversation_fragment.xml b/app/src/main/res/layout/chat_conversation_fragment.xml index c681a8157..71b12c898 100644 --- a/app/src/main/res/layout/chat_conversation_fragment.xml +++ b/app/src/main/res/layout/chat_conversation_fragment.xml @@ -90,9 +90,10 @@ + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e56533d70..bd6ad23cb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -332,6 +332,11 @@ Say something… No meeting for the moment… + New meeting + Meeting + Broadcast + Info about broadcast. Learn more + Add title… Operation in progress, please wait