diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 633f2b1eb..0e12acc93 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -30,6 +30,11 @@ + + . + */ +package org.linphone.ui.assistant + +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat +import androidx.core.view.WindowCompat +import androidx.databinding.DataBindingUtil +import org.linphone.LinphoneApplication +import org.linphone.R +import org.linphone.databinding.AssistantActivityBinding + +class AssistantActivity : AppCompatActivity() { + private lateinit var binding: AssistantActivityBinding + + override fun onCreate(savedInstanceState: Bundle?) { + WindowCompat.setDecorFitsSystemWindows(window, true) + super.onCreate(savedInstanceState) + + window.statusBarColor = ContextCompat.getColor( + this, + R.color.primary_color + ) + + while (!LinphoneApplication.coreContext.isReady()) { + Thread.sleep(20) + } + + binding = DataBindingUtil.setContentView(this, R.layout.assistant_activity) + binding.lifecycleOwner = this + } +} diff --git a/app/src/main/java/org/linphone/ui/assistant/fragment/LoginFragment.kt b/app/src/main/java/org/linphone/ui/assistant/fragment/LoginFragment.kt new file mode 100644 index 000000000..296611d94 --- /dev/null +++ b/app/src/main/java/org/linphone/ui/assistant/fragment/LoginFragment.kt @@ -0,0 +1,56 @@ +/* + * 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.assistant.fragment + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.navigation.fragment.findNavController +import org.linphone.databinding.AssistantLoginFragmentBinding +import org.linphone.ui.main.fragment.GenericFragment + +class LoginFragment : GenericFragment() { + private lateinit var binding: AssistantLoginFragmentBinding + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + binding = AssistantLoginFragmentBinding.inflate(layoutInflater) + return binding.root + } + + override fun goBack() { + requireActivity().finish() + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + binding.lifecycleOwner = viewLifecycleOwner + + binding.setRegisterClickListener { + val action = LoginFragmentDirections.actionLoginFragmentToRegisterFragment() + findNavController().navigate(action) + } + } +} diff --git a/app/src/main/java/org/linphone/ui/assistant/fragment/RegisterFragment.kt b/app/src/main/java/org/linphone/ui/assistant/fragment/RegisterFragment.kt new file mode 100644 index 000000000..ec8201b29 --- /dev/null +++ b/app/src/main/java/org/linphone/ui/assistant/fragment/RegisterFragment.kt @@ -0,0 +1,55 @@ +/* + * 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.assistant.fragment + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.navigation.fragment.findNavController +import org.linphone.databinding.AssistantRegisterFragmentBinding +import org.linphone.ui.main.fragment.GenericFragment + +class RegisterFragment : GenericFragment() { + private lateinit var binding: AssistantRegisterFragmentBinding + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + binding = AssistantRegisterFragmentBinding.inflate(layoutInflater) + return binding.root + } + + override fun goBack() { + findNavController().popBackStack() + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + binding.lifecycleOwner = viewLifecycleOwner + + binding.setLoginClickListener { + goBack() + } + } +} diff --git a/app/src/main/java/org/linphone/ui/main/MainActivity.kt b/app/src/main/java/org/linphone/ui/main/MainActivity.kt index 834fb4093..0b2b95934 100644 --- a/app/src/main/java/org/linphone/ui/main/MainActivity.kt +++ b/app/src/main/java/org/linphone/ui/main/MainActivity.kt @@ -20,6 +20,7 @@ package org.linphone.ui.main import android.Manifest +import android.content.Intent import android.content.pm.PackageManager import android.os.Bundle import android.view.Gravity @@ -27,9 +28,12 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat import androidx.core.view.WindowCompat import androidx.databinding.DataBindingUtil +import androidx.lifecycle.ViewModelProvider import org.linphone.LinphoneApplication.Companion.coreContext import org.linphone.R import org.linphone.databinding.MainActivityBinding +import org.linphone.ui.assistant.AssistantActivity +import org.linphone.ui.main.viewmodel.DrawerMenuViewModel class MainActivity : AppCompatActivity() { companion object { @@ -39,6 +43,7 @@ class MainActivity : AppCompatActivity() { } private lateinit var binding: MainActivityBinding + private lateinit var drawerMenuViewModel: DrawerMenuViewModel override fun onCreate(savedInstanceState: Bundle?) { WindowCompat.setDecorFitsSystemWindows(window, true) @@ -61,6 +66,17 @@ class MainActivity : AppCompatActivity() { binding = DataBindingUtil.setContentView(this, R.layout.main_activity) binding.lifecycleOwner = this + + drawerMenuViewModel = run { + ViewModelProvider(this)[DrawerMenuViewModel::class.java] + } + binding.drawerMenuViewModel = drawerMenuViewModel + + drawerMenuViewModel.startAssistantEvent.observe(this) { + it.consume { + startActivity(Intent(baseContext, AssistantActivity::class.java)) + } + } } override fun onPostCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/org/linphone/ui/main/viewmodel/DrawerMenuViewModel.kt b/app/src/main/java/org/linphone/ui/main/viewmodel/DrawerMenuViewModel.kt new file mode 100644 index 000000000..11b24ab3b --- /dev/null +++ b/app/src/main/java/org/linphone/ui/main/viewmodel/DrawerMenuViewModel.kt @@ -0,0 +1,36 @@ +/* + * 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.viewmodel + +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel +import org.linphone.utils.Event + +class DrawerMenuViewModel : ViewModel() { + + val startAssistantEvent: MutableLiveData> by lazy { + MutableLiveData>() + } + + fun addAccount() { + // UI thread + startAssistantEvent.value = Event(true) + } +} diff --git a/app/src/main/java/org/linphone/ui/voip/VoipActivity.kt b/app/src/main/java/org/linphone/ui/voip/VoipActivity.kt index fc3efa0ad..70048c52d 100644 --- a/app/src/main/java/org/linphone/ui/voip/VoipActivity.kt +++ b/app/src/main/java/org/linphone/ui/voip/VoipActivity.kt @@ -48,7 +48,7 @@ class VoipActivity : AppCompatActivity() { this, R.color.in_call_black ) - window.statusBarColor = inCallBlackColor + // window.statusBarColor = inCallBlackColor window.navigationBarColor = inCallBlackColor while (!LinphoneApplication.coreContext.isReady()) { diff --git a/app/src/main/res/drawable/shape_edit_text_background.xml b/app/src/main/res/drawable/shape_edit_text_background.xml new file mode 100644 index 000000000..da6dc5ae7 --- /dev/null +++ b/app/src/main/res/drawable/shape_edit_text_background.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_orange_filled_button_background.xml b/app/src/main/res/drawable/shape_orange_filled_button_background.xml new file mode 100644 index 000000000..d1be0cfad --- /dev/null +++ b/app/src/main/res/drawable/shape_orange_filled_button_background.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/show_password.xml b/app/src/main/res/drawable/show_password.xml new file mode 100644 index 000000000..612f28667 --- /dev/null +++ b/app/src/main/res/drawable/show_password.xml @@ -0,0 +1,13 @@ + + + diff --git a/app/src/main/res/layout/assistant_activity.xml b/app/src/main/res/layout/assistant_activity.xml new file mode 100644 index 000000000..4df86cbb7 --- /dev/null +++ b/app/src/main/res/layout/assistant_activity.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/assistant_login_fragment.xml b/app/src/main/res/layout/assistant_login_fragment.xml new file mode 100644 index 000000000..7d4221d2f --- /dev/null +++ b/app/src/main/res/layout/assistant_login_fragment.xml @@ -0,0 +1,298 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/assistant_register_fragment.xml b/app/src/main/res/layout/assistant_register_fragment.xml new file mode 100644 index 000000000..81a0a4be6 --- /dev/null +++ b/app/src/main/res/layout/assistant_register_fragment.xml @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/drawer_menu.xml b/app/src/main/res/layout/drawer_menu.xml index 2413493ea..a1dbb759c 100644 --- a/app/src/main/res/layout/drawer_menu.xml +++ b/app/src/main/res/layout/drawer_menu.xml @@ -5,6 +5,9 @@ + - + diff --git a/app/src/main/res/navigation/assistant_nav_graph.xml b/app/src/main/res/navigation/assistant_nav_graph.xml new file mode 100644 index 000000000..41afb403b --- /dev/null +++ b/app/src/main/res/navigation/assistant_nav_graph.xml @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file