Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
cleanup home screen
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed Oct 13, 2023
1 parent 9c15995 commit ff6de6e
Showing 1 changed file with 45 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/*******************************************************************************
Created By Suhas Dissanayake on 7/30/23, 1:20 PM
Copyright (c) 2023
https://github.com/SuhasDissa/
All Rights Reserved
******************************************************************************/

package app.suhasdissa.memerize.ui.screens.home

import androidx.activity.ComponentActivity
Expand Down Expand Up @@ -96,53 +89,57 @@ fun HomeScreen(
LazyColumn(
Modifier.fillMaxSize().padding(horizontal = 8.dp).padding(paddingValues)
) {
item {
Text(
stringResource(R.string.subreddits),
style = MaterialTheme.typography.titleLarge
)
}
items(items = subreddits) {
HighlightCard(
onClick = {
if (selectedSubreddits.isNotEmpty()) {
if (subreddits.isNotEmpty()) {
item {
Text(
stringResource(R.string.subreddits),
style = MaterialTheme.typography.titleLarge
)
}
items(items = subreddits) {
HighlightCard(
onClick = {
if (selectedSubreddits.isNotEmpty()) {
if (selectedSubreddits.contains(it)) {
selectedSubreddits.remove(it)
} else {
selectedSubreddits.add(it)
}
} else {
redditViewModel.getMemePhotos(it)
onNavigate(Destination.RedditMemeView)
}
},
name = it.name,
thumbnail_url = it.iconUrl,
onLongClick = {
if (selectedSubreddits.contains(it)) {
selectedSubreddits.remove(it)
} else {
selectedSubreddits.add(it)
}
} else {
redditViewModel.getMemePhotos(it)
onNavigate(Destination.RedditMemeView)
}
},
name = it.name,
thumbnail_url = it.iconUrl,
onLongClick = {
if (selectedSubreddits.contains(it)) {
selectedSubreddits.remove(it)
} else {
selectedSubreddits.add(it)
}
},
highlighted = selectedSubreddits.contains(it)
)
}
item {
Text(
stringResource(R.string.lemmy_communities),
style = MaterialTheme.typography.titleLarge
)
},
highlighted = selectedSubreddits.contains(it)
)
}
}
items(items = communities) {
HighlightCard(
onClick = {
lemmyViewModel.getMemePhotos(it)
onNavigate(Destination.LemmyMemeView)
},
name = it.name,
thumbnail_url = it.iconUrl
)
if (communities.isNotEmpty()) {
item {
Text(
stringResource(R.string.lemmy_communities),
style = MaterialTheme.typography.titleLarge
)
}
items(items = communities) {
HighlightCard(
onClick = {
lemmyViewModel.getMemePhotos(it)
onNavigate(Destination.LemmyMemeView)
},
name = it.name,
thumbnail_url = it.iconUrl
)
}
}
}
}
Expand Down

0 comments on commit ff6de6e

Please sign in to comment.