use of com.tevinjeffrey.rutgersct.rutgersapi.model.Course.Section in project Rutgers-Course-Tracker by tevjef.
the class TrackedSectionsPresenterImpl method loadTrackedSections.
public void loadTrackedSections(final boolean pullToRefresh) {
if (getView() != null)
getView().showLoading(pullToRefresh);
cancePreviousSubscription();
trackedSectinsSubscriber = new Subscriber<List<Section>>() {
@Override
public void onCompleted() {
if (getView() != null)
getView().showLoading(false);
}
@Override
public void onError(Throwable e) {
//Removes the animated loading drawable
if (getView() != null)
getView().showLoading(false);
//Lets the view decide what to display depending on what type of exception it is.
if (getView() != null)
getView().showError(e);
}
@Override
public void onNext(List<Section> sectionList) {
if (getView() != null) {
getView().setData(sectionList);
}
}
};
mSubscription = mDatabaseHandler.getObservableSections().flatMap(new Func1<List<Request>, Observable<Section>>() {
@Override
public Observable<Section> call(List<Request> requests) {
return mRetroRutgers.getTrackedSections(requests);
}
}).doOnSubscribe(new Action0() {
@Override
public void call() {
isLoading = true;
}
}).doOnTerminate(new Action0() {
@Override
public void call() {
isLoading = false;
}
}).toSortedList().subscribeOn(mBackgroundThread).observeOn(mMainThread).subscribe(trackedSectinsSubscriber);
}
use of com.tevinjeffrey.rutgersct.rutgersapi.model.Course.Section in project Rutgers-Course-Tracker by tevjef.
the class TrackedSectionsFragmentAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final TrackedSectionVH holder, int position) {
final Section section = sectionList.get(position);
holder.setCourseTitle(section.getCourse());
holder.setOpenStatus(section);
holder.setSectionNumber(section);
holder.setInstructors(section);
holder.setTimes(section);
holder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
itemClickListener.onItemClicked(section, v);
}
});
}
use of com.tevinjeffrey.rutgersct.rutgersapi.model.Course.Section in project Rutgers-Course-Tracker by tevjef.
the class CourseInfoFragmentAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
if (holder.getItemViewType() == TYPE_HEADER && position == 0) {
HeaderVH headerVH = (HeaderVH) holder;
headerVH.setHeaders(mHeaders);
} else if (holder.getItemViewType() == TYPE_ITEM) {
CourseInfoVH courseInfoVH = (CourseInfoVH) holder;
final Section section = sectionList.get(position - 1);
courseInfoVH.setOpenStatus(section);
courseInfoVH.setSectionNumber(section);
courseInfoVH.setInstructors(section);
courseInfoVH.setTimes(section);
courseInfoVH.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
itemClickListener.onItemClicked(section, v);
}
});
}
}
Aggregations