diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt index 888c99e27..66c43661f 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt @@ -17,7 +17,6 @@ import com.github.libretube.extensions.TAG import com.github.libretube.extensions.toStreamItem import com.github.libretube.extensions.toastFromMainThread import com.github.libretube.ui.models.PlaylistViewModel -import com.github.libretube.util.ThemeHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -31,7 +30,6 @@ class AddToPlaylistDialog( override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { binding = DialogAddtoplaylistBinding.inflate(layoutInflater) - binding.title.text = ThemeHelper.getStyledAppName(requireContext()) binding.createPlaylist.setOnClickListener { CreatePlaylistDialog { diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt index 6df8d0192..ac1ec1a6a 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/CreatePlaylistDialog.kt @@ -9,7 +9,6 @@ import com.github.libretube.R import com.github.libretube.api.PlaylistsHelper import com.github.libretube.databinding.DialogCreatePlaylistBinding import com.github.libretube.util.TextUtils -import com.github.libretube.util.ThemeHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder class CreatePlaylistDialog( @@ -20,8 +19,6 @@ class CreatePlaylistDialog( override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { binding = DialogCreatePlaylistBinding.inflate(layoutInflater) - binding.title.text = ThemeHelper.getStyledAppName(requireContext()) - binding.clonePlaylist.setOnClickListener { val playlistUrl = binding.playlistUrl.text.toString() if (!TextUtils.validateUrl(playlistUrl)) { diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/CustomInstanceDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/CustomInstanceDialog.kt index 86aa9343f..f9a4befde 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/CustomInstanceDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/CustomInstanceDialog.kt @@ -9,7 +9,6 @@ import com.github.libretube.databinding.DialogCustomInstanceBinding import com.github.libretube.db.DatabaseHolder.Companion.Database import com.github.libretube.db.obj.CustomInstance import com.github.libretube.extensions.query -import com.github.libretube.util.ThemeHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder import java.net.URL @@ -64,8 +63,6 @@ class CustomInstanceDialog : DialogFragment() { } } - binding.title.text = ThemeHelper.getStyledAppName(requireContext()) - return MaterialAlertDialogBuilder(requireContext()) .setView(binding.root) .show() diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt index 2fc799793..3613aabee 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/DeleteAccountDialog.kt @@ -11,7 +11,6 @@ import com.github.libretube.api.RetrofitInstance import com.github.libretube.databinding.DialogDeleteAccountBinding import com.github.libretube.extensions.TAG import com.github.libretube.util.PreferenceHelper -import com.github.libretube.util.ThemeHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder class DeleteAccountDialog : DialogFragment() { @@ -32,8 +31,6 @@ class DeleteAccountDialog : DialogFragment() { } } - binding.title.text = ThemeHelper.getStyledAppName(requireContext()) - return MaterialAlertDialogBuilder(requireContext()) .setView(binding.root) .show() diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt index b3dc7d2c3..3cdeb9732 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt @@ -19,7 +19,6 @@ import com.github.libretube.extensions.sanitize import com.github.libretube.services.DownloadService import com.github.libretube.util.ImageHelper import com.github.libretube.util.MetadataHelper -import com.github.libretube.util.ThemeHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder import java.io.IOException import retrofit2.HttpException @@ -34,8 +33,6 @@ class DownloadDialog( fetchAvailableSources() - binding.title.text = ThemeHelper.getStyledAppName(requireContext()) - binding.audioRadio.setOnClickListener { binding.videoSpinner.visibility = View.GONE } diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt index 861dfb52f..d0306a2a8 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/LoginDialog.kt @@ -13,7 +13,6 @@ import com.github.libretube.databinding.DialogLoginBinding import com.github.libretube.extensions.TAG import com.github.libretube.util.PreferenceHelper import com.github.libretube.util.TextUtils -import com.github.libretube.util.ThemeHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder class LoginDialog : DialogFragment() { @@ -57,8 +56,6 @@ class LoginDialog : DialogFragment() { } } - binding.title.text = ThemeHelper.getStyledAppName(requireContext()) - return MaterialAlertDialogBuilder(requireContext()) .setView(binding.root) .show() diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt index 9a152a1e6..a03ff7678 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/LogoutDialog.kt @@ -1,5 +1,6 @@ package com.github.libretube.ui.dialogs +import android.annotation.SuppressLint import android.app.Dialog import android.os.Bundle import android.widget.Toast @@ -7,12 +8,12 @@ import androidx.fragment.app.DialogFragment import com.github.libretube.R import com.github.libretube.databinding.DialogLogoutBinding import com.github.libretube.util.PreferenceHelper -import com.github.libretube.util.ThemeHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder class LogoutDialog : DialogFragment() { private lateinit var binding: DialogLogoutBinding + @SuppressLint("SetTextI18n") override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { binding = DialogLogoutBinding.inflate(layoutInflater) @@ -27,8 +28,6 @@ class LogoutDialog : DialogFragment() { activity?.recreate() } - binding.title.text = ThemeHelper.getStyledAppName(requireContext()) - return MaterialAlertDialogBuilder(requireContext()) .setView(binding.root) .show() diff --git a/app/src/main/java/com/github/libretube/ui/fragments/BookmarksFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/BookmarksFragment.kt index 47bfa84a5..abd456dee 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/BookmarksFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/BookmarksFragment.kt @@ -4,7 +4,6 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager import com.github.libretube.databinding.FragmentBookmarksBinding import com.github.libretube.db.DatabaseHolder.Companion.Database diff --git a/app/src/main/java/com/github/libretube/ui/views/AppNameTextView.kt b/app/src/main/java/com/github/libretube/ui/views/AppNameTextView.kt new file mode 100644 index 000000000..aad8a7f5a --- /dev/null +++ b/app/src/main/java/com/github/libretube/ui/views/AppNameTextView.kt @@ -0,0 +1,23 @@ +package com.github.libretube.ui.views + +import android.content.Context +import android.util.AttributeSet +import android.util.TypedValue +import androidx.appcompat.widget.AppCompatTextView +import com.github.libretube.util.ThemeHelper + +class AppNameTextView : AppCompatTextView { + constructor(context: Context, attributeSet: AttributeSet?) : super(context, attributeSet) + + constructor(context: Context) : super(context, null) + + init { + text = ThemeHelper.getStyledAppName(context) + textSize = spToPixel(10f) + } + + @Suppress("SameParameterValue") + private fun spToPixel(sp: Float): Float { + return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, resources.displayMetrics) + } +} diff --git a/app/src/main/res/layout/dialog_addtoplaylist.xml b/app/src/main/res/layout/dialog_addtoplaylist.xml index 8819546e8..f7d04c57e 100644 --- a/app/src/main/res/layout/dialog_addtoplaylist.xml +++ b/app/src/main/res/layout/dialog_addtoplaylist.xml @@ -5,14 +5,11 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + android:gravity="center" /> - + android:gravity="center" /> - + android:gravity="center" /> - + android:gravity="center" /> - + android:gravity="center" /> - + android:gravity="center" /> - + android:gravity="center" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f417ea6ed..b059131ab 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -53,7 +53,7 @@ Playlist created. Playlist name The playlist name can\'t be empty - Add + Add to playlist Done. Failed :( About