-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from VeceluXa/screen-map
Screen map
- Loading branch information
Showing
63 changed files
with
1,203 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,41 @@ | ||
# Space | ||
# Space Android App | ||
## Mars Photos | ||
App uses Nasa's API to display photos from Mars in a list. When clicking on a photo, details screen is opened. There user can zoom/move photo like in a gallery app. Also user can share photo with 3rd party apps. | ||
|
||
## Setup | ||
- Add Firebase's google-services.json to the root directory of app module | ||
|
||
## Map | ||
|
||
User can view map of Earth in 3 different views (default, hybrid, satellite). When user clicks on a map the dialog opens up to type marker name. Upon saving marker it will be displayed in bottom sheet dialog that is visible to user but collapsed by default. | ||
|
||
--- | ||
# Tech stack | ||
- Android SDK | ||
- Clean Architecture | ||
- Moxy MVP | ||
- Cicerone Navigation | ||
- RxJava3 | ||
- Retrofit, OkHttp | ||
- Hilt | ||
- Splash Screen API | ||
- Google Maps SDK | ||
- Firebase Cloud Messaging | ||
- Moshi | ||
|
||
|
||
# Setup | ||
- Add Firebase's google-services.json to the root directory of app module to be able to send notification from Firebase Console | ||
- Add [NASA_API_KEY](https://api.nasa.gov/) to local.properties | ||
- Add [MAPS_API_KEY](https://developers.google.com/maps) to local.properties | ||
- Add [MAPS_API_KEY](https://developers.google.com/maps) to local.properties | ||
|
||
# Screenshots | ||
## Main Screen | ||
![](./assets/screen_home.jpg) | ||
|
||
## Details Screen | ||
![](./assets/screen_details_tutorial.jpg) | ||
![](./assets/screen_details.jpg) | ||
|
||
## Map Screen | ||
![](./assets/screen_map.jpg) | ||
![](./assets/screen_map_marker_dialog.jpg) | ||
![](./assets/screen_map_bottom_sheet_dialog.jpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/danilovfa/space/presentation/model/MapMarker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.danilovfa.space.presentation.model | ||
|
||
import com.google.android.gms.maps.model.Marker | ||
|
||
data class MapMarker( | ||
val label: String, | ||
val marker: Marker | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
app/src/main/java/com/danilovfa/space/presentation/mvp/map/MapView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
package com.danilovfa.space.presentation.mvp.map | ||
|
||
import com.danilovfa.space.presentation.model.MapMarker | ||
import moxy.MvpView | ||
import moxy.viewstate.strategy.AddToEndSingleStrategy | ||
import moxy.viewstate.strategy.OneExecutionStateStrategy | ||
import moxy.viewstate.strategy.StateStrategyType | ||
|
||
@StateStrategyType(value = OneExecutionStateStrategy::class) | ||
interface MapView : MvpView | ||
@StateStrategyType(value = AddToEndSingleStrategy::class) | ||
interface MapView : MvpView { | ||
fun showMarkers(markers: List<MapMarker>) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
app/src/main/java/com/danilovfa/space/presentation/ui/adapter/MarkersAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.danilovfa.space.presentation.ui.adapter | ||
|
||
import android.content.Context | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.AsyncListDiffer | ||
import androidx.recyclerview.widget.DiffUtil | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.danilovfa.space.databinding.ItemMarkerBinding | ||
import com.danilovfa.space.presentation.model.MapMarker | ||
|
||
class MarkersAdapter : | ||
RecyclerView.Adapter<MarkersAdapter.ViewHolder>() { | ||
|
||
private var onMarkerDeleteListener: OnMarkerDeleteListener? = null | ||
|
||
private val differCallback = object : DiffUtil.ItemCallback<MapMarker>() { | ||
override fun areItemsTheSame(oldItem: MapMarker, newItem: MapMarker): Boolean { | ||
return oldItem == newItem | ||
} | ||
|
||
override fun areContentsTheSame(oldItem: MapMarker, newItem: MapMarker): Boolean { | ||
return oldItem.label == newItem.label | ||
} | ||
} | ||
|
||
val differ = AsyncListDiffer(this, differCallback) | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { | ||
val binding = ItemMarkerBinding.inflate(LayoutInflater.from(parent.context)) | ||
return ViewHolder(binding, parent.context) | ||
} | ||
|
||
override fun getItemCount() = differ.currentList.size | ||
|
||
override fun onBindViewHolder(holder: ViewHolder, position: Int) { | ||
holder.bind(differ.currentList[position]) | ||
} | ||
|
||
inner class ViewHolder(private val binding: ItemMarkerBinding, private val context: Context) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
fun bind(marker: MapMarker) { | ||
binding.apply { | ||
markerNameTextView.text = marker.label | ||
markerLongitudeTextView.text = marker.marker.position.longitude.toString() | ||
markerLatitudeTextView.text = marker.marker.position.latitude.toString() | ||
markerDeleteImageButton.setOnClickListener { | ||
onMarkerDeleteListener?.onMarkerDelete(marker) | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun setOnMarkerDeleteListener(listener: OnMarkerDeleteListener) { | ||
onMarkerDeleteListener = listener | ||
} | ||
|
||
interface OnMarkerDeleteListener { | ||
fun onMarkerDelete(marker: MapMarker) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.