gt:                 case 3: // schedules
context: package es.usc.citius.servando.calendula;
  
  import android.content.Context;
  import android.content.Intent;
  import android.content.SharedPreferences;
  import android.os.Build;
  import android.os.Bundle;
  import android.os.Handler;
  import android.preference.PreferenceManager;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentPagerAdapter;
  import android.support.v4.view.ViewPager;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBar;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.app.ActionBarDrawerToggle;
  import android.support.v7.widget.Toolbar;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.ImageView;
  import android.widget.ListView;
  import android.widget.TextView;
  
  import com.astuetz.PagerSlidingTabStrip;
  import com.makeramen.RoundedImageView;
  import com.melnykov.fab.FloatingActionButton;
  
  import org.joda.time.LocalTime;
  import org.joda.time.format.DateTimeFormat;
  
  import java.util.Arrays;
  import java.util.List;
  
  import es.usc.citius.servando.calendula.activities.CalendarActivity;
  import es.usc.citius.servando.calendula.activities.MedicinesActivity;
  import es.usc.citius.servando.calendula.activities.ReminderNotification;
  import es.usc.citius.servando.calendula.activities.RoutinesActivity;
  import es.usc.citius.servando.calendula.activities.ScheduleCreationActivity;
  import es.usc.citius.servando.calendula.activities.SettingsActivity;
  import es.usc.citius.servando.calendula.adapters.HomePageAdapter;
  import es.usc.citius.servando.calendula.events.PersistenceEvents;
  import es.usc.citius.servando.calendula.events.PharmaModeChangeEvent;
  import es.usc.citius.servando.calendula.fragments.DailyAgendaFragment;
  import es.usc.citius.servando.calendula.fragments.MedicinesListFragment;
  import es.usc.citius.servando.calendula.fragments.RoutinesListFragment;
  import es.usc.citius.servando.calendula.fragments.ScheduleListFragment;
  import es.usc.citius.servando.calendula.persistence.Medicine;
  import es.usc.citius.servando.calendula.persistence.Routine;
  import es.usc.citius.servando.calendula.persistence.Schedule;
  import es.usc.citius.servando.calendula.util.AppTutorial;
  import es.usc.citius.servando.calendula.util.FragmentUtils;
  import es.usc.citius.servando.calendula.util.Snack;
  import es.usc.citius.servando.calendula.util.view.ScrimInsetsFrameLayout;
  
  
  /**
   * Main activity holding fragments for agenda, routine, medicine, a schedule management
   */
  public class HomeActivity extends ActionBarActivity
          implements ViewPager.OnPageChangeListener, ActionBar.OnNavigationListener, View.OnClickListener,
          RoutinesListFragment.OnRoutineSelectedListener,
          MedicinesListFragment.OnMedicineSelectedListener,
          ScheduleListFragment.OnScheduleSelectedListener {
  
      private static final String TAG = "HomeActivity";
  
      /**
       * The {@link android.support.v4.view.PagerAdapter} that will provide
       * fragments for each of the sections. We use a
       * {@link FragmentPagerAdapter} derivative, which will keep every
       * loaded fragment in memory. If this becomes too memory intensive, it
       * may be best to switch to a
       * {@link android.support.v4.app.FragmentStatePagerAdapter}.
       */
      HomePageAdapter mSectionsPagerAdapter;
      DrawerLayout mDrawerLayout;
      ListView mDrawerList;
      ScrimInsetsFrameLayout drawerView;
      ActionBarDrawerToggle mDrawerToggle;
      int currentActionBarColor;
      int previousActionBarColor;
  
      FloatingActionButton addButton;
      String[] titles;
  
      Toolbar toolbar;
      PagerSlidingTabStrip tabs;
      Handler mHandler;
      View tabsShadow;
  
      /**
       * The {@link ViewPager} that will host the section contents.
       */
      ViewPager mViewPager;
  
      private AppTutorial tutorial;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          // set the content view layout
          setContentView(R.layout.activity_home);
          mHandler = new Handler();
          // initialize current and previous action bar colors
          currentActionBarColor = getResources().getColor(R.color.transparent);
          previousActionBarColor = getResources().getColor(R.color.transparent);
          // Create the adapter that will manage sections
          mSectionsPagerAdapter = new HomePageAdapter(getSupportFragmentManager(), this, this);
          // Set up the ViewPager with the sections adapter.
          mViewPager = (ViewPager) findViewById(R.id.pager);
          tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
          tabsShadow = findViewById(R.id.tabs_shadow);
          mViewPager.setAdapter(mSectionsPagerAdapter);
          mViewPager.setOffscreenPageLimit(5);
  
          tabs.setOnPageChangeListener(this);
          tabs.setShouldExpand(true);
          tabs.setAllCaps(true);
          tabs.setTabPaddingLeftRight(30);
          tabs.setShouldExpand(true);
          tabs.setDividerColor(getResources().getColor(R.color.white_50));
          tabs.setDividerColor(getResources().getColor(R.color.transparent));
          tabs.setIndicatorHeight(getResources().getDimensionPixelSize(R.dimen.tab_indicator_height));
          tabs.setScrollOffset(50);
          tabs.setIndicatorColor(getResources().getColor(R.color.white));
          tabs.setTextColor(getResources().getColor(R.color.white_80));
          tabs.setUnderlineColor(getResources().getColor(R.color.transparent));
  
          tabs.setBackgroundColor(getResources().getColor(R.color.transparent));
          tabs.setVisibility(View.GONE);
          tabsShadow.setVisibility(View.GONE);
          tabs.setViewPager(mViewPager);
          // set up the toolbar
          toolbar = (Toolbar) findViewById(R.id.toolbar);
          toolbar.setBackgroundColor(getResources().getColor(R.color.transparent));
          toolbar.setNavigationIcon(R.drawable.ic_launcher_white);
          // configure toolbar as action bar
          setSupportActionBar(toolbar);
          getSupportActionBar().setDisplayShowTitleEnabled(false);
          getSupportActionBar().setDisplayShowCustomEnabled(true);
  
          // initialize left drawer
          initializeDrawer();
  
          titles = getResources().getStringArray(R.array.home_action_list);
          addButton = (FloatingActionButton) findViewById(R.id.add_button);
          addButton.setOnClickListener(this);
  
          hideAddButton();
          CalendulaApp.eventBus().register(this);
  
          setTutorial(new AppTutorial());
          getTutorial().init(this);
  
          Log.d(TAG, "OnCreate  - Routine Id Extra: " + getIntent().getLongExtra(
                  CalendulaApp.INTENT_EXTRA_ROUTINE_ID, -1l));
          checkReminder(getIntent());
          startTutorialIfNeeded();
      }
  
      public int getActionDrawable(int index) {
          switch (index) {
  
              case 1:
                  return R.drawable.ic_small_home_w;
              case 3:
                  return R.drawable.ic_alarm_white_48dp;
              case 4:
                  return R.drawable.ic_pill;
              case 5:
                  return R.drawable.ic_event_white_48dp;
              case 7:
                  return R.drawable.ic_room_white_48dp;
              case 8:
                  return R.drawable.ic_small_plane_w;
              default:
                  return R.drawable.ic_small_home_w;
          }
      }
  
      public int getActionColor(int index) {
          switch (index) {
              case 3:
                  return R.color.android_orange;
              case 4:
                  return R.color.android_pink;
              case 5:
                  return R.color.android_green;
              case 7:
                  return R.color.android_blue_light;
              case 8:
                  return R.color.android_red_light;
              default:
                  return R.color.dark_grey_home;
          }
      }
  
      public int getAddButtonColor(int page) {
          switch (page) {
              case 1:
                  return R.color.android_orange;
              case 2:
                  return R.color.android_pink_dark;
              case 3:
                  return R.color.android_green;
              default:
                  return R.color.android_blue_darker;
          }
      }
  
      public int getSecondaryAddButtonColor(int page) {
          switch (page) {
              case 1:
                  return R.color.android_orange_dark;
              case 2:
                  return R.color.android_pink;
              case 3:
                  return R.color.android_green_dark;
              default:
                  return R.color.android_blue_dark;
          }
      }
  
      private void initializeDrawer() {
  
          mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
          mDrawerList = (ListView) findViewById(R.id.left_drawer_list);
          drawerView = (ScrimInsetsFrameLayout) findViewById(R.id.left_drawer);
  
          List<String> items =
                  Arrays.asList(getResources().getStringArray(R.array.home_drawer_actions));
          // Set the adapter for the list view
          mDrawerList.setAdapter(new DrawerListAdapter(getApplication(), R.layout.drawer_list_item, items));
          // Set the list's click listener
          mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
          mDrawerList.setOnItemLongClickListener(new DrawerItemLongClickListener());
          mDrawerToggle = new ActionBarDrawerToggle(this,
                  mDrawerLayout,
                  toolbar,
                  R.string.drawer_open,
                  R.string.drawer_close) {
  
              /** Called when a drawer has settled in a completely closed state. */
              public void onDrawerClosed(View view) {
                  super.onDrawerClosed(view);
              }
  
              /** Called when a drawer has settled in a completely open state. */
              public void onDrawerOpened(View drawerView) {
                  super.onDrawerOpened(drawerView);
              }
          };
  
          // Set the drawer toggle as the DrawerListener
          mDrawerLayout.setDrawerListener(mDrawerToggle);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          getSupportActionBar().setHomeButtonEnabled(true);
      }
  
      @Override
      public void onRoutineSelected(Routine r) {
          Intent i = new Intent(this, RoutinesActivity.class);
          i.putExtra(CalendulaApp.INTENT_EXTRA_ROUTINE_ID, r.getId());
          launchActivity(i);
      }
  
      @Override
      public void onCreateRoutine() {
          //do nothing
      }
  
      @Override
      public void onMedicineSelected(Medicine m) {
          Intent i = new Intent(this, MedicinesActivity.class);
          i.putExtra(CalendulaApp.INTENT_EXTRA_MEDICINE_ID, m.getId());
          launchActivity(i);
      }
  
      @Override
      public void onCreateMedicine() {
  
          //do nothing
      }
  
      @Override
      public void onScheduleSelected(Schedule r) {
          Intent i = new Intent(this, ScheduleCreationActivity.class);
          i.putExtra(CalendulaApp.INTENT_EXTRA_SCHEDULE_ID, r.getId());
          launchActivity(i);
      }
  
      @Override
      public void onCreateSchedule() {
  
      }
  
      @Override
      protected void onPostCreate(Bundle savedInstanceState) {
          super.onPostCreate(savedInstanceState);
          mDrawerToggle.syncState();
      }
  
      public AppTutorial getTutorial() {
          return tutorial;
      }
  
      public void setTutorial(AppTutorial tutorial) {
          this.tutorial = tutorial;
      }
  
      @Override
      public void onClick(View view) {
  
          if (view.getId() == R.id.add_button) {
              Intent i;
              switch (mViewPager.getCurrentItem()) {
                  case 0: // agenda
                      launchActivity(new Intent(this, ScheduleCreationActivity.class));
                      break;
                  case 1: // routines
                      launchActivity(new Intent(this, RoutinesActivity.class));
                      break;
                  case 2: // medicines
                      i = new Intent(this, MedicinesActivity.class);
                      i.putExtra("create", true);
                      launchActivity(i);
                      break;
  