From 1c61d1f82f3132c5851fa652cb2b237374d7729d Mon Sep 17 00:00:00 2001 From: phildupuis Date: Sat, 24 Mar 2018 20:40:00 -0400 Subject: [PATCH 1/8] Add markers on map --- android/app/build.gradle | 2 + .../fragment/MapSegmentFragment.kt | 67 +++++++++++++++---- .../csmapapplication/service/PiecesService.kt | 3 + 3 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 android/app/src/main/java/com/mirego/csmapapplication/service/PiecesService.kt diff --git a/android/app/build.gradle b/android/app/build.gradle index 7813539..8af7892 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -38,6 +38,8 @@ kapt { } dependencies { + compile 'com.android.volley:volley:1.0.0' + implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support.constraint:constraint-layout:1.0.2' diff --git a/android/app/src/main/java/com/mirego/csmapapplication/fragment/MapSegmentFragment.kt b/android/app/src/main/java/com/mirego/csmapapplication/fragment/MapSegmentFragment.kt index e663b07..d41ade1 100644 --- a/android/app/src/main/java/com/mirego/csmapapplication/fragment/MapSegmentFragment.kt +++ b/android/app/src/main/java/com/mirego/csmapapplication/fragment/MapSegmentFragment.kt @@ -1,27 +1,27 @@ package com.mirego.csmapapplication.fragment -import android.support.v4.app.Fragment +import android.graphics.Bitmap +import android.graphics.Canvas import android.os.Bundle +import android.support.annotation.DrawableRes +import android.support.v4.app.Fragment +import android.support.v4.content.res.ResourcesCompat import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import com.android.volley.Request +import com.android.volley.Response +import com.android.volley.toolbox.JsonArrayRequest +import com.android.volley.toolbox.Volley import com.google.android.gms.maps.GoogleMap import com.google.android.gms.maps.OnMapReadyCallback import com.google.android.gms.maps.model.BitmapDescriptor -import com.mirego.csmapapplication.R -import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.BitmapDescriptorFactory +import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.MarkerOptions -import kotlinx.android.synthetic.main.fragment_map.mapView -import kotlinx.android.synthetic.main.fragment_map.view.mapView -import android.opengl.ETC1.getHeight -import android.opengl.ETC1.getWidth -import android.graphics.Canvas -import android.graphics.Bitmap -import android.support.v4.content.res.ResourcesCompat -import android.graphics.drawable.Drawable -import android.support.annotation.DrawableRes - +import com.mirego.csmapapplication.R +import kotlinx.android.synthetic.main.fragment_map.* +import kotlinx.android.synthetic.main.fragment_map.view.* class MapSegmentFragment : Fragment(), OnMapReadyCallback { @@ -47,6 +47,44 @@ class MapSegmentFragment : Fragment(), OnMapReadyCallback { override fun onResume() { super.onResume() mapView.onResume() + + val url = "https://s3.amazonaws.com/shared.ws.mirego.com/competition/mapping.json" + + var requestQueue = Volley.newRequestQueue(this.context); + + val jsonArrayRequest = JsonArrayRequest(Request.Method.GET, url, null, + Response.Listener { response -> + for (i in 0 until response.length()) { + + val piece = response.getJSONObject(i) + val name = piece.getString("name") + val type = piece.getString("type") + if (!piece.isNull("lat") && !piece.isNull("lon")) { + val lat = piece.getDouble("lat") + val lon = piece.getDouble("lon") + println(name) + var resourceId = context?.resources?.getIdentifier("ic_part_" + type, "drawable", context?.packageName) + resourceId?.let { + this.mapView.getMapAsync { map -> + map.addMarker( + MarkerOptions() + .position(LatLng(lat, lon)) + .title(name) + .icon(createPinForPart(resourceId)) + ) + } + } + + } + } + }, + Response.ErrorListener { error -> + println("Something here") + // TODO: Handle error + } + ) + + requestQueue.add(jsonArrayRequest) } override fun onMapReady(p0: GoogleMap?) { @@ -54,6 +92,7 @@ class MapSegmentFragment : Fragment(), OnMapReadyCallback { } private fun createPinForPart(@DrawableRes partResId: Int): BitmapDescriptor { + val pinDrawable = ResourcesCompat.getDrawable(resources, R.drawable.ic_pin, null) val partDrawable = ResourcesCompat.getDrawable(resources, partResId, null)!! @@ -71,4 +110,4 @@ class MapSegmentFragment : Fragment(), OnMapReadyCallback { return BitmapDescriptorFactory.fromBitmap(bitmap) } -} \ No newline at end of file +} diff --git a/android/app/src/main/java/com/mirego/csmapapplication/service/PiecesService.kt b/android/app/src/main/java/com/mirego/csmapapplication/service/PiecesService.kt new file mode 100644 index 0000000..cd29825 --- /dev/null +++ b/android/app/src/main/java/com/mirego/csmapapplication/service/PiecesService.kt @@ -0,0 +1,3 @@ +package com.mirego.csmapapplication.service + + From c4a8c9d89e11201862a74be41834793d91b6e460 Mon Sep 17 00:00:00 2001 From: phildupuis Date: Sat, 24 Mar 2018 20:57:01 -0400 Subject: [PATCH 2/8] Update readme --- android/.gitignore | 3 +- android/.idea/misc.xml | 2 +- android/README.md | 62 +++++++++++++----------------------------- 3 files changed, 21 insertions(+), 46 deletions(-) diff --git a/android/.gitignore b/android/.gitignore index c6cbe56..b339598 100644 --- a/android/.gitignore +++ b/android/.gitignore @@ -1,8 +1,7 @@ *.iml .gradle /local.properties -/.idea/workspace.xml -/.idea/libraries +/.idea/* .DS_Store /build /captures diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml index 13c4629..93713f5 100644 --- a/android/.idea/misc.xml +++ b/android/.idea/misc.xml @@ -24,7 +24,7 @@ - + diff --git a/android/README.md b/android/README.md index f5be1b6..72cf067 100644 --- a/android/README.md +++ b/android/README.md @@ -1,53 +1,29 @@ -# CS Games 2018 - Mobile - Android App +## Équipe -This project serves as a starting base for the CS Games 2018 Mobile Competition. +**Nom de l'équipe:** Délé ULaval 1 -You may edit it as much as you like – as long as you make something awesome! +**Code de l'équipe:** 1 -## Prerequisites +**Université:** Université Laval -Make sure you have the following software installed before beginning: +**Auteurs:** +- Daphnée Pateneaude +- Philippe Dupuis -- Latest version of Android Studio (3.0.1) -- Recent version of the Android SDK (at least API 21) +## Solution -You can download these from the [Android Developer website](https://developer.android.com/studio/index.html). +**Plateforme:** Android -> **NOTE:** If you have a Mac computer running macOS 10.12.6 or later, you may also be interested in our [iOS app](https://github.com/mirego/csgames18-competition/tree/master/ios), which uses Xcode and the latest iOS SDK. +**Fonctionnalités:** +1. Mode carte: connexion de la data source et affichage de toutes les pins +2. Liste des pièces perdues -## Getting started +**Étapes de build:** +- Rien de nouveau -First, make sure you have cloned the project from GitHub: +**Ce qui a bien été ou mal été:** +- Le projet de base était vraiment bien fait, ça a aidé pour commencer ;) +- Très nice défi ! -``` -git clone http://github.com/mirego/csgames18-competition.git -``` - -Then, in Android Studio: - -- Select **Import project (Eclipse, ADT, Gradle, etc.)** in the Welcome Screen, go find the `android` folder in the repository you just cloned, and click **OK**. -- Once the project is open, click on **Sync Project with Gradle Files** in the main toolbar (or navigate to `Tools -> Android` in the application menu and select the same option). - -

- -Once you see a `BUILD SUCCESSFUL` notice in the Gradle Console, your environment should be ready to build and run the project. - -## Building the project - -The project should have already been configured as an Android project in Android Studio, therefore you should see a target named `app` in the main toolbar, with **Play** and **Debug** buttons on its right. - -Press on the **Debug** icon, and if you don't already have one, [create a new Android Virtual Device](https://developer.android.com/studio/run/managing-avds.html), then select it to run the project. - -Once the app appears running in your Virtual Device, your environment is ready for the competition. - -## License - -This competition is © 2018 [Mirego](http://www.mirego.com) and may be freely -distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). -See the [`LICENSE.md`](https://github.com/mirego/csgames18-competition/blob/master/LICENSE.md) file. - -## About Mirego - -[Mirego](http://mirego.com) is a team of passionate people who believe that work is a place where you can innovate and have fun. We're a team of [talented people](http://life.mirego.com) who imagine and build beautiful Web and mobile applications. We come together to share ideas and [change the world](http://mirego.org). - -We also [love open-source software](http://open.mirego.com) and we try to give back to the community as much as we can. +**Fiertés et déceptions:** +- From ebc478629a17e4bbc527e80f1984cbe84ea549dd Mon Sep 17 00:00:00 2001 From: phildupuis Date: Sat, 24 Mar 2018 20:57:55 -0400 Subject: [PATCH 3/8] Add gitignore --- .gitignore | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..cea68ec --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +# Logs +logs +*.log +npm-debug.log* + +# Dependency directories +node_modules + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +# Compiled files +dist + +#maven +dependency-reduced-pom.xml + +# IDE +.idea + +**/target/ +/target/ +*/target/* +.classpath +.project +.settings + +Package Files # +*.jar +*.war +*.ear +*.iml + +/frontend/src/**/*.js +/frontend/src/**/*.js.map From f510ce57e5850afb31c09f2b6d3fa2e0a2801710 Mon Sep 17 00:00:00 2001 From: phildupuis Date: Sat, 24 Mar 2018 21:24:05 -0400 Subject: [PATCH 4/8] Clean a little --- android/.idea/misc.xml | 2 +- .../mirego/csmapapplication/fragment/ListSegmentFragment.kt | 2 +- .../mirego/csmapapplication/fragment/MapSegmentFragment.kt | 6 ++---- .../res/layout/{fragment_list.xml => fragment_piece.xml} | 0 android/app/src/main/res/values/strings.xml | 1 + 5 files changed, 5 insertions(+), 6 deletions(-) rename android/app/src/main/res/layout/{fragment_list.xml => fragment_piece.xml} (100%) diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml index 93713f5..13c4629 100644 --- a/android/.idea/misc.xml +++ b/android/.idea/misc.xml @@ -24,7 +24,7 @@
- + diff --git a/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt b/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt index 7a461af..3493d8b 100644 --- a/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt +++ b/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt @@ -13,6 +13,6 @@ class ListSegmentFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View? { - return inflater.inflate(R.layout.fragment_list, container, false) + return inflater.inflate(R.layout.fragment_piece, container, false) } } diff --git a/android/app/src/main/java/com/mirego/csmapapplication/fragment/MapSegmentFragment.kt b/android/app/src/main/java/com/mirego/csmapapplication/fragment/MapSegmentFragment.kt index d41ade1..63b3f01 100644 --- a/android/app/src/main/java/com/mirego/csmapapplication/fragment/MapSegmentFragment.kt +++ b/android/app/src/main/java/com/mirego/csmapapplication/fragment/MapSegmentFragment.kt @@ -48,11 +48,9 @@ class MapSegmentFragment : Fragment(), OnMapReadyCallback { super.onResume() mapView.onResume() - val url = "https://s3.amazonaws.com/shared.ws.mirego.com/competition/mapping.json" + var requestQueue = Volley.newRequestQueue(this.context) - var requestQueue = Volley.newRequestQueue(this.context); - - val jsonArrayRequest = JsonArrayRequest(Request.Method.GET, url, null, + val jsonArrayRequest = JsonArrayRequest(Request.Method.GET, resources.getString(R.string.pieces_url), null, Response.Listener { response -> for (i in 0 until response.length()) { diff --git a/android/app/src/main/res/layout/fragment_list.xml b/android/app/src/main/res/layout/fragment_piece.xml similarity index 100% rename from android/app/src/main/res/layout/fragment_list.xml rename to android/app/src/main/res/layout/fragment_piece.xml diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index dc1484f..6ee7298 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ Map Ping + https://s3.amazonaws.com/shared.ws.mirego.com/competition/mapping.json From d91f1609eaa49ecf2b0e17af91d1e0bcc9e0fcd1 Mon Sep 17 00:00:00 2001 From: Sag0ld Date: Sat, 24 Mar 2018 20:44:01 -0400 Subject: [PATCH 5/8] add adapter and set listview --- .../csmapapplication/activity/MainActivity.kt | 2 +- .../component/LostObjectsAdapter.kt | 54 +++++++++++++++++++ .../fragment/ListSegmentFragment.kt | 14 ++++- .../src/main/res/layout/fragment_piece.xml | 4 ++ 4 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 android/app/src/main/java/com/mirego/csmapapplication/component/LostObjectsAdapter.kt diff --git a/android/app/src/main/java/com/mirego/csmapapplication/activity/MainActivity.kt b/android/app/src/main/java/com/mirego/csmapapplication/activity/MainActivity.kt index d94302b..eca0148 100644 --- a/android/app/src/main/java/com/mirego/csmapapplication/activity/MainActivity.kt +++ b/android/app/src/main/java/com/mirego/csmapapplication/activity/MainActivity.kt @@ -53,7 +53,7 @@ class MainActivity : FragmentActivity() { } private fun downloadData() { - retrofit.create(GitHubService::class.java).listRepos("olivierpineau").enqueue(object : Callback> { + retrofit.create(GitHubService::class.java).listRepos("olivierpineuau").enqueue(object : Callback> { override fun onFailure(call: Call>?, t: Throwable?) { Log.d("street's test", "Oops") } diff --git a/android/app/src/main/java/com/mirego/csmapapplication/component/LostObjectsAdapter.kt b/android/app/src/main/java/com/mirego/csmapapplication/component/LostObjectsAdapter.kt new file mode 100644 index 0000000..0dc8012 --- /dev/null +++ b/android/app/src/main/java/com/mirego/csmapapplication/component/LostObjectsAdapter.kt @@ -0,0 +1,54 @@ +package com.mirego.csmapapplication.component + +import android.content.Context +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.BaseAdapter +import com.mirego.csmapapplication.R +import android.widget.ImageView +import android.widget.TextView + + + + + +/** + * Created by Sagold on 2018-03-24. + */ +class LostObjectsAdapter(private val context: Context, private val objects: ArrayList) : BaseAdapter() { + + override fun getView(i: Int, p0: View?, viewGroup: ViewGroup?): View { + var view = p0 + if (view == null) { + view = LayoutInflater.from(viewGroup!!.context).inflate(R.layout.fragment_list, viewGroup, false) + } + + val s = this.getItem(i) as String + + val img = view!!.findViewById(R.id.imageIcon) as ImageView + val description = view!!.findViewById(R.id.txtDescription) as TextView + val position = view!!.findViewById(R.id.txtPosition) as TextView + val distance = view!!.findViewById(R.id.txtDistance) as TextView + val name = view!!.findViewById(R.id.txtObjectName) as TextView + + description.text = "ici" + position.text = "jhdfhg" + distance.text = "hjbfdh" + name.text = "djfbhgbf" + + return view + } + + override fun getItem(p0: Int): Any { + return objects.get(p0) + } + + override fun getItemId(p0: Int): Long { + return p0.toLong() + } + + override fun getCount(): Int { + return objects.size + } +} \ No newline at end of file diff --git a/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt b/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt index 3493d8b..b933a11 100644 --- a/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt +++ b/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt @@ -5,14 +5,26 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.FrameLayout +import android.widget.ListView import com.mirego.csmapapplication.R +import com.mirego.csmapapplication.component.LostObjectsAdapter +import kotlinx.android.synthetic.* + class ListSegmentFragment : Fragment() { + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - return inflater.inflate(R.layout.fragment_piece, container, false) + val view = inflater.inflate(R.layout.fragment_list, container, false) + val frameLayout = view.findViewById(R.id.fragmentRoot) as FrameLayout + val listView = ListView(context) + val adapter = LostObjectsAdapter(context!!, ArrayList()) + listView.adapter = adapter + frameLayout.addView(listView) + return view } } diff --git a/android/app/src/main/res/layout/fragment_piece.xml b/android/app/src/main/res/layout/fragment_piece.xml index 9e96618..b6439e9 100644 --- a/android/app/src/main/res/layout/fragment_piece.xml +++ b/android/app/src/main/res/layout/fragment_piece.xml @@ -41,6 +41,7 @@ android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="1" + android:id="@+id/txtObjectName" android:text="Bougie 4W" android:textAppearance="@style/partTitle" android:textColor="@color/purpleBrown" /> @@ -50,6 +51,7 @@ android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="1" + android:id="@+id/txtDescription" android:text="Moteur principal" android:textColor="@color/purpleBrown" /> @@ -65,6 +67,7 @@ android:ellipsize="end" android:maxLines="1" android:text="46.7552° N, 71.2265° W" + android:id="@+id/txtPosition" android:textColor="@color/brownishGrey" /> From 5637a91f48927c343893260f2c01f8c01da0cafc Mon Sep 17 00:00:00 2001 From: Sag0ld Date: Sat, 24 Mar 2018 20:55:01 -0400 Subject: [PATCH 6/8] add listview but didnt show --- .../mirego/csmapapplication/fragment/ListSegmentFragment.kt | 6 +++--- android/app/src/main/res/layout/fragment_piece.xml | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt b/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt index b933a11..68296f4 100644 --- a/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt +++ b/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt @@ -2,6 +2,7 @@ package com.mirego.csmapapplication.fragment import android.support.v4.app.Fragment import android.os.Bundle +import android.support.constraint.ConstraintLayout import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -9,7 +10,6 @@ import android.widget.FrameLayout import android.widget.ListView import com.mirego.csmapapplication.R import com.mirego.csmapapplication.component.LostObjectsAdapter -import kotlinx.android.synthetic.* class ListSegmentFragment : Fragment() { @@ -20,11 +20,11 @@ class ListSegmentFragment : Fragment() { savedInstanceState: Bundle? ): View? { val view = inflater.inflate(R.layout.fragment_list, container, false) - val frameLayout = view.findViewById(R.id.fragmentRoot) as FrameLayout + val constraintLayout = view.findViewById(R.id.container) as ConstraintLayout val listView = ListView(context) val adapter = LostObjectsAdapter(context!!, ArrayList()) listView.adapter = adapter - frameLayout.addView(listView) + constraintLayout.addView(listView) return view } } diff --git a/android/app/src/main/res/layout/fragment_piece.xml b/android/app/src/main/res/layout/fragment_piece.xml index b6439e9..a790017 100644 --- a/android/app/src/main/res/layout/fragment_piece.xml +++ b/android/app/src/main/res/layout/fragment_piece.xml @@ -2,7 +2,8 @@ + android:layout_height="match_parent" + android:id="@+id/container"> Date: Sat, 24 Mar 2018 21:41:49 -0400 Subject: [PATCH 7/8] list caline --- .../component/LostObjectsAdapter.kt | 23 +++-- .../fragment/ListSegmentFragment.kt | 16 ++-- .../src/main/res/layout/fragment_piece.xml | 88 +------------------ android/app/src/main/res/layout/item.xml | 84 ++++++++++++++++++ 4 files changed, 109 insertions(+), 102 deletions(-) create mode 100644 android/app/src/main/res/layout/item.xml diff --git a/android/app/src/main/java/com/mirego/csmapapplication/component/LostObjectsAdapter.kt b/android/app/src/main/java/com/mirego/csmapapplication/component/LostObjectsAdapter.kt index 0dc8012..0498b74 100644 --- a/android/app/src/main/java/com/mirego/csmapapplication/component/LostObjectsAdapter.kt +++ b/android/app/src/main/java/com/mirego/csmapapplication/component/LostObjectsAdapter.kt @@ -1,6 +1,8 @@ package com.mirego.csmapapplication.component +import android.app.Activity import android.content.Context +import android.support.v4.app.FragmentActivity import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -9,30 +11,27 @@ import com.mirego.csmapapplication.R import android.widget.ImageView import android.widget.TextView - - - - /** * Created by Sagold on 2018-03-24. */ -class LostObjectsAdapter(private val context: Context, private val objects: ArrayList) : BaseAdapter() { +class LostObjectsAdapter(private val objects: ArrayList, private val activity: FragmentActivity) : BaseAdapter() { override fun getView(i: Int, p0: View?, viewGroup: ViewGroup?): View { var view = p0 if (view == null) { - view = LayoutInflater.from(viewGroup!!.context).inflate(R.layout.fragment_list, viewGroup, false) + view = View.inflate(activity,R.layout.item,null) } + val s = this.getItem(i) as String val img = view!!.findViewById(R.id.imageIcon) as ImageView - val description = view!!.findViewById(R.id.txtDescription) as TextView - val position = view!!.findViewById(R.id.txtPosition) as TextView - val distance = view!!.findViewById(R.id.txtDistance) as TextView - val name = view!!.findViewById(R.id.txtObjectName) as TextView + var description = view!!.findViewById(R.id.txtDescription) as TextView + var position = view!!.findViewById(R.id.txtPosition) as TextView + var distance = view!!.findViewById(R.id.txtDistance) as TextView + var name = view!!.findViewById(R.id.txtObjectName) as TextView - description.text = "ici" + description.text = "..." position.text = "jhdfhg" distance.text = "hjbfdh" name.text = "djfbhgbf" @@ -49,6 +48,6 @@ class LostObjectsAdapter(private val context: Context, private val objects: Arra } override fun getCount(): Int { - return objects.size + return objects.size; } } \ No newline at end of file diff --git a/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt b/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt index 68296f4..1aa8108 100644 --- a/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt +++ b/android/app/src/main/java/com/mirego/csmapapplication/fragment/ListSegmentFragment.kt @@ -2,11 +2,10 @@ package com.mirego.csmapapplication.fragment import android.support.v4.app.Fragment import android.os.Bundle -import android.support.constraint.ConstraintLayout import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.FrameLayout +import android.widget.ArrayAdapter import android.widget.ListView import com.mirego.csmapapplication.R import com.mirego.csmapapplication.component.LostObjectsAdapter @@ -20,11 +19,16 @@ class ListSegmentFragment : Fragment() { savedInstanceState: Bundle? ): View? { val view = inflater.inflate(R.layout.fragment_list, container, false) - val constraintLayout = view.findViewById(R.id.container) as ConstraintLayout - val listView = ListView(context) - val adapter = LostObjectsAdapter(context!!, ArrayList()) + val listView = view.findViewById(R.id.listContainer) as ListView + + val list = ArrayList() + var adapterlist : ArrayAdapter?=null + list.add("Hello") + list.add("Hello 1") + list.add("Hello 2") + adapterlist = ArrayAdapter(activity!!,android.R.layout.simple_list_item_1,list) + val adapter = LostObjectsAdapter(list, activity!!) listView.adapter = adapter - constraintLayout.addView(listView) return view } } diff --git a/android/app/src/main/res/layout/fragment_piece.xml b/android/app/src/main/res/layout/fragment_piece.xml index a790017..13a78c3 100644 --- a/android/app/src/main/res/layout/fragment_piece.xml +++ b/android/app/src/main/res/layout/fragment_piece.xml @@ -3,89 +3,9 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/container"> - - - + - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="match_parent" + android:id="@+id/listContainer"/> \ No newline at end of file diff --git a/android/app/src/main/res/layout/item.xml b/android/app/src/main/res/layout/item.xml new file mode 100644 index 0000000..e40212a --- /dev/null +++ b/android/app/src/main/res/layout/item.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From f1ddc2268b3c7b5fd6dc7d24af9947ed79399305 Mon Sep 17 00:00:00 2001 From: phildupuis Date: Sat, 24 Mar 2018 21:48:57 -0400 Subject: [PATCH 8/8] dsgfsd --- .DS_Store | Bin 0 -> 6148 bytes android/.idea/misc.xml | 2 +- .../{fragment_piece.xml => fragment_list.xml} | 0 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .DS_Store rename android/app/src/main/res/layout/{fragment_piece.xml => fragment_list.xml} (100%) diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..fe4508abbc3dcf41306cabdebeb135f68fbc6aed GIT binary patch literal 6148 zcmeHKOG*Pl5PhWq1KDKhvajF`nh;Om1!5coAvmD8pH9?4g0$`iB;RaX(SW+EvbTbz}cb&;ac^oZjjCjH@ygnTE<1G5T!*j22k7o>c!I%8; zz>?pO9$9-o=F$0j@`?d5AO^&M7!U)$GvE!DvRoy~iUBbo20j_^??aeM z0uUE;hj1OU1hKh;*bApbdMK8u#7wmsF)Y*RZxz=Ir^HN$#m%f!H(O087Pr&iA{^Ee zWyOFPIA!26w`=eJx6~iz|I;Mx#DEz1R}9! - + diff --git a/android/app/src/main/res/layout/fragment_piece.xml b/android/app/src/main/res/layout/fragment_list.xml similarity index 100% rename from android/app/src/main/res/layout/fragment_piece.xml rename to android/app/src/main/res/layout/fragment_list.xml