Search in sources :

Example 1 with Person

use of de.tum.in.tumcampusapp.component.tumui.person.model.Person in project TumCampusApp by TCA-Team.

the class PersonsSearchActivity method getRecents.

private ArrayList<Person> getRecents() {
    List<Recent> recentList = recentsDao.getAll(RecentsDao.PERSONS);
    ArrayList<Person> personList = new ArrayList<>(recentList.size());
    for (Recent r : recentList) {
        personList.add(Person.Companion.fromRecent(r));
    }
    return personList;
}
Also used : Recent(de.tum.in.tumcampusapp.component.other.general.model.Recent) ArrayList(java.util.ArrayList) Person(de.tum.in.tumcampusapp.component.tumui.person.model.Person)

Example 2 with Person

use of de.tum.in.tumcampusapp.component.tumui.person.model.Person in project TumCampusApp by TCA-Team.

the class PersonsSearchActivity method onItemClick.

@Override
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
    Person person = (Person) lvPersons.getItemAtPosition(position);
    // store selected person ID in bundle to get in in StaffDetails
    Bundle bundle = new Bundle();
    bundle.putSerializable("personObject", person);
    // show detailed information in new activity
    Intent intent = new Intent(this, PersonsDetailsActivity.class);
    intent.putExtras(bundle);
    startActivity(intent);
    String lastSearch = person.getId() + "$" + person.toString().trim();
    recentsDao.insert(new Recent(lastSearch, RecentsDao.PERSONS));
}
Also used : Recent(de.tum.in.tumcampusapp.component.other.general.model.Recent) Bundle(android.os.Bundle) Intent(android.content.Intent) Person(de.tum.in.tumcampusapp.component.tumui.person.model.Person)

Example 3 with Person

use of de.tum.in.tumcampusapp.component.tumui.person.model.Person in project TumCampusApp by TCA-Team.

the class PersonsDetailsActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // get person from staff activity
    Bundle bundle = this.getIntent().getExtras();
    Person person = (Person) bundle.getSerializable("personObject");
    // make sure not both person is not null (error occurred)
    if (person == null) {
        // no query text specified
        Utils.showToast(this, R.string.no_person_set);
        return;
    }
    // Sets the current name as a title
    setTitle(person.getName() + ' ' + person.getSurname());
    requestHandler.setParameter("pIdentNr", person.getId());
    super.requestFetch();
}
Also used : Bundle(android.os.Bundle) Person(de.tum.in.tumcampusapp.component.tumui.person.model.Person)

Aggregations

Person (de.tum.in.tumcampusapp.component.tumui.person.model.Person)3 Bundle (android.os.Bundle)2 Recent (de.tum.in.tumcampusapp.component.other.general.model.Recent)2 Intent (android.content.Intent)1 ArrayList (java.util.ArrayList)1