feat(ranking): 반응형 폭 스케일을 추가한다
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
package kr.co.vividnext.sodalive.v2.widget.ranking
|
||||
|
||||
import android.content.res.Resources
|
||||
|
||||
object RankingResponsiveScale {
|
||||
private const val BASE_WIDTH_DP = 402
|
||||
|
||||
fun fromResources(resources: Resources): Float = fromScreenWidthDp(resources.configuration.screenWidthDp)
|
||||
|
||||
fun fromScreenWidthDp(screenWidthDp: Int): Float {
|
||||
return when {
|
||||
screenWidthDp <= 0 -> 1f
|
||||
screenWidthDp >= BASE_WIDTH_DP -> 1f
|
||||
else -> screenWidthDp / BASE_WIDTH_DP.toFloat()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user