Automatically change the color of the navigation bar in the Receive Home and Send screens to green blue and red respectively.
This commit is contained in:
parent
b2a6a3828c
commit
3f3423873c
3 changed files with 21 additions and 9 deletions
|
@ -51,9 +51,13 @@ class HomeFragment : Fragment() {
|
||||||
val window = activity?.window
|
val window = activity?.window
|
||||||
window?.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
|
window?.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
|
||||||
window?.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
window?.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||||
// Sets the status bar background color to a primaryColorDark
|
// Sets the status and navigation bars background color to a dark blue or just dark
|
||||||
window?.statusBarColor = ContextCompat.getColor(context!!,
|
context?.let { context ->
|
||||||
|
val statusBarColor = ContextCompat.getColor(context,
|
||||||
if (!nightMode) R.color.colorPrimaryDark else R.color.colorStatusBarDark)
|
if (!nightMode) R.color.colorPrimaryDark else R.color.colorStatusBarDark)
|
||||||
|
window?.statusBarColor = statusBarColor
|
||||||
|
window?.navigationBarColor = statusBarColor
|
||||||
|
}
|
||||||
|
|
||||||
return inflater.inflate(R.layout.fragment_home, container, false)
|
return inflater.inflate(R.layout.fragment_home, container, false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,10 +91,14 @@ class ReceiveTransactionFragment : ConnectedFragment() {
|
||||||
val toolbar: Toolbar? = activity?.findViewById(R.id.toolbar)
|
val toolbar: Toolbar? = activity?.findViewById(R.id.toolbar)
|
||||||
toolbar?.setBackgroundResource(if (!nightMode) R.color.colorReceive else R.color.colorToolbarDark)
|
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
|
val window = activity?.window
|
||||||
window?.statusBarColor = ContextCompat.getColor(context!!,
|
context?.let { context ->
|
||||||
|
val statusBarColor = ContextCompat.getColor(context,
|
||||||
if (!nightMode) R.color.colorReceiveDark else R.color.colorStatusBarDark)
|
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)
|
return inflater.inflate(R.layout.fragment_receive_transaction, container, false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,10 +122,14 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
|
||||||
val toolbar: Toolbar? = activity?.findViewById(R.id.toolbar)
|
val toolbar: Toolbar? = activity?.findViewById(R.id.toolbar)
|
||||||
toolbar?.setBackgroundResource(if (!nightMode) R.color.colorSend else R.color.colorToolbarDark)
|
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
|
val window = activity?.window
|
||||||
window?.statusBarColor = ContextCompat.getColor(context!!,
|
context?.let { context ->
|
||||||
|
val statusBarColor = ContextCompat.getColor(context,
|
||||||
if (!nightMode) R.color.colorSendDark else R.color.colorStatusBarDark)
|
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)
|
return inflater.inflate(R.layout.fragment_send_transaction, container, false)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue