コード例 #1
0
        @Override
        public void onPanelSlide(View panel, float slideOffset) {
          // For every 1 percent that the panel is slid upwards, clip 1 percent off the top
          // edge of the shortcut card, to achieve the animated effect of the shortcut card
          // being pushed out of view when the panel is slid upwards. slideOffset is 1 when
          // the shortcut card is fully exposed, and 0 when completely hidden.
          float ratioCardHidden = (1 - slideOffset);
          if (mShortcutCardsListView.getChildCount() > 0) {
            final SwipeableShortcutCard v =
                (SwipeableShortcutCard) mShortcutCardsListView.getChildAt(0);
            v.clipCard(ratioCardHidden);
          }

          if (mActionBar != null) {
            // Amount of available space that is not being hidden by the bottom pane
            final int topPaneHeight = (int) (slideOffset * mShortcutCardsListView.getHeight());

            final int availableActionBarHeight = Math.min(mActionBar.getHeight(), topPaneHeight);
            ((HostInterface) getActivity())
                .setActionBarHideOffset(mActionBar.getHeight() - availableActionBarHeight);

            if (!mActionBar.isShowing()) {
              mActionBar.show();
            }
          }
        }
コード例 #2
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    TextView altezza = (TextView) findViewById(R.id.height);
    TextView altdens = (TextView) findViewById(R.id.heightden);
    TextView larghezza = (TextView) findViewById(R.id.width);
    TextView largdens = (TextView) findViewById(R.id.widthden);
    TextView diagonale = (TextView) findViewById(R.id.inches);

    int actionbarheight = 0;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
      ActionBar bar = getActionBar();

      if (bar != null) actionbarheight = bar.getHeight();
    }

    MainApplication.calculateScreenSizeInInches(getWindowManager(), actionbarheight);

    altezza.setText("Altezza (in pixel) = " + MainApplication.getScreenH());
    altdens.setText(
        "Densità altezza (in pollici) = " + String.valueOf(MainApplication.getScreenDh()));
    larghezza.setText("Larghezza (in pixel) = " + MainApplication.getScreenW());
    largdens.setText(
        "Densità larghezza (in pollici) = " + String.valueOf(MainApplication.getScreenDw()));
    diagonale.setText(
        "Diagonale (in pollici) = " + String.valueOf(MainApplication.getScreen_size_in_inches()));
  }
コード例 #3
0
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
      int topPadding =
          paddingEnabled && actionBar != null && actionBar.isShowing() ? actionBar.getHeight() : 0;
      setPadding(0, topPadding, 0, 0);

      super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }
コード例 #4
0
 @Override
 public int getHeight() {
   return mActionBar.getHeight();
 }
コード例 #5
0
 public int getHeight() {
   return mActionBar != null ? mActionBar.getHeight() : 0;
 }
コード例 #6
0
 public int getActionBarHeight() {
   ActionBar actionBar = getActionBar();
   return actionBar != null ? actionBar.getHeight() : 0;
 }