Completed the migration of the whole app to the new Material Components color theming.

This commit is contained in:
Severiano Jaramillo 2019-03-20 11:04:05 -06:00
parent 313ff06861
commit 5d8dc8ec39
10 changed files with 23 additions and 28 deletions

View file

@ -40,7 +40,7 @@
<activity <activity
android:name=".activities.MainActivity" android:name=".activities.MainActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Theme.Bitsy.NoActionBar" android:theme="@style/Theme.Bitsy"
android:windowSoftInputMode="adjustPan"/> android:windowSoftInputMode="adjustPan"/>
<!-- Used to share Images like the QR code and the eReceipt --> <!-- Used to share Images like the QR code and the eReceipt -->
<provider <provider

View file

@ -32,7 +32,7 @@ class MainActivity : ConnectedActivity() {
// Sets the theme to night mode if it has been selected by the user // Sets the theme to night mode if it has been selected by the user
if (PreferenceManager.getDefaultSharedPreferences(this) if (PreferenceManager.getDefaultSharedPreferences(this)
.getBoolean(Constants.KEY_NIGHT_MODE_ACTIVATED, false)) { .getBoolean(Constants.KEY_NIGHT_MODE_ACTIVATED, false)) {
setTheme(R.style.Theme_Bitsy_Dark_NoActionBar) setTheme(R.style.Theme_Bitsy_Dark)
} }
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)

View file

