Android Open Source - iEtueri Today Fragment






From Project

Back to project page iEtueri.

License

The source code is released under:

GNU General Public License

If you think the Android project iEtueri listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package today;
/*from w w  w. ja  va 2  s  .co  m*/
import java.util.ArrayList;
import java.util.Calendar;

import navigationdrawer.MainActivity;
import navigationdrawer.NavigationDrawerController;
import schedule.Event;
import schedule.EventsManager;
import schedule.FindEvents;
import schedule.RefreshScheduleEventsData;
import schedule.ScheduleTodayAdapter;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.Toast;

import com.javils.ietueri.R;

/** This class is for Today View */
public class TodayFragment extends Fragment {

  /** Views */
  private static ListView listEvents;

  private static boolean iAmActive = false;

  public static Handler updaterHandler = new Handler() {
    public void handleMessage(Message msg) {
      switch (msg.what) {
      case RefreshScheduleEventsData.CALENDAR_DATA_CHANGE:
        // Update adapter of the ListView
        ((ScheduleTodayAdapter) listEvents.getAdapter()).notifyDataSetChanged();
        break;
      }
      super.handleMessage(msg);
    }
  };

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setiAmActive(true);
    View view = inflater.inflate(R.layout.fragment_today, container, false);

    listEvents = (ListView) view.findViewById(R.id.list_today_today);

    Toast.makeText(getActivity(), "Cargando Eventos...", Toast.LENGTH_LONG).show();

    Calendar now = Calendar.getInstance();
    int year = now.get(Calendar.YEAR);
    int month = now.get(Calendar.MONTH);
    int day = now.get(Calendar.DAY_OF_MONTH);

    ScheduleTodayAdapter adapter = new ScheduleTodayAdapter(view.getContext(), R.layout.schedule_list_item,
        new ArrayList<Event>());

    EventsManager.setAdapter(adapter);

    ArrayList<Event> events = new ArrayList<Event>();

    listEvents.setAdapter(EventsManager.getAdapter());

    new Thread(new FindEvents(getActivity(), adapter, events, year, month, day, true)).start();

    return view;
  }

  @Override
  public void onDestroyView() {
    setiAmActive(false);
    super.onDestroyView();
  }

  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);
    ((MainActivity) activity).onSectionAttached(getArguments()
        .getInt(NavigationDrawerController.ARG_SECTION_NUMBER));
  }

  public static boolean isiAmActive() {
    return iAmActive;
  }

  public static void setiAmActive(boolean iAmActive) {
    TodayFragment.iAmActive = iAmActive;
  }
}




Java Source Code List

courses.CourseDetailFragment.java
courses.Course.java
courses.CoursesAdapter.java
courses.CoursesFragment.java
courses.NewCourseFragment.java
exams.Exam.java
exams.ExamsAdapter.java
exams.ExamsFragment.java
exams.NewExamFragment.java
homework.HomeworkAdapter.java
homework.HomeworkFragment.java
homework.Homework.java
homework.NewHomeworkFragment.java
navigationdrawer.DrawerListAdapter.java
navigationdrawer.DrawerList.java
navigationdrawer.MainActivity.java
navigationdrawer.NavigationDrawerCallbacks.java
navigationdrawer.NavigationDrawerController.java
navigationdrawer.NavigationDrawerFragment.java
navigationdrawer.OpenBrowser.java
schedule.CalendarManager.java
schedule.Event.java
schedule.EventsManager.java
schedule.FindEvents.java
schedule.RefreshScheduleEventsData.java
schedule.ScheduleFragment.java
schedule.ScheduleTodayAdapter.java
subject.DetailSubjectFragment.java
subject.NewSubjectFragment.java
subject.SubjectFragment.java
subject.SubjectListAdapter.java
subject.Subject.java
today.NewEventRepetitionDialogFragment.java
today.NewEventTodayFragment.java
today.TodayFragment.java
utility.DatabaseContract.java
utility.DatabaseHelper.java
utility.DatePickerDialogFragment.java
utility.OnBackPressed.java
utility.OnClickButtonXml.java
utility.PriorityDialogFragment.java
utility.TimePickerDialogFragment.java