Skip to content

Instantly share code, notes, and snippets.

@jtmuller5
Created June 5, 2020 04:42
Show Gist options
  • Save jtmuller5/672ed1a5cb08e416241e2c5102f846f2 to your computer and use it in GitHub Desktop.
Save jtmuller5/672ed1a5cb08e416241e2c5102f846f2 to your computer and use it in GitHub Desktop.
BroadcastReceiver for Custom Tabs
class DigBroadcastReceiver() : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val uri: Uri? = intent.data
if (uri != null) {
Log.d("Broadcast URL",uri.toString())
var toast = Toast.makeText(context, uri.toString(), Toast.LENGTH_SHORT)
val view = toast.view
view.background.setColorFilter(ContextCompat.getColor(context,R.color.red), PorterDuff.Mode.SRC_IN)
val text = view.findViewById(android.R.id.message) as TextView
text.setTextColor(ContextCompat.getColor(context, R.color.common_google_signin_btn_text_dark))
text.textAlignment = View.TEXT_ALIGNMENT_CENTER
toast.setGravity(Gravity.BOTTOM,0,200)
toast.show()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment