-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
186 additions
and
23 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
54 changes: 54 additions & 0 deletions
54
...ovie_Pigeon/app/src/main/java/org/example/team_pigeon/movie_pigeon/CinemaListAdapter.java
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,54 @@ | ||
package org.example.team_pigeon.movie_pigeon; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.BaseAdapter; | ||
import android.widget.TextView; | ||
|
||
import org.example.team_pigeon.movie_pigeon.models.Cinema; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* Created by Guo Mingxuan on 23/3/2017. | ||
*/ | ||
|
||
public class CinemaListAdapter extends BaseAdapter { | ||
private ArrayList<Cinema> cinemaList; | ||
private Cinema cinema; | ||
private Context mContext; | ||
|
||
public CinemaListAdapter(ArrayList<Cinema> cinemaList, Context context) { | ||
this.cinemaList = cinemaList; | ||
mContext = context; | ||
} | ||
@Override | ||
public int getCount() { | ||
int count = cinemaList.size(); | ||
return count; | ||
} | ||
|
||
@Override | ||
public Cinema getItem(int position) { | ||
return cinemaList.get(position); | ||
} | ||
|
||
@Override | ||
public long getItemId(int position) { | ||
return position; | ||
} | ||
|
||
@Override | ||
public View getView(int position, View convertView, ViewGroup parent) { | ||
cinema = cinemaList.get(position); | ||
convertView = LayoutInflater.from(mContext).inflate(R.layout.cinema_list_item, null); | ||
TextView name = (TextView) convertView.findViewById(R.id.cinema_name); | ||
name.setText(cinema.getName()); | ||
TextView distance = (TextView) convertView.findViewById(R.id.cinema_distance); | ||
// TODO set distance | ||
distance.setText("Distance"); | ||
return convertView; | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
frontend/Movie_Pigeon/app/src/main/res/layout/cinema_list_item.xml
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,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="horizontal" android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Testing text" | ||
android:textSize="16sp" | ||
android:padding="5dp" | ||
android:textColor="#000000" | ||
android:id="@+id/cinema_name"/> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="distance" | ||
android:layout_marginLeft="10dp" | ||
android:id="@+id/cinema_distance"/> | ||
</LinearLayout> |
11 changes: 11 additions & 0 deletions
11
frontend/Movie_Pigeon/app/src/main/res/layout/fragment_cinema_new.xml
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,11 @@ | ||
<?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" | ||
android:focusable="true" | ||
android:focusableInTouchMode="true"> | ||
<ListView | ||
android:id="@+id/cinema_list" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
</LinearLayout> |