Android Open Source - utexas-utilities Panes Activity






From Project

Back to project page utexas-utilities.

License

The source code is released under:

Apache License

If you think the Android project utexas-utilities 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.mapsaurus.paneslayout;
/*w w  w  .j a  v a  2 s . c o m*/
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
import com.mapsaurus.paneslayout.PanesSizer.PaneSizer;

public abstract class PanesActivity extends SherlockFragmentActivity implements FragmentLauncher{

  private ActivityDelegate mDelegate;

  @Override
  public void onSaveInstanceState(Bundle savedInstanceState) {
    super.onSaveInstanceState(savedInstanceState);

    mDelegate.onSaveInstanceState(savedInstanceState);
  }

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

    if (getResources().getBoolean(R.bool.largeScreen)) {
      mDelegate = new TabletDelegate(this);
    } else {
      mDelegate = new PhoneDelegate(this);
    }

    mDelegate.onCreate(savedInstanceState);
  }

  /* *********************************************************************
   * Deal with over-riding activity methods
   * ********************************************************************* */

  /**
   * Deal with menu buttons
   */
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (mDelegate.onOptionsItemSelected(item)) return true;
    return super.onOptionsItemSelected(item);
  }

  @Override
  protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    mDelegate.onPostCreate(savedInstanceState);
  }

  @Override
  public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    mDelegate.onConfigurationChanged(newConfig);
  }

  /**
   * Deal with back pressed
   */
  @Override
  public void onBackPressed() {
    if (onBackPressedHelper()) return;
    super.onBackPressed();
  }

  protected boolean onBackPressedHelper() {
    if (mDelegate.onBackPressed()) return true;
    return false;
  }

  /* *********************************************************************
   * Adding, removing, getting fragments
   * 
   * Note: fragments are added in a stack. Here's a sample use case:
   * 
   * setMenuFragment(A)
   * stack: A
   * 
   * addFragment(A, B)
   * stack: A, B
   * 
   * addFragment(B, C)
   * stack: A, B, C
   * 
   * addFragment(B, D)
   * stack: A, B, D
   * 
   * clearFragments()
   * stack: A
   * 
   * ********************************************************************* */

  /**
   * Add a new fragment after the previous fragment.
   */
  @Override
  public void addFragment(Fragment prevFragment, Fragment newFragment) {
    mDelegate.addFragment(prevFragment, newFragment);
  }

  /**
   * Add a fragment as a menu
   */
  public void setMenuFragment(Fragment f) {
    mDelegate.setMenuFragment(f);
  }

  /**
   * Clear all fragments from stack except the menu fragment
   */
  public void clearFragments() {
    mDelegate.clearFragments();
  }

  /**
   * Get menu fragment
   */
  public Fragment getMenuFragment() {
    return mDelegate.getMenuFragment();
  }

  /**
   * Get top fragment
   */
  public Fragment getTopFragment() {
    return mDelegate.getTopFragment();
  }

  /**
   * Show the menu
   */
  public void showMenu() {
    mDelegate.showMenu();
  }
  
  /**
   * Show the content
   */
  public void showContent() {
    mDelegate.showContent();
  }

  /* *********************************************************************
   * Setup tablet or phone delegates
   * ********************************************************************* */

  /**
   * Set the pane sizer
   */
  public void setPaneSizer(PaneSizer sizer) {
    if (mDelegate instanceof TabletDelegate)
      ((TabletDelegate) mDelegate).setPaneSizer(sizer);
  }
  
  public Fragment getFragment(int index) {
    if (mDelegate instanceof TabletDelegate)
      return ((TabletDelegate) mDelegate).getFragment(index);
    else
      throw new IllegalStateException("Can't call getFragment() when you're on a phone.");
  }
}




Java Source Code List

