@@ -37,7 +37,7 @@ public StopImageListAdaptor(Activity activity, List<Stop> stopList){
3737 this .stopList = stopList ;
3838 for (Stop s : stopList ){
3939 textList .add (s .getTts_name ());
40- imageList .add (getImageId (s .getFacilities (), s .getTts_name ()));
40+ imageList .add (getImageId (s .getFacilities (), s .getTts_name (), s . getAgency_id (), activity ));
4141 }
4242 }
4343
@@ -75,22 +75,33 @@ public View getView(int i, View view, ViewGroup viewGroup) {
7575 return view ;
7676 }
7777
78- private Drawable getImageId (List <String > facilities , String tts_name ){
79- if (facilities .contains ("subway" )){
80- return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_metro_logo , null );
81- }else if (facilities .contains ("train" )){
78+ public static Drawable getImageId (List <String > facilities , String tts_name , String agency_id , Activity activity ){
79+ if (agency_id .equals ("-1" )) {
80+ if (facilities .contains ("subway" )) {
81+ return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_metro_logo , null );
82+ } else if (facilities .contains ("train" )) {
83+ return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_train_logo , null );
84+ } else if (facilities .contains ("light_rail" )) {
85+ return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_lightrail_logo , null );
86+ } else if (facilities .contains ("boat" )) {
87+ return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_boat_logo , null );
88+ } else if (facilities .contains ("hospital" )) {
89+ return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_hospital_logo , null );
90+ } else if (doesTextContain (tts_name , "escola" )) {
91+ return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_school_logo , null );
92+ }else {
93+ return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_stop_logo , null );
94+ }
95+ }else if (agency_id .equals ("0" )){
96+ return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_carris_min , null );
97+ } else if (agency_id .equals ("1" )) {
8298 return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_train_logo , null );
83- }else if (facilities .contains ("light_rail" )){
84- return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_lightrail_logo , null );
85- }else if (facilities .contains ("boat" )){
86- return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_boat_logo , null );
87- }else if (facilities .contains ("hospital" )){
88- return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_hospital_logo , null );
89- }else if (doesTextContain (tts_name , "escola" )){
90- return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_school_logo , null );
91- }else {
99+ }else if (agency_id .equals ("2" )){
100+ return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_train_logo , null );
101+ }else if (agency_id .equals ("3" )){
92102 return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_stop_logo , null );
93103 }
104+ return ResourcesCompat .getDrawable (activity .getResources (), R .drawable .stop_stop_logo , null );
94105 }
95106
96107 public static boolean doesTextContain (String text1 , String text2 ) {
0 commit comments