Setup simple navigation from AddServer to Login
This commit is contained in:
parent
8b299694c2
commit
e1e1da8ca6
4 changed files with 34 additions and 5 deletions
|
@ -30,6 +30,10 @@ android {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = '1.8'
|
jvmTarget = '1.8'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -42,7 +46,7 @@ dependencies {
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
|
||||||
testImplementation 'junit:junit:4.+'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
}
|
}
|
|
@ -5,12 +5,24 @@ import androidx.fragment.app.Fragment
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import androidx.navigation.findNavController
|
||||||
|
import dev.jdtech.jellyfin.databinding.FragmentAddServerBinding
|
||||||
|
|
||||||
class AddServerFragment : Fragment() {
|
class AddServerFragment : Fragment() {
|
||||||
|
private var _binding: FragmentAddServerBinding? = null
|
||||||
|
private val binding get() = _binding!!
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
return inflater.inflate(R.layout.fragment_add_server, container, false)
|
_binding = FragmentAddServerBinding.inflate(inflater, container, false)
|
||||||
|
val view = binding.root
|
||||||
|
|
||||||
|
binding.buttonConnect.setOnClickListener { v: View ->
|
||||||
|
v.findNavController().navigate(R.id.action_addServerFragment_to_loginFragment)
|
||||||
|
}
|
||||||
|
|
||||||
|
return view
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -45,7 +45,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="24dp"
|
android:layout_marginBottom="24dp"
|
||||||
android:autofillHints="serverAddress"
|
android:autofillHints="no"
|
||||||
android:background="@drawable/edit_text_background"
|
android:background="@drawable/edit_text_background"
|
||||||
android:hint="@string/edit_text_server_address_hint"
|
android:hint="@string/edit_text_server_address_hint"
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
android:textColorHint="@color/neutral_400" />
|
android:textColorHint="@color/neutral_400" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_add_server"
|
android:id="@+id/button_connect"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:background="@drawable/button_setup_background"
|
android:background="@drawable/button_setup_background"
|
||||||
|
|
|
@ -8,5 +8,18 @@
|
||||||
android:id="@+id/addServerFragment"
|
android:id="@+id/addServerFragment"
|
||||||
android:name="dev.jdtech.jellyfin.AddServerFragment"
|
android:name="dev.jdtech.jellyfin.AddServerFragment"
|
||||||
android:label="fragment_add_server"
|
android:label="fragment_add_server"
|
||||||
tools:layout="@layout/fragment_add_server" />
|
tools:layout="@layout/fragment_add_server" >
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_addServerFragment_to_loginFragment"
|
||||||
|
app:destination="@id/loginFragment"
|
||||||
|
app:enterAnim="@anim/nav_default_enter_anim"
|
||||||
|
app:exitAnim="@anim/nav_default_exit_anim"
|
||||||
|
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||||
|
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||||
|
</fragment>
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/loginFragment"
|
||||||
|
android:name="dev.jdtech.jellyfin.LoginFragment"
|
||||||
|
android:label="fragment_login"
|
||||||
|
tools:layout="@layout/fragment_login" />
|
||||||
</navigation>
|
</navigation>
|
Loading…
Reference in a new issue