com.google.maps.android.ui.MyIconGenerator.java
com.mapsaurus.paneslayout.ActivityDelegate.java
com.mapsaurus.paneslayout.FragmentLauncher.java
com.mapsaurus.paneslayout.MenuItemWrapper.java
com.mapsaurus.paneslayout.MySlidingPaneLayout.java
com.mapsaurus.paneslayout.PanesActivity.java
com.mapsaurus.paneslayout.PanesLayout.java
com.mapsaurus.paneslayout.PanesSizer.java
com.mapsaurus.paneslayout.PhoneDelegate.java
com.mapsaurus.paneslayout.SimpleScrollView.java
com.mapsaurus.paneslayout.TabletDelegate.java
com.nasageek.utexasutilities.AsyncTask.java
com.nasageek.utexasutilities.AttachmentDownloadService.java
com.nasageek.utexasutilities.AuthCookie.java
com.nasageek.utexasutilities.BlackboardDashboardXmlParser.java
com.nasageek.utexasutilities.BuildingDatabase.java
com.nasageek.utexasutilities.BuildingProvider.java
com.nasageek.utexasutilities.BuildingSaxHandler.java
com.nasageek.utexasutilities.ChangeLog.java
com.nasageek.utexasutilities.ChangeableContextTask.java
com.nasageek.utexasutilities.CourseMapSaxHandler.java
com.nasageek.utexasutilities.FixedListPreference.java
com.nasageek.utexasutilities.LoginWebViewClient.java
com.nasageek.utexasutilities.MarkerManager.java
com.nasageek.utexasutilities.MyPair.java
com.nasageek.utexasutilities.MyScrollView.java
com.nasageek.utexasutilities.PlacemarkSaxHandler.java
com.nasageek.utexasutilities.PnaAuthCookie.java
com.nasageek.utexasutilities.RouteSaxHandler.java
com.nasageek.utexasutilities.SecurePreferences.java
com.nasageek.utexasutilities.TempLoginException.java
com.nasageek.utexasutilities.UTilitiesApplication.java
com.nasageek.utexasutilities.UtdAuthCookie.java
com.nasageek.utexasutilities.Utility.java
com.nasageek.utexasutilities.WrappedViewPager.java
com.nasageek.utexasutilities.WrappingSlidingDrawer.java
com.nasageek.utexasutilities.activities.AboutMeActivity.java
com.nasageek.utexasutilities.activities.BalanceActivity.java
com.nasageek.utexasutilities.activities.BlackboardPanesActivity.java
com.nasageek.utexasutilities.activities.CampusMapActivity.java
com.nasageek.utexasutilities.activities.DataUsageActivity.java
com.nasageek.utexasutilities.activities.LoginActivity.java
com.nasageek.utexasutilities.activities.MenuActivity.java
com.nasageek.utexasutilities.activities.NutritionInfoActivity.java
com.nasageek.utexasutilities.activities.Preferences.java
com.nasageek.utexasutilities.activities.ScheduleActivity.java
com.nasageek.utexasutilities.activities.UTilitiesActivity.java
com.nasageek.utexasutilities.adapters.BBClassAdapter.java
com.nasageek.utexasutilities.adapters.CourseMapAdapter.java
com.nasageek.utexasutilities.adapters.MultiPanePagerAdapter.java
com.nasageek.utexasutilities.adapters.MyFragmentPagerAdapter.java
com.nasageek.utexasutilities.adapters.ScheduleClassAdapter.java
com.nasageek.utexasutilities.adapters.TransactionAdapter.java
com.nasageek.utexasutilities.fragments.ActionModeFragment.java
com.nasageek.utexasutilities.fragments.BlackboardAnnouncementsFragment.java
com.nasageek.utexasutilities.fragments.BlackboardCourseListFragment.java
com.nasageek.utexasutilities.fragments.BlackboardCourseMapFragment.java
com.nasageek.utexasutilities.fragments.BlackboardDashboardFragment.java
com.nasageek.utexasutilities.fragments.BlackboardDownloadableItemFragment.java
com.nasageek.utexasutilities.fragments.BlackboardExternalItemFragment.java
com.nasageek.utexasutilities.fragments.BlackboardFragment.java
com.nasageek.utexasutilities.fragments.BlackboardGradesFragment.java
com.nasageek.utexasutilities.fragments.BlackboardPagerFragment.java
com.nasageek.utexasutilities.fragments.CourseScheduleFragment.java
com.nasageek.utexasutilities.fragments.DatePickerFragment.java
com.nasageek.utexasutilities.fragments.DoubleDatePickerDialogFragment.java
com.nasageek.utexasutilities.fragments.ExamScheduleFragment.java
com.nasageek.utexasutilities.fragments.MenuFragment.java
com.nasageek.utexasutilities.fragments.NutritionInfoFragment.java
com.nasageek.utexasutilities.fragments.PickCalendarDialogFragment.java
com.nasageek.utexasutilities.fragments.TransactionsFragment.java
com.nasageek.utexasutilities.model.BBClass.java
com.nasageek.utexasutilities.model.Building.java
com.nasageek.utexasutilities.model.Classtime.java
com.nasageek.utexasutilities.model.CourseMapItem.java
com.nasageek.utexasutilities.model.FeedItem.java
com.nasageek.utexasutilities.model.Placemark.java
com.nasageek.utexasutilities.model.Transaction.java
com.nasageek.utexasutilities.model.UTClass.java
com.viewpagerindicator.MyTabPageIndicator.java