rework the about fragment
This commit is contained in:
		| @ -1,5 +1,7 @@ | ||||
| package org.mosad.teapod.activity.main.fragments | ||||
|  | ||||
| import android.content.Intent | ||||
| import android.net.Uri | ||||
| import android.os.Bundle | ||||
| import android.view.LayoutInflater | ||||
| import android.view.View | ||||
| @ -17,6 +19,7 @@ import java.lang.StringBuilder | ||||
|  | ||||
| class AboutFragment : Fragment() { | ||||
|  | ||||
|     private val teapodRepoUrl = "https://git.mosad.xyz/Seil0/teapod" | ||||
|     private lateinit var binding: FragmentAboutBinding | ||||
|  | ||||
|     override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { | ||||
| @ -27,7 +30,7 @@ class AboutFragment : Fragment() { | ||||
|     override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||||
|         super.onViewCreated(view, savedInstanceState) | ||||
|  | ||||
|         binding.textVersion.text = getString(R.string.info_about_desc, BuildConfig.VERSION_NAME, getString(R.string.build_time)) | ||||
|         binding.textVersionDesc.text = getString(R.string.version_desc, BuildConfig.VERSION_NAME, getString(R.string.build_time)) | ||||
|  | ||||
|         getThirdPartyComponents().forEach { thirdParty -> | ||||
|             val componentBinding = ItemComponentBinding.inflate(layoutInflater) //(R.layout.item_component, container, false) | ||||
| @ -44,10 +47,25 @@ class AboutFragment : Fragment() { | ||||
|  | ||||
|             binding.linearThirdParty.addView(componentBinding.root) | ||||
|         } | ||||
|  | ||||
|         initActions() | ||||
|     } | ||||
|  | ||||
|     private fun initActions() { | ||||
|         binding.linearSource.setOnClickListener { | ||||
|             startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(teapodRepoUrl))) | ||||
|         } | ||||
|  | ||||
|         binding.linearLicense.setOnClickListener { | ||||
|             MaterialDialog(requireContext()) | ||||
|                 .title(text = License.GPL3.long) | ||||
|                 .message(text = parseLicense(R.raw.gpl_3_full)) | ||||
|                 .show() | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private fun getThirdPartyComponents(): List<ThirdPartyComponent> { | ||||
|         return listOf<ThirdPartyComponent>( | ||||
|         return listOf( | ||||
|             ThirdPartyComponent("AndroidX", "", "The Android Open Source Project", | ||||
|                 "https://developer.android.com/jetpack/androidx", License.APACHE2), | ||||
|             ThirdPartyComponent("Material Components for Android", "2020", "The Android Open Source Project", | ||||
| @ -79,13 +97,10 @@ class AboutFragment : Fragment() { | ||||
|             License.MIT -> parseLicense(R.raw.mit_full) | ||||
|         } | ||||
|  | ||||
|         println("showing: ${license.long}") | ||||
|  | ||||
|         MaterialDialog(requireContext()) | ||||
|             .title(text = license.long) | ||||
|             .message(text = licenseText) | ||||
|             .show() | ||||
|  | ||||
|     } | ||||
|  | ||||
|     private fun parseLicense(@RawRes id: Int): String { | ||||
|  | ||||
							
								
								
									
										5
									
								
								app/src/main/res/drawable/ic_baseline_code_24.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/src/main/res/drawable/ic_baseline_code_24.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| <vector android:height="24dp" android:tint="#FFFFFF" | ||||
|     android:viewportHeight="24" android:viewportWidth="24" | ||||
|     android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <path android:fillColor="@android:color/white" android:pathData="M9.4,16.6L4.8,12l4.6,-4.6L8,6l-6,6 6,6 1.4,-1.4zM14.6,16.6l4.6,-4.6 -4.6,-4.6L16,6l6,6 -6,6 -1.4,-1.4z"/> | ||||
| </vector> | ||||
							
								
								
									
										5
									
								
								app/src/main/res/drawable/ic_baseline_description_24.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/src/main/res/drawable/ic_baseline_description_24.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| <vector android:height="24dp" android:tint="#FFFFFF" | ||||
|     android:viewportHeight="24" android:viewportWidth="24" | ||||
|     android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <path android:fillColor="@android:color/white" android:pathData="M14,2L6,2c-1.1,0 -1.99,0.9 -1.99,2L4,20c0,1.1 0.89,2 1.99,2L18,22c1.1,0 2,-0.9 2,-2L20,8l-6,-6zM16,18L8,18v-2h8v2zM16,14L8,14v-2h8v2zM13,9L13,3.5L18.5,9L13,9z"/> | ||||
| </vector> | ||||
| @ -1,10 +0,0 @@ | ||||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:width="24dp" | ||||
|     android:height="24dp" | ||||
|     android:viewportWidth="24" | ||||
|     android:viewportHeight="24" | ||||
|     android:tint="?attr/colorControlNormal"> | ||||
|   <path | ||||
|       android:fillColor="@android:color/white" | ||||
|       android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/> | ||||
| </vector> | ||||
							
								
								
									
										5
									
								
								app/src/main/res/drawable/ic_baseline_people_24.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/src/main/res/drawable/ic_baseline_people_24.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| <vector android:height="24dp" android:tint="#FFFFFF" | ||||
|     android:viewportHeight="24" android:viewportWidth="24" | ||||
|     android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <path android:fillColor="@android:color/white" android:pathData="M16,11c1.66,0 2.99,-1.34 2.99,-3S17.66,5 16,5c-1.66,0 -3,1.34 -3,3s1.34,3 3,3zM8,11c1.66,0 2.99,-1.34 2.99,-3S9.66,5 8,5C6.34,5 5,6.34 5,8s1.34,3 3,3zM8,13c-2.33,0 -7,1.17 -7,3.5L1,19h14v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5zM16,13c-0.29,0 -0.62,0.02 -0.97,0.05 1.16,0.84 1.97,1.97 1.97,3.45L17,19h6v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5z"/> | ||||
| </vector> | ||||
							
								
								
									
										5
									
								
								app/src/main/res/drawable/ic_outline_info_24.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/src/main/res/drawable/ic_outline_info_24.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| <vector android:height="24dp" android:tint="#FFFFFF" | ||||
|     android:viewportHeight="24" android:viewportWidth="24" | ||||
|     android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|     <path android:fillColor="@android:color/white" android:pathData="M11,7h2v2h-2zM11,11h2v6h-2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/> | ||||
| </vector> | ||||
| @ -1,5 +1,7 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| <androidx.core.widget.NestedScrollView | ||||
|     xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
|     xmlns:tools="http://schemas.android.com/tools" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
| @ -17,11 +19,11 @@ | ||||
|             android:orientation="vertical"> | ||||
|  | ||||
|             <ImageView | ||||
|                 android:id="@+id/imageView5" | ||||
|                 android:id="@+id/image_app_icon" | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_gravity="center" | ||||
|                 android:layout_marginTop="12dp" | ||||
|                 android:layout_marginTop="17dp" | ||||
|                 android:contentDescription="@string/app_name" | ||||
|                 android:src="@mipmap/ic_launcher_round" /> | ||||
|  | ||||
| @ -30,23 +32,13 @@ | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_marginStart="5dp" | ||||
|                 android:layout_marginTop="7dp" | ||||
|                 android:layout_marginTop="12dp" | ||||
|                 android:layout_marginEnd="5dp" | ||||
|                 android:text="@string/app_name" | ||||
|                 android:textAlignment="center" | ||||
|                 android:textSize="20sp" | ||||
|                 android:textStyle="bold" /> | ||||
|  | ||||
|             <TextView | ||||
|                 android:id="@+id/text_version" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_marginStart="5dp" | ||||
|                 android:layout_marginTop="5dp" | ||||
|                 android:layout_marginEnd="5dp" | ||||
|                 android:text="@string/info_about_desc" | ||||
|                 android:textAlignment="center" /> | ||||
|  | ||||
|             <TextView | ||||
|                 android:id="@+id/text_about_info" | ||||
|                 android:layout_width="match_parent" | ||||
| @ -54,30 +46,188 @@ | ||||
|                 android:layout_marginStart="5dp" | ||||
|                 android:layout_marginTop="7dp" | ||||
|                 android:layout_marginEnd="5dp" | ||||
|                 android:text="@string/about_info" | ||||
|                 android:textAlignment="center" /> | ||||
|                 android:layout_marginBottom="12dp" | ||||
|                 android:text="@string/about_info" /> | ||||
|  | ||||
|             <TextView | ||||
|                 android:id="@+id/text_tmdb_notice" | ||||
|             <LinearLayout | ||||
|                 android:id="@+id/linear_version" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_marginStart="7dp" | ||||
|                 android:layout_marginTop="7dp" | ||||
|                 android:layout_marginEnd="7dp" | ||||
|                 android:text="@string/tmdb_notice" | ||||
|                 android:textAlignment="center" | ||||
|                 android:textColor="?textSecondary" /> | ||||
|                 android:layout_height="match_parent" | ||||
|                 android:foreground="?android:selectableItemBackground" | ||||
|                 android:gravity="center" | ||||
|                 android:orientation="horizontal" | ||||
|                 android:padding="7dp"> | ||||
|  | ||||
|             <TextView | ||||
|                 android:id="@+id/text_teapod_repo" | ||||
|                 <ImageView | ||||
|                     android:id="@+id/image_version" | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:contentDescription="@string/version" | ||||
|                     android:minWidth="48dp" | ||||
|                     android:minHeight="48dp" | ||||
|                     android:padding="9dp" | ||||
|                     android:scaleType="fitXY" | ||||
|                     android:src="@drawable/ic_outline_info_24" | ||||
|                     app:tint="?iconColor" /> | ||||
|  | ||||
|                 <LinearLayout | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="match_parent" | ||||
|                     android:layout_marginStart="12dp" | ||||
|                     android:orientation="vertical"> | ||||
|  | ||||
|                     <TextView | ||||
|                         android:id="@+id/text_version" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:layout_weight="1" | ||||
|                         android:text="@string/version" | ||||
|                         android:textSize="16sp" /> | ||||
|  | ||||
|                     <TextView | ||||
|                         android:id="@+id/text_version_desc" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:layout_weight="1" | ||||
|                         android:text="@string/version_desc" | ||||
|                         android:textColor="?textSecondary" /> | ||||
|                 </LinearLayout> | ||||
|             </LinearLayout> | ||||
|  | ||||
|             <LinearLayout | ||||
|                 android:id="@+id/linear_authors" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_marginStart="7dp" | ||||
|                 android:layout_marginTop="12dp" | ||||
|                 android:layout_marginEnd="7dp" | ||||
|                 android:autoLink="web" | ||||
|                 android:text="@string/teapod_repo" | ||||
|                 android:textAlignment="center" /> | ||||
|                 android:layout_height="match_parent" | ||||
|                 android:foreground="?android:selectableItemBackground" | ||||
|                 android:gravity="center" | ||||
|                 android:orientation="horizontal" | ||||
|                 android:padding="7dp"> | ||||
|  | ||||
|                 <ImageView | ||||
|                     android:id="@+id/image_authors" | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:contentDescription="@string/authors" | ||||
|                     android:minWidth="48dp" | ||||
|                     android:minHeight="48dp" | ||||
|                     android:padding="9dp" | ||||
|                     android:scaleType="fitXY" | ||||
|                     android:src="@drawable/ic_baseline_people_24" | ||||
|                     app:tint="?iconColor" /> | ||||
|  | ||||
|                 <LinearLayout | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="match_parent" | ||||
|                     android:layout_marginStart="12dp" | ||||
|                     android:orientation="vertical"> | ||||
|  | ||||
|                     <TextView | ||||
|                         android:id="@+id/text_authors" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:layout_weight="1" | ||||
|                         android:text="@string/authors" | ||||
|                         android:textSize="16sp" /> | ||||
|  | ||||
|                     <TextView | ||||
|                         android:id="@+id/text_authors_desc" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:layout_weight="1" | ||||
|                         android:text="@string/author_desc" | ||||
|                         android:textColor="?textSecondary" /> | ||||
|                 </LinearLayout> | ||||
|             </LinearLayout> | ||||
|  | ||||
|             <LinearLayout | ||||
|                 android:id="@+id/linear_source" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="match_parent" | ||||
|                 android:foreground="?android:selectableItemBackground" | ||||
|                 android:gravity="center" | ||||
|                 android:orientation="horizontal" | ||||
|                 android:padding="7dp"> | ||||
|  | ||||
|                 <ImageView | ||||
|                     android:id="@+id/image_source" | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:contentDescription="@string/source" | ||||
|                     android:minWidth="48dp" | ||||
|                     android:minHeight="48dp" | ||||
|                     android:padding="9dp" | ||||
|                     android:scaleType="fitXY" | ||||
|                     android:src="@drawable/ic_baseline_code_24" | ||||
|                     app:tint="?iconColor" /> | ||||
|  | ||||
|                 <LinearLayout | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="match_parent" | ||||
|                     android:layout_marginStart="12dp" | ||||
|                     android:orientation="vertical"> | ||||
|  | ||||
|                     <TextView | ||||
|                         android:id="@+id/text_source" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:layout_weight="1" | ||||
|                         android:text="@string/source" | ||||
|                         android:textSize="16sp" /> | ||||
|  | ||||
|                     <TextView | ||||
|                         android:id="@+id/text_source_desc" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:layout_weight="1" | ||||
|                         android:text="@string/teapod_repo" | ||||
|                         android:textColor="?textSecondary" /> | ||||
|                 </LinearLayout> | ||||
|             </LinearLayout> | ||||
|  | ||||
|             <LinearLayout | ||||
|                 android:id="@+id/linear_license" | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="match_parent" | ||||
|                 android:foreground="?android:selectableItemBackground" | ||||
|                 android:gravity="center" | ||||
|                 android:orientation="horizontal" | ||||
|                 android:padding="7dp"> | ||||
|  | ||||
|                 <ImageView | ||||
|                     android:id="@+id/image_license" | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:contentDescription="@string/account" | ||||
|                     android:minWidth="48dp" | ||||
|                     android:minHeight="48dp" | ||||
|                     android:padding="9dp" | ||||
|                     android:scaleType="fitXY" | ||||
|                     android:src="@drawable/ic_baseline_description_24" | ||||
|                     app:tint="?iconColor" /> | ||||
|  | ||||
|                 <LinearLayout | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="match_parent" | ||||
|                     android:layout_marginStart="12dp" | ||||
|                     android:orientation="vertical"> | ||||
|  | ||||
|                     <TextView | ||||
|                         android:id="@+id/text_license" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:layout_weight="1" | ||||
|                         android:text="@string/license" | ||||
|                         android:textSize="16sp" /> | ||||
|  | ||||
|                     <TextView | ||||
|                         android:id="@+id/text_license_desc" | ||||
|                         android:layout_width="match_parent" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:layout_weight="1" | ||||
|                         android:text="@string/license_desc" | ||||
|                         android:textColor="?textSecondary" /> | ||||
|                 </LinearLayout> | ||||
|             </LinearLayout> | ||||
|  | ||||
|         </LinearLayout> | ||||
|  | ||||
| @ -107,5 +257,18 @@ | ||||
|                 android:orientation="vertical" /> | ||||
|  | ||||
|         </LinearLayout> | ||||
|  | ||||
|         <TextView | ||||
|             android:id="@+id/text_tmdb_notice" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginStart="7dp" | ||||
|             android:layout_marginTop="7dp" | ||||
|             android:layout_marginEnd="7dp" | ||||
|             android:paddingBottom="5dp" | ||||
|             android:text="@string/tmdb_notice" | ||||
|             android:textAlignment="center" | ||||
|             android:textColor="?textSecondary" /> | ||||
|  | ||||
|     </LinearLayout> | ||||
| </androidx.core.widget.NestedScrollView> | ||||
| @ -312,7 +312,7 @@ | ||||
|                         android:minHeight="48dp" | ||||
|                         android:padding="9dp" | ||||
|                         android:scaleType="fitXY" | ||||
|                         app:srcCompat="@drawable/ic_baseline_info_24" | ||||
|                         app:srcCompat="@drawable/ic_outline_info_24" | ||||
|                         app:tint="?iconColor" /> | ||||
|  | ||||
|                     <LinearLayout | ||||
|  | ||||
| @ -97,7 +97,7 @@ | ||||
|                         android:textColor="?textSecondary" | ||||
|                         android:textSize="12sp" | ||||
|                         app:drawableTint="?buttonBackground" | ||||
|                         app:drawableTopCompat="@drawable/ic_baseline_info_24" /> | ||||
|                         app:drawableTopCompat="@drawable/ic_outline_info_24" /> | ||||
|  | ||||
|                     <Space | ||||
|                         android:layout_width="0dp" | ||||
|  | ||||
| @ -45,12 +45,11 @@ | ||||
|     <string name="theme_dark">Dunkel</string> | ||||
|  | ||||
|     <!-- about fragment --> | ||||
|     <string name="about_info"> | ||||
|         Teapod ist eine inoffizielle App für Anime on Demand. | ||||
|         Sie wird unter den Bedingungen der GNU GPL 3 oder höher zur Verfügung gestellt. | ||||
|         \n\n | ||||
|         © 2020-2021 seil0@mosad.xyz | ||||
|     </string> | ||||
|     <string name="version">Version</string> | ||||
|     <string name="authors">Autor</string> | ||||
|     <string name="source">Quellcode</string> | ||||
|     <string name="license">Lizenz</string> | ||||
|     <string name="about_info">Eine inoffizielle App für Anime on Demand.</string> | ||||
|     <string name="third_party_heading">Lizenzen von Drittanbietern</string> | ||||
|     <string name="third_party_component_desc">© %1$s %2$s unter %3$s</string> | ||||
|  | ||||
|  | ||||
| @ -56,14 +56,16 @@ | ||||
|     <string name="theme_dark">Dark</string> | ||||
|  | ||||
|     <!-- about fragment --> | ||||
|     <string name="about_info"> | ||||
|         Teapod is an unofficial app for anime on demand. | ||||
|         It is published under the terms and conditions of the GNU GPL 3 or later. | ||||
|         \n\n | ||||
|         © 2020-2021 seil0@mosad.xyz | ||||
|     </string> | ||||
|     <string name="tmdb_notice" translatable="false">This product uses the TMDb API but is not endorsed or certified by TMDb.</string> | ||||
|     <string name="version">Version</string> | ||||
|     <string name="version_desc" translatable="false">%1$s (%2$s)</string> | ||||
|     <string name="authors">Author</string> | ||||
|     <string name="author_desc" translatable="false">seil0@mosad.xyz</string> | ||||
|     <string name="source">Source code</string> | ||||
|     <string name="teapod_repo" translatable="false">git.mosad.xyz/Seil0/teapod</string> | ||||
|     <string name="license">License</string> | ||||
|     <string name="license_desc" translatable="false">GNU General Public License 3</string> | ||||
|     <string name="about_info">An unofficial app for anime on demand.</string> | ||||
|     <string name="tmdb_notice" translatable="false">This product uses the TMDb API but is not endorsed or certified by TMDb.</string> | ||||
|     <string name="third_party_heading">Third Party Licenses</string> | ||||
|     <string name="third_party_component_desc">© %1$s %2$s under %3$s</string> | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user