mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
settings fragment
This commit is contained in:
parent
27e7d56340
commit
9ba4b17c0d
@ -41,6 +41,7 @@ dependencies {
|
|||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.0'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.0'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.4.0'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.4.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
implementation("androidx.preference:preference-ktx:1.2.0")
|
||||||
|
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
|
@ -53,6 +53,21 @@ class ChannelFragment : Fragment() {
|
|||||||
recyclerView.layoutManager = LinearLayoutManager(context)
|
recyclerView.layoutManager = LinearLayoutManager(context)
|
||||||
|
|
||||||
fetchChannel(view)
|
fetchChannel(view)
|
||||||
|
val scrollView = view.findViewById<ScrollView>(R.id.channel_scrollView)
|
||||||
|
scrollView.viewTreeObserver
|
||||||
|
.addOnScrollChangedListener {
|
||||||
|
if (scrollView.getChildAt(0).bottom
|
||||||
|
== (scrollView.height + scrollView.scrollY)) {
|
||||||
|
//scroll view is at bottom
|
||||||
|
if(nextPage!=null && !isLoading){
|
||||||
|
isLoading=true
|
||||||
|
fetchNextPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//scroll view is not at bottom
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,21 +96,7 @@ class ChannelFragment : Fragment() {
|
|||||||
Picasso.get().load(response.avatarUrl).into(channelImage)
|
Picasso.get().load(response.avatarUrl).into(channelImage)
|
||||||
channelAdapter = ChannelAdapter(response.relatedStreams!!.toMutableList())
|
channelAdapter = ChannelAdapter(response.relatedStreams!!.toMutableList())
|
||||||
view.findViewById<RecyclerView>(R.id.channel_recView).adapter = channelAdapter
|
view.findViewById<RecyclerView>(R.id.channel_recView).adapter = channelAdapter
|
||||||
val scrollView = view.findViewById<ScrollView>(R.id.channel_scrollView)
|
|
||||||
scrollView.viewTreeObserver
|
|
||||||
.addOnScrollChangedListener {
|
|
||||||
if (scrollView.getChildAt(0).bottom
|
|
||||||
== (scrollView.height + scrollView.scrollY)) {
|
|
||||||
//scroll view is at bottom
|
|
||||||
if(nextPage!=null && !isLoading){
|
|
||||||
isLoading=true
|
|
||||||
fetchNextPage()
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//scroll view is not at bottom
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class LoginDialog : DialogFragment() {
|
|||||||
}
|
}
|
||||||
if (response.error!= null){
|
if (response.error!= null){
|
||||||
Toast.makeText(context, response.error, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, response.error, Toast.LENGTH_SHORT).show()
|
||||||
}else{
|
}else if(response.token!=null){
|
||||||
Toast.makeText(context,R.string.loggedIn, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context,R.string.loggedIn, Toast.LENGTH_SHORT).show()
|
||||||
dialog?.dismiss()
|
dialog?.dismiss()
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ class LoginDialog : DialogFragment() {
|
|||||||
}
|
}
|
||||||
if (response.error!= null){
|
if (response.error!= null){
|
||||||
Toast.makeText(context, response.error, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, response.error, Toast.LENGTH_SHORT).show()
|
||||||
}else{
|
}else if(response.token!=null){
|
||||||
Toast.makeText(context,R.string.registered, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context,R.string.registered, Toast.LENGTH_SHORT).show()
|
||||||
dialog?.dismiss()
|
dialog?.dismiss()
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
lateinit var bottomNavigationView: BottomNavigationView
|
lateinit var bottomNavigationView: BottomNavigationView
|
||||||
lateinit var toolbar: Toolbar
|
lateinit var toolbar: Toolbar
|
||||||
lateinit var navController : NavController
|
lateinit var navController : NavController
|
||||||
|
|
||||||
var f = false
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
@ -57,6 +55,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
toolbar.setNavigationOnClickListener{
|
toolbar.setNavigationOnClickListener{
|
||||||
//settings fragment stuff
|
//settings fragment stuff
|
||||||
|
navController.navigate(R.id.settings)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
app/src/main/java/com/github/libretube/Settings.kt
Normal file
10
app/src/main/java/com/github/libretube/Settings.kt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package com.github.libretube
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
|
||||||
|
class Settings : PreferenceFragmentCompat() {
|
||||||
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
|
setPreferencesFromResource(R.xml.settings, rootKey)
|
||||||
|
}
|
||||||
|
}
|
@ -54,4 +54,8 @@
|
|||||||
android:name="playlist_id"
|
android:name="playlist_id"
|
||||||
app:argType="string" />
|
app:argType="string" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/settings"
|
||||||
|
android:name="com.github.libretube.Settings"
|
||||||
|
android:label="Settings" />
|
||||||
</navigation>
|
</navigation>
|
14
app/src/main/res/xml/settings.xml
Normal file
14
app/src/main/res/xml/settings.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<androidx.preference.SwitchPreferenceCompat
|
||||||
|
app:key="notifications"
|
||||||
|
app:title="Enable message notifications"/>
|
||||||
|
|
||||||
|
<androidx.preference.Preference
|
||||||
|
app:key="feedback"
|
||||||
|
app:title="Send feedback"
|
||||||
|
app:summary="Report technical issues or suggest new features"/>
|
||||||
|
|
||||||
|
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user