diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/HomeFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/HomeFragment.kt
index 9cf3fea..c158d5a 100644
--- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/HomeFragment.kt
+++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/HomeFragment.kt
@@ -23,20 +23,21 @@ class HomeFragment : Fragment() {
private lateinit var mUserAccountViewModel: UserAccountViewModel
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View? {
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
setHasOptionsMenu(true)
+ val nightMode = PreferenceManager.getDefaultSharedPreferences(context)
+ .getBoolean(Constants.KEY_NIGHT_MODE_ACTIVATED, false)
+
// Sets the toolbar background color to primaryColor and forces shows the Bitsy icon to the left
val toolbar: Toolbar? = activity?.findViewById(R.id.toolbar)
toolbar?.navigationIcon = resources.getDrawable(R.drawable.ic_bitsy_logo_2, null)
- toolbar?.setBackgroundResource(R.color.colorPrimary)
+ toolbar?.setBackgroundResource(if (!nightMode) R.color.colorPrimary else R.color.colorToolbarDark)
// Sets the status bar background color to a primaryColorDark
val window = activity?.window
- window?.statusBarColor = ContextCompat.getColor(context!!, R.color.colorPrimaryDark)
+ window?.statusBarColor = ContextCompat.getColor(context!!,
+ if (!nightMode) R.color.colorPrimaryDark else R.color.colorStatusBarDark)
return inflater.inflate(R.layout.fragment_home, container, false)
}
diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt
index b8a470b..f2d6190 100644
--- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt
+++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/ReceiveTransactionFragment.kt
@@ -95,13 +95,17 @@ class ReceiveTransactionFragment : Fragment(), ServiceConnection {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
setHasOptionsMenu(true)
+ val nightMode = PreferenceManager.getDefaultSharedPreferences(context)
+ .getBoolean(Constants.KEY_NIGHT_MODE_ACTIVATED, false)
+
// Sets the toolbar background color to green
val toolbar: Toolbar? = activity?.findViewById(R.id.toolbar)
- toolbar?.setBackgroundResource(R.color.colorReceive)
+ toolbar?.setBackgroundResource(if (!nightMode) R.color.colorReceive else R.color.colorToolbarDark)
// Sets the status bar background color to a dark green
val window = activity?.window
- window?.statusBarColor = ContextCompat.getColor(context!!, R.color.colorReceiveDark)
+ window?.statusBarColor = ContextCompat.getColor(context!!,
+ if (!nightMode) R.color.colorReceiveDark else R.color.colorStatusBarDark)
return inflater.inflate(R.layout.fragment_receive_transaction, container, false)
}
diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt
index 231faf9..f16bd24 100644
--- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt
+++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/SendTransactionFragment.kt
@@ -111,13 +111,17 @@ class SendTransactionFragment : Fragment(), ZXingScannerView.ResultHandler, Serv
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
setHasOptionsMenu(true)
+ val nightMode = PreferenceManager.getDefaultSharedPreferences(context)
+ .getBoolean(Constants.KEY_NIGHT_MODE_ACTIVATED, false)
+
// Sets the toolbar background color to red
val toolbar: Toolbar? = activity?.findViewById(R.id.toolbar)
- toolbar?.setBackgroundResource(R.color.colorSend)
+ toolbar?.setBackgroundResource(if (!nightMode) R.color.colorSend else R.color.colorToolbarDark)
// Sets the status bar background color to a dark red
val window = activity?.window
- window?.statusBarColor = ContextCompat.getColor(context!!, R.color.colorSendDark)
+ window?.statusBarColor = ContextCompat.getColor(context!!,
+ if (!nightMode) R.color.colorSendDark else R.color.colorStatusBarDark)
return inflater.inflate(R.layout.fragment_send_transaction, container, false)
}
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index e44bbef..91ec463 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -6,6 +6,8 @@
#424242
+ #424242
+ #212121
#000
#888
@@ -17,6 +19,5 @@
#1B5E20
#D32F2F
#B71C1C
- #F44336
#2888