Project redesign: Profile deleted & List edited to "RoadTrip"

pull/5/head
Baptiiiiste 2 years ago
parent 6ba1c7e8e3
commit 7a9b159621

@ -1,14 +0,0 @@
package uca.baptistearthur.geocaching.model
import java.time.LocalDateTime
data class Geocache(
val id: String,
val name: String,
val difficulty: Float,
val placedDate: LocalDateTime,
val backgroundImageUrl: String,
val findCount: Int,
val latitude: Double,
val longitude: Double
)

@ -0,0 +1,6 @@
package uca.baptistearthur.geocaching.model
data class Place(
val latitude : Long,
val longitude : Long
)

@ -0,0 +1,14 @@
package uca.baptistearthur.geocaching.model
import java.util.Date
class RoadTrip(
val name: String,
val date: Date,
val places: ArrayList<Place>
){
fun addPlaceToRoadTripList(place: Place) = places.add(place)
fun addPlaceToRoadTripList(latitude: Long, longitude: Long) = places.add(Place(latitude, longitude))
}

@ -1,27 +0,0 @@
package uca.baptistearthur.geocaching.services
import java.net.HttpURLConnection
import java.net.URL
import java.io.BufferedReader
import java.io.InputStreamReader
class GeocacheAPIServices {
fun fetchGeocacheAPI(linkToApi: String): String{
val url = URL(linkToApi)
val connection = url.openConnection() as HttpURLConnection
connection.requestMethod = "GET"
val input = BufferedReader(InputStreamReader(connection.inputStream))
val response = StringBuilder()
var inputLine: String?
while (input.readLine().also { inputLine = it } != null) {
response.append(inputLine)
}
input.close()
connection.disconnect()
return response.toString();
}
}

@ -7,7 +7,6 @@ import com.google.android.material.bottomnavigation.BottomNavigationView
import uca.baptistearthur.geocaching.R
import uca.baptistearthur.geocaching.ui.fragment.Map
import uca.baptistearthur.geocaching.ui.fragment.Profile
class MainWindow: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@ -22,16 +21,16 @@ class MainWindow: AppCompatActivity() {
navigation.selectedItemId= R.id.map
navigation.setOnItemSelectedListener {
when (it.itemId) {
R.id.profile -> {
loadFragment(Profile())
true
}
// R.id.profile -> {
// loadFragment(Profile())
// true
// }
R.id.map -> {
loadFragment(map)
true
}
R.id.list -> {
loadFragment(uca.baptistearthur.geocaching.ui.fragment.List())
R.id.roadTrip -> {
loadFragment(uca.baptistearthur.geocaching.ui.fragment.RoadTrip())
true
}
else -> false

@ -1,60 +0,0 @@
package uca.baptistearthur.geocaching.ui.fragment
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import uca.baptistearthur.geocaching.R
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"
/**
* A simple [Fragment] subclass.
* Use the [Profile.newInstance] factory method to
* create an instance of this fragment.
*/
class Profile : Fragment() {
// TODO: Rename and change types of parameters
private var param1: String? = null
private var param2: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
arguments?.let {
param1 = it.getString(ARG_PARAM1)
param2 = it.getString(ARG_PARAM2)
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_profile, container, false)
}
companion object {
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment Profile.
*/
// TODO: Rename and change types and number of parameters
@JvmStatic
fun newInstance(param1: String, param2: String) =
Profile().apply {
arguments = Bundle().apply {
putString(ARG_PARAM1, param1)
putString(ARG_PARAM2, param2)
}
}
}
}

@ -14,10 +14,10 @@ private const val ARG_PARAM2 = "param2"
/**
* A simple [Fragment] subclass.
* Use the [List.newInstance] factory method to
* Use the [RoadTrip.newInstance] factory method to
* create an instance of this fragment.
*/
class List : Fragment() {
class RoadTrip : Fragment() {
// TODO: Rename and change types of parameters
private var param1: String? = null
private var param2: String? = null
@ -35,7 +35,7 @@ class List : Fragment() {
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_list, container, false)
return inflater.inflate(R.layout.fragment_roadtrip, container, false)
}
companion object {
@ -50,7 +50,7 @@ class List : Fragment() {
// TODO: Rename and change types and number of parameters
@JvmStatic
fun newInstance(param1: String, param2: String) =
List().apply {
RoadTrip().apply {
arguments = Bundle().apply {
putString(ARG_PARAM1, param1)
putString(ARG_PARAM2, param2)

@ -1,5 +0,0 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,5.9c1.16,0 2.1,0.94 2.1,2.1s-0.94,2.1 -2.1,2.1S9.9,9.16 9.9,8s0.94,-2.1 2.1,-2.1m0,9c2.97,0 6.1,1.46 6.1,2.1v1.1L5.9,18.1L5.9,17c0,-0.64 3.13,-2.1 6.1,-2.1M12,4C9.79,4 8,5.79 8,8s1.79,4 4,4 4,-1.79 4,-4 -1.79,-4 -4,-4zM12,13c-2.67,0 -8,1.34 -8,4v3h16v-3c0,-2.66 -5.33,-4 -8,-4z"/>
</vector>

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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=".ui.fragment.Profile">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="PROFILE" />
</FrameLayout>

@ -3,11 +3,11 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.fragment.List">
tools:context=".ui.fragment.RoadTrip">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="List" />
android:text="Mes voyages !" />
</FrameLayout>

@ -1,18 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/profile"
android:enabled="true"
android:title="@string/profil"
android:icon="@drawable/profile"/>
<item
android:id="@+id/map"
android:enabled="true"
android:title="@string/carte"
android:icon="@drawable/map"/>
<item
android:id="@+id/list"
android:id="@+id/roadTrip"
android:enabled="true"
android:title="@string/liste"
android:icon="@drawable/list" />
android:title="@string/voyages"
android:icon="@drawable/road_trip" />
</menu>

@ -1,8 +1,7 @@
<resources>
<string name="app_name">Geocaching</string>
<string name="profil">Profil</string>
<string name="app_name">RoadTrip</string>
<string name="carte">Carte</string>
<string name="liste">Liste</string>
<string name="voyages">Voyages</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
Loading…
Cancel
Save