Added a map to the Merchants section with the default values and using the Google Maps API key Tadeo created when he was working on the project.

This commit is contained in:
Severiano Jaramillo 2018-12-14 12:12:42 -06:00
parent 283125b40e
commit 5ddce2a33f
7 changed files with 95 additions and 31 deletions

View file

@ -0,0 +1,24 @@
<resources>
<!--
Before you run your application, you need a Google Maps API key.
To get one, follow this link, follow the directions and press "Create" at the end:
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=08:07:B8:EC:7B:1E:00:82:29:24:A8:08:A6:AD:84:76:1C:D2:69:1A%3Bcy.agorise.bitsybitshareswallet.activities
You can also add your credentials to an existing key, using these values:
Package name:
08:07:B8:EC:7B:1E:00:82:29:24:A8:08:A6:AD:84:76:1C:D2:69:1A
SHA-1 certificate fingerprint:
08:07:B8:EC:7B:1E:00:82:29:24:A8:08:A6:AD:84:76:1C:D2:69:1A
Alternatively, follow the directions here:
https://developers.google.com/maps/documentation/android/start#get-key
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
-->
<string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">AIzaSyDIYbjdkZqbLUINQXrAzNSjNwep5jGNjKA</string>
</resources>

View file

@ -3,7 +3,13 @@
xmlns:tools="http://schemas.android.com/tools"
package="cy.agorise.bitsybitshareswallet">
<uses-permission android:name="android.permission.CAMERA" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA"/>
<application
android:name=".utils.BitsyApplication"
@ -14,6 +20,18 @@
android:supportsRtl="true"
android:theme="@style/Theme.Bitsy"
tools:ignore="GoogleAppIndexingWarning">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key"/>
<activity
android:name=".activities.SplashActivity"
android:theme="@style/SplashTheme">
@ -28,8 +46,8 @@
<activity android:name=".activities.ImportBrainkeyActivity"/>
<activity
android:name=".activities.MainActivity"
android:theme="@style/Theme.Bitsy.NoActionBar"
android:screenOrientation="portrait"
android:theme="@style/Theme.Bitsy.NoActionBar"
android:windowSoftInputMode="adjustPan"/>
</application>

View file

@ -1,18 +1,23 @@
package cy.agorise.bitsybitshareswallet.fragments
import androidx.lifecycle.ViewModelProviders
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.android.gms.maps.CameraUpdateFactory
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.LatLng
import com.google.android.gms.maps.model.MarkerOptions
import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.viewmodels.MerchantsViewModel
import kotlinx.android.synthetic.main.fragment_merchants.*
class MerchantsFragment : Fragment() {
class MerchantsFragment : Fragment(), OnMapReadyCallback {
private lateinit var viewModel: MerchantsViewModel
private lateinit var mMap: GoogleMap
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
@ -24,8 +29,28 @@ class MerchantsFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewModel = ViewModelProviders.of(this).get(MerchantsViewModel::class.java)
// TODO: Use the ViewModel
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
val mapFragment = childFragmentManager
.findFragmentById(R.id.map) as SupportMapFragment
mapFragment.getMapAsync(this)
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
override fun onMapReady(googleMap: GoogleMap) {
mMap = googleMap
// Add a marker in Sydney and move the camera
val sydney = LatLng(-34.0, 151.0)
mMap.addMarker(MarkerOptions().position(sydney).title("Marker in Sydney"))
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney))
}
}

View file

@ -1,7 +0,0 @@
package cy.agorise.bitsybitshareswallet.viewmodels
import androidx.lifecycle.ViewModel;
class MerchantsViewModel : ViewModel() {
// TODO: Implement the ViewModel
}

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/map"
tools:context=".activities.MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment"/>

View file

@ -1,14 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.MerchantsFragment">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/title_merchants"/>
</FrameLayout>
android:id="@+id/map"
tools:context=".fragments.MerchantsFragment"
android:name="com.google.android.gms.maps.SupportMapFragment"/>

View file

@ -67,7 +67,8 @@
edited.
</string>
<string name="msg__brainkey_info">Print this out, or write it down. Anyone with access to your recovery key will
have access to funds within this wallet.</string>
have access to funds within this wallet.
</string>
<string name="btn__view_and_copy"><![CDATA[View & Copy]]></string>
<string name="title__bugs_or_ideas">Bugs or Ideas?</string>
<string name="msg__bugs_or_ideas">Telegram chat: http://t.me/Agorise\nEmail: Agorise@protonmail.ch\nOpen Source: