changing topbar text in settings categories

This commit is contained in:
Bnyro 2022-06-07 21:22:35 +02:00
parent 6d6aaf08d1
commit e1e6933c34
7 changed files with 26 additions and 8 deletions

View File

@ -4,7 +4,9 @@ import android.app.NotificationManager
import android.os.Build
import android.os.Bundle
import android.view.View
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import com.github.libretube.preferences.MainSettings
@ -32,7 +34,7 @@ class SettingsActivity : AppCompatActivity() {
setContentView(R.layout.activity_settings)
val backButton = view.findViewById<ImageView>(R.id.back_imageView)
val backButton = view.findViewById<ImageButton>(R.id.back_imageButton)
backButton.setOnClickListener {
onBackPressed()
}
@ -65,6 +67,8 @@ class SettingsActivity : AppCompatActivity() {
.beginTransaction()
.replace(R.id.settings, MainSettings())
.commit()
val topBarTextView = findViewById<TextView>(R.id.topBar_textView)
topBarTextView?.text = getString(R.string.settings)
}
}
}

View File

@ -27,6 +27,9 @@ class AboutFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val topBarText = activity?.findViewById<TextView>(R.id.topBar_textView)
topBarText?.text = getString(R.string.about)
val appVersion = view?.findViewById<TextView>(R.id.app_version)
appVersion.text = BuildConfig.VERSION_NAME
val website = view?.findViewById<MaterialCardView>(R.id.website)

View File

@ -16,8 +16,8 @@ class AdvancedSettings : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.advanced_settings, rootKey)
val settingsTextView = view?.findViewById<TextView>(R.id.settings_textView)
settingsTextView?.text = getString(R.string.advanced)
val topBarTextView = activity?.findViewById<TextView>(R.id.topBar_textView)
topBarTextView?.text = getString(R.string.advanced)
val clearHistory = findPreference<Preference>("clear_history")
clearHistory?.setOnPreferenceClickListener {

View File

@ -1,6 +1,7 @@
package com.github.libretube.preferences
import android.os.Bundle
import android.widget.TextView
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
@ -13,6 +14,9 @@ class AppearanceSettings : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.appearance_settings, rootKey)
val topBarTextView = activity?.findViewById<TextView>(R.id.topBar_textView)
topBarTextView?.text = getString(R.string.appearance)
val themeToggle = findPreference<ListPreference>("theme_togglee")
themeToggle?.setOnPreferenceChangeListener { _, _ ->
activity?.recreate()

View File

@ -1,6 +1,7 @@
package com.github.libretube.preferences
import android.os.Bundle
import android.widget.TextView
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
import com.github.libretube.R
@ -20,6 +21,10 @@ class SponsorBlockSettings : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.sponsorblock_settings, rootKey)
val topBarTextView = activity?.findViewById<TextView>(R.id.topBar_textView)
topBarTextView?.text = getString(R.string.sponsorblock)
val sponsorBlockToggle = findPreference<SwitchPreferenceCompat>("sb_enabled_key")
sponsorBlockToggle?.setOnPreferenceChangeListener { _, newValue ->
sponsorBlockEnabled = newValue as Boolean

View File

@ -7,15 +7,17 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/back_imageView"
<ImageButton
android:id="@+id/back_imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_marginLeft="6dp"
android:layout_marginVertical="10dp"
android:backgroundTint="@android:color/transparent"
android:src="@drawable/ic_arrow_back"/>
<TextView
android:id="@+id/settings_textView"
android:id="@+id/topBar_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings"

View File

@ -14,7 +14,7 @@
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:layout_marginTop="100dp"
android:layout_marginTop="30dp"
android:src="@mipmap/ic_launcher" />
<TextView