Merge pull request #422 from Bnyro/master

back button in settings
This commit is contained in:
Bnyro 2022-06-07 20:17:45 +02:00 committed by GitHub
commit aa11dfd45b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import android.app.NotificationManager
import android.os.Build
import android.os.Bundle
import android.view.View
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import com.github.libretube.preferences.MainSettings
@ -30,6 +31,12 @@ class SettingsActivity : AppCompatActivity() {
view.animate().alpha(1F).duration = 300
setContentView(R.layout.activity_settings)
val backButton = view.findViewById<ImageView>(R.id.back_imageView)
backButton.setOnClickListener {
onBackPressed()
}
if (savedInstanceState == null) {
supportFragmentManager
.beginTransaction()

View File

@ -3,6 +3,7 @@ package com.github.libretube.preferences
import android.content.Intent
import android.os.Bundle
import android.provider.DocumentsContract
import android.widget.TextView
import androidx.core.net.toUri
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
@ -15,6 +16,9 @@ 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 clearHistory = findPreference<Preference>("clear_history")
clearHistory?.setOnPreferenceClickListener {
val sharedPreferences =

View File

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:autoMirrored="true"
android:tint="?android:attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z" />
</vector>

View File

@ -1,9 +1,33 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/back_imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_arrow_back"/>
<TextView
android:id="@+id/settings_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings"
android:layout_marginLeft="14dp"
android:textSize="20sp"
android:layout_gravity="center"/>
</LinearLayout>
<LinearLayout
android:id="@+id/settings"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>