當前位置: 首頁>>代碼示例>>Java>>正文


Java WindowInsets.getSystemWindowInsetTop方法代碼示例

本文整理匯總了Java中android.view.WindowInsets.getSystemWindowInsetTop方法的典型用法代碼示例。如果您正苦於以下問題:Java WindowInsets.getSystemWindowInsetTop方法的具體用法?Java WindowInsets.getSystemWindowInsetTop怎麽用?Java WindowInsets.getSystemWindowInsetTop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.WindowInsets的用法示例。


在下文中一共展示了WindowInsets.getSystemWindowInsetTop方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onApplyWindowInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        mInsets[0] = insets.getSystemWindowInsetLeft();
        mInsets[1] = insets.getSystemWindowInsetTop();
        mInsets[2] = insets.getSystemWindowInsetRight();
        mInsets[3] = insets.getSystemWindowInsetBottom();

        post(new Runnable() {
            @Override
            public void run() {
                notifyListener();
            }
        });
        return super.onApplyWindowInsets(insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), 0,
                insets.getSystemWindowInsetRight(), lockHeight ? 0 : insets.getSystemWindowInsetBottom()));
    } else {
        return super.onApplyWindowInsets(insets);
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:21,代碼來源:UILayoutImpl.java

示例2: onApplyWindowInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
    int l = insets.getSystemWindowInsetLeft();
    int t = insets.getSystemWindowInsetTop();
    int r = insets.getSystemWindowInsetRight();

    toolbar.setPadding(l, toolbar.getPaddingTop() + t, 0, 0);

    final boolean ltr = recyclerView.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;

    setPadding(getPaddingLeft(), getPaddingTop(), getPaddingEnd() + (ltr ? r : 0),
            getPaddingBottom()
    );

    setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
}
 
開發者ID:Assassinss,項目名稱:Interessant,代碼行數:18,代碼來源:InsetsDrawerLayout.java

示例3: onApplyWindowInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
public WindowInsets onApplyWindowInsets(@Nullable WindowInsets insets) {
    if (insets != null) {
        mInsets = new Rect(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(),
                insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom());
    }

    for (int i = 0; i < mView.getChildCount(); i++) {
        final View child = mView.getChildAt(i);

        if (!(child instanceof InsetsDispatchReceiver)) {
            InsetsDispatcherLayoutParamsHelper helper = ((InsetsDispatcherLayoutParams) child.getLayoutParams()).getHelper();
            if (helper != null) {
                applyInsets(mInsets, child, helper.useLeftInset, helper.useTopInset, helper.useRightInset, helper.useBottomInset, helper.insetsUseMargin);
            } else {
                applyInsets(mInsets, child, false, false, false, false, false);
            }
        }
    }

    applyInsets(mInsets, mView, mUseLeftInset, mUseTopInset, mUseRightInset, mUseBottomInset, mInsetsUseMargin);

    ViewCompat.postInvalidateOnAnimation(mView);

    return insets;
}
 
開發者ID:plusCubed,項目名稱:insets-dispatcher,代碼行數:27,代碼來源:InsetsDispatcherHelper.java

示例4: applySystemWindowInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
private boolean applySystemWindowInsets(WindowInsets insets) {
    boolean consumed = false;

    mInsets = new Rect(
            insets.getSystemWindowInsetLeft(),
            insets.getSystemWindowInsetTop(),
            insets.getSystemWindowInsetRight(),
            insets.getSystemWindowInsetBottom());

    for (int i = 0; i < getChildCount(); i++) {
        View child = getChildAt(i);

        Rect childInsets = new Rect(
                insets.getSystemWindowInsetLeft(),
                insets.getSystemWindowInsetTop(),
                insets.getSystemWindowInsetRight(),
                insets.getSystemWindowInsetBottom());

        child.dispatchApplyWindowInsets(insets.replaceSystemWindowInsets(childInsets));

        consumed = true;
    }

    return consumed;
}
 
開發者ID:oxoooo,項目名稱:excited-android,代碼行數:26,代碼來源:InsetsCoordinatorLayout.java

