public void onSliding(View v) {
   if (spl.isOpen()) {
     spl.closePane();
   } else {
     spl.openPane();
   }
 }
 @Override
 public boolean onNavigationItemSelected(int itemPosition, long itemId) {
   loadTrackList(itemPosition); // itemPosition == view type
   if (!mInitialTabSelect) {
     onTrackSelected(mTracksDropdownFragment.getSelectedTrackId());
     mSlidingPaneLayout.openPane();
   }
   return true;
 }
Ejemplo n.º 3
0
 @Override
 public void onBackPressed() {
   if (!mSlidingLayout.isOpen()) {
     mSlidingLayout.openPane();
   } else {
     MyListFragment.contatti = true;
     super.onBackPressed();
   }
 }
  @Override
  protected void initViews(Bundle var) {
    slidingLeftFragment.setSlidingLeftListener(this);

    slidingPaneLayout.openPane();
    slidingPaneLayout.setPanelSlideListener(
        new SlidingPaneLayout.PanelSlideListener() {
          @Override
          public void onPanelSlide(View panel, float slideOffset) {
            if (slidingLeftFragment.isAnimation()) {
              if (mMenuPanel == null) {
                final int childCount = slidingPaneLayout.getChildCount();
                for (int i = 0; i < childCount; i++) {
                  final View child = slidingPaneLayout.getChildAt(i);
                  if (child != panel) {
                    mMenuPanel = child;
                    break;
                  }
                }
              }
              final float scaleLeft = 1 - 0.3f * (1 - slideOffset);
              mMenuPanel.setPivotX(-0.3f * mMenuPanel.getWidth());
              mMenuPanel.setPivotY(mMenuPanel.getHeight() / 2f);
              mMenuPanel.setScaleX(scaleLeft);
              mMenuPanel.setScaleY(scaleLeft);

              final float scale = 1 - 0.2f * slideOffset;
              panel.setPivotX(0);
              panel.setPivotY(panel.getHeight() / 2.0f);
              panel.setScaleX(scale);
              panel.setScaleY(scale);
            }
          }

          @Override
          public void onPanelOpened(View panel) {
            slidingLeftFragment.setHasOptionsMenu(false);
          }

          @Override
          public void onPanelClosed(View panel) {
            slidingLeftFragment.setHasOptionsMenu(true);
          }
        });
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case android.R.id.home:
        if (mSlidingPaneLayout.isSlideable() && !mSlidingPaneLayout.isOpen()) {
          // If showing the detail view, pressing Up should show the master pane.
          mSlidingPaneLayout.openPane();
          return true;
        }
        break;

      case R.id.menu_search:
        if (!UIUtils.hasHoneycomb()) {
          startSearch(null, false, Bundle.EMPTY, false);
          return true;
        }
        break;
    }
    return super.onOptionsItemSelected(item);
  }
  private void routeIntent(Intent intent, boolean updateSurfaceOnly) {
    Uri uri = intent.getData();
    if (uri == null) {
      return;
    }

    if (intent.hasExtra(Intent.EXTRA_TITLE)) {
      setTitle(intent.getStringExtra(Intent.EXTRA_TITLE));
    }

    String mimeType = getContentResolver().getType(uri);

    if (ScheduleContract.Tracks.CONTENT_ITEM_TYPE.equals(mimeType)) {
      // Load track details
      showFullUI(true);
      if (!updateSurfaceOnly) {
        // TODO: don't assume the URI will contain the track ID
        int defaultViewType =
            intent.getIntExtra(EXTRA_DEFAULT_VIEW_TYPE, TracksDropdownFragment.VIEW_TYPE_SESSIONS);
        String selectedTrackId = ScheduleContract.Tracks.getTrackId(uri);
        loadTrackList(defaultViewType, selectedTrackId);
        getSupportActionBar().setSelectedNavigationItem(defaultViewType);
        onTrackSelected(selectedTrackId);
        mSlidingPaneLayout.openPane();
      }

    } else if (ScheduleContract.Sessions.CONTENT_TYPE.equals(mimeType)) {
      // Load a session list, hiding the tracks dropdown and the tabs
      mViewType = TracksDropdownFragment.VIEW_TYPE_SESSIONS;
      showFullUI(false);
      if (!updateSurfaceOnly) {
        loadSessionList(uri, null);
        mSlidingPaneLayout.openPane();
      }

    } else if (ScheduleContract.Sessions.CONTENT_ITEM_TYPE.equals(mimeType)) {
      // Load session details
      if (intent.hasExtra(EXTRA_MASTER_URI)) {
        mViewType = TracksDropdownFragment.VIEW_TYPE_SESSIONS;
        showFullUI(false);
        if (!updateSurfaceOnly) {
          loadSessionList(
              (Uri) intent.getParcelableExtra(EXTRA_MASTER_URI),
              ScheduleContract.Sessions.getSessionId(uri));
          loadSessionDetail(uri);
        }
      } else {
        mViewType = TracksDropdownFragment.VIEW_TYPE_SESSIONS; // prepare for onTrackInfo...
        showFullUI(true);
        if (!updateSurfaceOnly) {
          loadSessionDetail(uri);
          loadTrackInfoFromSessionUri(uri);
        }
      }

    } else if (ScheduleContract.Sandbox.CONTENT_TYPE.equals(mimeType)) {
      // Load a sandbox company list
      mViewType = TracksDropdownFragment.VIEW_TYPE_SANDBOX;
      showFullUI(false);
      if (!updateSurfaceOnly) {
        loadSandboxList(uri, null);
        mSlidingPaneLayout.openPane();
      }

    } else if (ScheduleContract.Sandbox.CONTENT_ITEM_TYPE.equals(mimeType)) {
      // Load company details
      mViewType = TracksDropdownFragment.VIEW_TYPE_SANDBOX;
      showFullUI(false);
      if (!updateSurfaceOnly) {
        Uri masterUri = intent.getParcelableExtra(EXTRA_MASTER_URI);
        if (masterUri == null) {
          masterUri = ScheduleContract.Sandbox.CONTENT_URI;
        }
        loadSandboxList(masterUri, ScheduleContract.Sandbox.getCompanyId(uri));
        loadSandboxDetail(uri);
      }
    }

    updateDetailBackground();
  }
