Search in sources :

Example 1 with HoraireManager

use of ca.etsmtl.applets.etsmobile.util.HoraireManager in project ETSMobile-Android2 by ApplETS.

the class HoraireFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.calendar_horaire_layout, container, false);
    ButterKnife.bind(this, v);
    databaseHelper = new DatabaseHelper(getActivity());
    seanceAdapter = new SeanceAdapter(getActivity());
    allseanceAdapter = new SeanceAdapter(getActivity());
    upcomingseanceAdapter = new SeanceAdapter(getActivity());
    fillSeancesList(dateTime.toDate());
    fillListView();
    setDaysList();
    calendar_listview.setAdapter(upcomingseanceAdapter);
    mCalendarView.setCurrentDate(new Date());
    mCalendarView.setSelectedDate(new Date());
    mCalendarView.setOnDateChangedListener(this);
    mCalendarView.addDecorators(new CourseDecorator(getActivity(), courseDays), new FinalExamDecorator(getActivity(), finalExamDays), new EventDecorator(eventDays, ContextCompat.getColor(getActivity(), R.color.black)), new TodayDecorator(getActivity()), new CourseTodayDecorator(getActivity(), courseDays));
    horaireManager = new HoraireManager(this, getActivity());
    horaireManager.addObserver(this);
    progressBarSyncHoraire = (ProgressBar) v.findViewById(R.id.progressBar_sync_horaire);
    progressBarSyncHoraire.setVisibility(ProgressBar.VISIBLE);
    //        customProgressDialog = new CustomProgressDialog(getActivity(), R.drawable.loading_spinner, "Synchronisation en cours");
    //        customProgressDialog.show();
    dataManager.getDataFromSignet(DataManager.SignetMethods.LIST_SESSION, ApplicationManager.userCredentials, this);
    dataManager.getDataFromSignet(SignetMethods.LIST_SEANCES_CURRENT_AND_NEXT_SESSION, ApplicationManager.userCredentials, this);
    dataManager.getDataFromSignet(SignetMethods.LIST_JOURSREMPLACES_CURRENT_AND_NEXT_SESSION, ApplicationManager.userCredentials, this);
    // @TODO Eventually, we might want to make the call for ETS Events here instead of in the onRequestSuccess.
    // The problem right now is getting the endDate without using the ListeDeSessions
    /*String dateStart = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
        dataManager.sendRequest(new AppletsApiCalendarRequest(getActivity(), dateStart, "2016-04-30"), this);*/
    AnalyticsHelper.getInstance(getActivity()).sendScreenEvent(getClass().getSimpleName());
    return v;
}
Also used : HoraireManager(ca.etsmtl.applets.etsmobile.util.HoraireManager) SeanceAdapter(ca.etsmtl.applets.etsmobile.ui.adapter.SeanceAdapter) DatabaseHelper(ca.etsmtl.applets.etsmobile.db.DatabaseHelper) CourseDecorator(ca.etsmtl.applets.etsmobile.ui.calendar_decorator.CourseDecorator) FinalExamDecorator(ca.etsmtl.applets.etsmobile.ui.calendar_decorator.FinalExamDecorator) EventDecorator(ca.etsmtl.applets.etsmobile.ui.calendar_decorator.EventDecorator) View(android.view.View) MaterialCalendarView(com.prolificinteractive.materialcalendarview.MaterialCalendarView) ListView(android.widget.ListView) CourseTodayDecorator(ca.etsmtl.applets.etsmobile.ui.calendar_decorator.CourseTodayDecorator) Date(java.util.Date) CourseTodayDecorator(ca.etsmtl.applets.etsmobile.ui.calendar_decorator.CourseTodayDecorator) TodayDecorator(ca.etsmtl.applets.etsmobile.ui.calendar_decorator.TodayDecorator)

Example 2 with HoraireManager

use of ca.etsmtl.applets.etsmobile.util.HoraireManager in project ETSMobile-Android2 by ApplETS.

