Automatically change the color of the navigation bar in the Receive Home and Send screens to green blue and red respectively.

master
Severiano Jaramillo 2019-03-13 21:31:51 -06:00
parent b2a6a3828c
commit 3f3423873c
3 changed files with 21 additions and 9 deletions

View File

@ -51,9 +51,13 @@ class HomeFragment : Fragment() {
val window = activity?.window
window?.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
window?.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
// Sets the status bar background color to a primaryColorDark
window?.statusBarColor = ContextCompat.getColor(context!!,
if (!nightMode) R.color.colorPrimaryDark else R.color.colorStatusBarDark)
// Sets the status and navigation bars background color to a dark blue or just dark
context?.let { context ->
val statusBarColor = ContextCompat.getColor(context,
if (!nightMode) R.color.colorPrimaryDark else R.color.colorStatusBarDark)
window?.statusBarColor = statusBarColor
window?.navigationBarColor = statusBarColor
}
return inflater.inflate(R.layout.fragment_home, container, false)
}

View File

@ -91,10 +91,14 @@ class ReceiveTransactionFragment : ConnectedFragment() {
val toolbar: Toolbar? = activity?.findViewById(R.id.toolbar)
toolbar?.setBackgroundResource(if (!nightMode) R.color.colorReceive else R.color.colorToolbarDark)
// Sets the status bar background color to a dark green
// Sets the status and navigation bars background color to a dark green or just dark
val window = activity?.window
window?.statusBarColor = ContextCompat.getColor(context!!,
if (!nightMode) R.color.colorReceiveDark else R.color.colorStatusBarDark)
context?.let { context ->
val statusBarColor = ContextCompat.getColor(context,
if (!nightMode) R.color.colorReceiveDark else R.color.colorStatusBarDark)
window?.statusBarColor = statusBarColor
window?.navigationBarColor = statusBarColor
}
return inflater.inflate(R.layout.fragment_receive_transaction, container, false)
}

View File

@ -122,10 +122,14 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
val toolbar: Toolbar? = activity?.findViewById(R.id.toolbar)
toolbar?.setBackgroundResource(if (!nightMode) R.color.colorSend else R.color.colorToolbarDark)
// Sets the status bar background color to a dark red
// Sets the status and navigation bars background color to a dark red or just dark
val window = activity?.window
window?.statusBarColor = ContextCompat.getColor(context!!,
if (!nightMode) R.color.colorSendDark else R.color.colorStatusBarDark)
context?.let { context ->
val statusBarColor = ContextCompat.getColor(context,
if (!nightMode) R.color.colorSendDark else R.color.colorStatusBarDark)
window?.statusBarColor = statusBarColor
window?.navigationBarColor = statusBarColor
}
return inflater.inflate(R.layout.fragment_send_transaction, container, false)
}