aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/views
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-08-06 00:49:58 -0700
committerAllan Wang <me@allanwang.ca>2019-08-06 00:49:58 -0700
commit55bf3e4b5b4af5baa3c230ca82f74988608971a3 (patch)
tree3db856e037b70257aaef19e34db6b0856bda6412 /app/src/main/kotlin/com/pitchedapps/frost/views
parent99953f087f2c363dad05ae3f86b5bcba22484e43 (diff)
downloadfrost-55bf3e4b5b4af5baa3c230ca82f74988608971a3.tar.gz
frost-55bf3e4b5b4af5baa3c230ca82f74988608971a3.tar.bz2
frost-55bf3e4b5b4af5baa3c230ca82f74988608971a3.zip
Format kotlin
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt19
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt5
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt13
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt8
6 files changed, 43 insertions, 13 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
index 51a7a8e9..9f2b8a5d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/BadgedIcon.kt
@@ -42,9 +42,13 @@ class BadgedIcon @JvmOverloads constructor(
init {
inflate(context, R.layout.view_badged_icon, this)
- val badgeColor = Prefs.mainActivityLayout.backgroundColor().withAlpha(255).colorToForeground(0.2f)
+ val badgeColor =
+ Prefs.mainActivityLayout.backgroundColor().withAlpha(255).colorToForeground(0.2f)
val badgeBackground =
- GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, intArrayOf(badgeColor, badgeColor))
+ GradientDrawable(
+ GradientDrawable.Orientation.BOTTOM_TOP,
+ intArrayOf(badgeColor, badgeColor)
+ )
badgeBackground.cornerRadius = 13.dpToPx.toFloat()
badge_text.background = badgeBackground
badge_text.setTextColor(Prefs.mainActivityLayout.iconColor())
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt
index 97be8951..5e82f0e9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt
@@ -96,7 +96,8 @@ class FrostRecyclerView @JvmOverloads constructor(
* Otherwise scroll to top
*/
override fun onTabClicked() {
- val firstPosition = (layoutManager as LinearLayoutManager).findFirstCompletelyVisibleItemPosition()
+ val firstPosition =
+ (layoutManager as LinearLayoutManager).findFirstCompletelyVisibleItemPosition()
if (firstPosition == 0) reloadBase(true)
else scrollToTop()
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
index 4d88ad3d..8d433c9e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostVideoViewer.kt
@@ -68,14 +68,19 @@ class FrostVideoViewer @JvmOverloads constructor(
* This is under the assumption that the container allows for overlays,
* such as a FrameLayout
*/
- fun showVideo(url: String, repeat: Boolean, contract: FrostVideoContainerContract): FrostVideoViewer {
+ fun showVideo(
+ url: String,
+ repeat: Boolean,
+ contract: FrostVideoContainerContract
+ ): FrostVideoViewer {
val container = contract.videoContainer
val videoViewer = FrostVideoViewer(container.context)
container.addView(videoViewer)
videoViewer.bringToFront()
videoViewer.setVideo(url, repeat)
videoViewer.video.containerContract = contract
- videoViewer.video.onFinishedListener = { container.removeView(videoViewer); contract.onVideoFinished() }
+ videoViewer.video.onFinishedListener =
+ { container.removeView(videoViewer); contract.onVideoFinished() }
return videoViewer
}
}
@@ -101,7 +106,8 @@ class FrostVideoViewer @JvmOverloads constructor(
when (it.itemId) {
R.id.action_pip -> video.isExpanded = false
R.id.action_download -> context.ctxCoroutine.launchMain {
- val cookie = FrostDatabase.get().cookieDao().currentCookie() ?: return@launchMain
+ val cookie =
+ FrostDatabase.get().cookieDao().currentCookie() ?: return@launchMain
context.frostDownload(cookie, video.videoUri)
}
}
@@ -162,7 +168,8 @@ class FrostVideoViewer @JvmOverloads constructor(
}
fun updateLocation() {
- viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
+ viewTreeObserver.addOnGlobalLayoutListener(object :
+ ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
video.updateLocation()
viewTreeObserver.removeOnGlobalLayoutListener(this)
@@ -172,7 +179,9 @@ class FrostVideoViewer @JvmOverloads constructor(
override fun onControlsShown() {
if (video.isExpanded)
- video_toolbar.fadeIn(duration = CONTROL_ANIMATION_DURATION, onStart = { video_toolbar.visible() })
+ video_toolbar.fadeIn(
+ duration = CONTROL_ANIMATION_DURATION,
+ onStart = { video_toolbar.visible() })
}
override fun onControlsHidden() {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt
index 7f0d792a..e018b6d8 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/KPrefTextSeekbar.kt
@@ -50,7 +50,10 @@ class KPrefTextSeekbar(builder: KPrefSeekbarContract) : KPrefSeekbar(builder) {
descOriginalSize = holder.desc?.textSize ?: 1f
holder.desc?.layoutParams
builder.toText = {
- holder.desc?.setTextSize(TypedValue.COMPLEX_UNIT_PX, descOriginalSize * it.toFloat() / 100)
+ holder.desc?.setTextSize(
+ TypedValue.COMPLEX_UNIT_PX,
+ descOriginalSize * it.toFloat() / 100
+ )
"$it%"
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt
index e63fcc21..02c60288 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt
@@ -58,7 +58,8 @@ class Keywords @JvmOverloads constructor(
editText.tint(Prefs.textColor)
addIcon.setImageDrawable(GoogleMaterial.Icon.gmd_add.keywordDrawable(context))
addIcon.setOnClickListener {
- if (editText.text.isNullOrEmpty()) editText.error = context.string(R.string.empty_keyword)
+ if (editText.text.isNullOrEmpty()) editText.error =
+ context.string(R.string.empty_keyword)
else {
adapter.add(0, KeywordItem(editText.text.toString()))
editText.text?.clear()
@@ -71,7 +72,12 @@ class Keywords @JvmOverloads constructor(
override fun onBind(viewHolder: RecyclerView.ViewHolder): View? =
(viewHolder as? KeywordItem.ViewHolder)?.delete
- override fun onClick(v: View, position: Int, fastAdapter: FastAdapter<KeywordItem>, item: KeywordItem) {
+ override fun onClick(
+ v: View,
+ position: Int,
+ fastAdapter: FastAdapter<KeywordItem>,
+ item: KeywordItem
+ ) {
adapter.remove(position)
}
})
@@ -82,7 +88,8 @@ class Keywords @JvmOverloads constructor(
}
}
-private fun IIcon.keywordDrawable(context: Context): Drawable = toDrawable(context, 20, Prefs.textColor)
+private fun IIcon.keywordDrawable(context: Context): Drawable =
+ toDrawable(context, 20, Prefs.textColor)
class KeywordItem(val keyword: String) : AbstractItem<KeywordItem, KeywordItem.ViewHolder>() {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt
index 5c7c58f1..9e9c2340 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/SwipeRefreshLayout.kt
@@ -83,7 +83,13 @@ class SwipeRefreshLayout @JvmOverloads constructor(context: Context, attrs: Attr
return super.onInterceptTouchEvent(ev)
}
- override fun onNestedScroll(target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int) {
+ override fun onNestedScroll(
+ target: View,
+ dxConsumed: Int,
+ dyConsumed: Int,
+ dxUnconsumed: Int,
+ dyUnconsumed: Int
+ ) {
if (preventRefresh) {
/*
* Ignoring offsetInWindow since