the class TodayWidgetProvider method onUpdate.

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    if (appWidgetIds.length > 0) {
        this.context = context;
        horaireManager = new HoraireManager(this, context);
        horaireManager.addObserver(this);
        mUserLoggedIn = userLoggedIn();
        this.appWidgetManager = appWidgetManager;
        if (mUserLoggedIn && !syncEnCours) {
            dataManager = DataManager.getInstance(context);
            sync();
            syncEnCours = true;
            // Sauvegarde des ids pour une mise à jour ultérieure à la suite de la synchronisation
            appWidgetsToBeUpdatedIds = appWidgetIds.clone();
        }
        String lang = TodayWidgetConfigureActivity.loadLanguagePref(context, appWidgetIds[0]);
        setAllWidgetsLocale(context, lang);
        // Mise à jour de chaque widget avec les données locales en attendant les données distantes
        for (int appWidgetId : appWidgetIds) {
            updateAppWidget(context, appWidgetManager, appWidgetId);
        }
    }
}
Also used : HoraireManager(ca.etsmtl.applets.etsmobile.util.HoraireManager) Paint(android.graphics.Paint)

Example 3 with HoraireManager

use of ca.etsmtl.applets.etsmobile.util.HoraireManager in project ETSMobile-Android2 by ApplETS.

the class TodayFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup v = (ViewGroup) inflater.inflate(R.layout.fragment_today, container, false);
    super.onCreateView(inflater, v, savedInstanceState);
    semesterProgressBar = (ProgressBar) v.findViewById(R.id.semester_progress_bar);
    semesterProgressBarText = (TextView) v.findViewById(R.id.semester_progress_bar_text);
    todaysList = (ListView) v.findViewById(R.id.todays_list);
    todaysTv = (TextView) v.findViewById(R.id.todays_name);
    tvNoCourses = (TextView) v.findViewById(R.id.tv_todays_no_courses);
    horaireManager = new HoraireManager(this, getActivity());
    horaireManager.addObserver(this);
    dataManager.getDataFromSignet(DataManager.SignetMethods.LIST_SESSION, ApplicationManager.userCredentials, this);
    dataManager.getDataFromSignet(DataManager.SignetMethods.LIST_SEANCES_CURRENT_AND_NEXT_SESSION, ApplicationManager.userCredentials, this);
    dataManager.getDataFromSignet(DataManager.SignetMethods.LIST_JOURSREMPLACES_CURRENT_AND_NEXT_SESSION, ApplicationManager.userCredentials, this);
    AnalyticsHelper.getInstance(getActivity()).sendScreenEvent(getClass().getSimpleName());
    return v;
}
Also used : HoraireManager(ca.etsmtl.applets.etsmobile.util.HoraireManager) ViewGroup(android.view.ViewGroup)

Aggregations

HoraireManager (ca.etsmtl.applets.etsmobile.util.HoraireManager)3 Paint (android.graphics.Paint)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 ListView (android.widget.ListView)1 DatabaseHelper (ca.etsmtl.applets.etsmobile.db.DatabaseHelper)1 SeanceAdapter (ca.etsmtl.applets.etsmobile.ui.adapter.SeanceAdapter)1 CourseDecorator (ca.etsmtl.applets.etsmobile.ui.calendar_decorator.CourseDecorator)1 CourseTodayDecorator (ca.etsmtl.applets.etsmobile.ui.calendar_decorator.CourseTodayDecorator)1 EventDecorator (ca.etsmtl.applets.etsmobile.ui.calendar_decorator.EventDecorator)1 FinalExamDecorator (ca.etsmtl.applets.etsmobile.ui.calendar_decorator.FinalExamDecorator)1 TodayDecorator (ca.etsmtl.applets.etsmobile.ui.calendar_decorator.TodayDecorator)1 MaterialCalendarView (com.prolificinteractive.materialcalendarview.MaterialCalendarView)1 Date (java.util.Date)1