Search in sources :

Example 1 with Recent

use of de.tum.in.tumcampusapp.component.other.general.model.Recent 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 Recent

use of de.tum.in.tumcampusapp.component.other.general.model.Recent 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 Recent

use of de.tum.in.tumcampusapp.component.other.general.model.Recent in project TumCampusApp by TCA-Team.

the class RoomFinderActivity method openRoomDetails.

/**
 * Opens a {@link RoomFinderDetailsActivity} that displays details (e.g. location on a map) for
 * a given room. Also adds this room to the recent queries.
 */
private void openRoomDetails(Serializable room) {
    recentsDao.insert(new Recent(room.toString(), RecentsDao.ROOMS));
    // Start detail activity
    Intent intent = new Intent(this, RoomFinderDetailsActivity.class);
    intent.putExtra(RoomFinderDetailsActivity.EXTRA_ROOM_INFO, room);
    startActivity(intent);
}
Also used : Recent(de.tum.in.tumcampusapp.component.other.general.model.Recent) Intent(android.content.Intent)

Example 4 with Recent

use of de.tum.in.tumcampusapp.component.other.general.model.Recent in project TumCampusApp by TCA-Team.

the class MVVWidgetConfigureActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Setup cancel button
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_action_cancel);
    // Get appWidgetId from intent
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        appWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
    }
    TransportController tm = new TransportController(this);
    this.widgetDepartures = tm.getWidget(appWidgetId);
    Switch autoReloadSwitch = findViewById(R.id.mvv_widget_auto_reload);
    autoReloadSwitch.setChecked(this.widgetDepartures.getAutoReload());
    autoReloadSwitch.setOnCheckedChangeListener((compoundButton, checked) -> widgetDepartures.setAutoReload(checked));
    // TODO add handling for use location
    listViewResults = findViewById(R.id.activity_transport_listview_result);
    listViewResults.setOnItemClickListener(this);
    // Initialize stations adapter
    List<Recent> recentStations = recentsDao.getAll(RecentsDao.STATIONS);
    adapterStations = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, TransportController.getRecentStations(recentStations));
    if (adapterStations.getCount() == 0) {
        openSearch();
    } else {
        listViewResults.setAdapter(adapterStations);
        listViewResults.requestFocus();
    }
}
Also used : Recent(de.tum.in.tumcampusapp.component.other.general.model.Recent) Switch(android.widget.Switch) Bundle(android.os.Bundle) Intent(android.content.Intent) TransportController(de.tum.in.tumcampusapp.component.ui.transportation.TransportController)

Example 5 with Recent

use of de.tum.in.tumcampusapp.component.other.general.model.Recent in project TumCampusApp by TCA-Team.

the class BarrierFreeFacilitiesActivity method onItemClick.

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    RoomFinderRoom facility = facilities.get(position);
    recents.insert(new Recent(facility.toString(), RecentsDao.ROOMS));
    // Start detail activity
    Intent intent = new Intent(this, RoomFinderDetailsActivity.class);
    intent.putExtra(RoomFinderDetailsActivity.EXTRA_ROOM_INFO, facility);
    startActivity(intent);
}
Also used : Recent(de.tum.in.tumcampusapp.component.other.general.model.Recent) RoomFinderRoom(de.tum.in.tumcampusapp.component.tumui.roomfinder.model.RoomFinderRoom) Intent(android.content.Intent)

Aggregations

Recent (de.tum.in.tumcampusapp.component.other.general.model.Recent)7 Intent (android.content.Intent)4 Bundle (android.os.Bundle)2 Person (de.tum.in.tumcampusapp.component.tumui.person.model.Person)2 RoomFinderRoom (de.tum.in.tumcampusapp.component.tumui.roomfinder.model.RoomFinderRoom)2 ArrayList (java.util.ArrayList)2 Switch (android.widget.Switch)1 TransportController (de.tum.in.tumcampusapp.component.ui.transportation.TransportController)1 Departure (de.tum.in.tumcampusapp.component.ui.transportation.model.efa.Departure)1 StationResult (de.tum.in.tumcampusapp.component.ui.transportation.model.efa.StationResult)1