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;
}
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));
}
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);
}
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();
}
}
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);
}
Aggregations