From f42118d6efa90911b1b502b35fa22eb6ef8e606f Mon Sep 17 00:00:00 2001 From: SayantanRC Date: Fri, 20 May 2022 15:43:35 +0530 Subject: [PATCH] App lounge: (issue_5171) Create model for Pagination --- .../model/AppsPaginationModel.kt | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 app/src/main/java/foundation/e/apps/applicationlist/model/AppsPaginationModel.kt diff --git a/app/src/main/java/foundation/e/apps/applicationlist/model/AppsPaginationModel.kt b/app/src/main/java/foundation/e/apps/applicationlist/model/AppsPaginationModel.kt new file mode 100644 index 000000000..431830d3b --- /dev/null +++ b/app/src/main/java/foundation/e/apps/applicationlist/model/AppsPaginationModel.kt @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2022 ECORP + * + * 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, see . + */ + +package foundation.e.apps.applicationlist.model + +import com.aurora.gplayapi.data.models.App +import com.aurora.gplayapi.data.models.StreamCluster + +/** + * Model to store list of apps from [StreamCluster] and nextClusterUrl. + * + * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5171 + * + * @param appList Corresponds to [StreamCluster.clusterAppList] + * @param nextUrl Corresponds to [StreamCluster.clusterNextPageUrl] + */ +class AppsPaginationModel(appList: List, val nextUrl: String) { + private val appList = mutableListOf() + init { + this.appList.addAll(appList) + } + fun getAppList(): List { + return appList.toList() + } + fun addToList(appsPaginationModel: AppsPaginationModel) { + this.appList.addAll(appsPaginationModel.getAppList()) + } +} -- GitLab