From 0c63d836c905b45344a28d6934da5ff15303bb04 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 3 Jul 2022 14:14:39 +0200 Subject: [PATCH 1/3] fix height --- .../main/java/com/github/libretube/fragments/PlayerFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index 466ecf12f..5b787ba2d 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -684,7 +684,7 @@ class PlayerFragment : Fragment() { // Redraw myView (binding.mainContainer.layoutParams as ConstraintLayout.LayoutParams).apply { matchConstraintPercentHeight = ( - videoSize.height / videoSize.width * currentWidth + videoSize.height / videoSize.width ).toFloat() } binding.mainContainer.requestLayout() From c59b719b92bdfe5578fdeff18462d971d382a32e Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 3 Jul 2022 14:43:29 +0200 Subject: [PATCH 2/3] convert about to cardviews --- .../libretube/preferences/AboutFragment.kt | 4 +- app/src/main/res/layout/fragment_about.xml | 183 ++++++++++-------- app/src/main/res/layout/fragment_player.xml | 5 +- app/src/main/res/values/strings.xml | 1 + app/src/main/res/values/style.xml | 29 ++- 5 files changed, 139 insertions(+), 83 deletions(-) diff --git a/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt b/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt index 0584e92be..e0d34b2f1 100644 --- a/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt +++ b/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt @@ -16,6 +16,7 @@ import com.github.libretube.util.AUTHORS_URL import com.github.libretube.util.CONTRIBUTING_URL import com.github.libretube.util.DONATE_URL import com.github.libretube.util.PIPED_GITHUB_URL +import com.github.libretube.util.ThemeHelper import com.github.libretube.util.WEBSITE_URL import com.google.android.material.dialog.MaterialAlertDialogBuilder @@ -33,6 +34,7 @@ class AboutFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + val settingsActivity = activity as SettingsActivity settingsActivity.changeTopBarText(getString(R.string.about)) @@ -48,7 +50,7 @@ class AboutFragment : Fragment() { binding.donate.setOnClickListener { openLinkFromHref(DONATE_URL) } - binding.contributing.setOnClickListener { + binding.github.setOnClickListener { openLinkFromHref(CONTRIBUTING_URL) } binding.license.setOnClickListener { diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index 1bf1f174b..9eef298de 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -1,20 +1,21 @@ + android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto"> - + android:src="@mipmap/ic_launcher_round" /> - + style="@style/AboutCard"> - + - + - + - + + + + + style="@style/AboutCard"> - + - + - + - + + + + + style="@style/AboutCard"> - + - + - + - + + + + + style="@style/AboutCard"> - + - + - + - + + + + + style="@style/AboutCard"> - + - + - + - + + + + + style="@style/AboutCard"> - + - + - + + + + + diff --git a/app/src/main/res/layout/fragment_player.xml b/app/src/main/res/layout/fragment_player.xml index ddeefc704..9bcc7e86e 100644 --- a/app/src/main/res/layout/fragment_player.xml +++ b/app/src/main/res/layout/fragment_player.xml @@ -281,7 +281,10 @@ style="@style/Widget.Material3.CardView.Elevated" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="16dp" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="16dp" app:cardCornerRadius="18dp"> Use a different instance for authenticated calls. Choose an auth instance Auto + GitHub \ No newline at end of file diff --git a/app/src/main/res/values/style.xml b/app/src/main/res/values/style.xml index 7b63c7620..49c91f885 100644 --- a/app/src/main/res/values/style.xml +++ b/app/src/main/res/values/style.xml @@ -2,8 +2,17 @@ + + + + From 4bd7e814525c1fa636bfd066f446aba347aa6523 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 3 Jul 2022 15:06:17 +0200 Subject: [PATCH 3/3] refactor about fragment --- .../libretube/preferences/AboutFragment.kt | 9 +- .../com/github/libretube/util/Constants.kt | 5 +- app/src/main/res/drawable/ic_donate.xml | 10 ++ app/src/main/res/drawable/ic_github.xml | 10 ++ app/src/main/res/drawable/ic_piped.xml | 93 ++++++++++++ app/src/main/res/layout/fragment_about.xml | 132 ++++++------------ app/src/main/res/values/style.xml | 39 ++++-- app/src/main/res/xml/advanced_settings.xml | 4 +- 8 files changed, 194 insertions(+), 108 deletions(-) create mode 100644 app/src/main/res/drawable/ic_donate.xml create mode 100644 app/src/main/res/drawable/ic_github.xml create mode 100644 app/src/main/res/drawable/ic_piped.xml diff --git a/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt b/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt index e0d34b2f1..77483ce33 100644 --- a/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt +++ b/app/src/main/java/com/github/libretube/preferences/AboutFragment.kt @@ -12,11 +12,9 @@ import androidx.fragment.app.Fragment import com.github.libretube.R import com.github.libretube.activities.SettingsActivity import com.github.libretube.databinding.FragmentAboutBinding -import com.github.libretube.util.AUTHORS_URL -import com.github.libretube.util.CONTRIBUTING_URL import com.github.libretube.util.DONATE_URL +import com.github.libretube.util.GITHUB_URL import com.github.libretube.util.PIPED_GITHUB_URL -import com.github.libretube.util.ThemeHelper import com.github.libretube.util.WEBSITE_URL import com.google.android.material.dialog.MaterialAlertDialogBuilder @@ -41,9 +39,6 @@ class AboutFragment : Fragment() { binding.website.setOnClickListener { openLinkFromHref(WEBSITE_URL) } - binding.authors.setOnClickListener { - openLinkFromHref(AUTHORS_URL) - } binding.piped.setOnClickListener { openLinkFromHref(PIPED_GITHUB_URL) } @@ -51,7 +46,7 @@ class AboutFragment : Fragment() { openLinkFromHref(DONATE_URL) } binding.github.setOnClickListener { - openLinkFromHref(CONTRIBUTING_URL) + openLinkFromHref(GITHUB_URL) } binding.license.setOnClickListener { val licenseString = view.context.assets diff --git a/app/src/main/java/com/github/libretube/util/Constants.kt b/app/src/main/java/com/github/libretube/util/Constants.kt index 90a13a619..8b120a006 100644 --- a/app/src/main/java/com/github/libretube/util/Constants.kt +++ b/app/src/main/java/com/github/libretube/util/Constants.kt @@ -2,7 +2,6 @@ package com.github.libretube.util const val GITHUB_API_URL = "https://api.github.com/repos/libre-tube/LibreTube/releases/latest" const val WEBSITE_URL = "https://libre-tube.github.io/" -const val AUTHORS_URL = "https://github.com/libre-tube/LibreTube/graphs/contributors" -const val DONATE_URL = "https://libre-tube.github.io/#donate" -const val CONTRIBUTING_URL = "https://github.com/libre-tube/LibreTube#donate" +const val DONATE_URL = "https://github.com/libre-tube/LibreTube#donate" +const val GITHUB_URL = "https://github.com/libre-tube/LibreTube" const val PIPED_GITHUB_URL = "https://github.com/TeamPiped/Piped" diff --git a/app/src/main/res/drawable/ic_donate.xml b/app/src/main/res/drawable/ic_donate.xml new file mode 100644 index 000000000..d80715927 --- /dev/null +++ b/app/src/main/res/drawable/ic_donate.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_github.xml b/app/src/main/res/drawable/ic_github.xml new file mode 100644 index 000000000..7476547b4 --- /dev/null +++ b/app/src/main/res/drawable/ic_github.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/ic_piped.xml b/app/src/main/res/drawable/ic_piped.xml new file mode 100644 index 000000000..9eb312ea2 --- /dev/null +++ b/app/src/main/res/drawable/ic_piped.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index 9eef298de..d09cf88f7 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -1,8 +1,8 @@ + android:layout_height="match_parent"> + android:layout_marginTop="50dp" + android:src="@mipmap/ic_launcher_round" + app:shapeAppearanceOverlay="@style/CircleImageView" /> - + + + - - + style="@style/AboutTextView" + android:text="@string/website" /> - + + + - - - - - - - - - - - - - - + style="@style/AboutTextView" + android:text="@string/github" /> @@ -97,19 +67,15 @@ android:id="@+id/piped" style="@style/AboutCard"> - + + + - - + style="@style/AboutTextView" + android:text="@string/piped" /> @@ -119,19 +85,15 @@ android:id="@+id/donate" style="@style/AboutCard"> - + + + - - + style="@style/AboutTextView" + android:text="@string/donate" /> @@ -141,19 +103,15 @@ android:id="@+id/license" style="@style/AboutCard"> - + + + - - + style="@style/AboutTextView" + android:text="@string/license" /> diff --git a/app/src/main/res/values/style.xml b/app/src/main/res/values/style.xml index 49c91f885..3db13793b 100644 --- a/app/src/main/res/values/style.xml +++ b/app/src/main/res/values/style.xml @@ -32,26 +32,47 @@ + + - + + diff --git a/app/src/main/res/xml/advanced_settings.xml b/app/src/main/res/xml/advanced_settings.xml index 19720126b..596003be4 100644 --- a/app/src/main/res/xml/advanced_settings.xml +++ b/app/src/main/res/xml/advanced_settings.xml @@ -58,8 +58,8 @@ android:defaultValue="true" android:icon="@drawable/ic_play_filled" app:key="watch_position_toggle" - app:title="@string/watch_positions" - app:summary="@string/watch_positions_summary"/> + app:summary="@string/watch_positions_summary" + app:title="@string/watch_positions" />