Skip to content

Commit

Permalink
Merge branch 'dev' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
jguerinet committed Feb 9, 2015
2 parents 1e9c698 + ff64c28 commit 1b6dbed
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion MyMartlet/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ca.appvelopers.mcgillmobile"
android:versionCode="9"
android:versionCode="10"
android:versionName="2.0" >

<uses-sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,7 @@ public View loadView(int orientation){
* @return The starting date
*/
private DateTime getStartingDate(){
//Clear the current course list, add the courses that are for this semester
mClassList.clear();
for(ClassItem classItem : App.getClasses()){
if(classItem.getTerm().equals(mTerm)){
mClassList.add(classItem);
}
}
fillClassList();

//Date is by default set to today
DateTime date = DateTime.now();
Expand All @@ -171,6 +165,19 @@ private DateTime getStartingDate(){
return date;
}

/**
* Fills the class list with the current term's classes
*/
private void fillClassList(){
//Clear the current course list, add the courses that are for this semester
mClassList.clear();
for(ClassItem classItem : App.getClasses()){
if(classItem.getTerm().equals(mTerm)){
mClassList.add(classItem);
}
}
}

//Downloads the list of classes for the given term
private void executeClassDownloader(){
new ClassDownloader(mActivity, mTerm){
Expand All @@ -196,6 +203,12 @@ protected void onPostExecute(Boolean loadInfo) {
public List<ClassItem> getClassesForDate(Day day, DateTime date){
List<ClassItem> courses = new ArrayList<ClassItem>();

//Make sure the class list is initialized
if(mClassList == null){
mClassList = new ArrayList<ClassItem>();
fillClassList();
}

//Go through the list of courses, find which ones have the same day and are for the given date
for(ClassItem course : mClassList){
if(course.isForDate(date) && course.getDays().contains(day)){
Expand Down

0 comments on commit 1b6dbed

Please sign in to comment.