Ejemplo n.º 7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_my);
    // actionBar=getSupportActionBar();
    checkPlayServices();
    int dpValue = 50; // margin in dips
    float d = this.getResources().getDisplayMetrics().density;
    final int margin = (int) (dpValue * d);

    mSlidingLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);
    final View Fmargin = mSlidingLayout.findViewById(R.id.content_pane);
    final ViewGroup.MarginLayoutParams lp =
        (ViewGroup.MarginLayoutParams) Fmargin.getLayoutParams();

    mSlidingLayout.setPanelSlideListener(
        new SlidingPaneLayout.PanelSlideListener() {
          @Override
          public void onPanelSlide(View panel, float slideOffset) {
            if (add) {

            } else {

            }
          }

          @Override
          public void onPanelOpened(View panel) {
            getSupportFragmentManager()
                .findFragmentById(R.id.content_pane)
                .setHasOptionsMenu(false);
            getSupportFragmentManager().findFragmentById(R.id.list_pane).setHasOptionsMenu(true);
            // actionBar.removeAllTabs();
            // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
            add = true;
            lp.setMargins(margin, 0, 0, 0);
            Fmargin.setLayoutParams(lp);
          }

          @Override
          public void onPanelClosed(View panel) {
            getSupportFragmentManager().findFragmentById(R.id.content_pane).setHasOptionsMenu(true);
            getSupportFragmentManager().findFragmentById(R.id.list_pane).setHasOptionsMenu(false);
            if (!MyListFragment.contatti) {
              // actionBar.removeAllTabs();
              // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
              add = true;
              lp.setMargins(margin, 0, 0, 0);
              Fmargin.setLayoutParams(lp);
            } else if (add) {
              // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
              // actionBar.addTab(actionBar.newTab().setText("Utenti
              // ChipChat").setTabListener(tabListener));
              // actionBar.addTab(actionBar.newTab().setText("Altri
              // Utenti").setTabListener(tabListener));
              Log.i(TAG, "addTab");
              add = false;
              lp.setMargins(0, 0, 0, 0);
              Fmargin.setLayoutParams(lp);
            }
          }
        });
    if (getIntent().getStringExtra("Destinatario") != null) {
      MyListFragment.contatti = false;
      mSlidingLayout.closePane();
      FragmentManager fragmentManager = getSupportFragmentManager();
      FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
      DetailFragment fragment = new DetailFragment();
      fragmentTransaction.replace(R.id.content_pane, fragment);
      fragmentTransaction.commit();
      DetailFragment.destinatario = getIntent().getStringExtra("Destinatario");
      DetailFragment.animato = getIntent().getBooleanExtra("Animato", true);
    } else mSlidingLayout.openPane();
    /*findViewById(R.id.chat_content).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mSlidingLayout.closePane();
        }
    });*/
  }
 private void openPane() {
   mPanes.openPane();
 }