From 2ed39fabdd9c11ce289114a3b7605c187c58e9f6 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Tue, 22 Jan 2019 15:53:14 -0600 Subject: [PATCH] Create a night mode style for the Merchants & Tellers map and apply it only when the app is in night mode, use the default map theme otherwise. --- .../fragments/MerchantsFragment.kt | 27 ++- app/src/main/res/raw/map_style_night.json | 161 ++++++++++++++++++ 2 files changed, 184 insertions(+), 4 deletions(-) create mode 100644 app/src/main/res/raw/map_style_night.json diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt index 89e8005..5413b95 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/MerchantsFragment.kt @@ -12,9 +12,6 @@ import android.view.ViewGroup import com.google.android.gms.maps.GoogleMap import com.google.android.gms.maps.OnMapReadyCallback import com.google.android.gms.maps.SupportMapFragment -import com.google.android.gms.maps.model.BitmapDescriptorFactory -import com.google.android.gms.maps.model.LatLng -import com.google.android.gms.maps.model.MarkerOptions import com.google.gson.GsonBuilder import cy.agorise.bitsybitshareswallet.R @@ -28,8 +25,9 @@ import java.io.IOException import android.graphics.Bitmap import android.graphics.Canvas import android.graphics.drawable.Drawable +import android.preference.PreferenceManager import androidx.core.content.ContextCompat -import com.google.android.gms.maps.model.BitmapDescriptor +import com.google.android.gms.maps.model.* import cy.agorise.bitsybitshareswallet.database.entities.Merchant import cy.agorise.bitsybitshareswallet.utils.Constants import cy.agorise.bitsybitshareswallet.utils.toast @@ -105,6 +103,8 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, retrofit2.Callback>, response: Response>) { if (response.isSuccessful) { val res: FeathersResponse? = response.body() diff --git a/app/src/main/res/raw/map_style_night.json b/app/src/main/res/raw/map_style_night.json new file mode 100644 index 0000000..049e213 --- /dev/null +++ b/app/src/main/res/raw/map_style_night.json @@ -0,0 +1,161 @@ +[ + { + "elementType": "geometry", + "stylers": [ + { + "color": "#242f3e" + } + ] + }, + { + "elementType": "labels.text.fill", + "stylers": [ + { + "color": "#746855" + } + ] + }, + { + "elementType": "labels.text.stroke", + "stylers": [ + { + "color": "#242f3e" + } + ] + }, + { + "featureType": "administrative.locality", + "elementType": "labels.text.fill", + "stylers": [ + { + "color": "#d59563" + } + ] + }, + { + "featureType": "poi", + "elementType": "labels.text.fill", + "stylers": [ + { + "color": "#d59563" + } + ] + }, + { + "featureType": "poi.park", + "elementType": "geometry", + "stylers": [ + { + "color": "#263c3f" + } + ] + }, + { + "featureType": "poi.park", + "elementType": "labels.text.fill", + "stylers": [ + { + "color": "#6b9a76" + } + ] + }, + { + "featureType": "road", + "elementType": "geometry", + "stylers": [ + { + "color": "#38414e" + } + ] + }, + { + "featureType": "road", + "elementType": "geometry.stroke", + "stylers": [ + { + "color": "#212a37" + } + ] + }, + { + "featureType": "road", + "elementType": "labels.text.fill", + "stylers": [ + { + "color": "#9ca5b3" + } + ] + }, + { + "featureType": "road.highway", + "elementType": "geometry", + "stylers": [ + { + "color": "#746855" + } + ] + }, + { + "featureType": "road.highway", + "elementType": "geometry.stroke", + "stylers": [ + { + "color": "#1f2835" + } + ] + }, + { + "featureType": "road.highway", + "elementType": "labels.text.fill", + "stylers": [ + { + "color": "#f3d19c" + } + ] + }, + { + "featureType": "transit", + "elementType": "geometry", + "stylers": [ + { + "color": "#2f3948" + } + ] + }, + { + "featureType": "transit.station", + "elementType": "labels.text.fill", + "stylers": [ + { + "color": "#d59563" + } + ] + }, + { + "featureType": "water", + "elementType": "geometry", + "stylers": [ + { + "color": "#17263c" + } + ] + }, + { + "featureType": "water", + "elementType": "labels.text.fill", + "stylers": [ + { + "color": "#515c6d" + } + ] + }, + { + "featureType": "water", + "elementType": "labels.text.stroke", + "stylers": [ + { + "color": "#17263c" + } + ] + } +] \ No newline at end of file