diff --git a/app/src/main/java/com/github/libretube/extensions/GetStyledSnackBar.kt b/app/src/main/java/com/github/libretube/extensions/GetStyledSnackBar.kt index 4ec13f654..1bd6d4b58 100644 --- a/app/src/main/java/com/github/libretube/extensions/GetStyledSnackBar.kt +++ b/app/src/main/java/com/github/libretube/extensions/GetStyledSnackBar.kt @@ -2,6 +2,7 @@ package com.github.libretube.extensions import android.view.View import android.widget.FrameLayout +import androidx.core.content.res.ResourcesCompat import com.github.libretube.R import com.google.android.material.snackbar.Snackbar @@ -21,6 +22,6 @@ fun View.getStyledSnackBar(text: Int): Snackbar { ) snackBar.view.layoutParams = params - snackBar.view.background = resources.getDrawable(R.drawable.snackbar_shape, null) + snackBar.view.background = ResourcesCompat.getDrawable(resources, R.drawable.snackbar_shape, null) return snackBar } diff --git a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt index 277d65cc5..3ec3a12b7 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/AboutActivity.kt @@ -10,7 +10,6 @@ import android.os.Bundle import androidx.core.text.HtmlCompat import androidx.core.text.parseAsHtml import com.github.libretube.R -import com.github.libretube.constants.DONATE_URL import com.github.libretube.constants.GITHUB_URL import com.github.libretube.constants.LICENSE_URL import com.github.libretube.constants.PIPED_GITHUB_URL @@ -31,6 +30,10 @@ class AboutActivity : BaseActivity() { binding = ActivityAboutBinding.inflate(layoutInflater) setContentView(binding.root) + binding.toolbar.setNavigationOnClickListener { + onBackPressedDispatcher.onBackPressed() + } + binding.appIcon.setOnClickListener { val sendIntent: Intent = Intent().apply { action = Intent.ACTION_SEND @@ -66,14 +69,6 @@ class AboutActivity : BaseActivity() { true } - binding.donate.setOnClickListener { - openLinkFromHref(DONATE_URL) - } - binding.donate.setOnLongClickListener { - onLongClick(DONATE_URL) - true - } - binding.github.setOnClickListener { openLinkFromHref(GITHUB_URL) } diff --git a/app/src/main/java/com/github/libretube/ui/activities/CommunityActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/CommunityActivity.kt index b48da6bc0..f6d89650c 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/CommunityActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/CommunityActivity.kt @@ -20,6 +20,10 @@ class CommunityActivity : BaseActivity() { binding = ActivityCommunityBinding.inflate(layoutInflater) setContentView(binding.root) + binding.toolbar.setNavigationOnClickListener { + onBackPressedDispatcher.onBackPressed() + } + binding.telegram.setOnClickListener { openLinkFromHref(TELEGRAM_URL) } diff --git a/app/src/main/java/com/github/libretube/ui/activities/SettingsActivity.kt b/app/src/main/java/com/github/libretube/ui/activities/SettingsActivity.kt index f2c29bd19..690bdac09 100644 --- a/app/src/main/java/com/github/libretube/ui/activities/SettingsActivity.kt +++ b/app/src/main/java/com/github/libretube/ui/activities/SettingsActivity.kt @@ -17,7 +17,7 @@ class SettingsActivity : BaseActivity() { setContentView(binding.root) - binding.backImageButton.setOnClickListener { + binding.toolbar.setNavigationOnClickListener { onBackPressedDispatcher.onBackPressed() } @@ -51,6 +51,6 @@ class SettingsActivity : BaseActivity() { } fun changeTopBarText(text: String) { - if (this::binding.isInitialized) binding.topBarTextView.text = text + if (this::binding.isInitialized) binding.toolbar.title = text } } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/BackupOptionsAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/BackupOptionsAdapter.kt deleted file mode 100644 index df171b4af..000000000 --- a/app/src/main/java/com/github/libretube/ui/adapters/BackupOptionsAdapter.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.github.libretube.ui.adapters - -import android.view.LayoutInflater -import android.view.ViewGroup -import androidx.recyclerview.widget.RecyclerView -import com.github.libretube.databinding.BackupRowBinding - -class BackupOptionsAdapter( - private val options: List, - private val onChange: (position: Int, isChecked: Boolean) -> Unit -) : RecyclerView.Adapter() { - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BackupOptionsViewHolder { - val binding = BackupRowBinding.inflate( - LayoutInflater.from(parent.context), - parent, - false - ) - return BackupOptionsViewHolder(binding) - } - - override fun getItemCount(): Int { - return options.size - } - - override fun onBindViewHolder(holder: BackupOptionsViewHolder, position: Int) { - holder.binding.apply { - title.text = root.context?.getString(options[position]) - switchWidget.setOnCheckedChangeListener { _, isChecked -> - onChange.invoke(position, isChecked) - } - } - } -} - -class BackupOptionsViewHolder( - val binding: BackupRowBinding -) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt index 494eb63c7..4723ce7ef 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/BackupDialog.kt @@ -3,25 +3,20 @@ package com.github.libretube.ui.dialogs import android.app.Dialog import android.os.Bundle import androidx.fragment.app.DialogFragment -import androidx.recyclerview.widget.LinearLayoutManager import com.github.libretube.R -import com.github.libretube.databinding.DialogBackupBinding import com.github.libretube.db.DatabaseHolder.Companion.Database import com.github.libretube.obj.BackupFile import com.github.libretube.obj.PreferenceItem -import com.github.libretube.ui.adapters.BackupOptionsAdapter import com.github.libretube.util.PreferenceHelper import com.google.android.material.dialog.MaterialAlertDialogBuilder class BackupDialog( private val createBackupFile: (BackupFile) -> Unit ) : DialogFragment() { - private lateinit var binding: DialogBackupBinding - private val backupFile = BackupFile() override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - val backupOptions = listOf( + val backupOptionNames = listOf( R.string.watch_history, R.string.watch_positions, R.string.search_history, @@ -30,18 +25,15 @@ class BackupDialog( R.string.preferences ) - val selected = MutableList(backupOptions.size) { false } + val backupItems = backupOptionNames.map { context?.getString(it)!! }.toTypedArray() - binding = DialogBackupBinding.inflate(layoutInflater) - binding.backupOptionsRecycler.layoutManager = LinearLayoutManager(context) - binding.backupOptionsRecycler.adapter = - BackupOptionsAdapter(backupOptions) { position, isChecked -> - selected[position] = isChecked - } + val selected = BooleanArray(backupOptionNames.size) { false } return MaterialAlertDialogBuilder(requireContext()) .setTitle(R.string.backup) - .setView(binding.root) + .setMultiChoiceItems(backupItems, selected) { _, index, newValue -> + selected[index] = newValue + } .setNegativeButton(R.string.cancel, null) .setPositiveButton(R.string.backup) { _, _ -> val thread = Thread { diff --git a/app/src/main/res/drawable/ic_arrow_back.xml b/app/src/main/res/drawable/ic_arrow_back.xml deleted file mode 100644 index cd06f3098..000000000 --- a/app/src/main/res/drawable/ic_arrow_back.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_campaign.xml b/app/src/main/res/drawable/ic_campaign.xml deleted file mode 100644 index 7f22d42a0..000000000 --- a/app/src/main/res/drawable/ic_campaign.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_community.xml b/app/src/main/res/drawable/ic_community.xml deleted file mode 100644 index 63b593147..000000000 --- a/app/src/main/res/drawable/ic_community.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_filter.xml b/app/src/main/res/drawable/ic_filter.xml deleted file mode 100644 index 52d959093..000000000 --- a/app/src/main/res/drawable/ic_filter.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_folder.xml b/app/src/main/res/drawable/ic_folder.xml deleted file mode 100644 index 4350ae5ec..000000000 --- a/app/src/main/res/drawable/ic_folder.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_home_outlined.xml b/app/src/main/res/drawable/ic_home_outlined.xml deleted file mode 100644 index 745a5e520..000000000 --- a/app/src/main/res/drawable/ic_home_outlined.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_sponsorblock.xml b/app/src/main/res/drawable/ic_sponsorblock.xml deleted file mode 100644 index afe0e720b..000000000 --- a/app/src/main/res/drawable/ic_sponsorblock.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_toggle_off.xml b/app/src/main/res/drawable/ic_toggle_off.xml deleted file mode 100644 index 1f3a01873..000000000 --- a/app/src/main/res/drawable/ic_toggle_off.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_toggle_on.xml b/app/src/main/res/drawable/ic_toggle_on.xml deleted file mode 100644 index d19f35406..000000000 --- a/app/src/main/res/drawable/ic_toggle_on.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_visibility.xml b/app/src/main/res/drawable/ic_visibility.xml deleted file mode 100644 index b49cf911c..000000000 --- a/app/src/main/res/drawable/ic_visibility.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/rounded_bottom_sheet.xml b/app/src/main/res/drawable/rounded_bottom_sheet.xml deleted file mode 100644 index a911e59af..000000000 --- a/app/src/main/res/drawable/rounded_bottom_sheet.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 4999b4636..d2e672cd9 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -9,12 +9,19 @@ android:layout_height="wrap_content" android:orientation="vertical"> + + @@ -100,24 +107,6 @@ - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_community.xml b/app/src/main/res/layout/activity_community.xml index 8b7715693..8eabde815 100644 --- a/app/src/main/res/layout/activity_community.xml +++ b/app/src/main/res/layout/activity_community.xml @@ -9,24 +9,22 @@ android:layout_height="wrap_content" android:orientation="vertical"> + + - - diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 904b19f13..55a5c0926 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -1,37 +1,20 @@ - + app:navigationIcon="?homeAsUpIndicator" + app:title="@string/settings" /> - - - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/backup_row.xml b/app/src/main/res/layout/backup_row.xml deleted file mode 100644 index 340927967..000000000 --- a/app/src/main/res/layout/backup_row.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/channel_row.xml b/app/src/main/res/layout/channel_row.xml index 1611ae45c..6e4d00831 100644 --- a/app/src/main/res/layout/channel_row.xml +++ b/app/src/main/res/layout/channel_row.xml @@ -8,8 +8,8 @@ android:layout_width="70dp" android:layout_height="70dp" android:layout_marginVertical="5dp" - android:layout_marginStart="40dp" - android:layout_marginEnd="50dp" + android:layout_marginStart="50dp" + android:layout_marginEnd="55dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/dialog_backup.xml b/app/src/main/res/layout/dialog_backup.xml deleted file mode 100644 index 5b4fe20df..000000000 --- a/app/src/main/res/layout/dialog_backup.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - \ No newline at end of file