diff --git a/app/build.gradle b/app/build.gradle index 45c711111..5892549a2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -93,9 +93,13 @@ dependencies { implementation("io.coil-kt:coil-gif:$coil_version") implementation("io.coil-kt:coil-svg:$coil_version") implementation("io.coil-kt:coil-video:$coil_version") + // https://github.com/GetStream/avatarview-android/blob/main/LICENSE Apache v2.0 implementation "io.getstream:avatarview-coil:1.0.7" + // https://github.com/tommybuonomo/dotsindicator/blob/master/LICENSE Apache v2.0 + implementation("com.tbuonomo:dotsindicator:5.0") + implementation platform('com.google.firebase:firebase-bom:30.3.2') implementation 'com.google.firebase:firebase-messaging' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4c3a0ae64..edf5c21fd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -40,6 +40,7 @@ @@ -51,13 +52,22 @@ + + + { + OutgoingCallFragmentDirections.actionOutgoingCallFragmentToActiveCallFragment() + } + R.id.incomingCallFragment -> { + IncomingCallFragmentDirections.actionIncomingCallFragmentToActiveCallFragment() + } + else -> { + ActiveCallFragmentDirections.actionGlobalActiveCallFragment() + } } navController.navigate(action) } diff --git a/app/src/main/java/org/linphone/ui/welcome/WelcomeActivity.kt b/app/src/main/java/org/linphone/ui/welcome/WelcomeActivity.kt new file mode 100644 index 000000000..7b1503230 --- /dev/null +++ b/app/src/main/java/org/linphone/ui/welcome/WelcomeActivity.kt @@ -0,0 +1,125 @@ +/* + * 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.welcome + +import android.os.Bundle +import android.view.View +import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.WindowCompat +import androidx.databinding.DataBindingUtil +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentActivity +import androidx.viewpager2.adapter.FragmentStateAdapter +import androidx.viewpager2.widget.ViewPager2 +import org.linphone.LinphoneApplication.Companion.coreContext +import org.linphone.R +import org.linphone.core.tools.Log +import org.linphone.databinding.WelcomeActivityBinding +import org.linphone.ui.welcome.fragment.WelcomePage1Fragment +import org.linphone.ui.welcome.fragment.WelcomePage2Fragment +import org.linphone.ui.welcome.fragment.WelcomePage3Fragment + +class WelcomeActivity : AppCompatActivity() { + companion object { + private const val TAG = "[Welcome Activity]" + private const val PAGES = 3 + } + + private lateinit var binding: WelcomeActivityBinding + + private lateinit var viewPager: ViewPager2 + + private val pageChangedCallback = PageChangedCallback() + + override fun onBackPressed() { + if (viewPager.currentItem == 0) { + super.onBackPressed() + } else { + viewPager.currentItem = viewPager.currentItem - 1 + } + } + + override fun onCreate(savedInstanceState: Bundle?) { + WindowCompat.setDecorFitsSystemWindows(window, true) + super.onCreate(savedInstanceState) + + while (!coreContext.isReady()) { + Thread.sleep(20) + } + + binding = DataBindingUtil.setContentView(this, R.layout.welcome_activity) + binding.lifecycleOwner = this + + viewPager = binding.pager + val pagerAdapter = ScreenSlidePagerAdapter(this) + viewPager.adapter = pagerAdapter + + binding.dotsIndicator.attachTo(viewPager) + + binding.setSkipClickListener { + Log.i("$TAG User clicked on 'skip' button, going to last page") + viewPager.currentItem = PAGES - 1 + } + + binding.setNextClickListener { + if (viewPager.currentItem == PAGES - 1) { + Log.i("$TAG User clicked on 'start' button, leaving activity") + finish() + } else { + viewPager.currentItem = viewPager.currentItem + 1 + } + } + } + + override fun onResume() { + super.onResume() + viewPager.registerOnPageChangeCallback(pageChangedCallback) + } + + override fun onPause() { + viewPager.unregisterOnPageChangeCallback(pageChangedCallback) + super.onPause() + } + + private inner class ScreenSlidePagerAdapter(fa: FragmentActivity) : FragmentStateAdapter(fa) { + override fun getItemCount(): Int = PAGES + + override fun createFragment(position: Int): Fragment { + return when (position) { + 0 -> WelcomePage1Fragment() + 1 -> WelcomePage2Fragment() + else -> WelcomePage3Fragment() + } + } + } + + private inner class PageChangedCallback : ViewPager2.OnPageChangeCallback() { + override fun onPageSelected(position: Int) { + Log.i("$TAG Current page is [$position]") + if (position == PAGES - 1) { + binding.next.text = "Start" + binding.skip.visibility = View.INVISIBLE + } else { + binding.next.text = "Next" + binding.skip.visibility = View.VISIBLE + } + } + } +} diff --git a/app/src/main/java/org/linphone/ui/welcome/fragment/WelcomePage1Fragment.kt b/app/src/main/java/org/linphone/ui/welcome/fragment/WelcomePage1Fragment.kt new file mode 100644 index 000000000..35fd892f1 --- /dev/null +++ b/app/src/main/java/org/linphone/ui/welcome/fragment/WelcomePage1Fragment.kt @@ -0,0 +1,35 @@ +/* + * 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.welcome.fragment + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import org.linphone.R + +class WelcomePage1Fragment : Fragment() { + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View = inflater.inflate(R.layout.welcome_page_1, container, false) +} diff --git a/app/src/main/java/org/linphone/ui/welcome/fragment/WelcomePage2Fragment.kt b/app/src/main/java/org/linphone/ui/welcome/fragment/WelcomePage2Fragment.kt new file mode 100644 index 000000000..672f065c2 --- /dev/null +++ b/app/src/main/java/org/linphone/ui/welcome/fragment/WelcomePage2Fragment.kt @@ -0,0 +1,35 @@ +/* + * 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.welcome.fragment + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import org.linphone.R + +class WelcomePage2Fragment : Fragment() { + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View = inflater.inflate(R.layout.welcome_page_2, container, false) +} diff --git a/app/src/main/java/org/linphone/ui/welcome/fragment/WelcomePage3Fragment.kt b/app/src/main/java/org/linphone/ui/welcome/fragment/WelcomePage3Fragment.kt new file mode 100644 index 000000000..8e53e221e --- /dev/null +++ b/app/src/main/java/org/linphone/ui/welcome/fragment/WelcomePage3Fragment.kt @@ -0,0 +1,35 @@ +/* + * 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.welcome.fragment + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import org.linphone.R + +class WelcomePage3Fragment : Fragment() { + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View = inflater.inflate(R.layout.welcome_page_3, container, false) +} diff --git a/app/src/main/res/layout/assistant_activity.xml b/app/src/main/res/layout/assistant_activity.xml index 4df86cbb7..11a9dead4 100644 --- a/app/src/main/res/layout/assistant_activity.xml +++ b/app/src/main/res/layout/assistant_activity.xml @@ -9,7 +9,7 @@ + tools:context=".ui.assistant.AssistantActivity"> + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/welcome_page_1.xml b/app/src/main/res/layout/welcome_page_1.xml new file mode 100644 index 000000000..d2a9ccead --- /dev/null +++ b/app/src/main/res/layout/welcome_page_1.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/welcome_page_2.xml b/app/src/main/res/layout/welcome_page_2.xml new file mode 100644 index 000000000..7a770349b --- /dev/null +++ b/app/src/main/res/layout/welcome_page_2.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/welcome_page_3.xml b/app/src/main/res/layout/welcome_page_3.xml new file mode 100644 index 000000000..dac266fa1 --- /dev/null +++ b/app/src/main/res/layout/welcome_page_3.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + \ No newline at end of file