示例5: applySystemWindowInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
private boolean applySystemWindowInsets(WindowInsets insets) {
    boolean consumed = false;

    mInsets = new Rect(
            (prevent ^ PREVENT_LEFT) > 0 ? insets.getSystemWindowInsetLeft() : 0,
            (prevent ^ PREVENT_TOP) > 0 ? insets.getSystemWindowInsetTop() : 0,
            (prevent ^ PREVENT_RIGHT) > 0 ? insets.getSystemWindowInsetRight() : 0,
            (prevent ^ PREVENT_BOTTOM) > 0 ? insets.getSystemWindowInsetBottom() : 0);

    for (int i = 0; i < getChildCount(); i++) {
        View child = getChildAt(i);

        Rect childInsets = new Rect(
                (prevent ^ PREVENT_LEFT) > 0 ? insets.getSystemWindowInsetLeft() : 0,
                (prevent ^ PREVENT_TOP) > 0 ? insets.getSystemWindowInsetTop() : 0,
                (prevent ^ PREVENT_RIGHT) > 0 ? insets.getSystemWindowInsetRight() : 0,
                (prevent ^ PREVENT_BOTTOM) > 0 ? insets.getSystemWindowInsetBottom() : 0);

        child.dispatchApplyWindowInsets(insets.replaceSystemWindowInsets(childInsets));

        consumed = true;
    }

    return consumed;
}
 
開發者ID:oxoooo,項目名稱:excited-android,代碼行數:26,代碼來源:InsetsFrameLayout.java

示例6: applyMarginInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
public static void applyMarginInsets(ViewGroup.MarginLayoutParams paramMarginLayoutParams, Object paramObject, int paramInt)
{
  WindowInsets localWindowInsets = (WindowInsets)paramObject;
  if (paramInt == 3) {
    localWindowInsets = localWindowInsets.replaceSystemWindowInsets(localWindowInsets.getSystemWindowInsetLeft(), localWindowInsets.getSystemWindowInsetTop(), 0, localWindowInsets.getSystemWindowInsetBottom());
  }
  for (;;)
  {
    paramMarginLayoutParams.leftMargin = localWindowInsets.getSystemWindowInsetLeft();
    paramMarginLayoutParams.topMargin = localWindowInsets.getSystemWindowInsetTop();
    paramMarginLayoutParams.rightMargin = localWindowInsets.getSystemWindowInsetRight();
    paramMarginLayoutParams.bottomMargin = localWindowInsets.getSystemWindowInsetBottom();
    return;
    if (paramInt == 5) {
      localWindowInsets = localWindowInsets.replaceSystemWindowInsets(0, localWindowInsets.getSystemWindowInsetTop(), localWindowInsets.getSystemWindowInsetRight(), localWindowInsets.getSystemWindowInsetBottom());
    }
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:19,代碼來源:DrawerLayoutCompatApi21.java

示例7: onApplyWindowInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
    int l = insets.getSystemWindowInsetLeft();
    int t = insets.getSystemWindowInsetTop();
    int r = insets.getSystemWindowInsetRight();
    int b = insets.getSystemWindowInsetBottom();
    toolbar.setPadding(l, t, 0, 0);

    recyclerView.setPaddingRelative(recyclerView.getPaddingLeft() + l,
            recyclerView.getPaddingTop(),
            recyclerView.getPaddingRight(),
            recyclerView.getPaddingBottom() + b);

    final boolean ltr = recyclerView.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;

    setPadding(getPaddingLeft(), getPaddingTop(), getPaddingEnd() + (ltr ? r : 0),
            getPaddingBottom()
    );

    setOnApplyWindowInsetsListener(null);
    return insets.consumeSystemWindowInsets();
}
 
開發者ID:Assassinss,項目名稱:pretty-girl,代碼行數:23,代碼來源:InsetCoordinatorLayout.java

示例8: dispatchApplyWindowInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
@TargetApi(20)
public WindowInsets dispatchApplyWindowInsets(WindowInsets insets) {
  if (insets != null) {
    if (mApplyInsetsToShadow && mShadowView != null) {
      MarginLayoutParams lp = (MarginLayoutParams)mShadowView.getLayoutParams();
      if (lp.topMargin != insets.getSystemWindowInsetTop()) {
        lp.topMargin = insets.getSystemWindowInsetTop();
      }
    }

    final int childCount = getChildCount();
    for (int i = 0; i < childCount; ++i) {
      getChildAt(i).dispatchApplyWindowInsets(insets);
    }
  }
  return insets;
}
 
開發者ID:neevek,項目名稱:Paginize,代碼行數:18,代碼來源:ContainerViewManager.java

示例9: onApplyWindowInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
@Override
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
    insets = super.onApplyWindowInsets(insets);
    mInsets = new Rect(
            insets.getSystemWindowInsetLeft(),
            insets.getSystemWindowInsetTop(),
            insets.getSystemWindowInsetRight(),
            insets.getSystemWindowInsetBottom());
    setWillNotDraw(false);
    postInvalidateOnAnimation();
    if (mOnInsetsCallback != null) {
        mOnInsetsCallback.onInsetsChanged(mInsets);
    }
    return insets;
}
 
