Ejemplo n.º 1
0
  private void intiActionTab() {
    actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    tab_top = actionBar.newTab().setText("头条");
    tab_cyclopedia = actionBar.newTab().setText("百科");
    tab_message = actionBar.newTab().setText("资讯");
    tab_manage = actionBar.newTab().setText("经营");
    tab_data = actionBar.newTab().setText("数据");

    tab_top.setTabListener(this);
    tab_cyclopedia.setTabListener(this);
    tab_message.setTabListener(this);
    tab_manage.setTabListener(this);
    tab_data.setTabListener(this);

    actionBar.addTab(tab_top);
    actionBar.addTab(tab_cyclopedia);
    actionBar.addTab(tab_message);
    actionBar.addTab(tab_manage);
    actionBar.addTab(tab_data);
  }
Ejemplo n.º 2
0
  private void addTabs() {
    ActionBar.Tab addNewExpenseTab = actionBar.newTab();
    addNewExpenseTab.setTabListener(this);
    addNewExpenseTab.setText("Add New");
    actionBar.addTab(addNewExpenseTab);

    ActionBar.Tab todayTab = actionBar.newTab();
    todayTab.setTabListener(this);
    todayTab.setText("Today");
    actionBar.addTab(todayTab);
  }
Ejemplo n.º 3
0
 public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
   TabInfo info = new TabInfo(clss, args);
   tab.setTag(info);
   tab.setTabListener(this);
   mTabs.add(info);
   mActionBar.addTab(tab);
   notifyDataSetChanged();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_profile);

    fragmentManager = getFragmentManager();

    ActionBar actionBar = getActionBar();

    // Hide ActionBar Icon
    actionBar.setDisplayShowHomeEnabled(false);

    // Hide ActionBar Title
    actionBar.setDisplayShowTitleEnabled(false);

    // Create ActionBar Tabs
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set Tab Icon and Titles
    Profile = actionBar.newTab().setText("Profile");
    Events = actionBar.newTab().setText("Events");

    // Set Tab Listeners
    Profile.setTabListener(new TabListener(fragmentProfileTab));
    Events.setTabListener(new TabListener(fragmentEventsTab));

    // Add Tabs to ActionBar
    actionBar.addTab(Profile);
    actionBar.addTab(Events);

    // Get which tab is selected from the intent
    Intent fromHomeView = getIntent();
    String tabSelected = fromHomeView.getStringExtra("tabSelected");
    int tabPosition = 0;
    if (tabSelected != null && tabSelected.equals("events")) {
      tabPosition = 1;
    }

    actionBar.setSelectedNavigationItem(tabPosition);
  }
Ejemplo n.º 5
0
 private ActionBar.Tab CreateTab(String title, View v) {
   ActionBar actionBar = this.controls.activity.getActionBar();
   ActionBar.Tab tab = actionBar.newTab();
   tab.setText(title); //
   if (mCountTab != 0) {
     v.setVisibility(View.INVISIBLE);
   }
   TabContentFragment content = new TabContentFragment(v, title);
   tab.setTabListener(
       new TabListener(
           content)); // All tabs must have a TabListener set before being added to the ActionBar.
   mCountTab = mCountTab + 1;
   return tab;
 }
Ejemplo n.º 6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stations_all);
    ActionBar ab = getActionBar();
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    ActionBar.Tab listTab = ab.newTab().setText("List");
    ActionBar.Tab mapTab = ab.newTab().setText("Map");

    Fragment listFrag = new StationsListFragment();
    Fragment mapFrag = new InteractiveMapFragment();

    listTab.setTabListener(new StationsAllTabListener(listFrag));
    listTab.setTabListener(new StationsAllTabListener(listFrag));
    listTab.setTabListener(new StationsAllTabListener(listFrag));

    mapTab.setTabListener(new StationsAllTabListener(mapFrag));

    ab.addTab(listTab);
    ab.addTab(mapTab);

    listTab.select();
  }
Ejemplo n.º 7
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   ctoDAO = ContatoDAO.getInstance(MainActivity.this);
   ctoDAO.open();
   screen_tablet_ou_phone = isTablet(MainActivity.this);
   if (screen_tablet_ou_phone) {
     setContentView(R.layout.tela_inicial_tablet); // associa o layout para tablets
   } else {
     setContentView(R.layout.tela_inicial_smartphone); // associa o layout para smartphones
     ActionBar actionBar = getActionBar();
     actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
     // tab1
     ActionBar.Tab tab1 = actionBar.newTab().setText("Lista de Contatos");
     Fragment fragment_listview = new ListviewFragment();
     tab1.setTabListener(new MyTabListener(MainActivity.this, fragment_listview));
     actionBar.addTab(tab1);
     // tab2
     ActionBar.Tab tab2 = actionBar.newTab().setText("Novo Contato");
     Fragment fragment_inputs = new InputsFragment();
     tab2.setTabListener(new MyTabListener(MainActivity.this, fragment_inputs));
     actionBar.addTab(tab2);
   }
 }
