-
-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite BaseItemInfoRow with Compose #3379
Rewrite BaseItemInfoRow with Compose #3379
Conversation
<item quantity="one">%1$s item</item> | ||
<item quantity="other">%1$s items</item> | ||
</plurals> | ||
<plurals name="movies"> |
Check warning
Code scanning / Android Lint
Unused resources Warning
<item quantity="one">%1$s movie</item> | ||
<item quantity="other">%1$s movies</item> | ||
</plurals> | ||
<plurals name="tv_series"> |
Check warning
Code scanning / Android Lint
Unused resources Warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
detekt found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
d0ff7ca
to
366b188
Compare
|
||
public class InfoLayoutHelper { | ||
public static void addInfoRow(Context context, BaseItemDto item, LinearLayout layout, boolean includeRuntime) { |
Check notice
Code scanning / Android Lint
Unknown nullness Note
|
||
public class InfoLayoutHelper { | ||
public static void addInfoRow(Context context, BaseItemDto item, LinearLayout layout, boolean includeRuntime) { |
Check notice
Code scanning / Android Lint
Unknown nullness Note
|
||
public class InfoLayoutHelper { | ||
public static void addInfoRow(Context context, BaseItemDto item, LinearLayout layout, boolean includeRuntime) { |
Check notice
Code scanning / Android Lint
Unknown nullness Note
} | ||
|
||
@Composable | ||
fun InfoRowMediaDetails(item: BaseItemDto) { |
Check warning
Code scanning / detekt
One method should have one responsibility. Long methods tend to handle many things at once. Prefer smaller methods to make them easier to understand. Warning
} | ||
|
||
@Composable | ||
fun BaseItemInfoRow( |
Check warning
Code scanning / detekt
One method should have one responsibility. Long methods tend to handle many things at once. Prefer smaller methods to make them easier to understand. Warning
} | ||
|
||
@Composable | ||
fun InfoRowMediaDetails(item: BaseItemDto) { |
Check warning
Code scanning / detekt
Prefer splitting up complex methods into smaller, easier to test methods. Warning
} | ||
|
||
@Composable | ||
fun BaseItemInfoRow( |
Check warning
Code scanning / detekt
Prefer splitting up complex methods into smaller, easier to test methods. Warning
|
||
@Composable | ||
@Suppress("MagicNumber") | ||
fun getResolutionName(width: Int, height: Int, interlaced: Boolean = false): String { |
Check warning
Code scanning / detekt
Prefer splitting up complex methods into smaller, easier to test methods. Warning
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
if (ratingType != RatingType.RATING_HIDDEN) { | ||
item.communityRating?.let { InfoRowCommunityRating(it / 10f) } |
Check warning
Code scanning / detekt
Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning
) { | ||
if (ratingType != RatingType.RATING_HIDDEN) { | ||
item.communityRating?.let { InfoRowCommunityRating(it / 10f) } | ||
item.criticRating?.let { InfoRowCriticRating(it / 100f) } |
Check warning
Code scanning / detekt
Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning
* Colors used inm the [BaseItemInfoRow]. | ||
*/ | ||
object InfoRowColors { | ||
val Default = Color(0xFF333333) |
Check warning
Code scanning / detekt
Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning
*/ | ||
object InfoRowColors { | ||
val Default = Color(0xFF333333) | ||
val Green = Color(0xFF30843D) |
Check warning
Code scanning / detekt
Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning
object InfoRowColors { | ||
val Default = Color(0xFF333333) | ||
val Green = Color(0xFF30843D) | ||
val Red = Color(0xFFB20000) |
Check warning
Code scanning / detekt
Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning
app/src/main/java/org/jellyfin/androidtv/ui/browsing/composable/inforow/InfoRowColors.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Cody Robibero <[email protected]>
This is an old branch of mine that I started about a year ago but never finished... I've finally completed it now lol.
The info row is what is shown below the title while browsing, almost all screens use it and thus it is a bit messy. This pull request aims to rewrite it in Kotlin with Compose, not necessarily to clean it up.
The info row items shown are mostly the same. There are some tweaks to the design, improvements to datetime formatting and in some cases some items are removed/reordered or added.
This also adds a lot of proper plurals to the strings, so stuff like "1 episodes" should not happen in this row anymore.
Changes
Before
After
Issues