Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

adding the new styles to shuttle route stops screen mostly complete.

  • Loading branch information...
commit acb9f9063af8843f38b0bff0808c6ddda9d18c78 1 parent 8eb4c0b
Brian Patt BrianPatt authored
BIN  res/drawable-xhdpi/status_route_off_between.9.png
BIN  res/drawable-xhdpi/status_route_off_end.9.png
BIN  res/drawable-xhdpi/status_route_off_start.9.png
BIN  res/drawable-xhdpi/status_route_on_between.9.png
BIN  res/drawable-xhdpi/status_route_on_end.9.png
BIN  res/drawable-xhdpi/status_route_on_start.9.png
8 res/layout/loader.xml
@@ -4,7 +4,7 @@
4 4 android:orientation="horizontal"
5 5 android:layout_width="fill_parent"
6 6 android:layout_height="25dip"
7   - android:background="#ff191919" >
  7 + android:background="#ff979797" >
8 8
9 9
10 10 <ImageView
@@ -19,7 +19,8 @@
19 19 android:layout_width="wrap_content"
20 20 android:layout_height="wrap_content"
21 21 android:layout_gravity="center_vertical"
22   - style="@style/Caption" />
  22 + android:textColor="#8cffffff"
  23 + style="@style/SmallPrint" />
23 24
24 25
25 26 <TextView
@@ -29,6 +30,7 @@
29 30 android:layout_width="wrap_content"
30 31 android:layout_height="wrap_content"
31 32 android:layout_gravity="center_vertical"
32   - style="@style/Caption" />
  33 + android:textColor="#8cffffff"
  34 + style="@style/SmallPrint" />
33 35
34 36 </LinearLayout>
14 res/layout/routes_lv.xml
@@ -9,21 +9,23 @@
9 9 <TextView android:id="@+id/routesTitleTV"
10 10 android:layout_width="fill_parent"
11 11 android:layout_height="wrap_content"
12   - android:paddingLeft="@dimen/horizontalPadding"
13   - android:paddingTop="@dimen/verticalPadding"
  12 + android:paddingLeft="@dimen/standardPadding"
  13 + android:paddingRight="@dimen/standardPadding"
  14 + android:paddingTop="@dimen/ContentTitlePadding"
  15 + android:paddingBottom="5.25dip"
14 16 style="@style/ContentTitle" />
15 17
16 18 <TextView android:id="@+id/routesInfoTV"
17 19 android:layout_width="fill_parent"
18 20 android:layout_height="wrap_content"
19   - android:paddingLeft="@dimen/horizontalPadding"
20   - android:paddingTop="@dimen/verticalPadding"
21   - android:paddingBottom="@dimen/verticalPadding"
  21 + android:paddingLeft="@dimen/standardPadding"
  22 + android:paddingRight="@dimen/standardPadding"
  23 + android:paddingBottom="@dimen/SmallPrintPadding"
22 24 style="@style/SmallPrint" />
23 25
24 26 <ListView android:id="@+id/routesLV"
25 27 android:layout_width="fill_parent"
26   - android:layout_height="wrap_content"
  28 + android:layout_height="0dip"
27 29 android:layout_weight="1"
28 30 style="@style/Lists" />
29 31
45 res/layout/routes_row.xml
@@ -2,34 +2,47 @@
2 2 <RelativeLayout
3 3 xmlns:android="http://schemas.android.com/apk/res/android"
4 4 android:orientation="horizontal"
5   - android:minHeight="@dimen/minRowHeight"
6 5 android:layout_width="fill_parent"
7 6 android:layout_height="wrap_content">
8   -
9   - <ImageView android:id="@+id/routesRowIV"
10   - android:layout_width="wrap_content"
11   - android:layout_height="wrap_content"
12   - android:paddingLeft="@dimen/horizontalPadding"
13   - android:layout_centerVertical="true"
14   - android:layout_alignParentLeft="true" />
15 7
16 8 <TextView android:id="@+id/routesRowNextTV"
17 9 android:layout_width="wrap_content"
18 10 android:layout_height="wrap_content"
19   - android:paddingRight="@dimen/horizontalPadding"
  11 + android:paddingRight="@dimen/standardPadding"
20 12 android:layout_alignParentRight="true"
21 13 android:layout_centerVertical="true"
22 14 style="@style/ListValue" />
23 15
24   - <TextView android:id="@+id/routesRowStopTV"
  16 + <LinearLayout
  17 + android:orientation="horizontal"
