forked from mirego/csgames18-competition
-
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 #1 from phildupuis/listView
List view
- Loading branch information
Showing
5 changed files
with
160 additions
and
82 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
53 changes: 53 additions & 0 deletions
53
android/app/src/main/java/com/mirego/csmapapplication/component/LostObjectsAdapter.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,53 @@ | ||
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 | ||
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 objects: ArrayList<String>, private val activity: FragmentActivity) : BaseAdapter() { | ||
|
||
override fun getView(i: Int, p0: View?, viewGroup: ViewGroup?): View { | ||
var view = p0 | ||
if (view == null) { | ||
view = View.inflate(activity,R.layout.item,null) | ||
} | ||
|
||
|
||
val s = this.getItem(i) as String | ||
|
||
val img = view!!.findViewById(R.id.imageIcon) as ImageView | ||
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 = "..." | ||
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; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:id="@+id/container"> | ||
|
||
<android.support.v7.widget.CardView android:layout_width="match_parent" | ||
android:layout_height="106dp" | ||
android:background="@android:color/white" | ||
app:layout_constraintLeft_toLeftOf="parent" | ||
app:layout_constraintRight_toRightOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_marginLeft="16dp" | ||
android:layout_marginRight="16dp" | ||
android:gravity="center_vertical" | ||
android:orientation="horizontal"> | ||
|
||
<ImageView | ||
android:id="@+id/imageIcon" | ||
android:layout_width="70dp" | ||
android:layout_height="70dp" | ||
android:scaleType="fitCenter" | ||
android:background="@drawable/imageview_copper_border" | ||
android:padding="12dp" | ||
android:src="@drawable/ic_part_bulb" /> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="16dp" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:ellipsize="end" | ||
android:maxLines="1" | ||
android:id="@+id/txtObjectName" | ||
android:textAppearance="@style/partTitle" | ||
android:textColor="@color/purpleBrown" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:ellipsize="end" | ||
android:maxLines="1" | ||
android:id="@+id/txtDescription" | ||
android:textColor="@color/purpleBrown" /> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="3dp" | ||
android:orientation="horizontal"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:ellipsize="end" | ||
android:maxLines="1" | ||
android:id="@+id/txtPosition" | ||
android:textColor="@color/brownishGrey" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="10dp" | ||
android:ellipsize="end" | ||
android:maxLines="1" | ||
android:textColor="@color/brownishGrey" | ||
android:id="@+id/txtDistance" | ||
android:textStyle="italic" /> | ||
|
||
</LinearLayout> | ||
</LinearLayout> | ||
</LinearLayout> | ||
</android.support.v7.widget.CardView> | ||
</android.support.constraint.ConstraintLayout> |