Ejemplo n.º 1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    view = inflater.inflate(R.layout.fragment_draw, container, false);
    frame_draw_layout = (LinearLayout) view.findViewById(R.id.frame_draw_layout);
    slidingPaneLayout = new SlidingPaneLayout(getActivity());
    try {
      Field f_overHang = SlidingPaneLayout.class.getDeclaredField("mOverhangSize");
      f_overHang.setAccessible(true);
      f_overHang.set(slidingPaneLayout, 0);
      slidingPaneLayout.setPanelSlideListener(this);
      slidingPaneLayout.setSliderFadeColor(getResources().getColor(android.R.color.transparent));
    } catch (Exception e) {
      e.printStackTrace();
    }

    View leftView = new View(getActivity());
    leftView.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    leftView.setBackgroundColor(getResources().getColor(android.R.color.transparent));
    slidingPaneLayout.addView(leftView, 0);

    ViewGroup decor = (ViewGroup) getActivity().getWindow().getDecorView();
    ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
    decorChild.setBackgroundColor(getResources().getColor(android.R.color.transparent));
    decor.removeView(decorChild);
    decor.addView(slidingPaneLayout);
    slidingPaneLayout.addView(decorChild, 1);
    return view;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    UIUtils.tryTranslateHttpIntent(this);
    BeamUtils.tryUpdateIntentFromBeam(this);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_sessions_sandbox);

    final FragmentManager fm = getSupportFragmentManager();
    mTracksDropdownFragment =
        (TracksDropdownFragment) fm.findFragmentById(R.id.fragment_tracks_dropdown);

    mSlidingPaneLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);

    // Offset the left pane by its full width and left margin when collapsed
    // (ViewPager-like presentation)
    mSlidingPaneLayout.setParallaxDistance(
        getResources().getDimensionPixelSize(R.dimen.sliding_pane_width)
            + getResources().getDimensionPixelSize(R.dimen.multipane_padding));
    mSlidingPaneLayout.setSliderFadeColor(
        getResources().getColor(R.color.sliding_pane_content_fade));

    routeIntent(getIntent(), savedInstanceState != null);

    if (savedInstanceState != null) {
      if (mFullUI) {
        int viewType = savedInstanceState.getInt(STATE_VIEW_TYPE);
        getSupportActionBar().setSelectedNavigationItem(viewType);
      }

      mDetailFragment = fm.findFragmentById(R.id.fragment_container_detail);
      updateDetailBackground();
    }

    // This flag prevents onTabSelected from triggering extra master pane reloads
    // unless it's actually being triggered by the user (and not automatically by
    // the system)
    mInitialTabSelect = false;

    mImageLoader =
        new ImageLoader(this, R.drawable.person_image_empty)
            .setMaxImageSize(getResources().getDimensionPixelSize(R.dimen.speaker_image_size))
            .setFadeInImage(UIUtils.hasHoneycombMR1());

    EasyTracker.getInstance().setContext(this);
  }