1
0
mirror of https://github.com/libre-tube/LibreTube.git synced 2024-12-15 06:40:30 +05:30

Merge pull request from Bnyro/master

changing topbar text in settings categories
This commit is contained in:
Bnyro 2022-06-07 21:23:37 +02:00 committed by GitHub
commit a2d35469f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 9 deletions

View File

@ -4,7 +4,8 @@ import android.app.NotificationManager
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageButton
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import com.github.libretube.preferences.MainSettings import com.github.libretube.preferences.MainSettings
@ -32,7 +33,7 @@ class SettingsActivity : AppCompatActivity() {
setContentView(R.layout.activity_settings) 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 { backButton.setOnClickListener {
onBackPressed() onBackPressed()
} }
@ -65,6 +66,8 @@ class SettingsActivity : AppCompatActivity() {
.beginTransaction() .beginTransaction()
.replace(R.id.settings, MainSettings()) .replace(R.id.settings, MainSettings())
.commit() .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?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) 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) val appVersion = view?.findViewById<TextView>(R.id.app_version)
appVersion.text = BuildConfig.VERSION_NAME appVersion.text = BuildConfig.VERSION_NAME
val website = view?.findViewById<MaterialCardView>(R.id.website) val website = view?.findViewById<MaterialCardView>(R.id.website)

View File

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

View File

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

View File

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

View File

@ -7,15 +7,17 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ImageView <ImageButton
android:id="@+id/back_imageView" android:id="@+id/back_imageButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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"/> android:src="@drawable/ic_arrow_back"/>
<TextView <TextView
android:id="@+id/settings_textView" android:id="@+id/topBar_textView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/settings" android:text="@string/settings"

View File

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