|
@@ -1,40 +1,39 @@ |
|
|
package at.ac.perg.htl.bhif16.coffeeapp; |
|
|
package at.ac.perg.htl.bhif16.coffeeapp; |
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity; |
|
|
|
|
|
import android.content.Context; |
|
|
import android.content.Intent; |
|
|
import android.content.Intent; |
|
|
|
|
|
import android.database.DataSetObserver; |
|
|
|
|
|
import android.graphics.drawable.Drawable; |
|
|
|
|
|
import android.media.Image; |
|
|
import android.support.v7.app.AppCompatActivity; |
|
|
import android.support.v7.app.AppCompatActivity; |
|
|
import android.os.Bundle; |
|
|
import android.os.Bundle; |
|
|
|
|
|
import android.view.LayoutInflater; |
|
|
|
|
|
import android.view.Menu; |
|
|
|
|
|
import android.view.MenuItem; |
|
|
import android.view.View; |
|
|
import android.view.View; |
|
|
|
|
|
import android.view.ViewGroup; |
|
|
|
|
|
import android.widget.AdapterView; |
|
|
|
|
|
import android.widget.ArrayAdapter; |
|
|
|
|
|
import android.widget.BaseAdapter; |
|
|
import android.widget.Button; |
|
|
import android.widget.Button; |
|
|
|
|
|
import android.widget.ImageView; |
|
|
import android.widget.ListView; |
|
|
import android.widget.ListView; |
|
|
import android.widget.SimpleAdapter; |
|
|
import android.widget.SimpleAdapter; |
|
|
import android.widget.TextView; |
|
|
import android.widget.TextView; |
|
|
|
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
|
|
|
|
import org.w3c.dom.Text; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
public class MainActivity extends AppCompatActivity { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Array of strings for ListView Title |
|
|
|
|
|
String[] listviewTitle = new String[]{ "Achleitner", "Aichinger", "Bodingbauer", |
|
|
|
|
|
"Bogdan","Derntl","Diesenreither", |
|
|
|
|
|
"Forthofer","Fröschl","Fürholzer", |
|
|
|
|
|
"Grünzweil","Gürler","Hametner", |
|
|
|
|
|
"Hemmelmayr","Kargl","Link", |
|
|
|
|
|
"Mayrhofer","Moser","Mühlbachler", |
|
|
|
|
|
"Nerat","Pilgersdorfer","Rauch", |
|
|
|
|
|
"Rauscher","Scheuchenpflug","Wall"}; |
|
|
|
|
|
|
|
|
public class MainActivity extends Activity { |
|
|
|
|
|
|
|
|
int[] listviewImage = new int[]{ R.drawable.achleitner, R.drawable.aichinger, R.drawable.bodingbauer, |
|
|
|
|
|
R.drawable.bogdan, R.drawable.derntl, R.drawable.unknown, |
|
|
|
|
|
R.drawable.forthofer, R.drawable.froeschl, R.drawable.fuerholzer, |
|
|
|
|
|
R.drawable.unknown, R.drawable.unknown, R.drawable.hametner, |
|
|
|
|
|
R.drawable.hemmelmayr, R.drawable.kargl, R.drawable.link, |
|
|
|
|
|
R.drawable.mayrhofer, R.drawable.moser, R.drawable.muehlbacher, |
|
|
|
|
|
R.drawable.unknown, R.drawable.pilgersdorfer, R.drawable.rauch, |
|
|
|
|
|
R.drawable.rauscher, R.drawable.scheuchenpflug, R.drawable.wall}; |
|
|
|
|
|
|
|
|
|
|
|
TextView count_field; |
|
|
|
|
|
|
|
|
ListView listview; |
|
|
|
|
|
DrinkAdapter studentArrayAdapter; |
|
|
|
|
|
ArrayList<Student> studentArray = new ArrayList<Student>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@@ -42,33 +41,25 @@ public class MainActivity extends AppCompatActivity { |
|
|
super.onCreate(savedInstanceState); |
|
|
super.onCreate(savedInstanceState); |
|
|
setContentView(R.layout.activity_main); |
|
|
setContentView(R.layout.activity_main); |
|
|
|
|
|
|
|
|
List<HashMap<String, String>> aList = new ArrayList<HashMap<String, String>>(); |
|
|
|
|
|
for (int i = 0; i < listviewTitle.length; i++) { |
|
|
|
|
|
HashMap<String, String> hm = new HashMap<String, String>(); |
|
|
|
|
|
hm.put("listview_title", listviewTitle[i]); |
|
|
|
|
|
hm.put("listview_image", Integer.toString(listviewImage[i])); |
|
|
|
|
|
aList.add(hm); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String[] from = {"listview_image", "listview_title", "listview_discription"}; |
|
|
|
|
|
int[] to = {R.id.listview_image, R.id.listview_item_title}; |
|
|
|
|
|
|
|
|
|
|
|
SimpleAdapter simpleAdapter = new SimpleAdapter(getBaseContext(), aList, R.layout.listview_activity, from, to); |
|
|
|
|
|
ListView androidListView = (ListView) findViewById(R.id.list_view); |
|
|
|
|
|
androidListView.setAdapter(simpleAdapter); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO |
|
|
|
|
|
//add students |
|
|
|
|
|
studentArray.add(new Student("Achleitner",0,R.drawable.achleitner)); |
|
|
|
|
|
studentArray.add(new Student("Aichinger",0,R.drawable.aichinger)); |
|
|
|
|
|
studentArray.add(new Student("Bodingbauer",0,R.drawable.bodingbauer)); |
|
|
|
|
|
studentArray.add(new Student("Bogdan",0,R.drawable.bogdan)); |
|
|
|
|
|
studentArray.add(new Student("Derntl",0,R.drawable.derntl)); |
|
|
|
|
|
studentArray.add(new Student("Diesenreiter",0,R.drawable.unknown)); |
|
|
|
|
|
studentArray.add(new Student("Forthofer",0,R.drawable.forthofer)); |
|
|
|
|
|
|
|
|
|
|
|
studentArrayAdapter = new DrinkAdapter(MainActivity.this, R.layout.listview_activity, studentArray); |
|
|
|
|
|
listview= (ListView) findViewById(R.id.list_view); |
|
|
|
|
|
listview.setItemsCanFocus(false); |
|
|
|
|
|
listview.setAdapter(studentArrayAdapter); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |