Merge pull request #677 from Bnyro/master

About Fragment Refactor
This commit is contained in:
Bnyro 2022-07-03 15:07:09 +02:00 committed by GitHub
commit a02a2ac9a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 245 additions and 103 deletions

View File

@ -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()

View File

@ -12,9 +12,8 @@ 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.WEBSITE_URL
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -33,23 +32,21 @@ 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))
binding.website.setOnClickListener {
openLinkFromHref(WEBSITE_URL)
}
binding.authors.setOnClickListener {
openLinkFromHref(AUTHORS_URL)
}
binding.piped.setOnClickListener {
openLinkFromHref(PIPED_GITHUB_URL)
}
binding.donate.setOnClickListener {
openLinkFromHref(DONATE_URL)
}
binding.contributing.setOnClickListener {
openLinkFromHref(CONTRIBUTING_URL)
binding.github.setOnClickListener {
openLinkFromHref(GITHUB_URL)
}
binding.license.setOnClickListener {
val licenseString = view.context.assets

View File

@ -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"

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?android:attr/colorControlNormal"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:fillColor="#FF000000"
android:pathData="M256,416c114.9,0 208,-93.1 208,-208S370.9,0 256,0 48,93.1 48,208s93.1,208 208,208zM233.8,97.4V80.6c0,-9.2 7.4,-16.6 16.6,-16.6h11.1c9.2,0 16.6,7.4 16.6,16.6v17c15.5,0.8 30.5,6.1 43,15.4 5.6,4.1 6.2,12.3 1.2,17.1L306,145.6c-3.8,3.7 -9.5,3.8 -14,1 -5.4,-3.4 -11.4,-5.1 -17.8,-5.1h-38.9c-9,0 -16.3,8.2 -16.3,18.3 0,8.2 5,15.5 12.1,17.6l62.3,18.7c25.7,7.7 43.7,32.4 43.7,60.1 0,34 -26.4,61.5 -59.1,62.4v16.8c0,9.2 -7.4,16.6 -16.6,16.6h-11.1c-9.2,0 -16.6,-7.4 -16.6,-16.6v-17c-15.5,-0.8 -30.5,-6.1 -43,-15.4 -5.6,-4.1 -6.2,-12.3 -1.2,-17.1l16.3,-15.5c3.8,-3.7 9.5,-3.8 14,-1 5.4,3.4 11.4,5.1 17.8,5.1h38.9c9,0 16.3,-8.2 16.3,-18.3 0,-8.2 -5,-15.5 -12.1,-17.6l-62.3,-18.7c-25.7,-7.7 -43.7,-32.4 -43.7,-60.1 0.1,-34 26.4,-61.5 59.1,-62.4zM480,352h-32.5c-19.6,26 -44.6,47.7 -73,64h63.8c5.3,0 9.6,3.6 9.6,8v16c0,4.4 -4.3,8 -9.6,8H73.6c-5.3,0 -9.6,-3.6 -9.6,-8v-16c0,-4.4 4.3,-8 9.6,-8h63.8c-28.4,-16.3 -53.3,-38 -73,-64H32c-17.7,0 -32,14.3 -32,32v96c0,17.7 14.3,32 32,32h448c17.7,0 32,-14.3 32,-32v-96c0,-17.7 -14.3,-32 -32,-32z" />
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?android:attr/colorControlNormal"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:fillColor="#FF000000"
android:pathData="M16,0.396c-8.839,0 -16,7.167 -16,16 0,7.073 4.584,13.068 10.937,15.183 0.803,0.151 1.093,-0.344 1.093,-0.772 0,-0.38 -0.009,-1.385 -0.015,-2.719 -4.453,0.964 -5.391,-2.151 -5.391,-2.151 -0.729,-1.844 -1.781,-2.339 -1.781,-2.339 -1.448,-0.989 0.115,-0.968 0.115,-0.968 1.604,0.109 2.448,1.645 2.448,1.645 1.427,2.448 3.744,1.74 4.661,1.328 0.14,-1.031 0.557,-1.74 1.011,-2.135 -3.552,-0.401 -7.287,-1.776 -7.287,-7.907 0,-1.751 0.62,-3.177 1.645,-4.297 -0.177,-0.401 -0.719,-2.031 0.141,-4.235 0,0 1.339,-0.427 4.4,1.641 1.281,-0.355 2.641,-0.532 4,-0.541 1.36,0.009 2.719,0.187 4,0.541 3.043,-2.068 4.381,-1.641 4.381,-1.641 0.859,2.204 0.317,3.833 0.161,4.235 1.015,1.12 1.635,2.547 1.635,4.297 0,6.145 -3.74,7.5 -7.296,7.891 0.556,0.479 1.077,1.464 1.077,2.959 0,2.14 -0.02,3.864 -0.02,4.385 0,0.416 0.28,0.916 1.104,0.755 6.4,-2.093 10.979,-8.093 10.979,-15.156 0,-8.833 -7.161,-16 -16,-16z" />
</vector>

View File

@ -0,0 +1,93 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="24dp"
android:height="24dp"
android:tint="?android:attr/colorControlNormal"
android:viewportWidth="1080"
android:viewportHeight="1080">
<path android:pathData="M308.4,156.8C308.4,156.8 315.7,151.4 328.7,144.1C336,141 345.1,137.7 355.5,134.8C366.4,132.6 378.6,130.8 391.1,129.9C403.9,129.9 416.9,130.7 429.1,132.3C441.2,134.7 452.4,137.9 461.8,141.2C480,149.7 491.4,156.8 491.4,156.8C491.4,156.8 491.4,168.5 491.4,189.1C491.4,199.3 491.4,211.8 491.4,226C491.4,240.3 491.4,256.4 491.4,274C491.4,291.6 491.4,310.6 491.4,330.8C491.4,340.8 491.4,351.2 491.4,361.7C491.4,372.3 491.4,383.1 491.4,394.1C491.4,405.1 491.4,416.3 491.4,427.6C491.4,438.9 491.4,450.3 491.4,461.8C491.4,473.4 491.4,485 491.4,496.7C491.4,508.3 491.4,520.1 491.4,531.8C491.4,543.5 491.4,555.2 491.4,566.9C491.4,578.5 491.4,590.2 491.4,601.7C491.4,613.3 491.4,624.7 491.4,636C491.4,647.3 491.4,658.5 491.4,669.5C491.4,680.4 491.4,691.2 491.4,701.8C491.4,712.4 491.4,722.7 491.4,732.8C491.4,752.9 491.4,772 491.4,789.5C491.4,807.1 491.4,823.2 491.4,837.5C491.4,851.8 491.4,864.3 491.4,874.5C491.4,895 491.4,906.7 491.4,906.7C491.4,906.7 480,906.7 462.8,906.7C454.2,906.7 444.2,906.7 433.5,906.7C422.8,906.7 411.3,906.7 399.9,906.7C388.5,906.7 377,906.7 366.3,906.7C355.6,906.7 345.6,906.7 337,906.7C319.9,906.7 308.4,906.7 308.4,906.7C308.4,906.7 308.4,895 308.4,874.5C308.4,864.3 308.4,851.8 308.4,837.5C308.4,823.2 308.4,807.1 308.4,789.5C308.4,772 308.4,752.9 308.4,732.8C308.4,722.7 308.4,712.4 308.4,701.8C308.4,691.2 308.4,680.4 308.4,669.5C308.4,658.5 308.4,647.3 308.4,636C308.4,624.7 308.4,613.3 308.4,601.7C308.4,590.2 308.4,578.5 308.4,566.9C308.4,555.2 308.4,543.5 308.4,531.8C308.4,520.1 308.4,508.3 308.4,496.7C308.4,485 308.4,473.4 308.4,461.8C308.4,450.3 308.4,438.9 308.4,427.6C308.4,416.3 308.4,405.1 308.4,394.1C308.4,383.1 308.4,372.3 308.4,361.7C308.4,351.2 308.4,340.8 308.4,330.8C308.4,310.6 308.4,291.6 308.4,274C308.4,256.4 308.4,240.3 308.4,226C308.4,211.8 308.4,199.3 308.4,189.1C308.4,168.5 308.4,156.8 308.4,156.8Z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="522.5"
android:endY="481"
android:startX="138.3"
android:startY="555.7"
android:type="linear">
<item
android:color="#FF8B1010"
android:offset="0.2" />
<item
android:color="#FFF84330"
android:offset="1" />
</gradient>
</aapt:attr>
</path>
<path android:pathData="M400,948C349.1,948 308,931.5 308,911C308,890.5 349.1,874 400,874C450.9,874 492,890.5 492,911C492,931.5 450.9,948 400,948Z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="321.5"
android:endY="986.1"
android:startX="353.4"
android:startY="835.9"
android:type="linear">
<item
android:color="#FF493B32"
android:offset="0.2" />
<item
android:color="#FFDBCCC4"
android:offset="0.6" />
</gradient>
</aapt:attr>
</path>
<path android:pathData="M550.1,292.5C550.1,292.5 550.1,282.8 550,270.2C549.8,264.6 549.6,258.3 549.4,252C549.2,245.7 549,239 548.8,232.1C548.7,224.7 548.7,216.6 548.8,208.3C549.1,199 549.5,189.3 550,180.1C551.3,158.9 552.6,142.4 552.6,142.4C552.6,142.4 567.2,141.2 591.9,141C597.8,141.4 604.3,142 611.3,142.8C618.2,143.7 625.6,144.9 633.4,146.3C640.9,148.2 648.7,150.6 656.8,153.4C664.8,156.2 673.1,159.4 681.5,163.1C689.5,167.4 697.5,172.2 705.6,177.6C713.6,182.9 721.7,188.8 729.7,195.2C737.2,202 744.5,209.4 751.7,217.3C758.5,225.5 765.1,234.1 771.4,243.2C777.3,252.6 783,262.4 788.2,272.5C793,282.9 797.4,293.5 801.4,304.5C804.9,315.6 808,326.9 810.6,338.4C812.7,350 814.3,361.7 815.5,373.4C816,385.1 816.1,396.8 815.7,408.4C814.8,420 813.3,431.4 811.3,442.6C808.8,453.7 805.9,464.5 802.4,475C798.4,485.3 794,495.3 789.1,504.9C783.8,514.2 778,523.1 771.9,531.5C765.3,539.7 758.5,547.3 751.3,554.5C743.5,561.1 735.5,567.3 727.4,573C719.3,578.6 711.1,583.8 702.8,588.4C693.9,592.4 685,596 676.3,599.1C667.5,602.2 659,604.9 650.7,607.2C641.9,608.9 633.4,610.4 625.5,611.5C617.5,612.7 610,613.6 603.1,614.2C588.6,614.6 576.9,614.7 568.9,614.6C560.9,614.6 556.5,614.4 556.5,614.4C556.5,614.4 556.8,604.8 557.3,591.3C557.4,584.9 557.6,577.5 557.8,569.7C557.9,561.9 557.9,553.4 557.9,544.6C557.8,535.4 557.7,525.6 557.5,515.8C557.1,505.3 556.7,494.7 556.3,485C555.1,463.5 554.1,447.5 554.1,447.5C554.1,447.5 561,447.9 572.7,448C578.3,447.8 584.8,447.3 592,446.4C599,445.1 606.4,443.4 614,441.1C621.1,438.4 628.3,435 635.2,431C638.5,428.8 641.6,426.5 644.6,424C647.5,421.5 650.2,418.7 652.8,415.8C655.1,412.9 657.3,409.8 659.4,406.6C661.2,403.3 662.8,399.9 664.2,396.4C665.4,392.9 666.4,389.3 667.2,385.6C667.7,382 668,378.2 668.1,374.5C668,370.8 667.6,367 667,363.3C666.2,359.6 665.1,355.9 663.8,352.3C662.3,348.7 660.7,345.2 658.8,341.8C656.7,338.4 654.4,335.1 651.9,332C649.3,328.9 646.5,326 643.5,323.2C640.4,320.5 637.2,317.9 633.9,315.5C626.7,311 619.4,307.1 612,303.8C604.2,300.9 596.5,298.6 589.4,296.8C581.9,295.3 575.1,294.3 569.4,293.6C557.3,292.7 550.1,292.5 550.1,292.5Z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="861.4"
android:endY="323.3"
android:startX="300.2"
android:startY="432.4"
android:type="linear">
<item
android:color="#FF8B1010"
android:offset="0.2" />
<item
android:color="#FFF84330"
android:offset="1" />
</gradient>
</aapt:attr>
</path>
<path android:pathData="M556.4,294C533.9,294 515.7,259.9 515.7,217.8C515.7,175.6 533.9,141.5 556.4,141.5C578.8,141.5 597,175.6 597,217.8C597,259.9 578.8,294 556.4,294Z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="504.2"
android:endY="372.5"
android:startX="553.3"
android:startY="63"
android:type="linear">
<item
android:color="#FF493B32"
android:offset="0.2" />
<item
android:color="#FFDBCCC4"
android:offset="0.6" />
</gradient>
</aapt:attr>
</path>
<path android:pathData="M557.9,615C535.4,615 517.3,577.5 517.3,531C517.3,484.5 535.4,447 557.9,447C580.4,447 598.5,484.5 598.5,531C598.5,577.5 580.4,615 557.9,615Z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="503.3"
android:endY="701.5"
android:startX="557.3"
android:startY="360.5"
android:type="linear">
<item
android:color="#FF493B32"
android:offset="0.2" />
<item
android:color="#FFDBCCC4"
android:offset="0.6" />
</gradient>
</aapt:attr>
</path>
</vector>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -8,125 +9,113 @@
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
style="@style/roundedImageViewRounded"
android:layout_width="80dp"
android:layout_height="80dp"
<com.google.android.material.imageview.ShapeableImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:src="@mipmap/ic_launcher" />
android:layout_marginTop="50dp"
android:src="@mipmap/ic_launcher_round"
app:shapeAppearanceOverlay="@style/CircleImageView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_marginBottom="40dp"
android:text="LibreTube"
android:textSize="27sp"
android:textSize="24sp"
android:textStyle="bold" />
<LinearLayout
<com.google.android.material.card.MaterialCardView
android:id="@+id/website"
style="@style/AboutItem">
style="@style/AboutCard">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/website"
android:textStyle="bold" />
<LinearLayout style="@style/AboutItem">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/website_summary" />
<ImageView
style="@style/AboutImageView"
android:src="@drawable/ic_region" />
</LinearLayout>
<TextView
style="@style/AboutTextView"
android:text="@string/website" />
<LinearLayout
android:id="@+id/contributing"
style="@style/AboutItem">
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/contributing"
android:textStyle="bold" />
</com.google.android.material.card.MaterialCardView>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/contributing_summary" />
<com.google.android.material.card.MaterialCardView
android:id="@+id/github"
style="@style/AboutCard">
</LinearLayout>
<LinearLayout style="@style/AboutItem">
<LinearLayout
android:id="@+id/authors"
style="@style/AboutItem">
<ImageView
style="@style/AboutImageView"
android:src="@drawable/ic_github" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/authors"
android:textStyle="bold" />
<TextView
style="@style/AboutTextView"
android:text="@string/github" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/authors_summary" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<LinearLayout
<com.google.android.material.card.MaterialCardView
android:id="@+id/piped"
style="@style/AboutItem">
style="@style/AboutCard">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/piped"
android:textStyle="bold" />
<LinearLayout style="@style/AboutItem">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/piped_summary" />
<ImageView
style="@style/AboutImageView"
android:src="@drawable/ic_piped" />
</LinearLayout>
<TextView
style="@style/AboutTextView"
android:text="@string/piped" />
<LinearLayout
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:id="@+id/donate"
style="@style/AboutItem">
style="@style/AboutCard">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/donate"
android:textStyle="bold" />
<LinearLayout style="@style/AboutItem">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/donate_summary" />
<ImageView
style="@style/AboutImageView"
android:src="@drawable/ic_donate" />
</LinearLayout>
<TextView
style="@style/AboutTextView"
android:text="@string/donate" />
<LinearLayout
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:id="@+id/license"
style="@style/AboutItem">
style="@style/AboutCard">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/license"
android:textStyle="bold" />
<LinearLayout style="@style/AboutItem">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/license_summary" />
<ImageView
style="@style/AboutImageView"
android:src="@drawable/ic_license" />
</LinearLayout>
<TextView
style="@style/AboutTextView"
android:text="@string/license" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>

View File

@ -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">
<androidx.constraintlayout.widget.ConstraintLayout

View File

@ -214,4 +214,5 @@
<string name="auth_instance_summary">Use a different instance for authenticated calls.</string>
<string name="auth_instances">Choose an auth instance</string>
<string name="hls">Auto</string>
<string name="github">GitHub</string>
</resources>

View File

@ -2,8 +2,17 @@
<resources>
<style name="roundedImageViewRounded">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">10%</item>
</style>
<style name="CircleImageView">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">50%</item>
</style>
<style name="OLED">
@ -23,16 +32,47 @@
</style>
<style name="AboutItem">
<style name="AboutCard" parent="Widget.Material3.CardView.Elevated">
<item name="android:orientation">vertical</item>
<item name="android:layout_marginLeft">10dp</item>
<item name="android:layout_marginRight">5dp</item>
<item name="android:layout_marginBottom">5dp</item>
<item name="android:layout_marginTop">10dp</item>
<item name="strokeWidth">0dp</item>
<item name="cardCornerRadius">18dp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingLeft">20dp</item>
<item name="android:paddingRight">20dp</item>
<item name="android:paddingTop">12dp</item>
<item name="android:paddingBottom">12dp</item>
<item name="android:background">?android:attr/selectableItemBackground</item>
<item name="cardElevation">5dp</item>
</style>
<style name="AboutItem">
<item name="android:orientation">horizontal</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">20dp</item>
<item name="android:layout_marginRight">20dp</item>
<item name="android:layout_marginTop">15dp</item>
<item name="android:layout_marginBottom">15dp</item>
</style>
<style name="AboutTextView">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_gravity">center</item>
<item name="android:textSize">16sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="AboutImageView">
<item name="android:layout_height">24dp</item>
<item name="android:layout_width">24dp</item>
<item name="android:layout_marginRight">10dp</item>
</style>

View File

@ -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" />
<Preference
android:icon="@drawable/ic_trash"