diff --git a/README.md b/README.md index 7ef2b3340..640252782 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ LinphoneSdkBuildDir=/home//linphone-sdk/build/ - If you encounter the `couldn't find "libc++_shared.so"` crash when the app starts, simply clean the project in Android Studio (under Build menu) and build again. Also check you have built the SDK for the right CPU architecture using the `-DLINPHONESDK_ANDROID_ARCHS=armv7,arm64,x86,x86_64` cmake parameter. -- If during the build you have `DataBinderMapperImpl.java error: cannot find symbol`, try building again. +- If during the build you have `DataBinderMapperImpl.java error: cannot find symbol` or `Could not find accessor org.linphone.activities.main.chat.viewmodels.ChatRoomsListViewModel.chatRooms` with `Could not find accessor org.linphone.activities.main.settings.viewmodels.NetworkSettingsViewModel.sipPort`, try building again. It is merely a build failure from Android Studio that happens sometimes. - Push notification might not work when app has been started by Android Studio consecutively to an install. Remove the app from the recent activity view and start it again using the launcher icon to resolve this. diff --git a/app/src/main/java/org/linphone/activities/main/fragments/TabsFragment.kt b/app/src/main/java/org/linphone/activities/main/fragments/TabsFragment.kt index a6ad9de7c..580de3736 100644 --- a/app/src/main/java/org/linphone/activities/main/fragments/TabsFragment.kt +++ b/app/src/main/java/org/linphone/activities/main/fragments/TabsFragment.kt @@ -93,16 +93,6 @@ class TabsFragment : GenericFragment(), NavController.OnDes destination: NavDestination, arguments: Bundle? ) { - viewModel.historySelected.value = false - viewModel.contactsSelected.value = false - viewModel.dialerSelected.value = false - viewModel.chatSelected.value = false - - when (destination.id) { - R.id.masterCallLogsFragment -> viewModel.historySelected.value = true - R.id.masterContactsFragment -> viewModel.contactsSelected.value = true - R.id.dialerFragment -> viewModel.dialerSelected.value = true - R.id.masterChatRoomsFragment -> viewModel.chatSelected.value = true - } + viewModel.updateTabSelection(destination.id) } } diff --git a/app/src/main/java/org/linphone/activities/main/viewmodels/TabsViewModel.kt b/app/src/main/java/org/linphone/activities/main/viewmodels/TabsViewModel.kt index aa8bf389c..3c71c4c20 100644 --- a/app/src/main/java/org/linphone/activities/main/viewmodels/TabsViewModel.kt +++ b/app/src/main/java/org/linphone/activities/main/viewmodels/TabsViewModel.kt @@ -23,6 +23,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import org.linphone.LinphoneApplication.Companion.coreContext import org.linphone.LinphoneApplication.Companion.corePreferences +import org.linphone.R import org.linphone.core.* class TabsViewModel : ViewModel() { @@ -85,4 +86,18 @@ class TabsViewModel : ViewModel() { fun updateUnreadChatCount() { unreadMessagesCount.value = coreContext.core.unreadChatMessageCountFromActiveLocals } + + fun updateTabSelection(destinationId: Int) { + historySelected.value = false + contactsSelected.value = false + dialerSelected.value = false + chatSelected.value = false + + when (destinationId) { + R.id.masterCallLogsFragment -> historySelected.value = true + R.id.masterContactsFragment -> contactsSelected.value = true + R.id.dialerFragment -> dialerSelected.value = true + R.id.masterChatRoomsFragment -> chatSelected.value = true + } + } }