Android Open Source - ArduinoRGB-Controller Menu Pager Adapter






From Project

Back to project page ArduinoRGB-Controller.

License

The source code is released under:

MIT License

If you think the Android project ArduinoRGB-Controller 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 dk.cmol.arduinorgb_controller;
//from w  ww  .jav  a2 s.co  m
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class MenuPagerAdapter extends FragmentPagerAdapter {

  public MenuPagerAdapter(FragmentManager fm) {
    super(fm);
  }

  @Override
  public Fragment getItem(int position) {
    // getItem is called to instantiate the fragment for the given page.
    Fragment fragment;
    
    switch (position) {
    case 0:
      fragment = new ColorDotsFragment();
      break;
    case 1:
      fragment = new SliderFragment();
      break;
    case 2:
      fragment = new FaderFragment();
      break;
    case 3:
      fragment = new GyroFragment();
      break;
    default:
      fragment = new ColorDotsFragment();
      break;
    }

    return fragment;
  }

  @Override
  public int getCount() {
    // Show total pages.
    return 4; 
  }

  @Override
  public CharSequence getPageTitle(int position) {
    switch (position) {
    case 0:
      return "Dots";
    case 1:
      return "Slider";
    case 2:
      return "Fader";
    case 3:
      return "Gyro";
    }
    return null;
  }
}




Java Source Code List

dk.cmol.arduinorgb_controller.ArduinoRGBActivity.java
dk.cmol.arduinorgb_controller.ArduinoSocket.java
dk.cmol.arduinorgb_controller.ColorDotsFragment.java
dk.cmol.arduinorgb_controller.FaderFragment.java
dk.cmol.arduinorgb_controller.GyroFragment.java
dk.cmol.arduinorgb_controller.LampParser.java
dk.cmol.arduinorgb_controller.MenuPagerAdapter.java
dk.cmol.arduinorgb_controller.SettingsActivity.java
dk.cmol.arduinorgb_controller.SettingsFragment.java
dk.cmol.arduinorgb_controller.SliderFragment.java