Created
June 5, 2020 04:42
-
-
Save jtmuller5/672ed1a5cb08e416241e2c5102f846f2 to your computer and use it in GitHub Desktop.
BroadcastReceiver for Custom Tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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