Esempio n. 1
0
  /**
   * Construct a new ActionBarDrawerToggle.
   *
   * <p>
   *
   * <p>The given {@link android.app.Activity} will be linked to the specified {@link
   * android.support.v4.widget.DrawerLayout}. The provided drawer indicator drawable will animate
   * slightly off-screen as the drawer is opened, indicating that in the open state the drawer will
   * move off-screen when pressed and in the closed state the drawer will move on-screen when
   * pressed.
   *
   * <p>
   *
   * <p>String resources must be provided to describe the open/close drawer actions for
   * accessibility services.
   *
   * @param activity The Activity hosting the drawer
   * @param drawerLayout The DrawerLayout to link to the given Activity's ActionBar
   * @param drawerImageRes A Drawable resource to use as the drawer indicator
   * @param openDrawerContentDescRes A String resource to describe the "open drawer" action for
   *     accessibility
   * @param closeDrawerContentDescRes A String resource to describe the "close drawer" action for
   *     accessibility
   */
  public ActionBarDrawerToggle(
      SherlockFragmentActivity activity,
      DrawerLayout drawerLayout,
      int drawerImageRes,
      int openDrawerContentDescRes,
      int closeDrawerContentDescRes) {
    mActivity = activity;
    mDrawerLayout = drawerLayout;
    mDrawerImageResource = drawerImageRes;
    mOpenDrawerContentDescRes = openDrawerContentDescRes;
    mCloseDrawerContentDescRes = closeDrawerContentDescRes;

    mThemeImage = IMPL.getThemeUpIndicator(activity);
    mDrawerImage = activity.getResources().getDrawable(drawerImageRes);
    mSlider = new SlideDrawable(mDrawerImage);
    mSlider.setOffsetBy(1.f / 3);
  }
Esempio n. 2
0
 /**
  * This method should always be called by your <code>Activity</code>'s {@link
  * android.app.Activity#onConfigurationChanged(android.content.res.Configuration)
  * onConfigurationChanged} method.
  *
  * @param newConfig The new configuration
  */
 public void onConfigurationChanged(Configuration newConfig) {
   // Reload drawables that can change with configuration
   mThemeImage = IMPL.getThemeUpIndicator(mActivity);
   mDrawerImage = mActivity.getResources().getDrawable(mDrawerImageResource);
   syncState();
 }