Added animations between splash screen & main activity and between main activity & assisant
Also improved code a bit
This commit is contained in:
parent
9a1651a8a9
commit
f297007975
31 changed files with 66 additions and 63 deletions
|
@ -46,10 +46,10 @@ class AccountLoginFragment : AbstractPhoneFragment<AssistantAccountLoginFragment
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedAssistantViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this, AccountLoginViewModelFactory(sharedViewModel.getAccountCreator())).get(AccountLoginViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ class EmailAccountCreationFragment : GenericFragment<AssistantEmailAccountCreati
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedAssistantViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this, EmailAccountCreationViewModelFactory(sharedViewModel.getAccountCreator())).get(EmailAccountCreationViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
|
|
@ -38,9 +38,9 @@ class EmailAccountValidationFragment : GenericFragment<AssistantEmailAccountVali
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedAssistantViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this, EmailAccountValidationViewModelFactory(sharedViewModel.getAccountCreator())).get(EmailAccountValidationViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
|
|
@ -44,9 +44,9 @@ class GenericAccountLoginFragment : GenericFragment<AssistantGenericAccountLogin
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedAssistantViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this, GenericLoginViewModelFactory(sharedViewModel.getAccountCreator(true))).get(GenericLoginViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
|
|
@ -39,9 +39,9 @@ class PhoneAccountCreationFragment : AbstractPhoneFragment<AssistantPhoneAccount
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedAssistantViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this, PhoneAccountCreationViewModelFactory(sharedViewModel.getAccountCreator())).get(PhoneAccountCreationViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
|
|
@ -40,9 +40,9 @@ class PhoneAccountLinkingFragment : AbstractPhoneFragment<AssistantPhoneAccountL
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedAssistantViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
val accountCreator = sharedViewModel.getAccountCreator()
|
||||
viewModel = ViewModelProvider(this, PhoneAccountLinkingViewModelFactory(accountCreator)).get(PhoneAccountLinkingViewModel::class.java)
|
||||
|
|
|
@ -44,9 +44,9 @@ class PhoneAccountValidationFragment : GenericFragment<AssistantPhoneAccountVali
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedAssistantViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this, PhoneAccountValidationViewModelFactory(sharedViewModel.getAccountCreator())).get(PhoneAccountValidationViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
|
|
@ -43,9 +43,9 @@ class QrCodeFragment : GenericFragment<AssistantQrCodeFragmentBinding>() {
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedAssistantViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this).get(QrCodeViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
|
|
@ -42,9 +42,9 @@ class RemoteProvisioningFragment : GenericFragment<AssistantRemoteProvisioningFr
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedAssistantViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this).get(RemoteProvisioningViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
|
|
@ -35,7 +35,8 @@ class TopBarFragment : GenericFragment<AssistantTopBarFragmentBinding>() {
|
|||
|
||||
binding.setBackClickListener {
|
||||
if (!findNavController().popBackStack()) {
|
||||
activity?.finish()
|
||||
requireActivity().finish()
|
||||
requireActivity().overridePendingTransition(R.anim.enter_left, R.anim.exit_right)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@ class ControlsFragment : GenericFragment<CallControlsFragmentBinding>() {
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedCallViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
callsViewModel = ViewModelProvider(this).get(CallsViewModel::class.java)
|
||||
binding.viewModel = callsViewModel
|
||||
|
@ -86,7 +86,7 @@ class ControlsFragment : GenericFragment<CallControlsFragmentBinding>() {
|
|||
|
||||
callsViewModel.noMoreCallEvent.observe(viewLifecycleOwner, {
|
||||
it.consume {
|
||||
activity?.finish()
|
||||
requireActivity().finish()
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -49,9 +49,9 @@ class StatusFragment : GenericFragment<CallStatusFragmentBinding>() {
|
|||
viewModel = ViewModelProvider(this).get(StatusViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedCallViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
binding.setStatsClickListener {
|
||||
sharedViewModel.toggleDrawerEvent.value = Event(true)
|
||||
|
|
|
@ -55,5 +55,6 @@ class LauncherActivity : GenericActivity() {
|
|||
intent.data = getIntent().data
|
||||
|
||||
startActivity(intent)
|
||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,9 +52,9 @@ class ChatRoomCreationFragment : SecureFragment<ChatRoomCreationFragmentBinding>
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
val createGroup = arguments?.getBoolean("createGroup") ?: false
|
||||
|
||||
|
|
|
@ -89,9 +89,9 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
val chatRoom = sharedViewModel.selectedChatRoom.value
|
||||
chatRoom ?: return
|
||||
|
|
|
@ -40,9 +40,9 @@ class DevicesFragment : SecureFragment<ChatRoomDevicesFragmentBinding>() {
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
val chatRoom = sharedViewModel.selectedChatRoom.value
|
||||
chatRoom ?: return
|
||||
|
|
|
@ -43,9 +43,9 @@ class EphemeralFragment : SecureFragment<ChatRoomEphemeralFragmentBinding>() {
|
|||
isSecure = true
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
val chatRoom = sharedViewModel.selectedChatRoom.value
|
||||
chatRoom ?: return
|
||||
|
|
|
@ -55,9 +55,9 @@ class GroupInfoFragment : SecureFragment<ChatRoomGroupInfoFragmentBinding>() {
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
val chatRoom: ChatRoom? = sharedViewModel.selectedGroupChatRoom.value
|
||||
isSecure = chatRoom?.currentParams?.encryptionEnabled() ?: false
|
||||
|
|
|
@ -48,9 +48,9 @@ class ImdnFragment : SecureFragment<ChatRoomImdnFragmentBinding>() {
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
val chatRoom = sharedViewModel.selectedChatRoom.value
|
||||
chatRoom ?: return
|
||||
|
|
|
@ -79,9 +79,9 @@ class MasterChatRoomsFragment : MasterFragment<ChatRoomMasterFragmentBinding, Ch
|
|||
listViewModel = ViewModelProvider(this).get(ChatRoomsListViewModel::class.java)
|
||||
binding.viewModel = listViewModel
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
_adapter = ChatRoomsListAdapter(listSelectionViewModel, viewLifecycleOwner)
|
||||
// SubmitList is done on a background thread
|
||||
|
|
|
@ -57,9 +57,9 @@ class ContactEditorFragment : GenericFragment<ContactEditorFragmentBinding>(), S
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(
|
||||
this,
|
||||
|
|
|
@ -52,9 +52,9 @@ class DetailContactFragment : GenericFragment<ContactDetailFragmentBinding>() {
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
val contact = sharedViewModel.selectedContact.value
|
||||
contact ?: return
|
||||
|
|
|
@ -67,9 +67,9 @@ class MasterContactsFragment : MasterFragment<ContactMasterFragmentBinding, Cont
|
|||
listViewModel = ViewModelProvider(this).get(ContactsListViewModel::class.java)
|
||||
binding.viewModel = listViewModel
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
_adapter = ContactsListAdapter(listSelectionViewModel, viewLifecycleOwner)
|
||||
binding.contactsList.adapter = adapter
|
||||
|
|
|
@ -59,9 +59,9 @@ class DialerFragment : SecureFragment<DialerFragmentBinding>() {
|
|||
viewModel = ViewModelProvider(this).get(DialerViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
binding.setNewContactClickListener {
|
||||
val deepLink = "linphone-android://contact/new/${viewModel.enteredUri.value}"
|
||||
|
|
|
@ -44,9 +44,9 @@ class StatusFragment : GenericFragment<StatusFragmentBinding>() {
|
|||
viewModel = ViewModelProvider(this).get(StatusViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
sharedViewModel.proxyConfigRemoved.observe(viewLifecycleOwner, {
|
||||
Log.i("[Status Fragment] A proxy config was removed, update default proxy state")
|
||||
|
|
|
@ -49,9 +49,9 @@ class TabsFragment : GenericFragment<TabsFragmentBinding>(), NavController.OnDes
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
viewModel = activity?.run {
|
||||
viewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(TabsViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
binding.viewModel = viewModel
|
||||
|
||||
binding.setHistoryClickListener {
|
||||
|
|
|
@ -48,9 +48,9 @@ class DetailCallLogFragment : GenericFragment<HistoryDetailFragmentBinding>() {
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
val callLogGroup = sharedViewModel.selectedCallLogGroup.value
|
||||
callLogGroup ?: return
|
||||
|
|
|
@ -71,9 +71,9 @@ class MasterCallLogsFragment : MasterFragment<HistoryMasterFragmentBinding, Call
|
|||
listViewModel = ViewModelProvider(this).get(CallLogsListViewModel::class.java)
|
||||
binding.viewModel = listViewModel
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
_adapter = CallLogsListAdapter(listSelectionViewModel, viewLifecycleOwner)
|
||||
// SubmitList is done on a background thread
|
||||
|
@ -196,10 +196,10 @@ class MasterCallLogsFragment : MasterFragment<HistoryMasterFragmentBinding, Call
|
|||
coreContext.core.resetMissedCallsCount()
|
||||
coreContext.notificationsManager.dismissMissedCallNotification()
|
||||
|
||||
val tabsViewModel = activity?.run {
|
||||
val tabsViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(TabsViewModel::class.java)
|
||||
}
|
||||
tabsViewModel?.updateMissedCallCount()
|
||||
tabsViewModel.updateMissedCallCount()
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
|
|
|
@ -43,9 +43,9 @@ class AccountSettingsFragment : GenericFragment<SettingsAccountFragmentBinding>(
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
val identity = arguments?.getString("Identity") ?: ""
|
||||
viewModel = ViewModelProvider(this, AccountSettingsViewModelFactory(identity)).get(AccountSettingsViewModel::class.java)
|
||||
|
|
|
@ -45,9 +45,9 @@ class SettingsFragment : SecureFragment<SettingsFragmentBinding>() {
|
|||
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this).get(SettingsViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
|
|
@ -62,9 +62,9 @@ class SideMenuFragment : GenericFragment<SideMenuFragmentBinding>() {
|
|||
viewModel = ViewModelProvider(this).get(SideMenuViewModel::class.java)
|
||||
binding.viewModel = viewModel
|
||||
|
||||
sharedViewModel = activity?.run {
|
||||
sharedViewModel = requireActivity().run {
|
||||
ViewModelProvider(this).get(SharedMainViewModel::class.java)
|
||||
} ?: throw Exception("Invalid Activity")
|
||||
}
|
||||
|
||||
sharedViewModel.proxyConfigRemoved.observe(viewLifecycleOwner, {
|
||||
Log.i("[Side Menu] Proxy config removed, update accounts list")
|
||||
|
@ -89,6 +89,7 @@ class SideMenuFragment : GenericFragment<SideMenuFragmentBinding>() {
|
|||
binding.setAssistantClickListener {
|
||||
sharedViewModel.toggleDrawerEvent.value = Event(true)
|
||||
startActivity(Intent(context, AssistantActivity::class.java))
|
||||
requireActivity().overridePendingTransition(R.anim.enter_right, R.anim.exit_left)
|
||||
}
|
||||
|
||||
binding.setSettingsClickListener {
|
||||
|
|
Loading…
Reference in a new issue