added licenses dialog
This commit is contained in:
		| @ -1,3 +1,25 @@ | ||||
| /** | ||||
|  * Teapod | ||||
|  * | ||||
|  * Copyright 2020  <seil0@mosad.xyz> | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation; either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * This program is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with this program; if not, write to the Free Software | ||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||||
|  * MA 02110-1301, USA. | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| package org.mosad.teapod | ||||
|  | ||||
| import android.content.Intent | ||||
|  | ||||
| @ -6,7 +6,8 @@ import android.view.LayoutInflater | ||||
| import android.view.View | ||||
| import android.view.ViewGroup | ||||
| import androidx.fragment.app.Fragment | ||||
| import com.afollestad.materialdialogs.MaterialDialog | ||||
| import com.google.android.material.dialog.MaterialAlertDialogBuilder | ||||
| import de.psdev.licensesdialog.LicensesDialog | ||||
| import kotlinx.android.synthetic.main.fragment_account.* | ||||
| import org.mosad.teapod.BuildConfig | ||||
| import org.mosad.teapod.R | ||||
| @ -35,9 +36,19 @@ class AccountFragment : Fragment() { | ||||
|         } | ||||
|  | ||||
|         linear_about.setOnClickListener { | ||||
|             MaterialDialog(requireContext()) | ||||
|                 .title(R.string.info_about) | ||||
|                 .message(R.string.info_about_dialog) | ||||
|             MaterialAlertDialogBuilder(requireContext()) | ||||
|                 .setTitle(R.string.info_about) | ||||
|                 .setMessage(R.string.info_about_dialog) | ||||
|                 .show() | ||||
|         } | ||||
|  | ||||
|         text_licenses.setOnClickListener { | ||||
|             LicensesDialog.Builder(requireContext()) | ||||
|                 .setNotices(R.raw.notices) | ||||
|                 .setTitle(R.string.licenses) | ||||
|                 .setIncludeOwnLicense(true) | ||||
|                 .setThemeResourceId(R.style.AppTheme) | ||||
|                 .build() | ||||
|                 .show() | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -39,6 +39,7 @@ | ||||
|                     android:id="@+id/linear_account_login" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="match_parent" | ||||
|                     android:layout_margin="7dp" | ||||
|                     android:gravity="center" | ||||
|                     android:orientation="horizontal"> | ||||
|  | ||||
| @ -103,6 +104,7 @@ | ||||
|                     android:id="@+id/linear_about" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="match_parent" | ||||
|                     android:layout_margin="7dp" | ||||
|                     android:gravity="center" | ||||
|                     android:orientation="horizontal"> | ||||
|  | ||||
| @ -110,6 +112,7 @@ | ||||
|                         android:id="@+id/imageView2" | ||||
|                         android:layout_width="wrap_content" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:contentDescription="@string/info" | ||||
|                         android:minWidth="48dp" | ||||
|                         android:minHeight="48dp" | ||||
|                         android:padding="5dp" | ||||
| @ -140,6 +143,23 @@ | ||||
|                     </LinearLayout> | ||||
|  | ||||
|                 </LinearLayout> | ||||
|  | ||||
|                 <View | ||||
|                     android:id="@+id/divider" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="1dp" | ||||
|                     android:background="?android:attr/listDivider" /> | ||||
|  | ||||
|                 <TextView | ||||
|                     android:id="@+id/text_licenses" | ||||
|                     android:layout_width="match_parent" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:layout_margin="7dp" | ||||
|                     android:paddingStart="48dp" | ||||
|                     android:paddingEnd="48dp" | ||||
|                     android:text="Licenses" | ||||
|                     android:textColor="@android:color/primary_text_light" | ||||
|                     android:textSize="16sp" /> | ||||
|             </LinearLayout> | ||||
|         </LinearLayout> | ||||
|     </ScrollView> | ||||
|  | ||||
							
								
								
									
										63
									
								
								app/src/main/res/raw/notices.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								app/src/main/res/raw/notices.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,63 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <notices> | ||||
|     <notice> | ||||
|         <name>AndroidX</name> | ||||
|         <url>https://developer.android.com/jetpack/androidx</url> | ||||
|         <copyright>Copyright The Android Open Source Project</copyright> | ||||
|         <license>Apache Software License 2.0</license> | ||||
|     </notice> | ||||
|     <notice> | ||||
|         <name>Material Components for Android</name> | ||||
|         <url>https://github.com/material-components/material-components-android</url> | ||||
|         <copyright>Copyright The Android Open Source Project</copyright> | ||||
|         <license>Apache Software License 2.0</license> | ||||
|     </notice> | ||||
|     <notice> | ||||
|         <name>ExoPlayer</name> | ||||
|         <url>https://github.com/material-components/material-components-android</url> | ||||
|         <copyright>Copyright The Android Open Source Project</copyright> | ||||
|         <license>Apache Software License 2.0</license> | ||||
|     </notice> | ||||
|     <notice> | ||||
|         <name>Gson</name> | ||||
|         <url>https://github.com/google/gson</url> | ||||
|         <copyright>Copyright 2008 Google Inc.</copyright> | ||||
|         <license>Apache Software License 2.0</license> | ||||
|     </notice> | ||||
|     <notice> | ||||
|         <name>Material design icons</name> | ||||
|         <url>https://github.com/google/material-design-icons</url> | ||||
|         <copyright>Copyright Google Inc.</copyright> | ||||
|         <license>Apache Software License 2.0</license> | ||||
|     </notice> | ||||
|     <notice> | ||||
|         <name>Material Dialogs</name> | ||||
|         <url>https://github.com/afollestad/material-dialogs</url> | ||||
|         <copyright>Copyright Aidan Follestad</copyright> | ||||
|         <license>Apache Software License 2.0</license> | ||||
|     </notice> | ||||
|     <notice> | ||||
|         <name>Jsoup</name> | ||||
|         <url>https://jsoup.org/</url> | ||||
|         <copyright>Copyright 2009 - 2020 Jonathan Hedley</copyright> | ||||
|         <license>MIT License</license> | ||||
|     </notice> | ||||
|     <notice> | ||||
|         <name>kotlinx.coroutines</name> | ||||
|         <url>https://github.com/Kotlin/kotlinx.coroutines</url> | ||||
|         <copyright>Copyright 2016 - 2019 JetBrains</copyright> | ||||
|         <license>Apache Software License 2.0</license> | ||||
|     </notice> | ||||
|     <notice> | ||||
|         <name>Glide</name> | ||||
|         <url>https://github.com/bumptech/glide</url> | ||||
|         <copyright>Copyright Google, Inc</copyright> | ||||
|         <license>BSD 3-Clause License</license> | ||||
|     </notice> | ||||
|     <notice> | ||||
|         <name>Glide Transformations</name> | ||||
|         <url>https://github.com/wasabeef/glide-transformations</url> | ||||
|         <copyright>Copyright 2020 Wasabeef</copyright> | ||||
|         <license>Apache Software License 2.0</license> | ||||
|     </notice> | ||||
| </notices> | ||||
| @ -18,6 +18,9 @@ | ||||
|     <string name="account">Account</string> | ||||
|     <string name="account_login_desc">Zum bearbeiten tippen</string> | ||||
|     <string name="info">Info</string> | ||||
|     <string name="info_about_desc">Version %1$s (%2$s)</string> | ||||
|     <string name="info_about_dialog">Diese App wird unter den Bedingungen der GNU GPL 3 oder höher zur Verfügung gestellt. Weiter Informationen findest du unter: \ngit.mosad.xyz/Seil0/teapod \n\n© 2020 seil0@mosad.xyz</string> | ||||
|     <string name="licenses">Lizenzen</string> | ||||
|  | ||||
|     <!-- dialogs --> | ||||
|     <string name="save">speichern</string> | ||||
|  | ||||
| @ -26,8 +26,9 @@ | ||||
|     <string name="account_login_desc">Tap to edit</string> | ||||
|     <string name="info">Info</string> | ||||
|     <string name="info_about" translatable="false">Teapod by @Seil0</string> | ||||
|     <string name="info_about_desc" translatable="false">Version %1$s (%2$s)</string> | ||||
|     <string name="info_about_dialog" translatable="false">This software is published under the terms and conditions of GPL 3. For further information visit: \ngit.mosad.xyz/Seil0/teapod \n\n© 2020 seil0@mosad.xyz</string> | ||||
|     <string name="info_about_desc">Version %1$s (%2$s)</string> | ||||
|     <string name="info_about_dialog">This app is published under the terms and conditions of the GNU GPL 3 or later. For further information visit: \ngit.mosad.xyz/Seil0/teapod \n\n© 2020 seil0@mosad.xyz</string> | ||||
|     <string name="licenses">Licenses</string> | ||||
|  | ||||
|     <!-- dialogs --> | ||||
|     <string name="save">save</string> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user