Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion JetNews/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ dependencies {

implementation(libs.androidx.compose.animation)
implementation(libs.androidx.compose.foundation.layout)
implementation(libs.androidx.compose.material.iconsExtended)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.materialWindow)
implementation(libs.androidx.compose.runtime.livedata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.ListAlt
import androidx.compose.material3.DrawerState
import androidx.compose.material3.DrawerValue
import androidx.compose.material3.Icon
Expand Down Expand Up @@ -60,7 +57,7 @@ fun AppDrawer(
)
NavigationDrawerItem(
label = { Text(stringResource(id = R.string.home_title)) },
icon = { Icon(Icons.Filled.Home, null) },
icon = { Icon(painterResource(R.drawable.ic_home), null) },
selected = currentRoute == JetnewsDestinations.HOME_ROUTE,
onClick = {
navigateToHome()
Expand All @@ -70,7 +67,7 @@ fun AppDrawer(
)
NavigationDrawerItem(
label = { Text(stringResource(id = R.string.interests_title)) },
icon = { Icon(Icons.Filled.ListAlt, null) },
icon = { Icon(painterResource(R.drawable.ic_list_alt), null) },
selected = currentRoute == JetnewsDestinations.INTERESTS_ROUTE,
onClick = {
navigateToInterests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.BottomAppBar
import androidx.compose.material3.CenterAlignedTopAppBar
Expand Down Expand Up @@ -75,7 +73,7 @@ import kotlinx.coroutines.runBlocking
* @param showNavigationIcon (state) if the navigation icon should be shown
* @param onBack (event) request navigate back
* @param isFavorite (state) is this item currently a favorite
* @param onToggleFavorite (event) request that this post toggle it's favorite state
* @param onToggleFavorite (event) request that this post toggle its favorite state
* @param lazyListState (state) the [LazyListState] for the article content
*/
@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -103,7 +101,7 @@ fun ArticleScreen(
if (!isExpandedScreen) {
IconButton(onClick = onBack) {
Icon(
imageVector = Icons.Filled.ArrowBack,
painter = painterResource(R.drawable.ic_arrow_back),
contentDescription = stringResource(R.string.cd_navigate_up),
tint = MaterialTheme.colorScheme.primary,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountCircle
import androidx.compose.material3.ColorScheme
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -132,7 +130,7 @@ private fun PostMetadata(metadata: Metadata, modifier: Modifier = Modifier) {
modifier = modifier.semantics(mergeDescendants = true) {},
) {
Image(
imageVector = Icons.Filled.AccountCircle,
painter = painterResource(id = R.drawable.ic_account_circle),
contentDescription = null, // decorative
modifier = Modifier.size(40.dp),
colorFilter = ColorFilter.tint(LocalContentColor.current),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ package com.example.jetnews.ui.components
import android.content.res.Configuration
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.ListAlt
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationRail
Expand Down Expand Up @@ -54,14 +51,14 @@ fun AppNavRail(currentRoute: String, navigateToHome: () -> Unit, navigateToInter
NavigationRailItem(
selected = currentRoute == JetnewsDestinations.HOME_ROUTE,
onClick = navigateToHome,
icon = { Icon(Icons.Filled.Home, stringResource(R.string.home_title)) },
icon = { Icon(painterResource(id = R.drawable.ic_home), stringResource(R.string.home_title)) },
label = { Text(stringResource(R.string.home_title)) },
alwaysShowLabel = false,
)
NavigationRailItem(
selected = currentRoute == JetnewsDestinations.INTERESTS_ROUTE,
onClick = navigateToInterests,
icon = { Icon(Icons.Filled.ListAlt, stringResource(R.string.interests_title)) },
icon = { Icon(painterResource(id = R.drawable.ic_list_alt), stringResource(R.string.interests_title)) },
label = { Text(stringResource(R.string.interests_title)) },
alwaysShowLabel = false,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Search
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExperimentalMaterial3Api
Expand Down Expand Up @@ -612,7 +610,7 @@ private fun HomeSearch(modifier: Modifier = Modifier, searchInput: String = "",
value = searchInput,
onValueChange = onSearchInputChanged,
placeholder = { Text(stringResource(R.string.home_search)) },
leadingIcon = { Icon(Icons.Filled.Search, null) },
leadingIcon = { Icon(painter = painterResource(R.drawable.ic_search), contentDescription = null) },
modifier = modifier
.fillMaxWidth()
.interceptKey(Key.Enter) {
Expand Down Expand Up @@ -706,7 +704,7 @@ private fun HomeTopAppBar(
).show()
}) {
Icon(
imageVector = Icons.Filled.Search,
painter = painterResource(R.drawable.ic_search),
contentDescription = stringResource(R.string.cd_search),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
Expand Down Expand Up @@ -160,7 +158,7 @@ fun PostCardHistory(post: Post, navigateToArticle: (String) -> Unit) {
}
IconButton(onClick = { openDialog = true }) {
Icon(
imageVector = Icons.Filled.MoreVert,
painter = painterResource(R.drawable.ic_more_vert),
contentDescription = stringResource(R.string.cd_more_actions),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.selection.toggleable
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Search
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
Expand Down Expand Up @@ -155,7 +153,7 @@ fun InterestsScreen(
},
) {
Icon(
imageVector = Icons.Filled.Search,
painter = painterResource(R.drawable.ic_search),
contentDescription = stringResource(R.string.cd_search),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,20 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Done
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.example.jetnews.R
import com.example.jetnews.ui.theme.JetnewsTheme

@Composable
fun SelectTopicButton(modifier: Modifier = Modifier, selected: Boolean = false) {
val icon = if (selected) Icons.Filled.Done else Icons.Filled.Add
val icon = if (selected) painterResource(R.drawable.ic_check) else painterResource(R.drawable.ic_add)
val iconColor = if (selected) {
MaterialTheme.colorScheme.onPrimary
} else {
Expand All @@ -59,7 +58,7 @@ fun SelectTopicButton(modifier: Modifier = Modifier, selected: Boolean = false)
modifier = modifier.size(36.dp, 36.dp),
) {
Image(
imageVector = icon,
painter = icon,
colorFilter = ColorFilter.tint(iconColor),
modifier = Modifier.padding(8.dp),
contentDescription = null, // toggleable at higher level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@

package com.example.jetnews.ui.utils

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Bookmark
import androidx.compose.material.icons.filled.BookmarkBorder
import androidx.compose.material.icons.filled.Share
import androidx.compose.material.icons.filled.ThumbUpOffAlt
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconToggleButton
Expand All @@ -36,7 +31,7 @@ import com.example.jetnews.R
fun FavoriteButton(onClick: () -> Unit) {
IconButton(onClick) {
Icon(
imageVector = Icons.Filled.ThumbUpOffAlt,
painter = painterResource(R.drawable.ic_thumb_up),
contentDescription = stringResource(R.string.cd_add_to_favorites),
)
}
Expand All @@ -57,7 +52,7 @@ fun BookmarkButton(isBookmarked: Boolean, onClick: () -> Unit, modifier: Modifie
},
) {
Icon(
imageVector = if (isBookmarked) Icons.Filled.Bookmark else Icons.Filled.BookmarkBorder,
painter = if (isBookmarked) painterResource(R.drawable.ic_bookmark) else painterResource(R.drawable.ic_bookmark_outline),
contentDescription = null, // handled by click label of parent
)
}
Expand All @@ -67,7 +62,7 @@ fun BookmarkButton(isBookmarked: Boolean, onClick: () -> Unit, modifier: Modifie
fun ShareButton(onClick: () -> Unit) {
IconButton(onClick) {
Icon(
imageVector = Icons.Filled.Share,
painter = painterResource(R.drawable.ic_share),
contentDescription = stringResource(R.string.cd_share),
)
}
Expand Down
9 changes: 9 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_account_circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M234,684Q285,645 348,622.5Q411,600 480,600Q549,600 612,622.5Q675,645 726,684Q761,643 780.5,591Q800,539 800,480Q800,347 706.5,253.5Q613,160 480,160Q347,160 253.5,253.5Q160,347 160,480Q160,539 179.5,591Q199,643 234,684ZM480,520Q421,520 380.5,479.5Q340,439 340,380Q340,321 380.5,280.5Q421,240 480,240Q539,240 579.5,280.5Q620,321 620,380Q620,439 579.5,479.5Q539,520 480,520ZM480,880Q397,880 324,848.5Q251,817 197,763Q143,709 111.5,636Q80,563 80,480Q80,397 111.5,324Q143,251 197,197Q251,143 324,111.5Q397,80 480,80Q563,80 636,111.5Q709,143 763,197Q817,251 848.5,324Q880,397 880,480Q880,563 848.5,636Q817,709 763,763Q709,817 636,848.5Q563,880 480,880Z"/>
</vector>
9 changes: 9 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_add.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M440,520L200,520L200,440L440,440L440,200L520,200L520,440L760,440L760,520L520,520L520,760L440,760L440,520Z"/>
</vector>
10 changes: 10 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_arrow_back.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M313,520L537,744L480,800L160,480L480,160L537,216L313,440L800,440L800,520L313,520Z"/>
</vector>
9 changes: 9 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_bookmark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M200,840L200,200Q200,167 223.5,143.5Q247,120 280,120L680,120Q713,120 736.5,143.5Q760,167 760,200L760,840L480,720L200,840Z"/>
</vector>
9 changes: 9 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_bookmark_outline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M200,840L200,200Q200,167 223.5,143.5Q247,120 280,120L680,120Q713,120 736.5,143.5Q760,167 760,200L760,840L480,720L200,840ZM280,718L480,632L680,718L680,200Q680,200 680,200Q680,200 680,200L280,200Q280,200 280,200Q280,200 280,200L280,718ZM280,200L280,200Q280,200 280,200Q280,200 280,200L680,200Q680,200 680,200Q680,200 680,200L680,200L480,200L280,200Z"/>
</vector>
9 changes: 9 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_check.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M382,720L154,492L211,435L382,606L749,239L806,296L382,720Z"/>
</vector>
9 changes: 9 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_home.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M160,840L160,360L480,120L800,360L800,840L560,840L560,560L400,560L400,840L160,840Z"/>
</vector>
10 changes: 10 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_list_alt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M320,680Q337,680 348.5,668.5Q360,657 360,640Q360,623 348.5,611.5Q337,600 320,600Q303,600 291.5,611.5Q280,623 280,640Q280,657 291.5,668.5Q303,680 320,680ZM320,520Q337,520 348.5,508.5Q360,497 360,480Q360,463 348.5,451.5Q337,440 320,440Q303,440 291.5,451.5Q280,463 280,480Q280,497 291.5,508.5Q303,520 320,520ZM320,360Q337,360 348.5,348.5Q360,337 360,320Q360,303 348.5,291.5Q337,280 320,280Q303,280 291.5,291.5Q280,303 280,320Q280,337 291.5,348.5Q303,360 320,360ZM440,680L680,680L680,600L440,600L440,680ZM440,520L680,520L680,440L440,440L440,520ZM440,360L680,360L680,280L440,280L440,360ZM200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L760,120Q793,120 816.5,143.5Q840,167 840,200L840,760Q840,793 816.5,816.5Q793,840 760,840L200,840Z"/>
</vector>
9 changes: 9 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_more_vert.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M480,800Q447,800 423.5,776.5Q400,753 400,720Q400,687 423.5,663.5Q447,640 480,640Q513,640 536.5,663.5Q560,687 560,720Q560,753 536.5,776.5Q513,800 480,800ZM480,560Q447,560 423.5,536.5Q400,513 400,480Q400,447 423.5,423.5Q447,400 480,400Q513,400 536.5,423.5Q560,447 560,480Q560,513 536.5,536.5Q513,560 480,560ZM480,320Q447,320 423.5,296.5Q400,273 400,240Q400,207 423.5,183.5Q447,160 480,160Q513,160 536.5,183.5Q560,207 560,240Q560,273 536.5,296.5Q513,320 480,320Z"/>
</vector>
9 changes: 9 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M784,840L532,588Q502,612 463,626Q424,640 380,640Q271,640 195.5,564.5Q120,489 120,380Q120,271 195.5,195.5Q271,120 380,120Q489,120 564.5,195.5Q640,271 640,380Q640,424 626,463Q612,502 588,532L840,784L784,840ZM380,560Q455,560 507.5,507.5Q560,455 560,380Q560,305 507.5,252.5Q455,200 380,200Q305,200 252.5,252.5Q200,305 200,380Q200,455 252.5,507.5Q305,560 380,560Z"/>
</vector>
9 changes: 9 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_share.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M680,880Q630,880 595,845Q560,810 560,760Q560,754 563,732L282,568Q266,583 245,591.5Q224,600 200,600Q150,600 115,565Q80,530 80,480Q80,430 115,395Q150,360 200,360Q224,360 245,368.5Q266,377 282,392L563,228Q561,221 560.5,214.5Q560,208 560,200Q560,150 595,115Q630,80 680,80Q730,80 765,115Q800,150 800,200Q800,250 765,285Q730,320 680,320Q656,320 635,311.5Q614,303 598,288L317,452Q319,459 319.5,465.5Q320,472 320,480Q320,488 319.5,494.5Q319,501 317,508L598,672Q614,657 635,648.5Q656,640 680,640Q730,640 765,675Q800,710 800,760Q800,810 765,845Q730,880 680,880Z"/>
</vector>
9 changes: 9 additions & 0 deletions JetNews/app/src/main/res/drawable/ic_thumb_up.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M720,840L320,840L320,320L600,40L650,90Q657,97 661.5,109Q666,121 666,132L666,146L622,320L840,320Q872,320 896,344Q920,368 920,400L920,480Q920,487 918.5,495Q917,503 914,510L794,792Q785,812 764,826Q743,840 720,840ZM240,320L240,840L80,840L80,320L240,320Z"/>
</vector>