25 18 android:layout_width="wrap_content"
26 19 android:layout_height="wrap_content"
27 20 android:layout_toLeftOf="@id/routesRowNextTV"
28   - android:layout_toRightOf="@id/routesRowIV"
29   - android:paddingLeft="@dimen/horizontalPadding"
30   - android:layout_centerVertical="true"
31   - android:singleLine="true"
32   - android:ellipsize="end"
33   - style="@style/ListItemPrimary" />
  21 + android:paddingLeft="@dimen/halfStandardPadding"
  22 + android:paddingRight="@dimen/standardPadding"
  23 + android:layout_alignParentLeft="true"
  24 + >
  25 +
  26 + <ImageView android:id="@+id/routesRowIV"
  27 + android:layout_width="wrap_content"
  28 + android:layout_height="fill_parent"
  29 + android:scaleType="fitXY"
  30 + android:paddingLeft="@dimen/horizontalPadding"
  31 + />
  32 +
  33 + <TextView android:id="@+id/routesRowStopTV"
  34 + android:layout_width="wrap_content"
  35 + android:layout_height="wrap_content"
  36 + android:paddingTop="@dimen/ListItemPrimaryPadding"
  37 + android:paddingBottom="@dimen/ListItemPrimaryPadding"
  38 + android:paddingLeft="@dimen/standardPadding"
  39 + android:singleLine="true"
  40 + android:ellipsize="end"
  41 + style="@style/ListItemPrimary" />
  42 +
  43 +
  44 + </LinearLayout>
  45 +
  46 +
34 47
35 48 </RelativeLayout>
15 src/edu/mit/mitmobile2/SliderListNewModuleActivity.java
@@ -2,6 +2,7 @@
2 2
3 3 import java.util.ArrayList;
4 4
  5 +import edu.mit.mitmobile2.SliderListAdapter.OnPositionChangedListener;
