mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Changes for assistant
This commit is contained in:
parent
973afe08c5
commit
abd5b865e1
8 changed files with 208 additions and 4 deletions
|
|
@ -34,6 +34,10 @@ import org.linphone.ui.main.fragment.GenericFragment
|
|||
|
||||
@UiThread
|
||||
class LoginFragment : GenericFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[Login Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: AssistantLoginFragmentBinding
|
||||
|
||||
private val viewModel: AssistantViewModel by navGraphViewModels(
|
||||
|
|
@ -73,6 +77,11 @@ class LoginFragment : GenericFragment() {
|
|||
findNavController().navigate(action)
|
||||
}
|
||||
|
||||
binding.setThirdPartySipAccountLoginClickListener {
|
||||
val action = LoginFragmentDirections.actionLoginFragmentToThirdPartySipAccountLoginFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
|
||||
viewModel.accountLoggedInEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
goBack()
|
||||
|
|
|
|||
|
|
@ -19,17 +19,24 @@
|
|||
*/
|
||||
package org.linphone.ui.assistant.fragment
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.AssistantRegisterFragmentBinding
|
||||
import org.linphone.ui.main.fragment.GenericFragment
|
||||
|
||||
@UiThread
|
||||
class RegisterFragment : GenericFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[Register Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: AssistantRegisterFragmentBinding
|
||||
|
||||
override fun onCreateView(
|
||||
|
|
@ -57,5 +64,18 @@ class RegisterFragment : GenericFragment() {
|
|||
binding.setLoginClickListener {
|
||||
goBack()
|
||||
}
|
||||
|
||||
binding.setOpenSubscribeWebPageClickListener {
|
||||
try {
|
||||
val url = "https://subscribe.linphone.org"
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
startActivity(browserIntent)
|
||||
} catch (ise: IllegalStateException) {
|
||||
Log.e("$TAG Can't start ACTION_VIEW intent, IllegalStateException: $ise")
|
||||
}
|
||||
}
|
||||
|
||||
binding.setCreateClickListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.assistant.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import org.linphone.databinding.AssistantThirdPartySipAccountLoginFragmentBinding
|
||||
import org.linphone.ui.main.fragment.GenericFragment
|
||||
|
||||
@UiThread
|
||||
class ThirdPartySipAccountLoginFragment : GenericFragment() {
|
||||
private lateinit var binding: AssistantThirdPartySipAccountLoginFragmentBinding
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = AssistantThirdPartySipAccountLoginFragmentBinding.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.setBackClickListener {
|
||||
goBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
app/src/main/res/drawable/header.xml
Normal file
27
app/src/main/res/drawable/header.xml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="481.54dp"
|
||||
android:height="54.66dp"
|
||||
android:viewportWidth="481.54"
|
||||
android:viewportHeight="54.66">
|
||||
<path
|
||||
android:pathData="m0,0.15 l121.11,27.53 62.69,-9.36 26.46,-18.32 55.77,24.42 92.81,-24.02 81.12,17.95 41.59,-17.92 0,54.22h-481.54z"
|
||||
android:strokeLineJoin="miter"
|
||||
android:strokeWidth="0.264583"
|
||||
android:fillColor="#ffb9a0"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="m0,19.77 l109.31,-14.89 34.19,10.88 30.53,-1.11 33.38,11.4 53.56,-14.36 62.33,19.19 40.01,-14.59 66.24,22.22 39.77,-25.27 12.22,6.55 0,34.88 -481.54,0z"
|
||||
android:strokeLineJoin="miter"
|
||||
android:strokeWidth="0.264583"
|
||||
android:fillColor="#ff9e79"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="m0,54.66 l0,-3.09 58.83,-21.45 69.2,6.16 31.34,-3.72 25.64,9.36 79.38,7.73 58.91,-18.78 50.76,3.72 37.58,-14.83 43.84,14.2 26.07,17.6 0,3.09z"
|
||||
android:strokeLineJoin="miter"
|
||||
android:strokeWidth="0.264583"
|
||||
android:fillColor="#ff723b"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeLineCap="butt"/>
|
||||
</vector>
|
||||
|
|
@ -12,6 +12,9 @@
|
|||
<variable
|
||||
name="registerClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="thirdPartySipAccountLoginClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="qrCodeClickListener"
|
||||
type="View.OnClickListener" />
|
||||
|
|
@ -40,6 +43,18 @@
|
|||
app:tint="@color/gray_1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/header"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/back"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_800"
|
||||
|
|
@ -47,9 +62,10 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="100dp"
|
||||
android:paddingBottom="30dp"
|
||||
android:text="Login"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/gray_9"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
|
@ -59,7 +75,7 @@
|
|||
style="@style/default_text_style_700"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="48dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="Username*"
|
||||
|
|
@ -231,6 +247,7 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/or" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{thirdPartySipAccountLoginClickListener}"
|
||||
style="@style/default_text_style_600"
|
||||
android:id="@+id/third_party_sip_account"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,12 @@
|
|||
<variable
|
||||
name="backClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="createClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="openSubscribeWebPageClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="loginClickListener"
|
||||
type="View.OnClickListener" />
|
||||
|
|
@ -33,16 +39,29 @@
|
|||
app:tint="@color/gray_1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/header"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/back"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_800"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="100dp"
|
||||
android:paddingBottom="30dp"
|
||||
android:text="Register"
|
||||
android:textSize="20sp"
|
||||
android:textColor="@color/gray_9"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
|
@ -144,6 +163,7 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{createClickListener}"
|
||||
style="@style/default_text_style_600"
|
||||
android:id="@+id/create"
|
||||
android:layout_width="0dp"
|
||||
|
|
@ -177,6 +197,7 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{openSubscribeWebPageClickListener}"
|
||||
style="@style/default_text_style_600"
|
||||
android:id="@+id/create_email_account"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:bind="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<import type="android.text.InputType" />
|
||||
<variable
|
||||
name="backClickListener"
|
||||
type="View.OnClickListener" />
|
||||
</data>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:onClick="@{backClickListener}"
|
||||
android:id="@+id/back"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:src="@drawable/caret_left"
|
||||
app:tint="@color/gray_1"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</layout>
|
||||
|
|
@ -26,6 +26,14 @@
|
|||
app:popEnterAnim="@anim/slide_in_left"
|
||||
app:popExitAnim="@anim/slide_out_right"
|
||||
app:launchSingleTop="true" />
|
||||
<action
|
||||
android:id="@+id/action_loginFragment_to_thirdPartySipAccountLoginFragment"
|
||||
app:destination="@id/thirdPartySipAccountLoginFragment"
|
||||
app:enterAnim="@anim/slide_in_right"
|
||||
app:exitAnim="@anim/slide_out_left"
|
||||
app:popEnterAnim="@anim/slide_in_left"
|
||||
app:popExitAnim="@anim/slide_out_right"
|
||||
app:launchSingleTop="true" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
|
|
@ -40,4 +48,10 @@
|
|||
android:label="QrCodeScannerFragment"
|
||||
tools:layout="@layout/assistant_qr_code_scanner_fragment" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/thirdPartySipAccountLoginFragment"
|
||||
android:name="org.linphone.ui.assistant.fragment.ThirdPartySipAccountLoginFragment"
|
||||
android:label="ThirdPartySipAccountLoginFragment"
|
||||
tools:layout="@layout/assistant_third_party_sip_account_login_fragment" />
|
||||
|
||||
</navigation>
|
||||
Loading…
Add table
Reference in a new issue