use of com.example.alphatour.oggetti.TourItem in project AlphaTour by Frank99DG.
the class TourAdapter method getView.
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_search_dashboard, parent, false);
}
ImageView tourImage = convertView.findViewById(R.id.imagePlaceZoneElement);
TextView tourText = convertView.findViewById(R.id.displayPlaceZoneElement);
TourItem tourItem = getItem(position);
if (tourItem != null) {
tourImage.setImageResource(tourItem.getTourImage());
tourText.setText(tourItem.getTourText());
}
return convertView;
}
use of com.example.alphatour.oggetti.TourItem in project AlphaTour by Frank99DG.
the class DashboardActivity method inputSearchClick.
private void inputSearchClick() {
inputSearch.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
TourItem clickedItem = (TourItem) parent.getItemAtPosition(position);
String clickedTourText = clickedItem.getTourText();
db.collection("Elements").get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
if (!queryDocumentSnapshots.isEmpty()) {
// lista elementi
List<DocumentSnapshot> listDocument = queryDocumentSnapshots.getDocuments();
for (DocumentSnapshot d : listDocument) {
ElementString element = d.toObject(ElementString.class);
if (clickedTourText.equals(element.getTitle())) {
Intent intent = new Intent(DashboardActivity.this, ModifyObjectActivity.class);
intent.putExtra("data", element.getQrData());
String dashboardFlag = "1";
intent.putExtra("dashboardFlag", dashboardFlag);
startActivity(intent);
inputSearch.setText(null);
break;
}
}
}
}
});
db.collection("Zones").get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
if (!queryDocumentSnapshots.isEmpty()) {
// lista zone
List<DocumentSnapshot> listDocument = queryDocumentSnapshots.getDocuments();
for (DocumentSnapshot d : listDocument) {
Zone zone = d.toObject(Zone.class);
if (clickedTourText.equals(zone.getName())) {
Intent intent = new Intent(DashboardActivity.this, ModifyZoneActivity.class);
intent.putExtra("idPlace", zone.getIdPlace());
intent.putExtra("Zone", zone.getName());
String dashboardFlag = "1";
intent.putExtra("dashboardFlag", dashboardFlag);
startActivity(intent);
inputSearch.setText(null);
break;
}
}
}
}
});
db.collection("Places").get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
if (!queryDocumentSnapshots.isEmpty()) {
// lista luoghi
List<DocumentSnapshot> listDocument = queryDocumentSnapshots.getDocuments();
for (DocumentSnapshot d : listDocument) {
Place place = d.toObject(Place.class);
if (clickedTourText.equals(place.getName())) {
Intent intent = new Intent(DashboardActivity.this, ModifyPlaceActivity.class);
intent.putExtra("Place", place.getName());
String dashboardFlag = "1";
intent.putExtra("dashboardFlag", dashboardFlag);
startActivity(intent);
inputSearch.setText(null);
break;
}
}
}
}
});
}
});
}
Aggregations