5 6 import edu.mit.mitmobile2.SliderView.Adapter;
6 7
7 8 import android.content.Context;
@@ -9,7 +10,7 @@
9 10 import android.os.Bundle;
10 11 import android.view.View;
11 12
12   -public abstract class SliderListNewModuleActivity extends SliderNewModuleActivity {
  13 +public abstract class SliderListNewModuleActivity extends SliderNewModuleActivity implements OnPositionChangedListener {
13 14 public static final String KEY_POSITION = "start_position";
14 15 private static final String KEY_POSITION_SAVED = "saved_start_position";
15 16 private int mLastSavedPosition = -1;
@@ -18,6 +19,7 @@
18 19
19 20 private ArrayList<String> mHeaderTitles = new ArrayList<String>();
20 21 private SliderListAdapter mSliderListAdapter = new SliderListAdapter();
  22 + private OnPositionChangedListener mOnPositionChangedListener;
21 23
22 24
23 25 /****************************************************/
@@ -28,6 +30,8 @@ protected void onCreate(Bundle savedInstanceState) {
28 30 if(savedInstanceState != null && savedInstanceState.containsKey(KEY_POSITION_SAVED)) {
29 31 mLastSavedPosition = savedInstanceState.getInt(KEY_POSITION_SAVED);
30 32 }
  33 +
  34 + mSliderListAdapter.setOnPositionChangedListener(this);
31 35 }
32 36
33 37 @Override
@@ -90,8 +94,15 @@ protected void onNewIntent(Intent intent) {
90 94
91 95 }
92 96
  97 + @Override
  98 + public void onPositionChanged(int newPosition, int oldPosition) {
  99 + if (mOnPositionChangedListener != null) {
  100 + mOnPositionChangedListener.onPositionChanged(newPosition, oldPosition);
  101 + }
  102 + }
  103 +
93 104 protected void setOnPositionChangedListener(SliderListAdapter.OnPositionChangedListener positionChangedListener) {
94   - mSliderListAdapter.setOnPositionChangedListener(positionChangedListener);
  105 + mOnPositionChangedListener = positionChangedListener;
95 106 }
96 107
97 108 @Override
34 src/edu/mit/mitmobile2/shuttles/MITRoutesSliderActivity.java
@@ -11,11 +11,12 @@
11 11 import edu.mit.mitmobile2.NewModule;
12 12 import edu.mit.mitmobile2.OnMITMenuItemListener;
13 13 import edu.mit.mitmobile2.R;
  14 +import edu.mit.mitmobile2.SliderListNewModuleActivity;
14 15 import edu.mit.mitmobile2.maps.MITMapActivity;
15 16 import edu.mit.mitmobile2.objs.RouteItem;
16 17 import edu.mit.mitmobile2.objs.RouteItem.Stops;
17 18
18   -public class MITRoutesSliderActivity extends CategoryNewModuleActivity {
  19 +public class MITRoutesSliderActivity extends SliderListNewModuleActivity {
19 20 private RoutesAsyncListView curView;
20 21
21 22 private int position;
@@ -42,6 +43,7 @@ public void onCreate(Bundle savedInstanceState) {
42 43 position = bundle.getInt(KEY_POSITION, 0);
43 44 }
44 45
  46 + /*
45 47 getSecondaryBar().addMenuItem(new MITMenuItem("LIST_MAP", "", R.drawable.menu_view_as_list));
46 48 getSecondaryBar().setOnMITMenuItemListener(new OnMITMenuItemListener() {
47 49 @Override
@@ -53,6 +55,8 @@ public void onOptionItemSelected(String optionId) {
53 55 }
54 56 }
55 57 });
  58 + */
  59 +
56 60 createViews();
57 61 }
58 62 /****************************************************/
@@ -87,20 +91,19 @@ void createViews() {
87 91
88 92 cv = new RoutesAsyncListView(this, routeId, r);
89 93
90   - addCategory(cv, r.title, r.title);
  94 + addScreen(cv, r.title, r.title);
91 95 }
92   - onOptionItemSelected(ShuttleModel.getSortedRoutes().get(position).title);
  96 + setPosition(position);
93 97 }
94 98
95 99 @Override
96   - public void onOptionItemSelected(String optionId) {
97   - // TODO Auto-generated method stub
98   - super.onOptionItemSelected(optionId);
99   -
100   - if(curView != null) {
101   - curView.terminate();
102   - }
103   - curView = (RoutesAsyncListView) getCategory(optionId);
  100 + public void onPositionChanged(int newPosition, int oldPosition) {
  101 + super.onPositionChanged(newPosition, oldPosition);
  102 +
  103 + if(curView != null) {
  104 + curView.terminate();
  105 + }
  106 + curView = (RoutesAsyncListView) getScreen(newPosition);
104 107 }
105 108
106 109 @Override
@@ -131,13 +134,14 @@ protected NewModule getNewModule() {
131 134 // TODO Auto-generated method stub
132 135 return new ShuttlesModule();
133 136 }
  137 +
134 138 @Override
135   - protected boolean isScrollable() {
  139 + protected void onOptionSelected(String optionId) {
136 140 // TODO Auto-generated method stub
137   - return false;
138 141 }
  142 +
139 143 @Override
140   - protected void onOptionSelected(String optionId) {
141   - // TODO Auto-generated method stub
  144 + protected String getHeaderTitle(int position) {
  145 + return null;
142 146 }
143 147 }
21 src/edu/mit/mitmobile2/shuttles/RouteStopsArrayAdapter.java
@@ -20,12 +20,14 @@
20 20 public class RouteStopsArrayAdapter extends ArrayAdapter<Stops> {
21 21
22 22 Context ctx;
  23 + List<Stops> mStops;
23 24
24 25 //int nearest = 0;
25 26
26 27 public RouteStopsArrayAdapter(Context context, int resource, int textViewResourceId, List<Stops> stops) {
27 28 super(context, resource, textViewResourceId, stops);
28 29 this.ctx = context;
  30 + mStops = stops;
29 31 }
30 32
31 33 @Override
@@ -62,11 +64,26 @@ public View getView(int position, View convertView, ViewGroup parent) {
62 64 ImageView routeIV = (ImageView) v.findViewById(R.id.routesRowIV);
63 65 //routeIV.setImageResource(R.drawable.shuttle_stop_dot);
64 66
  67 + boolean isStart = (position == 0);
  68 + boolean isEnd = (position == (mStops.size()-1));
  69 +
65 70 if (s.upcoming) {
66   - routeIV.setImageResource(R.drawable.shuttle_stop_dot_next);
  71 + if (isStart) {
  72 + routeIV.setImageResource(R.drawable.status_route_on_start);
  73 + } else if(isEnd) {
  74 + routeIV.setImageResource(R.drawable.status_route_on_end);
  75 + } else {
  76 + routeIV.setImageResource(R.drawable.status_route_on_between);
  77 + }
67 78 nextTV.setTextAppearance(ctx, R.style.BoldRed);
68 79 } else {
69   - routeIV.setImageResource(R.drawable.shuttle_stop_dot);
  80 + if (isStart) {
  81 + routeIV.setImageResource(R.drawable.status_route_off_start);
  82 + } else if(isEnd) {
  83 + routeIV.setImageResource(R.drawable.status_route_off_end);
  84 + } else {
  85 + routeIV.setImageResource(R.drawable.status_route_off_between);
  86 + }
70 87 nextTV.setTextAppearance(ctx, R.style.ListValue);
71 88 }
72 89

0 comments on commit acb9f90

Please sign in to comment.
Something went wrong with that request. Please try again.