Skip to content

Commit

Permalink
Aastha/map view2 (#35)
Browse files Browse the repository at this point in the history
* Add mvp searchview functionality with rxjava

* Route Options searchview ui

* Addressing requested changes

* Adding MaxHeightListView commenting

* More commenting

* SearchInput focus on lower API versions

* More states for SearchView

* Search State changes

* Update map slightly

* Resolving conflicts

* MapSupport is now a MapView

Co-authored-by: connorreinhold <cyreinhold@gmail.com>
  • Loading branch information
aasthashah999 and connorreinhold authored Feb 12, 2020
1 parent 3a681ab commit ce816b8
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ build/
# Custom
app/src/main/res/values/google_maps_api.xml
.DS_Store
app/.DS_Store
app/src/.DS_Store
google-services.json

# API keys
Expand Down
Binary file modified app/.DS_Store
Binary file not shown.
Binary file modified app/src/.DS_Store
Binary file not shown.
14 changes: 7 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand All @@ -19,8 +19,6 @@
<activity android:name=".views.RouteCardCompact">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
Expand All @@ -37,17 +35,19 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.ithaca_transit_android_v2.MainActivity" />
</activity>

<!-- google_maps_key loaded in build.gradle -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class MainActivity : AppCompatActivity(), OnMapReadyCallback {
mSearchPresenter = SearchPresenter(search_card_holder, this, mSearchAdapter)

searchDisposable = mSearchPresenter.initSearchView()
(map_fragment as SupportMapFragment).getMapAsync(this)

// set up search adapter, location_list refers to listview of locations on launch
// location_list_2 refers to the listview of locations when editing their route options
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.example.ithaca_transit_android_v2

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.example.ithaca_transit_android_v2.R.id.map_fragment
import com.google.android.gms.common.GooglePlayServicesRepairableException
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.MapView
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.OnMapReadyCallback


class MapFragment: Fragment() , OnMapReadyCallback{
private lateinit var mapView: MapView
private lateinit var map: GoogleMap


override fun onCreateView(inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?): View? {

var v = inflater.inflate(R.layout.fragment_map, container, false)
mapView = v.findViewById(R.id.mapView2)
mapView.onCreate(savedInstanceState)
mapView.getMapAsync { this }
return v
}

override fun onMapReady(googleMap: GoogleMap) {
map = googleMap
map.uiSettings.isMyLocationButtonEnabled = false
map.isMyLocationEnabled = true
mapView.onResume()
}
override fun onResume() {
mapView.onResume()
super.onResume()
}


override fun onPause() {
super.onPause()
mapView.onPause()
}

override fun onDestroy() {
super.onDestroy()
mapView.onDestroy()
}

override fun onLowMemory() {
super.onLowMemory()
mapView.onLowMemory()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.example.ithaca_transit_android_v2.models.Coordinate
import com.example.ithaca_transit_android_v2.models.Location
import com.example.ithaca_transit_android_v2.models.RouteOptions
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types.newParameterizedType
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
Expand Down
24 changes: 12 additions & 12 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
android:gravity="bottom"
tools:context=".MainActivity">


<fragment
android:name="com.example.ithaca_transit_android_v2.MapFragment"
android:id="@+id/map_fragment"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:clickable="false"
android:focusable="false"
android:layout_marginTop="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/search_main" />
</LinearLayout>
android:layout_height="match_parent" />

<LinearLayout
android:clickable="false"
android:focusable="false"
android:layout_marginTop="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/search_main" />
</LinearLayout>

</fragment>
</RelativeLayout>

14 changes: 14 additions & 0 deletions app/src/main/res/layout/fragment_map.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">

<com.google.android.gms.maps.MapView
android:id="@+id/mapView2"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.google.android.gms.maps.MapView>


</LinearLayout>

0 comments on commit ce816b8

Please sign in to comment.