Ejemplo n.º 8
0
 @Override
 public Tab setTabListener(TabListener listener) {
   mNativeTab.setTabListener(listener != null ? this : null);
   mListener = listener;
   return this;
 }
Ejemplo n.º 9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
    Log.i("Leaderboard", "entered leaderboard");

    // set the layout for the parent activity which contains the fragments
    setContentView(R.layout.activity_leaderboard);

    // Initialize the database according to whether it's a test or not.
    Log.d("Leaderboard: Using Test Database", "" + TitlePage.useTestDB);
    if (TitlePage.useTestDB) { // The Testing Database on Parse
      Parse.initialize(
          this,
          "E8hfMLlgnEWvPw1auMOvGVsrTp1C6eSoqW1s6roq",
          "hzPRfP284H5GuRzIFDhVxX6iR9sgTwg4tJU08Bez");
    } else { // The Real App Database on Parse
      Parse.initialize(
          this,
          "Iy4JZxlewoSxswYgOEa6vhOSRgJkGIfDJ8wj8FtM",
          "SVlq5dqYQ4FemgUfA7zdQvdIHOmKBkc5bXoI7y0C");
    }

    lp = new LoginPopup(currentUser);

    // set up the action bar for the different tabs
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayUseLogoEnabled(false);

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    ActionBar.Tab singlePlayerTab = actionBar.newTab().setText(R.string.single_player_tab);
    ActionBar.Tab multiPlayerTab = actionBar.newTab().setText(R.string.multi_player_tab);
    ActionBar.Tab relativeUserScoreTab = actionBar.newTab().setText(R.string.relative_tab);

    // get the list of scores from the model and send it to each of the tabs

    lb = new SingleLeaderBoardModel(getApplicationContext());
    try {
      mlb = new MultiLeaderBoardModel();
    } catch (InternetConnectionException e) {
      e.fillInStackTrace();
      Log.i("Leaderboard", "triggering internet connection error screen");
      Intent intent = new Intent(this, ErrorScreen.class);
      intent.putExtra("error", R.layout.activity_connection_error_lb);
      startActivity(intent);
      return;
    }

    // need to get the username to pass into the leaderboard
    Fragment singlePlayerFragment = SingleplayerTab.newInstance(lb.getTopScores());
    Fragment multiPlayerFragment = MultiplayerTab.newInstance("", mlb.getTopScores());
    Fragment relativeUserScoreFragment = RelativeUserScoreTab.emptyNewInstance();

    singlePlayerTab.setTabListener(new LBTabListener(singlePlayerFragment, "singleplayer"));
    multiPlayerTab.setTabListener(new LBTabListener(multiPlayerFragment, "multiplayer"));
    relativeUserScoreTab.setTabListener(new LBTabListener(relativeUserScoreFragment, "relative"));

    actionBar.addTab(singlePlayerTab);
    actionBar.addTab(multiPlayerTab);
    actionBar.addTab(relativeUserScoreTab);
  }
Ejemplo n.º 10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.workout_info_pager);
    dayWeek = new int[2];

    uDBTools = new UserInfoDatabaseTools(this);

    progress = new ProgressDialog(TrainerDay.this, R.style.MyTheme);
    progress.setCancelable(false);
    progress.setProgressStyle(android.R.style.Widget_ProgressBar_Small);
    progress.show();

    Intent intent = getIntent();

    trainerType = intent.getStringExtra("trainerType");
    dayWeek = intent.getIntArrayExtra("dayWeek");

    viewPager = (ViewPager) findViewById(R.id.workout_view_pager);
    viewPager.setOffscreenPageLimit(2);

    myAdapter = new MyAdapter(getSupportFragmentManager());

    viewPager.setAdapter(myAdapter);
    viewPager.setOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {

          @Override
          public void onPageScrolled(
              int position, float positionOffset, int positionOffsetPixels) {}

          @Override
          public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
            Fragment page =
                getSupportFragmentManager()
                    .findFragmentByTag(
                        "android:switcher:"
                            + R.id.workout_view_pager
                            + ":"
                            + viewPager.getCurrentItem());

            if (viewPager.getCurrentItem() == 1 && page != null) {
              ((TrainerWorkoutTab) page).updateFragment();
            }
          }

          @Override
          public void onPageScrollStateChanged(int state) {}
        });

    actionBar = this.getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    formatTab = actionBar.newTab();
    formatTab.setText("WarmUp");
    formatTab.setTabListener(this);

    wallTab = actionBar.newTab();
    wallTab.setText("Workout");
    wallTab.setTabListener(this);

    postTab = actionBar.newTab();
    postTab.setText("Stretch/Core");
    postTab.setTabListener(this);

    actionBar.addTab(formatTab);
    actionBar.addTab(wallTab);
    actionBar.addTab(postTab);
  }