@ -54,7 +54,7 @@ class HomeFragment : Fragment() {
// Sets the status and navigation bars background color to a dark blue or just dark // Sets the status and navigation bars background color to a dark blue or just dark
context?.let { context -> context?.let { context ->
val statusBarColor = ContextCompat.getColor(context, val statusBarColor = ContextCompat.getColor(context,
if (!nightMode) R.color.colorPrimaryDark else R.color.colorStatusBarDark) if (!nightMode) R.color.colorPrimaryVariant else R.color.colorStatusBarDark)
window?.statusBarColor = statusBarColor window?.statusBarColor = statusBarColor
window?.navigationBarColor = statusBarColor window?.navigationBarColor = statusBarColor
} }

View file

@ -354,8 +354,8 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
cameraPreview.setFormats(listOf(BarcodeFormat.QR_CODE)) cameraPreview.setFormats(listOf(BarcodeFormat.QR_CODE))
cameraPreview.setAspectTolerance(0.5f) cameraPreview.setAspectTolerance(0.5f)
cameraPreview.setAutoFocus(true) cameraPreview.setAutoFocus(true)
cameraPreview.setLaserColor(R.color.colorAccent) cameraPreview.setLaserColor(R.color.colorSecondary)
cameraPreview.setMaskColor(R.color.colorAccent) cameraPreview.setMaskColor(R.color.colorSecondary)
cameraPreview.setResultHandler(this) cameraPreview.setResultHandler(this)
cameraPreview.startCamera() cameraPreview.startCamera()

View file

@ -6,6 +6,7 @@ import android.os.Bundle
import android.os.Message import android.os.Message
import android.widget.DatePicker import android.widget.DatePicker
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import com.google.android.material.picker.MaterialDatePickerDialog
import cy.agorise.bitsybitshareswallet.fragments.FilterOptionsDialog import cy.agorise.bitsybitshareswallet.fragments.FilterOptionsDialog
import java.util.* import java.util.*
@ -58,7 +59,7 @@ class DatePickerFragment : DialogFragment(), DatePickerDialog.OnDateSetListener
val day = calendar.get(Calendar.DAY_OF_MONTH) val day = calendar.get(Calendar.DAY_OF_MONTH)
// Create a new instance of DatePickerDialog and return it // Create a new instance of DatePickerDialog and return it
val datePicker = DatePickerDialog(activity!!, this, year, month, day) val datePicker = MaterialDatePickerDialog(activity!!, this, year, month, day)
// Set maximum date allowed to today // Set maximum date allowed to today
datePicker.datePicker.maxDate = maxTime datePicker.datePicker.maxDate = maxTime

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent"/> <solid android:color="@android:color/transparent"/>
<corners android:radius="4dp"/> <corners android:radius="4dp"/>
<stroke android:color="@color/colorAccent" android:width="1dp"/> <stroke android:color="@color/colorSecondary" android:width="1dp"/>
</shape> </shape>

View file

@ -48,6 +48,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_different_section" android:layout_marginStart="@dimen/spacing_different_section"
android:layout_marginEnd="@dimen/spacing_different_section" android:layout_marginEnd="@dimen/spacing_different_section"
app:boxBackgroundColor="?android:colorBackground"
app:layout_constraintTop_toBottomOf="@id/tvSubTitle" app:layout_constraintTop_toBottomOf="@id/tvSubTitle"
app:layout_constraintBottom_toBottomOf="parent"> app:layout_constraintBottom_toBottomOf="parent">

View file

@ -31,6 +31,7 @@
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabReceiveTransaction" android:id="@+id/fabReceiveTransaction"
style="@style/Widget.MaterialComponents.FloatingActionButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:fabSize="auto" app:fabSize="auto"
@ -79,7 +80,6 @@
app:layout_constraintBottom_toTopOf="@+id/tvSendTransaction" app:layout_constraintBottom_toTopOf="@+id/tvSendTransaction"
app:layout_constraintVertical_chainStyle="packed"/> app:layout_constraintVertical_chainStyle="packed"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabSendTransactionCamera" android:id="@+id/fabSendTransactionCamera"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="colorPrimary">#0099d6</color> <color name="colorPrimary">#0099d6</color>
<color name="colorPrimaryDark">#006ba4</color> <color name="colorPrimaryVariant">#006ba4</color>
<color name="colorAccent">#0099d6</color> <color name="colorSecondary">#0099d6</color>
<!-- Dark theme --> <!-- Dark theme -->
<color name="colorBackgroundFloating">#424242</color> <color name="colorBackgroundFloating">#424242</color>

View file

@ -1,43 +1,36 @@
<resources> <resources>
<!-- Base application light theme. --> <!-- Base application light theme. -->
<style name="Theme.Bitsy" parent="Theme.MaterialComponents.Light.DarkActionBar.Bridge"> <style name="Theme.Bitsy" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryVariant">@color/colorPrimaryVariant</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorSecondary">@color/colorSecondary</item>
<item name="colorOnSecondary">#fff</item>
<!--Custom attributes --> <!--Custom attributes -->
<item name="android:fontFamily">@font/p_f_beau_sans_pro</item> <item name="android:fontFamily">@font/p_f_beau_sans_pro</item>
<item name="themedColorBackgroundFloating">@android:color/white</item> <item name="themedColorBackgroundFloating">@android:color/white</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item> <item name="android:statusBarColor">@color/colorPrimaryVariant</item>
<item name="android:navigationBarColor">@color/colorPrimaryDark</item> <item name="android:navigationBarColor">@color/colorPrimaryVariant</item>
</style>
<style name="Theme.Bitsy.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style> </style>
<style name="Theme.Bitsy.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar"/> <style name="Theme.Bitsy.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar"/>
<!-- Base application dark theme. --> <!-- Base application dark theme. -->
<!-- Bridge is still used cause there is an issue with the Transactions' FilterOptionsDialog Calendar --> <style name="Theme.Bitsy.Dark" parent="Theme.MaterialComponents.NoActionBar">
<style name="Theme.Bitsy.Dark" parent="Theme.MaterialComponents.Bridge">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryVariant">@color/colorPrimaryVariant</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorSecondary">@color/colorSecondary</item>
<item name="colorOnSecondary">#fff</item>
<!--Custom attributes --> <!--Custom attributes -->
<item name="android:fontFamily">@font/p_f_beau_sans_pro</item> <item name="android:fontFamily">@font/p_f_beau_sans_pro</item>
<item name="themedColorBackgroundFloating">@color/colorBackgroundFloating</item> <item name="themedColorBackgroundFloating">@color/colorBackgroundFloating</item>
<item name="android:statusBarColor">@color/colorStatusBarDark</item> <item name="android:statusBarColor">@color/colorStatusBarDark</item>
<item name="android:navigationBarColor">@color/colorStatusBarDark</item> <item name="android:navigationBarColor">@color/colorStatusBarDark</item>
</style> </style>
<style name="Theme.Bitsy.Dark.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<!-- Custom widget styles --> <!-- Custom widget styles -->
<style name="SplashTheme" parent="Theme.Bitsy.NoActionBar"> <style name="SplashTheme" parent="Theme.Bitsy">
<item name="android:windowBackground">@drawable/splash_screen</item> <item name="android:windowBackground">@drawable/splash_screen</item>
</style> </style>