Remove unused items variables

This commit is contained in:
davide 2022-07-24 03:38:46 +02:00
parent e37eae8d16
commit dbbc191704
3 changed files with 1 additions and 14 deletions

View File

@ -103,7 +103,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
private val FAV_SHOWN = 3 private val FAV_SHOWN = 3
private var items: ArrayList<SelfossModel.Item> = ArrayList() private var items: ArrayList<SelfossModel.Item> = ArrayList()
private var allItems: ArrayList<SelfossModel.Item> = ArrayList()
private var internalBrowser = false private var internalBrowser = false
private var articleViewer = false private var articleViewer = false
@ -206,8 +205,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
searchService = SearchService(DateUtils(repository.apiMajorVersion)) searchService = SearchService(DateUtils(repository.apiMajorVersion))
dbService = AndroidDeviceDatabaseService(dataBase, searchService) dbService = AndroidDeviceDatabaseService(dataBase, searchService)
service = SelfossService(api, dbService, searchService) service = SelfossService(api, dbService, searchService)
items = ArrayList()
allItems = ArrayList()
handleBottomBar() handleBottomBar()
handleDrawer() handleDrawer()
@ -229,7 +226,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
) )
binding.swipeRefreshLayout.setOnRefreshListener { binding.swipeRefreshLayout.setOnRefreshListener {
offlineShortcut = false offlineShortcut = false
allItems = ArrayList()
lastFetchDone = false lastFetchDone = false
handleDrawerItems() handleDrawerItems()
CoroutineScope(Dispatchers.Main).launch { CoroutineScope(Dispatchers.Main).launch {
@ -549,7 +545,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
textColor = ColorHolder.fromColor(Color.WHITE) textColor = ColorHolder.fromColor(Color.WHITE)
color = ColorHolder.fromColor(appColors.colorAccent) } color = ColorHolder.fromColor(appColors.colorAccent) }
onDrawerItemClickListener = { _,_,_ -> onDrawerItemClickListener = { _,_,_ ->
allItems = ArrayList()
searchService.tagFilter = it.tag searchService.tagFilter = it.tag
searchService.sourceFilter = null searchService.sourceFilter = null
searchService.sourceIDFilter = null searchService.sourceIDFilter = null
@ -602,7 +597,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
textColor = ColorHolder.fromColor(Color.WHITE) textColor = ColorHolder.fromColor(Color.WHITE)
color = ColorHolder.fromColor(appColors.colorAccent) } color = ColorHolder.fromColor(appColors.colorAccent) }
onDrawerItemClickListener = { _,_,_ -> onDrawerItemClickListener = { _,_,_ ->
allItems = ArrayList()
searchService.tagFilter = it.tag searchService.tagFilter = it.tag
searchService.sourceFilter = null searchService.sourceFilter = null
searchService.sourceIDFilter = null searchService.sourceIDFilter = null
@ -638,7 +632,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
identifier = source.id.toLong() identifier = source.id.toLong()
iconUrl = source.getIcon(apiDetailsService.getBaseUrl()) iconUrl = source.getIcon(apiDetailsService.getBaseUrl())
onDrawerItemClickListener = { _,_,_ -> onDrawerItemClickListener = { _,_,_ ->
allItems = ArrayList()
searchService.sourceIDFilter = source.id.toLong() searchService.sourceIDFilter = source.id.toLong()
searchService.sourceFilter = source.title searchService.sourceFilter = source.title
searchService.tagFilter = null searchService.tagFilter = null
@ -661,7 +654,6 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener, DIAwar
identifier = DRAWER_ID_FILTERS identifier = DRAWER_ID_FILTERS
badgeRes = R.string.drawer_action_clear badgeRes = R.string.drawer_action_clear
onDrawerItemClickListener = { _,_,_ -> onDrawerItemClickListener = { _,_,_ ->
allItems = ArrayList()
searchService.sourceFilter = null searchService.sourceFilter = null
searchService.sourceIDFilter = null searchService.sourceIDFilter = null
searchService.tagFilter = null searchService.tagFilter = null

View File

@ -6,7 +6,6 @@ interface Repository {
// TODO: remove the items variables in favor of storing everything in the database // TODO: remove the items variables in favor of storing everything in the database
var items: ArrayList<SelfossModel.Item> var items: ArrayList<SelfossModel.Item>
var selectedItems: ArrayList<SelfossModel.Item>
var baseUrl: String var baseUrl: String
var selectedType: String var selectedType: String

View File

@ -17,10 +17,6 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
get() { return ArrayList(field) } get() { return ArrayList(field) }
set(value) { field = ArrayList(value) } set(value) { field = ArrayList(value) }
override var selectedItems = ArrayList<SelfossModel.Item>()
get() { return ArrayList(field) }
set(value) { field = ArrayList(value) }
override var baseUrl = apiDetails.getBaseUrl() override var baseUrl = apiDetails.getBaseUrl()
// TODO: Validate the string in the setter // TODO: Validate the string in the setter
@ -55,7 +51,7 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
override suspend fun getOlderItems(): ArrayList<SelfossModel.Item> { override suspend fun getOlderItems(): ArrayList<SelfossModel.Item> {
// TODO: Check connectivity // TODO: Check connectivity
val offset = selectedItems.size val offset = filterSelectedItems(items).size
val fetchedItems = api.getItems(selectedType, val fetchedItems = api.getItems(selectedType,
settings.getString("prefer_api_items_number", "200").toInt(), settings.getString("prefer_api_items_number", "200").toInt(),
offset, offset,