Permalink
Browse files

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

  • Loading branch information...
1 parent 8eb4c0b commit acb9f9063af8843f38b0bff0808c6ddda9d18c78 @BrianPatt BrianPatt committed Apr 24, 2012
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -4,7 +4,7 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="25dip"
- android:background="#ff191919" >
+ android:background="#ff979797" >
<ImageView
@@ -19,7 +19,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
- style="@style/Caption" />
+ android:textColor="#8cffffff"
+ style="@style/SmallPrint" />
<TextView
@@ -29,6 +30,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
- style="@style/Caption" />
+ android:textColor="#8cffffff"
+ style="@style/SmallPrint" />
</LinearLayout>
@@ -9,21 +9,23 @@
<TextView android:id="@+id/routesTitleTV"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:paddingLeft="@dimen/horizontalPadding"
- android:paddingTop="@dimen/verticalPadding"
+ android:paddingLeft="@dimen/standardPadding"
+ android:paddingRight="@dimen/standardPadding"
+ android:paddingTop="@dimen/ContentTitlePadding"
+ android:paddingBottom="5.25dip"
style="@style/ContentTitle" />
<TextView android:id="@+id/routesInfoTV"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:paddingLeft="@dimen/horizontalPadding"
- android:paddingTop="@dimen/verticalPadding"
- android:paddingBottom="@dimen/verticalPadding"
+ android:paddingLeft="@dimen/standardPadding"
+ android:paddingRight="@dimen/standardPadding"
+ android:paddingBottom="@dimen/SmallPrintPadding"
style="@style/SmallPrint" />
<ListView android:id="@+id/routesLV"
android:layout_width="fill_parent"
- android:layout_height="wrap_content"
+ android:layout_height="0dip"
android:layout_weight="1"
style="@style/Lists" />
@@ -2,34 +2,47 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
- android:minHeight="@dimen/minRowHeight"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
-
- <ImageView android:id="@+id/routesRowIV"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingLeft="@dimen/horizontalPadding"
- android:layout_centerVertical="true"
- android:layout_alignParentLeft="true" />
<TextView android:id="@+id/routesRowNextTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingRight="@dimen/horizontalPadding"
+ android:paddingRight="@dimen/standardPadding"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
style="@style/ListValue" />
- <TextView android:id="@+id/routesRowStopTV"
+ <LinearLayout
+ android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/routesRowNextTV"
- android:layout_toRightOf="@id/routesRowIV"
- android:paddingLeft="@dimen/horizontalPadding"
- android:layout_centerVertical="true"
- android:singleLine="true"
- android:ellipsize="end"
- style="@style/ListItemPrimary" />
+ android:paddingLeft="@dimen/halfStandardPadding"
+ android:paddingRight="@dimen/standardPadding"
+ android:layout_alignParentLeft="true"
+ >
+
+ <ImageView android:id="@+id/routesRowIV"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+ android:scaleType="fitXY"
+ android:paddingLeft="@dimen/horizontalPadding"
+ />
+
+ <TextView android:id="@+id/routesRowStopTV"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/ListItemPrimaryPadding"
+ android:paddingBottom="@dimen/ListItemPrimaryPadding"
+ android:paddingLeft="@dimen/standardPadding"
+ android:singleLine="true"
+ android:ellipsize="end"
+ style="@style/ListItemPrimary" />
+
+
+ </LinearLayout>
+
+
</RelativeLayout>
@@ -2,14 +2,15 @@
import java.util.ArrayList;
+import edu.mit.mitmobile2.SliderListAdapter.OnPositionChangedListener;
import edu.mit.mitmobile2.SliderView.Adapter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
-public abstract class SliderListNewModuleActivity extends SliderNewModuleActivity {
+public abstract class SliderListNewModuleActivity extends SliderNewModuleActivity implements OnPositionChangedListener {
public static final String KEY_POSITION = "start_position";
private static final String KEY_POSITION_SAVED = "saved_start_position";
private int mLastSavedPosition = -1;
@@ -18,6 +19,7 @@
private ArrayList<String> mHeaderTitles = new ArrayList<String>();
private SliderListAdapter mSliderListAdapter = new SliderListAdapter();
+ private OnPositionChangedListener mOnPositionChangedListener;
/****************************************************/
@@ -28,6 +30,8 @@ protected void onCreate(Bundle savedInstanceState) {
if(savedInstanceState != null && savedInstanceState.containsKey(KEY_POSITION_SAVED)) {
mLastSavedPosition = savedInstanceState.getInt(KEY_POSITION_SAVED);
}
+
+ mSliderListAdapter.setOnPositionChangedListener(this);
}
@Override
@@ -90,8 +94,15 @@ protected void onNewIntent(Intent intent) {
}
+ @Override
+ public void onPositionChanged(int newPosition, int oldPosition) {
+ if (mOnPositionChangedListener != null) {
+ mOnPositionChangedListener.onPositionChanged(newPosition, oldPosition);
+ }
+ }
+
protected void setOnPositionChangedListener(SliderListAdapter.OnPositionChangedListener positionChangedListener) {
- mSliderListAdapter.setOnPositionChangedListener(positionChangedListener);
+ mOnPositionChangedListener = positionChangedListener;
}
@Override
@@ -11,11 +11,12 @@
import edu.mit.mitmobile2.NewModule;
import edu.mit.mitmobile2.OnMITMenuItemListener;
import edu.mit.mitmobile2.R;
+import edu.mit.mitmobile2.SliderListNewModuleActivity;
import edu.mit.mitmobile2.maps.MITMapActivity;
import edu.mit.mitmobile2.objs.RouteItem;
import edu.mit.mitmobile2.objs.RouteItem.Stops;
-public class MITRoutesSliderActivity extends CategoryNewModuleActivity {
+public class MITRoutesSliderActivity extends SliderListNewModuleActivity {
private RoutesAsyncListView curView;
private int position;
@@ -42,6 +43,7 @@ public void onCreate(Bundle savedInstanceState) {
position = bundle.getInt(KEY_POSITION, 0);
}
+ /*
getSecondaryBar().addMenuItem(new MITMenuItem("LIST_MAP", "", R.drawable.menu_view_as_list));
getSecondaryBar().setOnMITMenuItemListener(new OnMITMenuItemListener() {
@Override
@@ -53,6 +55,8 @@ public void onOptionItemSelected(String optionId) {
}
}
});
+ */
+
createViews();
}
/****************************************************/
@@ -87,20 +91,19 @@ void createViews() {
cv = new RoutesAsyncListView(this, routeId, r);
- addCategory(cv, r.title, r.title);
+ addScreen(cv, r.title, r.title);
}
- onOptionItemSelected(ShuttleModel.getSortedRoutes().get(position).title);
+ setPosition(position);
}
@Override
- public void onOptionItemSelected(String optionId) {
- // TODO Auto-generated method stub
- super.onOptionItemSelected(optionId);
-
- if(curView != null) {
- curView.terminate();
- }
- curView = (RoutesAsyncListView) getCategory(optionId);
+ public void onPositionChanged(int newPosition, int oldPosition) {
+ super.onPositionChanged(newPosition, oldPosition);
+
+ if(curView != null) {
+ curView.terminate();
+ }
+ curView = (RoutesAsyncListView) getScreen(newPosition);
}
@Override
@@ -131,13 +134,14 @@ protected NewModule getNewModule() {
// TODO Auto-generated method stub
return new ShuttlesModule();
}
+
@Override
- protected boolean isScrollable() {
+ protected void onOptionSelected(String optionId) {
// TODO Auto-generated method stub
- return false;
}
+
@Override
- protected void onOptionSelected(String optionId) {
- // TODO Auto-generated method stub
+ protected String getHeaderTitle(int position) {
+ return null;
}
}
@@ -20,12 +20,14 @@
public class RouteStopsArrayAdapter extends ArrayAdapter<Stops> {
Context ctx;
+ List<Stops> mStops;
//int nearest = 0;
public RouteStopsArrayAdapter(Context context, int resource, int textViewResourceId, List<Stops> stops) {
super(context, resource, textViewResourceId, stops);
this.ctx = context;
+ mStops = stops;
}
@Override
@@ -62,11 +64,26 @@ public View getView(int position, View convertView, ViewGroup parent) {
ImageView routeIV = (ImageView) v.findViewById(R.id.routesRowIV);
//routeIV.setImageResource(R.drawable.shuttle_stop_dot);
+ boolean isStart = (position == 0);
+ boolean isEnd = (position == (mStops.size()-1));
+
if (s.upcoming) {
- routeIV.setImageResource(R.drawable.shuttle_stop_dot_next);
+ if (isStart) {
+ routeIV.setImageResource(R.drawable.status_route_on_start);
+ } else if(isEnd) {
+ routeIV.setImageResource(R.drawable.status_route_on_end);
+ } else {
+ routeIV.setImageResource(R.drawable.status_route_on_between);
+ }
nextTV.setTextAppearance(ctx, R.style.BoldRed);
} else {
- routeIV.setImageResource(R.drawable.shuttle_stop_dot);
+ if (isStart) {
+ routeIV.setImageResource(R.drawable.status_route_off_start);
+ } else if(isEnd) {
+ routeIV.setImageResource(R.drawable.status_route_off_end);
+ } else {
+ routeIV.setImageResource(R.drawable.status_route_off_between);
+ }
nextTV.setTextAppearance(ctx, R.style.ListValue);
}

0 comments on commit acb9f90

Please sign in to comment.