Android Open Source - Calendar-DayView Tabs Listener






From Project

Back to project page Calendar-DayView.

License

The source code is released under:

Apache License

If you think the Android project Calendar-DayView 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 com.srikanthgr.calendarweekview.listeners;
//from www .  ja  v a2 s. co m
import com.srikanthgr.calendarweekview.R;

import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.Fragment;
import android.app.FragmentTransaction;


/**
 * @author Srikanth G.R
 *
 */
public class TabsListener implements ActionBar.TabListener {
  public Fragment fragment;

  public TabsListener(Fragment fragment) {
    this.fragment = fragment;
  }

  public void onTabReselected(Tab tab, FragmentTransaction ft) {
  }

  public void onTabSelected(Tab tab, FragmentTransaction ft) {
    if (fragment != null) {
      ft.replace(R.id.mainLayout, fragment);
      // isSettingClicked = false;
    } else {
      ft.attach(fragment);
    }
  }

  public void onTabUnselected(Tab tab, FragmentTransaction ft) {
    if (fragment != null) {
      try {
        ft.remove(fragment);
      } catch (Exception e) {
        // TODO: handle exception
      }
    }
  }

}




Java Source Code List

com.srikanthgr.calendarweekview.MainActivity.java
com.srikanthgr.calendarweekview.datainterface.DataInterface.java
com.srikanthgr.calendarweekview.fragments.DayFragment.java
com.srikanthgr.calendarweekview.listeners.TabsListener.java
com.srikanthgr.calendarweekview.model.Event.java
com.srikanthgr.calendarweekview.utility.Utility.java