mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-31 05:23:28 +01:00 
			
		
		
		
	Merge pull request #568 from ImranR98/dev
App ID Filter (#564), Apps Page Bottom Buttons Menu UI Changes
This commit is contained in:
		| @@ -180,6 +180,7 @@ | ||||
|     "yesMarkUpdated": "Ja, als aktualisiert markieren", | ||||
|     "fdroid": "F-Droid Official", | ||||
|     "appIdOrName": "App ID oder Name", | ||||
|     "appId": "App ID", | ||||
|     "appWithIdOrNameNotFound": "Es wurde keine App mit dieser ID oder diesem Namen gefunden", | ||||
|     "reposHaveMultipleApps": "Repos können mehrere Apps enthalten", | ||||
|     "fdroidThirdPartyRepo": "F-Droid Third-Party Repo", | ||||
|   | ||||
| @@ -180,6 +180,7 @@ | ||||
|     "yesMarkUpdated": "Yes, Mark as Updated", | ||||
|     "fdroid": "F-Droid Official", | ||||
|     "appIdOrName": "App ID or Name", | ||||
|     "appId": "App ID", | ||||
|     "appWithIdOrNameNotFound": "No App was found with that ID or Name", | ||||
|     "reposHaveMultipleApps": "Repos may contain multiple Apps", | ||||
|     "fdroidThirdPartyRepo": "F-Droid Third-Party Repo", | ||||
|   | ||||
| @@ -180,6 +180,7 @@ | ||||
|     "yesMarkUpdated": "Sí, Marcar como Actualizada", | ||||
|     "fdroid": "Repositorio oficial de F-Droid", | ||||
|     "appIdOrName": "ID o Nombre de la Aplicación", | ||||
|     "appId": "ID de la Aplicación", | ||||
|     "appWithIdOrNameNotFound": "No se han encontrado aplicaciones con esa ID o nombre", | ||||
|     "reposHaveMultipleApps": "Los repositorios pueden contener varias aplicaciones", | ||||
|     "fdroidThirdPartyRepo": "Rpositorios de terceros de F-Droid", | ||||
|   | ||||
| @@ -180,6 +180,7 @@ | ||||
|     "yesMarkUpdated": "بله، علامت گذاری به عنوان به روز شده", | ||||
|     "fdroid": "F-Droid Official", | ||||
|     "appIdOrName": "شناسه یا نام برنامه", | ||||
|     "appId": "App ID", | ||||
|     "appWithIdOrNameNotFound": "هیچ برنامه ای با آن شناسه یا نام یافت نشد", | ||||
|     "reposHaveMultipleApps": "مخازن ممکن است شامل چندین برنامه باشد", | ||||
|     "fdroidThirdPartyRepo": "مخازن شخص ثالث F-Droid", | ||||
|   | ||||
| @@ -180,6 +180,7 @@ | ||||
|     "yesMarkUpdated": "Oui, marquer comme mis à jour", | ||||
|     "fdroid": "F-Droid Official", | ||||
|     "appIdOrName": "ID ou nom de l'application", | ||||
|     "appId": "ID de l'application", | ||||
|     "appWithIdOrNameNotFound": "Aucune application n'a été trouvée avec cet identifiant ou ce nom", | ||||
|     "reposHaveMultipleApps": "Les dépôts peuvent contenir plusieurs applications", | ||||
|     "fdroidThirdPartyRepo": "Dépôt tiers F-Droid", | ||||
|   | ||||
| @@ -180,6 +180,7 @@ | ||||
|     "yesMarkUpdated": "Igen, megjelölés frissítettként", | ||||
|     "fdroid": "F-Droid Official", | ||||
|     "appIdOrName": "App ID vagy név", | ||||
|     "appId": "App ID", | ||||
|     "appWithIdOrNameNotFound": "Nem található app ezzel az azonosítóval vagy névvel", | ||||
|     "reposHaveMultipleApps": "A repók több alkalmazást is tartalmazhatnak", | ||||
|     "fdroidThirdPartyRepo": "F-Droid Harmadik-fél Repo", | ||||
|   | ||||
| @@ -180,6 +180,7 @@ | ||||
|     "yesMarkUpdated": "Sì, contrassegna come aggiornato", | ||||
|     "fdroid": "F-Droid Official", | ||||
|     "appIdOrName": "ID o nome dell'App", | ||||
|     "appId": "ID dell'App", | ||||
|     "appWithIdOrNameNotFound": "Non è stata trovata alcuna App con quell'ID o nome", | ||||
|     "reposHaveMultipleApps": "I repository possono contenere più App", | ||||
|     "fdroidThirdPartyRepo": "Repository F-Droid di terze parti", | ||||
|   | ||||
| @@ -180,6 +180,7 @@ | ||||
|     "yesMarkUpdated": "はい、アップデート済みとしてマークします", | ||||
|     "fdroid": "F-Droid Official", | ||||
|     "appIdOrName": "アプリのIDまたは名前", | ||||
|     "appId": "App ID", | ||||
|     "appWithIdOrNameNotFound": "そのIDや名前を持つアプリは見つかりませんでした", | ||||
|     "reposHaveMultipleApps": "リポジトリには複数のアプリが含まれることがあります", | ||||
|     "fdroidThirdPartyRepo": "F-Droid サードパーティリポジトリ", | ||||
|   | ||||
| @@ -180,6 +180,7 @@ | ||||
|     "yesMarkUpdated": "是,标记为已更新", | ||||
|     "fdroid": "F-Droid 官方存储库", | ||||
|     "appIdOrName": "应用 ID 或名称", | ||||
|     "appId": "App ID", | ||||
|     "appWithIdOrNameNotFound": "未找到符合此 ID 或名称的应用", | ||||
|     "reposHaveMultipleApps": "存储库中可能包含多个应用", | ||||
|     "fdroidThirdPartyRepo": "F-Droid 第三方存储库", | ||||
|   | ||||
| @@ -61,8 +61,6 @@ class AppsPageState extends State<AppsPage> { | ||||
|     var settingsProvider = context.watch<SettingsProvider>(); | ||||
|     var sourceProvider = SourceProvider(); | ||||
|     var listedApps = appsProvider.getAppValues().toList(); | ||||
|     var currentFilterIsUpdatesOnly = | ||||
|         filter.isIdenticalTo(updatesOnlyFilter, settingsProvider); | ||||
|  | ||||
|     refresh() { | ||||
|       HapticFeedback.lightImpact(); | ||||
| @@ -129,6 +127,11 @@ class AppsPageState extends State<AppsPage> { | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       if (filter.idFilter.isNotEmpty) { | ||||
|         if (!app.app.id.contains(filter.idFilter)) { | ||||
|           return false; | ||||
|         } | ||||
|       } | ||||
|       if (filter.categoryFilter.isNotEmpty && | ||||
|           filter.categoryFilter | ||||
|               .intersection(app.app.categories.toSet()) | ||||
| @@ -882,10 +885,17 @@ class AppsPageState extends State<AppsPage> { | ||||
|           }); | ||||
|     } | ||||
|  | ||||
|     getMainBottomButtonsRow() { | ||||
|       return Row( | ||||
|         mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||||
|         children: [ | ||||
|     getMainBottomButtons() { | ||||
|       return [ | ||||
|         IconButton( | ||||
|             visualDensity: VisualDensity.compact, | ||||
|             onPressed: getMassObtainFunction(), | ||||
|             tooltip: selectedAppIds.isEmpty | ||||
|                 ? tr('installUpdateApps') | ||||
|                 : tr('installUpdateSelectedApps'), | ||||
|             icon: const Icon( | ||||
|               Icons.file_download_outlined, | ||||
|             )), | ||||
|         IconButton( | ||||
|           visualDensity: VisualDensity.compact, | ||||
|           onPressed: selectedAppIds.isEmpty | ||||
| @@ -897,15 +907,6 @@ class AppsPageState extends State<AppsPage> { | ||||
|           tooltip: tr('removeSelectedApps'), | ||||
|           icon: const Icon(Icons.delete_outline_outlined), | ||||
|         ), | ||||
|           IconButton( | ||||
|               visualDensity: VisualDensity.compact, | ||||
|               onPressed: getMassObtainFunction(), | ||||
|               tooltip: selectedAppIds.isEmpty | ||||
|                   ? tr('installUpdateApps') | ||||
|                   : tr('installUpdateSelectedApps'), | ||||
|               icon: const Icon( | ||||
|                 Icons.file_download_outlined, | ||||
|               )), | ||||
|         IconButton( | ||||
|           visualDensity: VisualDensity.compact, | ||||
|           onPressed: selectedAppIds.isEmpty ? null : launchCategorizeDialog(), | ||||
| @@ -918,8 +919,7 @@ class AppsPageState extends State<AppsPage> { | ||||
|           tooltip: tr('more'), | ||||
|           icon: const Icon(Icons.more_horiz), | ||||
|         ), | ||||
|         ], | ||||
|       ); | ||||
|       ]; | ||||
|     } | ||||
|  | ||||
|     showFilterDialog() async { | ||||
| @@ -941,6 +941,12 @@ class AppsPageState extends State<AppsPage> { | ||||
|                       required: false, | ||||
|                       defaultValue: vals['author']) | ||||
|                 ], | ||||
|                 [ | ||||
|                   GeneratedFormTextField('appId', | ||||
|                       label: tr('appId'), | ||||
|                       required: false, | ||||
|                       defaultValue: vals['appId']) | ||||
|                 ], | ||||
|                 [ | ||||
|                   GeneratedFormSwitch('upToDateApps', | ||||
|                       label: tr('upToDateApps'), | ||||
| @@ -986,50 +992,33 @@ class AppsPageState extends State<AppsPage> { | ||||
|     } | ||||
|  | ||||
|     getFilterButtonsRow() { | ||||
|       var isFilterOff = filter.isIdenticalTo(neutralFilter, settingsProvider); | ||||
|       return Row( | ||||
|         children: [ | ||||
|           getSelectAllButton(), | ||||
|           const VerticalDivider(), | ||||
|           Expanded( | ||||
|               child: SingleChildScrollView( | ||||
|                   scrollDirection: Axis.horizontal, | ||||
|                   child: getMainBottomButtonsRow())), | ||||
|           const VerticalDivider(), | ||||
|           IconButton( | ||||
|             visualDensity: VisualDensity.compact, | ||||
|             onPressed: () { | ||||
|               color: Theme.of(context).colorScheme.primary, | ||||
|               style: const ButtonStyle(visualDensity: VisualDensity.compact), | ||||
|               tooltip: isFilterOff ? tr('filter') : tr('filterActive'), | ||||
|               onPressed: isFilterOff | ||||
|                   ? showFilterDialog | ||||
|                   : () { | ||||
|                       setState(() { | ||||
|                 if (currentFilterIsUpdatesOnly) { | ||||
|                         filter = AppsFilter(); | ||||
|                 } else { | ||||
|                   filter = updatesOnlyFilter; | ||||
|                 } | ||||
|                       }); | ||||
|                     }, | ||||
|             tooltip: currentFilterIsUpdatesOnly | ||||
|                 ? tr('removeOutdatedFilter') | ||||
|                 : tr('showOutdatedOnly'), | ||||
|             icon: Icon( | ||||
|               currentFilterIsUpdatesOnly | ||||
|                   ? Icons.update_disabled_rounded | ||||
|                   : Icons.update_rounded, | ||||
|               color: Theme.of(context).colorScheme.primary, | ||||
|               icon: Icon(isFilterOff | ||||
|                   ? Icons.filter_list_rounded | ||||
|                   : Icons.filter_list_off_rounded)), | ||||
|           const SizedBox( | ||||
|             width: 10, | ||||
|           ), | ||||
|           ), | ||||
|           TextButton.icon( | ||||
|               style: const ButtonStyle(visualDensity: VisualDensity.compact), | ||||
|               label: Text( | ||||
|                 filter.isIdenticalTo(neutralFilter, settingsProvider) | ||||
|                     ? tr('filter') | ||||
|                     : tr('filterActive'), | ||||
|                 style: TextStyle( | ||||
|                     fontWeight: | ||||
|                         filter.isIdenticalTo(neutralFilter, settingsProvider) | ||||
|                             ? FontWeight.normal | ||||
|                             : FontWeight.bold), | ||||
|               ), | ||||
|               onPressed: showFilterDialog, | ||||
|               icon: const Icon(Icons.filter_list_rounded)) | ||||
|           const VerticalDivider(), | ||||
|           Expanded( | ||||
|               child: Row( | ||||
|             mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||||
|             children: getMainBottomButtons(), | ||||
|           )), | ||||
|         ], | ||||
|       ); | ||||
|     } | ||||
| @@ -1072,6 +1061,7 @@ class AppsPageState extends State<AppsPage> { | ||||
| class AppsFilter { | ||||
|   late String nameFilter; | ||||
|   late String authorFilter; | ||||
|   late String idFilter; | ||||
|   late bool includeUptodate; | ||||
|   late bool includeNonInstalled; | ||||
|   late Set<String> categoryFilter; | ||||
| @@ -1080,6 +1070,7 @@ class AppsFilter { | ||||
|   AppsFilter( | ||||
|       {this.nameFilter = '', | ||||
|       this.authorFilter = '', | ||||
|       this.idFilter = '', | ||||
|       this.includeUptodate = true, | ||||
|       this.includeNonInstalled = true, | ||||
|       this.categoryFilter = const {}, | ||||
| @@ -1089,6 +1080,7 @@ class AppsFilter { | ||||
|     return { | ||||
|       'appName': nameFilter, | ||||
|       'author': authorFilter, | ||||
|       'appId': idFilter, | ||||
|       'upToDateApps': includeUptodate, | ||||
|       'nonInstalledApps': includeNonInstalled, | ||||
|       'sourceFilter': sourceFilter | ||||
| @@ -1098,6 +1090,7 @@ class AppsFilter { | ||||
|   setFormValuesFromMap(Map<String, dynamic> values) { | ||||
|     nameFilter = values['appName']!; | ||||
|     authorFilter = values['author']!; | ||||
|     idFilter = values['appId']!; | ||||
|     includeUptodate = values['upToDateApps']; | ||||
|     includeNonInstalled = values['nonInstalledApps']; | ||||
|     sourceFilter = values['sourceFilter']; | ||||
| @@ -1106,6 +1099,7 @@ class AppsFilter { | ||||
|   bool isIdenticalTo(AppsFilter other, SettingsProvider settingsProvider) => | ||||
|       authorFilter.trim() == other.authorFilter.trim() && | ||||
|       nameFilter.trim() == other.nameFilter.trim() && | ||||
|       idFilter.trim() == other.idFilter.trim() && | ||||
|       includeUptodate == other.includeUptodate && | ||||
|       includeNonInstalled == other.includeNonInstalled && | ||||
|       settingsProvider.setEqual(categoryFilter, other.categoryFilter) && | ||||
|   | ||||
		Reference in New Issue
	
	Block a user