forked from Ashinch/ReadYou
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat(feed): parse favicon for feed's site (Ashinch#471)"
This reverts commit f5c6e5f.
- Loading branch information
1 parent
5a00a46
commit 6a5e938
Showing
7 changed files
with
66 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
app/src/main/java/me/ash/reader/infrastructure/rss/Favicon.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,45 @@ | ||
package me.ash.reader.ui.component | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import me.ash.reader.ui.component.base.RYAsyncImage | ||
|
||
@Composable | ||
fun FeedIcon( | ||
feedName: String, | ||
iconUrl: String?, | ||
size: Dp = 20.dp, | ||
) { | ||
if (iconUrl == null) { | ||
Box( | ||
modifier = Modifier | ||
.size(20.dp) | ||
.clip(CircleShape) | ||
.background(MaterialTheme.colorScheme.primary), | ||
contentAlignment = Alignment.Center, | ||
) { | ||
Text( | ||
text = feedName.ifEmpty { " " }.first().toString(), | ||
fontWeight = FontWeight.Bold, | ||
color = MaterialTheme.colorScheme.onPrimary, | ||
fontSize = 10.sp, | ||
) | ||
} | ||
} else { | ||
RYAsyncImage( | ||
modifier = Modifier | ||
.size(size) | ||
.clip(CircleShape), | ||
contentDescription = feedName, | ||
data = iconUrl, | ||
placeholder = null, | ||
) | ||
} | ||
} | ||
Row( | ||
modifier = Modifier | ||
.size(20.dp) | ||
.clip(CircleShape) | ||
.background(MaterialTheme.colorScheme.outline.copy(alpha = 0.2f)) | ||
) {} | ||
|
||
@Preview | ||
@Composable | ||
fun FeedIconPrev(){ | ||
FeedIcon("AFF", null) | ||
// val url by remember { | ||
// mutableStateOf( | ||
// "https://ui-avatars.com/api/?length=1&background=random&name=${ | ||
// URLEncoder.encode( | ||
// feedName, | ||
// Charsets.UTF_8.toString() | ||
// ) | ||
// }" | ||
// ) | ||
// } | ||
// | ||
// AsyncImage( | ||
// modifier = Modifier | ||
// .size(size) | ||
// .clip(CircleShape), | ||
// contentDescription = feedName, | ||
// data = url, | ||
// placeholder = null, | ||
// ) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters