mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Merge pull request #659 from Bnyro/master
UI improvements and settings crash fixed
This commit is contained in:
commit
1bd9e43c85
@ -27,7 +27,7 @@
|
|||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.NoInternetActivity"
|
android:name=".activities.NoInternetActivity"
|
||||||
android:label="@string/noInternet"/>
|
android:label="@string/noInternet" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.SettingsActivity"
|
android:name=".activities.SettingsActivity"
|
||||||
android:label="@string/settings" />
|
android:label="@string/settings" />
|
||||||
|
@ -79,7 +79,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
// hide the trending page if enabled
|
// hide the trending page if enabled
|
||||||
val hideTrendingPage = PreferenceHelper.getBoolean(this, "hide_trending_page", false)
|
val hideTrendingPage = PreferenceHelper.getBoolean(this, "hide_trending_page", false)
|
||||||
if (hideTrendingPage) bottomNavigationView.menu.findItem(R.id.homeFragment).isVisible = false
|
if (hideTrendingPage) bottomNavigationView.menu.findItem(R.id.homeFragment).isVisible =
|
||||||
|
false
|
||||||
|
|
||||||
// navigate to the default start tab
|
// navigate to the default start tab
|
||||||
when (PreferenceHelper.getString(this, "default_tab", "home")) {
|
when (PreferenceHelper.getString(this, "default_tab", "home")) {
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package com.github.libretube.dialogs
|
package com.github.libretube.dialogs
|
||||||
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.text.HtmlCompat
|
import androidx.core.text.HtmlCompat
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
|
import com.github.libretube.activities.SettingsActivity
|
||||||
import com.github.libretube.databinding.DialogCustomInstanceBinding
|
import com.github.libretube.databinding.DialogCustomInstanceBinding
|
||||||
import com.github.libretube.obj.CustomInstance
|
import com.github.libretube.obj.CustomInstance
|
||||||
import com.github.libretube.util.PreferenceHelper
|
import com.github.libretube.util.PreferenceHelper
|
||||||
@ -43,7 +45,8 @@ class CustomInstanceDialog : DialogFragment() {
|
|||||||
URL(customInstance.frontendUrl).toURI()
|
URL(customInstance.frontendUrl).toURI()
|
||||||
|
|
||||||
PreferenceHelper.saveCustomInstance(requireContext(), customInstance)
|
PreferenceHelper.saveCustomInstance(requireContext(), customInstance)
|
||||||
activity?.recreate()
|
val intent = Intent(context, SettingsActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
dismiss()
|
dismiss()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
// invalid URL
|
// invalid URL
|
||||||
|
@ -46,7 +46,8 @@ class LibraryFragment : Fragment() {
|
|||||||
token = PreferenceHelper.getToken(requireContext())
|
token = PreferenceHelper.getToken(requireContext())
|
||||||
|
|
||||||
// hide watch history button of history disabled
|
// hide watch history button of history disabled
|
||||||
val watchHistoryEnabled = PreferenceHelper.getBoolean(requireContext(), "watch_history_toggle", true)
|
val watchHistoryEnabled =
|
||||||
|
PreferenceHelper.getBoolean(requireContext(), "watch_history_toggle", true)
|
||||||
if (!watchHistoryEnabled) {
|
if (!watchHistoryEnabled) {
|
||||||
binding.showWatchHistory.visibility = View.GONE
|
binding.showWatchHistory.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.github.libretube.preferences
|
package com.github.libretube.preferences
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
@ -49,7 +51,8 @@ class AdvancedSettings : PreferenceFragmentCompat() {
|
|||||||
PreferenceHelper.setToken(requireContext(), "")
|
PreferenceHelper.setToken(requireContext(), "")
|
||||||
|
|
||||||
requireMainActivityRestart = true
|
requireMainActivityRestart = true
|
||||||
activity?.recreate()
|
val intent = Intent(context, SettingsActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
.setNegativeButton(getString(R.string.cancel)) { _, _ -> }
|
.setNegativeButton(getString(R.string.cancel)) { _, _ -> }
|
||||||
.setTitle(R.string.reset)
|
.setTitle(R.string.reset)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.github.libretube.preferences
|
package com.github.libretube.preferences
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
@ -28,7 +30,8 @@ class AppearanceSettings : PreferenceFragmentCompat() {
|
|||||||
val accentColor = findPreference<Preference>("accent_color")
|
val accentColor = findPreference<Preference>("accent_color")
|
||||||
accentColor?.setOnPreferenceChangeListener { _, _ ->
|
accentColor?.setOnPreferenceChangeListener { _, _ ->
|
||||||
requireMainActivityRestart = true
|
requireMainActivityRestart = true
|
||||||
activity?.recreate()
|
val intent = Intent(context, SettingsActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.github.libretube.preferences
|
|||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.content.ContentResolver
|
import android.content.ContentResolver
|
||||||
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@ -135,7 +136,8 @@ class InstanceSettings : PreferenceFragmentCompat() {
|
|||||||
val clearCustomInstances = findPreference<Preference>("clearCustomInstances")
|
val clearCustomInstances = findPreference<Preference>("clearCustomInstances")
|
||||||
clearCustomInstances?.setOnPreferenceClickListener {
|
clearCustomInstances?.setOnPreferenceClickListener {
|
||||||
PreferenceHelper.removePreference(requireContext(), "customInstances")
|
PreferenceHelper.removePreference(requireContext(), "customInstances")
|
||||||
activity?.recreate()
|
val intent = Intent(context, SettingsActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
app/src/main/res/drawable/ic_time_outlined.xml
Normal file
22
app/src/main/res/drawable/ic_time_outlined.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="?android:attr/colorControlNormal"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:pathData="M21.25,12C21.25,17.108 17.109,21.25 12,21.25C6.892,21.25 2.75,17.108 2.75,12C2.75,6.891 6.892,2.75 12,2.75C17.109,2.75 21.25,6.891 21.25,12Z"
|
||||||
|
android:strokeWidth="2.5"
|
||||||
|
android:strokeColor="#130F26"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M16.191,12.767L11.661,12.693V7.846"
|
||||||
|
android:strokeWidth="2.5"
|
||||||
|
android:strokeColor="#130F26"
|
||||||
|
android:strokeLineCap="round"
|
||||||
|
android:strokeLineJoin="round" />
|
||||||
|
</vector>
|
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/noInternet_settingsImageView"
|
android:id="@+id/noInternet_settingsImageView"
|
||||||
android:padding="3dp"
|
|
||||||
android:layout_width="33dp"
|
android:layout_width="33dp"
|
||||||
android:layout_height="33dp"
|
android:layout_height="33dp"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:src="@drawable/ic_settings"
|
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:padding="3dp"
|
||||||
|
android:src="@drawable/ic_settings"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
@ -11,79 +11,88 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/showWatchHistory"
|
android:id="@+id/showWatchHistory"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/watch_history"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:textSize="20sp"/>
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp">
|
||||||
|
|
||||||
</LinearLayout>
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:src="@drawable/ic_time_outlined" />
|
||||||
|
|
||||||
<RelativeLayout
|
<TextView
|
||||||
android:id="@+id/loginOrRegister2"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_marginLeft="15dp"
|
||||||
android:layout_centerHorizontal="true"
|
android:text="@string/watch_history"
|
||||||
android:layout_centerVertical="true">
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<ImageView
|
</LinearLayout>
|
||||||
android:id="@+id/boogh"
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:src="@drawable/ic_login" />
|
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:id="@+id/text_like"
|
android:id="@+id/loginOrRegister2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_below="@id/boogh"
|
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:gravity="center"
|
android:layout_centerVertical="true">
|
||||||
android:text="@string/please_login"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<com.github.libretube.util.CustomSwipeToRefresh
|
<ImageView
|
||||||
android:id="@+id/playlist_refresh"
|
android:id="@+id/boogh"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="100dp"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="100dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:src="@drawable/ic_login" />
|
||||||
|
|
||||||
<ScrollView
|
<TextView
|
||||||
android:id="@+id/scrollview_playlist"
|
android:id="@+id/text_like"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/boogh"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/please_login"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<com.github.libretube.util.CustomSwipeToRefresh
|
||||||
|
android:id="@+id/playlist_refresh"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
|
android:id="@+id/scrollview_playlist"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:descendantFocusability="blocksDescendants">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<RelativeLayout
|
||||||
android:id="@+id/playlist_recView"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:nestedScrollingEnabled="false" />
|
android:descendantFocusability="blocksDescendants">
|
||||||
|
|
||||||
</RelativeLayout>
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
</LinearLayout>
|
android:id="@+id/playlist_recView"
|
||||||
</ScrollView>
|
android:layout_width="match_parent"
|
||||||
</com.github.libretube.util.CustomSwipeToRefresh>
|
android:layout_height="match_parent"
|
||||||
|
android:nestedScrollingEnabled="false" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
</com.github.libretube.util.CustomSwipeToRefresh>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -7,22 +7,23 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingHorizontal="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:layout_marginBottom="8dp" >
|
android:paddingHorizontal="8dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/watch_history"
|
android:layout_weight="1"
|
||||||
android:layout_weight="1"
|
android:text="@string/watch_history"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageView
|
||||||
android:id="@+id/clearHistory"
|
android:id="@+id/clearHistory"
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_width="16dp"
|
android:layout_width="16dp"
|
||||||
android:layout_height="16dp"
|
android:layout_height="16dp"
|
||||||
android:src="@drawable/ic_trash"/>
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:src="@drawable/ic_reset" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -31,6 +32,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
android:nestedScrollingEnabled="false"/>
|
android:nestedScrollingEnabled="false" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -47,5 +47,5 @@
|
|||||||
android:id="@+id/watchHistoryFragment"
|
android:id="@+id/watchHistoryFragment"
|
||||||
android:name="com.github.libretube.fragments.WatchHistoryFragment"
|
android:name="com.github.libretube.fragments.WatchHistoryFragment"
|
||||||
android:label="@string/watch_history"
|
android:label="@string/watch_history"
|
||||||
tools:layout="@layout/fragment_watch_history"/>
|
tools:layout="@layout/fragment_watch_history" />
|
||||||
</navigation>
|
</navigation>
|
@ -207,5 +207,5 @@
|
|||||||
<string name="deleteAccount_summary">Delete your Piped account</string>
|
<string name="deleteAccount_summary">Delete your Piped account</string>
|
||||||
<string name="account">Account</string>
|
<string name="account">Account</string>
|
||||||
<string name="restore">Restore</string>
|
<string name="restore">Restore</string>
|
||||||
<string name="watch_history">Watch history</string>
|
<string name="watch_history">Watch History</string>
|
||||||
</resources>
|
</resources>
|
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:icon="@drawable/ic_history_filled"
|
android:icon="@drawable/ic_time_outlined"
|
||||||
app:key="watch_history_toggle"
|
app:key="watch_history_toggle"
|
||||||
app:title="@string/watch_history" />
|
app:title="@string/watch_history" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user