Android Open Source - Android-Backup Tabs Pager Adapter






From Project

Back to project page Android-Backup.

License

The source code is released under:

GNU General Public License

If you think the Android project Android-Backup 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.Akkad.AndroidBackup;
//from   w  ww . j a va 2s. c  o m
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class TabsPagerAdapter extends FragmentPagerAdapter {

  private boolean deviceSupported;

  public TabsPagerAdapter(FragmentManager supportFragmentManager, boolean deviceSupported) {
    super(supportFragmentManager);
    this.deviceSupported = deviceSupported;
  }

  @Override
  public Fragment getItem(int arg0) {
    Bundle data = new Bundle();
    if (deviceSupported) {
      switch (arg0) {
      case 0: // Information tab is selected
        InformationFragment informationFragment = new InformationFragment();
        data.putInt("current_tab", arg0 + 1);
        informationFragment.setArguments(data);
        return informationFragment;
      case 1: // Tasks tab is selected
        TasksFragment tasksFragment = new TasksFragment();
        data.putInt("current_tab", arg0 + 1);
        tasksFragment.setArguments(data);
        return tasksFragment;
      case 2: // Applications tab is selected
        ApplicationsFragment applicationsFragment = new ApplicationsFragment();
        data.putInt("current_tab", arg0 + 1);
        applicationsFragment.setArguments(data);
        return applicationsFragment;
      case 3: // Schedule tab is selected
        ScheduleFragment scheduleFragment = new ScheduleFragment();
        data.putInt("current_tab", arg0 + 1);
        scheduleFragment.setArguments(data);
        return scheduleFragment;
      }
      return null;
    } else {
      switch (arg0) {
      case 0: // Information tab is selected
        InformationFragment informationFragment = new InformationFragment();
        data.putInt("current_tab", arg0 + 1);
        informationFragment.setArguments(data);
        return informationFragment;
      }
      return null;
    }

  }

  @Override
  public int getCount() {
    return deviceSupported ? 4 : 1;
  }

}




Java Source Code List

com.Akkad.AndroidBackup.AndroidBackupActivity.java
com.Akkad.AndroidBackup.AppInfoAdapter.java
com.Akkad.AndroidBackup.ApplicationsFragment.java
com.Akkad.AndroidBackup.BackupListAdapter.java
com.Akkad.AndroidBackup.BackupStore.java
com.Akkad.AndroidBackup.Backup.java
com.Akkad.AndroidBackup.Core.java
com.Akkad.AndroidBackup.InformationFragment.java
com.Akkad.AndroidBackup.ScheduleFragment.java
com.Akkad.AndroidBackup.TabsPagerAdapter.java
com.Akkad.AndroidBackup.TasksFragment.java