diff --git a/.idea/misc.xml b/.idea/misc.xml index 9422e84..b6b3462 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,12 @@ + + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f49b1e9..7e0a9c3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -30,7 +30,7 @@ android:value="YOUR_API_KEY" /> diff --git a/app/src/main/java/com/example/nemophila/MainActivity.java b/app/src/main/java/com/example/nemophila/MainActivity.java new file mode 100644 index 0000000..a01b35d --- /dev/null +++ b/app/src/main/java/com/example/nemophila/MainActivity.java @@ -0,0 +1,51 @@ +package com.example.nemophila; + +import androidx.fragment.app.FragmentActivity; + +import android.os.Bundle; + +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 com.example.nemophila.databinding.ActivityMainBinding; + +public class MainActivity extends FragmentActivity implements OnMapReadyCallback { + + private GoogleMap mMap; + private ActivityMainBinding binding; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + binding = ActivityMainBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + + // Obtain the SupportMapFragment and get notified when the map is ready to be used. + SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() + .findFragmentById(R.id.map); + 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 + public void onMapReady(GoogleMap googleMap) { + mMap = googleMap; + + // Add a marker in Sydney and move the camera + LatLng sydney = new LatLng(-34, 151); + mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); + mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/nemophila/MapsActivity.java b/app/src/main/java/com/example/nemophila/MapsActivity.java deleted file mode 100644 index e53633c..0000000 --- a/app/src/main/java/com/example/nemophila/MapsActivity.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.example.nemophila; - -import androidx.fragment.app.FragmentActivity; - -import android.os.Bundle; - -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 com.example.nemophila.databinding.ActivityMapsBinding; - -public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { - - private GoogleMap mMap; - private ActivityMapsBinding binding; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - binding = ActivityMapsBinding.inflate(getLayoutInflater()); - setContentView(binding.getRoot()); - - // Obtain the SupportMapFragment and get notified when the map is ready to be used. - SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() - .findFragmentById(R.id.map); - 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 - public void onMapReady(GoogleMap googleMap) { - mMap = googleMap; - - // Add a marker in Sydney and move the camera - LatLng sydney = new LatLng(-34, 151); - mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); - mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); - } -} \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..cfbceaa --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_maps.xml b/app/src/main/res/layout/activity_maps.xml deleted file mode 100644 index ec352fc..0000000 --- a/app/src/main/res/layout/activity_maps.xml +++ /dev/null @@ -1,9 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 500bfc3..18f9db5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,4 @@ Nemophila - MapsActivity + MainActivity \ No newline at end of file