From b9f82208aadbd0fad4810c678acdd51e71fc8140 Mon Sep 17 00:00:00 2001 From: frolovmo Date: Wed, 2 Jun 2010 15:05:28 +0000 Subject: [PATCH] odd long click info git-svn-id: https://osmand.googlecode.com/svn/trunk@117 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- OsmAnd/res/drawable/closed_poi.png | Bin 0 -> 1463 bytes .../activities/search/SearchPOIActivity.java | 25 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 OsmAnd/res/drawable/closed_poi.png diff --git a/OsmAnd/res/drawable/closed_poi.png b/OsmAnd/res/drawable/closed_poi.png new file mode 100644 index 0000000000000000000000000000000000000000..c140e73033649fe53cadf49a384cf5f6839ecc2e GIT binary patch literal 1463 zcmV;o1xWgdP)6Y;+qW}?LP{I0EZv9% zEW|2Y0+L7y8!Kz8G=T(7QYco&LI{cRN-M93rQj92JD28APY@xVimUTYu{)c&+4tW3 zSp^>q^X9j+?|nbN-*4W$nKzV#Sxc|i`w+lE0EYn_0wN&=6v@+L@hy^-{yXmTHGmaKR{-3M<9OIaM{R&!ulF&@ZvcEpaxVbb zgcohLelnY+#{jNMx)8_l(>i);0rdO*Z%KX+U_KL=7g{p{+v?-}LrG_&D7s!%Qzd|Y zzrRTGGJwxXqA0#7+yzqXs~{edvigdoGf@=%Gc&+oFz5ofLUJ)L_+3PxP=5yCc&F33 z-56jn7@Qz^o#YOiaF_Th5h&IjATK4I=yW=_Y6A=ggD%P6Nw!?VeGtAdAs zE?%4X%)TkW=Ze5A4$9g0k~}p@A(G3*3$O`m#|stWf6Hx^|=7RRvG4d zT;>8v&$A=jjIn9mHN$+%{e&Ta2|(3SHHTeL`D5F;HA+7Kuu;dWWyiKVr|s@qr(I8d zEda3EM7VECkO@xHbX(n(R#m|)^|esao#G8Af0At|bPbRBHhg#7vS`!*xgP@fThcI_ z5BY>=c2~aU#W$JERe{SLzXq@xwA<|$0PfapsF*UvRLN|<-^xa+l2lu1x7&}x@ejWM zI5dmbn?_)UXj}ot4>XdlVLTdDX{dOy`l90Vc3B%9xW|%iP5_KCLrFi*BEBp=d?Qi= zh^xk!;RGN{BT4_3iMI)~33Elj2T^gTeJJTdrh5WljCm^QoJ+jVvrQvVcAf*`tTAS? ziZk_YbbWpOPm;%~Jh)_b+ul|3Vv73;>9f*qx4ZfFrrwQ8`WnDJ0E?2QrovgHnLVrL z_Y?1Uo(F8=OF*7UI#bl^dcEES@CV5qF0a3<2sj{K0_YlJZdU>TCaW{o_j&FRqiJlVf01Ha{$jJZ2{Q8=n?h~fV*)VznHb}{{XXB0fW0< R2mk;8002ovPDHLkV1n|LoI3yj literal 0 HcmV?d00001 diff --git a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java index a63eaa762f..1b2a75f8d9 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java @@ -13,11 +13,13 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; +import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; +import android.widget.Toast; import com.osmand.Algoritms; import com.osmand.OsmandSettings; @@ -72,6 +74,7 @@ public class SearchPOIActivity extends ListActivity { } }); + Bundle bundle = this.getIntent().getExtras(); String anemity = bundle.getString(ANENITY_TYPE); if (anemity != null) { @@ -92,6 +95,22 @@ public class SearchPOIActivity extends ListActivity { setListAdapter(amenityAdapter); } } + // ListActivity has a ListView, which you can get with: + ListView lv = getListView(); + + // Then you can create a listener like so: + lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { + @Override + public boolean onItemLongClick(AdapterView av, View v, int pos, long id) { + Amenity amenity = amenityList.get(pos); + String format = amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(v.getContext())); + if(amenity.getOpeningHours() != null){ + format += "\n Opening hours : " + amenity.getOpeningHours(); + } + Toast.makeText(v.getContext(), format, Toast.LENGTH_SHORT).show(); + return true; + } + }); } public void onListItemClick(ListView parent, View v, int position, long id) { @@ -149,7 +168,11 @@ public class SearchPOIActivity extends ListActivity { .getLongitude())); String str = anemity.getStringWithoutType(OsmandSettings.usingEnglishNames(SearchPOIActivity.this)); label.setText(str); - icon.setImageResource(R.drawable.poi); + if(anemity.getOpeningHours() != null) { + icon.setImageResource(R.drawable.poi); + } else{ + icon.setImageResource(R.drawable.closed_poi); + } distanceLabel.setText(" " + dist + " m "); } }