@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView();

    FragmentManager fm = getSupportFragmentManager();

    if (fm.findFragmentById(R.id.root_container) == null) {
      ResponseMapFragment map =
          ResponseMapFragment.newInstance(ContentUris.parseId(getIntent().getData()));
      fm.beginTransaction().add(R.id.root_container, map).commit();
    }
  }
Ejemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (!MobilityHelper.isMobilityInstalled(this)) {
      setContentView(R.layout.mobility_missing);

      // hook up market link
      Button installMobilityButton = (Button) findViewById(R.id.mobility_install_btn);

      installMobilityButton.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              // launch the market and show mobility's details page
              Intent intent = new Intent(Intent.ACTION_VIEW);
              intent.setData(Uri.parse(getString(R.string.mobility_market_link)));
              startActivity(intent);
            }
          });
    } else if (!MobilityHelper.isMobilityVersionCorrect(this)) {
      TextView view = new TextView(this);
      view.setText("Please make sure Mobility is up to date.");
      view.setTextAppearance(this, android.R.attr.textAppearanceLarge);
      view.setGravity(Gravity.CENTER);
      setContentView(view);
    } else {
      mUserPrefs = new UserPreferencesHelper(this);
      setContentView(R.layout.tab_layout);
      setActionBarShadowVisibility(false);

      mTabHost = (TabHost) findViewById(android.R.id.tabhost);
      mTabHost.setup();

      mViewPager = (ViewPager) findViewById(R.id.pager);

      mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager);

      if (mUserPrefs.showMobilityFeedback()) {
        mTabsAdapter.addTab("Analytics", RecentMobilityChartFragment.class, null);
      } else {
        findViewById(android.R.id.tabs).setVisibility(View.GONE);
      }
      mTabsAdapter.addTab("Control", MobilityControlFragment.class, null);

      if (savedInstanceState != null) {
        mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
      }
    }
  }
Ejemplo n.º 3
0
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   if (mTabHost != null) outState.putString("tab", mTabHost.getCurrentTabTag());
 }