Skip to content

Commit

Permalink
Merge pull request #94 from pennlabs/active-drawer
Browse files Browse the repository at this point in the history
Active drawer
  • Loading branch information
dlakata committed Nov 23, 2014
2 parents 582d9c4 + 2e451b0 commit c7e185c
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public CourseDatabase(Context context) {
mDatabaseOpenHelper = new DatabaseHelper(context);

try {
Log.v("vivlabs", "creating db");
mDatabaseOpenHelper.createDatabase();
mDatabaseOpenHelper.openDatabase();
// sqLiteDatabase = mDatabaseOpenHelper.getReadableDatabase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ protected Boolean doInBackground(Void... params) {
if (responseArr.length() == 0) {
return false;
}
// Log.v("vivlabs", "LOL " + responseArr.toString());
return true;
} catch(JSONException e) {
return false;
Expand All @@ -172,7 +171,6 @@ protected void onPostExecute(Boolean valid) {

for (int i = 0; i < responseArr.length(); i++) {
resp = (JSONObject) responseArr.get(i);
// Log.v("vivlabs", resp.toString());

Person person = new Person.Builder(resp.get("list_name").toString(),
resp.get("list_affiliation").toString()).
Expand All @@ -186,8 +184,8 @@ protected void onPostExecute(Boolean valid) {
mListView.setAdapter(mAdapter);
getActivity().findViewById(R.id.loadingPanel).setVisibility(View.GONE);
getActivity().findViewById(android.R.id.list).setVisibility(View.VISIBLE);
} catch (JSONException e) {
// Log.v("vivlabs", e.toString());
} catch (JSONException ignored) {

} catch (NullPointerException ignored) {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ public void onCreate(Bundle savedInstanceState) {
mAPI = new TransitAPI();
// mAPI.setUrlPath("stopinventory");

Log.v("vivlabs", service.getLastKnownLocation(LocationManager.GPS_PROVIDER).toString());
Location mLocation = service.getLastKnownLocation(LocationManager.GPS_PROVIDER);
// 39.952960, -75.201339
// new GetRequestTask(mLocation.getLatitude(), mLocation.getLongitude()).execute();
new GetStopsTask(39.952960, -75.201339).execute();
new GetRoutesTask().execute();
Expand Down Expand Up @@ -100,7 +98,6 @@ protected Boolean doInBackground(Void... params) {
@Override
protected void onPostExecute(Boolean valid) {
if (!valid) {
Log.v("vivlabs", "Invalid?");
return;
}

Expand All @@ -110,7 +107,6 @@ protected void onPostExecute(Boolean valid) {
for (int i = 0; i < responseArr.length(); i++) {
JSONObject resp = (JSONObject) responseArr.get(i);
if (resp.has("BusStopName")) {
Log.v("vivlabs", resp.toString());
BusStop stop = new BusStop(resp.get("BusStopId").toString(),
resp.get("BusStopName").toString(),
resp.get("Latitude").toString(),
Expand All @@ -135,8 +131,8 @@ protected void onPostExecute(Boolean valid) {
*/


} catch (JSONException e) {
Log.v("vivlabs", "" + e);
} catch (JSONException ignored) {

}
}
}
Expand All @@ -154,7 +150,6 @@ protected Boolean doInBackground(Void... params) {
responseArr = (JSONArray) ((JSONObject) ((JSONObject) resultObj.get("result_data")).get("ConfigurationData")).get("Route");
return responseArr.length() != 0;
} catch (Exception e) {
Log.v("vivlabs", "" + e);
return false;
}
}
Expand Down Expand Up @@ -185,15 +180,14 @@ protected void onPostExecute(Boolean valid) {
tempList = routesByStop.get(stopTitle);
}
tempList.add(new BusRoute(routeTitle, routeDescription));
Log.v("vivlabs", count + " stop title: " + stopTitle);
count++;
routesByStop.put(stopTitle.trim(), tempList);
}

mRoutes.add(new BusRoute(routeTitle, routeDescription, routeStops));
}
} catch (JSONException e) {
Log.v("vivlabs", "" + e);
} catch (JSONException ignored) {

}

mAdapter = new NewExpListViewAdapter(mDistanceArr, routesByStop, mActivity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ public RegistrarAdapter(Context context, int layout, Cursor c, int flags) {

@Override
public void bindView(View view, Context context, Cursor cursor) {
/*
Log.v("adel", "" + cursor.getCount());
Log.v("adel", "" + cursor.getColumnCount());
*/

// Log.v("vivlabs", Arrays.toString(cursor.getColumnNames()));

TextView courseId = (TextView) view.findViewById(R.id.course_id_text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ public JSONObject getAPIData(String urlParam) {
(response.getEntity().getContent()).toString());
return new JSONObject(tokener);
} catch (IOException e) {
Log.v("vivlabs", "" + e);
return null;
} catch (JSONException e) {
Log.v("vivlabs", "" + e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ public JSONObject getDiningInfo(String courseId) {
HttpResponse response = httpClient.execute(httpGet);
JSONTokener tokener = new JSONTokener(inputStreamToString
(response.getEntity().getContent()).toString());
Log.v("vivlabs", tokener.toString());
return new JSONObject(tokener);
} catch (IOException e) {
Log.v("vivlabs", "yo1" + e);
return null;
} catch (JSONException e) {
Log.v("vivlabs", "yo2" + e);
return null;
}
}
Expand All @@ -46,10 +43,8 @@ public JSONObject getVenues() {
(response.getEntity().getContent()).toString());
return new JSONObject(tokener);
} catch (IOException e) {
Log.v("vivlabs", "" + e);
return null;
} catch (JSONException e) {
Log.v("vivlabs", "" + e);
return null;
}
}
Expand All @@ -62,10 +57,8 @@ public JSONObject getDailyMenu(int hallID) {
(response.getEntity().getContent()).toString());
return new JSONObject(tokener);
} catch (IOException e) {
Log.v("vivlabs", "" + e);
return null;
} catch (JSONException e) {
Log.v("vivlabs", "" + e);
return null;
}
}
Expand All @@ -78,10 +71,8 @@ public JSONObject getWeeklyMenu(String hallID) {
(response.getEntity().getContent()).toString());
return new JSONObject(tokener);
} catch (IOException e) {
Log.v("vivlabs", "" + e);
return null;
} catch (JSONException e) {
Log.v("vivlabs", "" + e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ public JSONObject getCourse(String courseId) {
(response.getEntity().getContent()).toString());
return new JSONObject(tokener);
} catch (IOException e) {
Log.v("vivlabs", "" + e);
return null;
} catch (JSONException e) {
Log.v("vivlabs", "" + e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ public JSONObject getStops() {
(response.getEntity().getContent()).toString());
return new JSONObject(tokener);
} catch (IOException e) {
Log.v("vivlabs", "" + e);
return null;
} catch (JSONException e) {
Log.v("vivlabs", "" + e);
return null;
}
}
Expand All @@ -55,10 +53,8 @@ public JSONObject getStop(int stopID) {
(response.getEntity().getContent()).toString());
return new JSONObject(tokener);
} catch (IOException e) {
Log.v("vivlabs", "" + e);
return null;
} catch (JSONException e) {
Log.v("vivlabs", "" + e);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public static class Builder {

public Builder(String name, String affiliation) {
int firstComma = name.indexOf(",");
if (name.contains("Dr")) Log.v("vivlabs", "name");
this.first_name = WordUtils.capitalizeFully(name.substring(firstComma + 1).trim());
this.last_name = WordUtils.capitalizeFully(name.substring(0, firstComma).trim());
this.affiliation = affiliation;
Expand Down
8 changes: 8 additions & 0 deletions PennMobile/src/main/res/drawable/list_item_bg_normal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#fafafa"
android:endColor="#fafafa"
android:angle="90" />
</shape>
8 changes: 8 additions & 0 deletions PennMobile/src/main/res/drawable/list_item_bg_pressed.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#e8e8e8"
android:endColor="#e8e8e8"
android:angle="90" />
</shape>
8 changes: 8 additions & 0 deletions PennMobile/src/main/res/drawable/list_selector.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/list_item_bg_pressed" android:state_pressed="true"/>
<item android:drawable="@drawable/list_item_bg_pressed" android:state_activated="true"/>
<item android:drawable="@drawable/list_item_bg_normal" android:state_activated="false"/>

</selector>
2 changes: 1 addition & 1 deletion PennMobile/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#EEE" />
android:background="#FAFAFA" />

</android.support.v4.widget.DrawerLayout>
1 change: 1 addition & 0 deletions PennMobile/src/main/res/layout/drawer_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@drawable/list_selector"
android:layout_height="48dp">

<ImageView
Expand Down

0 comments on commit c7e185c

Please sign in to comment.