開發者ID:rashikaranpuria,項目名稱:xyz-reader-2,代碼行數:16,代碼來源:DrawInsetsFrameLayout.java

示例10: applyMarginInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
@SuppressLint("NewApi")
private void applyMarginInsets(MarginLayoutParams lp, Object insets, int drawerGravity, boolean topOnly) {
    WindowInsets wi = (WindowInsets) insets;
    if (drawerGravity == Gravity.LEFT) {
        wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
    } else if (drawerGravity == Gravity.RIGHT) {
        wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
    }
    lp.leftMargin = wi.getSystemWindowInsetLeft();
    lp.topMargin = topOnly ? 0 : wi.getSystemWindowInsetTop();
    lp.rightMargin = wi.getSystemWindowInsetRight();
    lp.bottomMargin = wi.getSystemWindowInsetBottom();
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:14,代碼來源:DrawerLayoutContainer.java

示例11: applyMarginInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
public static void applyMarginInsets(ViewGroup.MarginLayoutParams lp, Object insets,
    int gravity) {
  WindowInsets wi = (WindowInsets) insets;
  if (gravity == Gravity.LEFT) {
    wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(),
        wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
  } else if (gravity == Gravity.RIGHT) {
    wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(),
        wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
  }
  lp.leftMargin = wi.getSystemWindowInsetLeft();
  lp.topMargin = wi.getSystemWindowInsetTop();
  lp.rightMargin = wi.getSystemWindowInsetRight();
  lp.bottomMargin = wi.getSystemWindowInsetBottom();
}
 
開發者ID:rogues-dev,項目名稱:superglue,代碼行數:16,代碼來源:DrawerLayoutCompatApi21.java

示例12: applyMarginInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
@SuppressLint("NewApi")
private void applyMarginInsets(MarginLayoutParams lp, Object insets, int drawerGravity, boolean topOnly) {
    WindowInsets wi = (WindowInsets) insets;
        if (drawerGravity == Gravity.LEFT) {
            wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
        } else if (drawerGravity == Gravity.RIGHT) {
            wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
        }
        lp.leftMargin = wi.getSystemWindowInsetLeft();
        lp.topMargin = topOnly ? 0 : wi.getSystemWindowInsetTop();
        lp.rightMargin = wi.getSystemWindowInsetRight();
        lp.bottomMargin = wi.getSystemWindowInsetBottom();
    }
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:14,代碼來源:DrawerLayoutContainer.java

示例13: applyMarginInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
public static void applyMarginInsets(MarginLayoutParams lp, Object insets, int gravity) {
    WindowInsets wi = (WindowInsets) insets;
    if (gravity == 3) {
        wi = wi.replaceSystemWindowInsets(wi.getSystemWindowInsetLeft(), wi.getSystemWindowInsetTop(), 0, wi.getSystemWindowInsetBottom());
    } else if (gravity == 5) {
        wi = wi.replaceSystemWindowInsets(0, wi.getSystemWindowInsetTop(), wi.getSystemWindowInsetRight(), wi.getSystemWindowInsetBottom());
    }
    lp.leftMargin = wi.getSystemWindowInsetLeft();
    lp.topMargin = wi.getSystemWindowInsetTop();
    lp.rightMargin = wi.getSystemWindowInsetRight();
    lp.bottomMargin = wi.getSystemWindowInsetBottom();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:13,代碼來源:DrawerLayoutCompatApi21.java

示例14: onApplyWindowInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
    if (getFitsSystemWindows()) {
        mStatusBarInset = insets.getSystemWindowInsetTop();
        insets = insets.replaceSystemWindowInsets(
                insets.getSystemWindowInsetLeft(),
                0, /* top */
                insets.getSystemWindowInsetRight(),
                insets.getSystemWindowInsetBottom()
        );
    }
    return insets;
}
 
開發者ID:Trumeet,項目名稱:SetupWizardLibCompat,代碼行數:15,代碼來源:StickyHeaderScrollView.java

示例15: onApplyWindowInsets

import android.view.WindowInsets; //導入方法依賴的package包/類
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
    if (getFitsSystemWindows()) {
        mStatusBarInset = insets.getSystemWindowInsetTop();
        insets.replaceSystemWindowInsets(
                insets.getSystemWindowInsetLeft(),
                0, /* top */
                insets.getSystemWindowInsetRight(),
                insets.getSystemWindowInsetBottom()
        );
    }
    return insets;
}
 
開發者ID:Trumeet,項目名稱:SetupWizardLibCompat,代碼行數:15,代碼來源:StickyHeaderListView.java


注:本文中的android.view.WindowInsets.getSystemWindowInsetTop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。