Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ public class DefaultDevLoadingViewImplementation(
private var devLoadingPopup: PopupWindow? = null

override fun showMessage(message: String) {
showMessage(message, color = null, backgroundColor = null)
}

override fun showMessage(message: String, color: Double?, backgroundColor: Double?) {
if (!isEnabled) {
return
}
UiThreadUtil.runOnUiThread { showInternal(message) }
UiThreadUtil.runOnUiThread { showInternal(message, color, backgroundColor) }
}

override fun updateProgress(status: String?, done: Int?, total: Int?) {
Expand All @@ -59,7 +63,7 @@ public class DefaultDevLoadingViewImplementation(
}
}

private fun showInternal(message: String) {
private fun showInternal(message: String, color: Double?, backgroundColor: Double?) {
if (devLoadingPopup?.isShowing == true) {
// already showing
return
Expand All @@ -84,6 +88,12 @@ public class DefaultDevLoadingViewImplementation(
currentActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
val view = inflater.inflate(R.layout.dev_loading_view, null) as TextView
view.text = message
if (color != null) {
view.setTextColor(color.toInt())
}
if (backgroundColor != null) {
view.setBackgroundColor(backgroundColor.toInt())
}
val popup =
PopupWindow(
view,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ package com.facebook.react.devsupport.interfaces
public interface DevLoadingViewManager {
public fun showMessage(message: String)

public fun showMessage(message: String, color: Double?, backgroundColor: Double?)

public fun updateProgress(status: String?, done: Int?, total: Int?)

public fun hide()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ internal class DevLoadingModule(reactContext: ReactApplicationContext) :
}

override fun showMessage(message: String, color: Double?, backgroundColor: Double?) {
UiThreadUtil.runOnUiThread { devLoadingViewManager?.showMessage(message) }
UiThreadUtil.runOnUiThread {
devLoadingViewManager?.showMessage(message, color, backgroundColor)
}
}

override fun hide() {
Expand Down
Loading