当前位置: 首页>>代码示例>>Java>>正文


Java WindowInsets类代码示例

本文整理汇总了Java中android.view.WindowInsets的典型用法代码示例。如果您正苦于以下问题:Java WindowInsets类的具体用法?Java WindowInsets怎么用?Java WindowInsets使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WindowInsets类属于android.view包,在下文中一共展示了WindowInsets类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onApplyWindowInsets

import android.view.WindowInsets; //导入依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
    super.onApplyWindowInsets(insets);

    // Load resources that have alternate values for round watches.
    Resources resources = MyWatchFace.this.getResources();
    boolean isRound = insets.isRound();
    mXOffset = resources.getDimension(isRound
            ? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);
    float textSize = resources.getDimension(isRound
            ? R.dimen.digital_text_size_round : R.dimen.digital_text_size);

    float textSizeSmall = resources.getDimension(R.dimen.digital_text_size_small);
    float textSizeVerySmall = resources.getDimension(R.dimen.digital_text_very_size_small);
    mTextPaint.setTextSize(textSize);
    dateTextPaint.setTextSize(textSizeSmall);
    lineTextPaint.setTextSize(textSizeVerySmall);
    mLowTempPaint.setTextSize(mLowTextSize);
    mHighTempPaint.setTextSize(mHighTextSize);
}
 
开发者ID:rashikaranpuria,项目名称:ubiquitous,代码行数:21,代码来源:MyWatchFace.java

示例2: DrawerLayoutContainer

import android.view.WindowInsets; //导入依赖的package包/类
public DrawerLayoutContainer(Context context) {
    super(context);

    minDrawerMargin = (int) (MIN_DRAWER_MARGIN * AndroidUtilities.density + 0.5f);
    setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
    setFocusableInTouchMode(true);

    if (Build.VERSION.SDK_INT >= 21) {
        setFitsSystemWindows(true);
        setOnApplyWindowInsetsListener(new OnApplyWindowInsetsListener() {
            @SuppressLint("NewApi")
            @Override
            public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
                final DrawerLayoutContainer drawerLayout = (DrawerLayoutContainer) v;
                lastInsets = insets;
                drawerLayout.setWillNotDraw(insets.getSystemWindowInsetTop() <= 0 && getBackground() == null);
                drawerLayout.requestLayout();
                return insets.consumeSystemWindowInsets();
            }
        });
        setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    }

    shadowLeft = getResources().getDrawable(R.drawable.menu_shadow);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:26,代码来源:DrawerLayoutContainer.java

示例3: onApplyWindowInsets

import android.view.WindowInsets; //导入依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
    super.onApplyWindowInsets(insets);

    // Load resources that have alternate values for round watches.
    Resources resources = MyWatchFace.this.getResources();
    boolean isRound = insets.isRound();
    mXOffset = resources.getDimension(isRound
            ? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
    float textSize = resources.getDimension(isRound
            ? R.dimen.digital_text_size_round : R.dimen.digital_text_size);


    hourPaint.setTextSize(textSize);
    minutePaint.setTextSize(textSize);
    colonPaint.setTextSize(textSize);
    highPaint.setTextSize(textSize);
    lowPaint.setTextSize(textSize);
    colonWidth = colonPaint.measureText(":");
}
 
开发者ID:changja88,项目名称:Android_Sunshine_Watch,代码行数:21,代码来源:MyWatchFace.java

示例4: 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

示例5: 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

示例6: onApplyWindowInsets

import android.view.WindowInsets; //导入依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
    super.onApplyWindowInsets(insets);

    // Load resources that have alternate values for round watches.
    Resources resources = MyDigitalWatchFace.this.getResources();
    boolean isRound = insets.isRound();
    mXOffset = resources.getDimension(isRound
            ? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);

    textPaintTime.setTextSize(resources.getDimension(R.dimen.time_text_size));
    textPaintTimeBold.setTextSize(resources.getDimension(R.dimen.time_text_size));
    textPaintDate.setTextSize(resources.getDimension(R.dimen.date_text_size));
    textPaintTemp.setTextSize(resources.getDimension(R.dimen.temp_text_size));
    textPaintTempBold.setTextSize(resources.getDimension(R.dimen.temp_text_size));
}
 
开发者ID:Hitesh880443,项目名称:SunshineWithWear,代码行数:17,代码来源:MyDigitalWatchFace.java

示例7: onApplyWindowInsets

import android.view.WindowInsets; //导入依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
    super.onApplyWindowInsets(insets);

    Resources res = WatchFaceService.this.getResources();
    boolean isRound = insets.isRound();

    float highTempTextSize = res.getDimension(isRound ? R.dimen.round_size_text_high_temp : R.dimen.square_size_text_high_temp);
    float lowTempTextSize = res.getDimension(isRound ? R.dimen.round_size_text_low_temp : R.dimen.square_size_text_low_temp);
    float textSize = res.getDimension(isRound ? R.dimen.clock_text_size_round : R.dimen.clock_text_size);
    float dateTextSize = res.getDimension(isRound ? R.dimen.round_size_text_date : R.dimen.square_size_text_date);

    highTempPaint.setTextSize(highTempTextSize);
    lowTempPaint.setTextSize(lowTempTextSize);
    timePaint.setTextSize(textSize);
    datePaint.setTextSize(dateTextSize);
}
 
开发者ID:hieple7985,项目名称:nano-go-ubiquitous,代码行数:18,代码来源:WatchFaceService.java

示例8: onApplyWindowInsets

import android.view.WindowInsets; //导入依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
    super.onApplyWindowInsets(insets);

    // Load resources that have alternate values for round watches.
    Resources resources = SunshineWatchFace.this.getResources();
    boolean isRound = insets.isRound();
    mXOffset = resources.getDimension(isRound
            ? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);
    float textSize = resources.getDimension(isRound
            ? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
    float textDateSize = resources.getDimension(isRound
            ? R.dimen.digital_date_text_size_round : R.dimen.digital_date_text_size);


    mTextPaint.setTextSize(textSize);
    mAlphaTextPaint.setTextSize(textDateSize);
    mAlphaTempPaint.setTextSize(textDateSize);


}
 
开发者ID:oscarbujinkan,项目名称:Go-Ubiquitous,代码行数:22,代码来源:SunshineWatchFace.java

示例9: onApplyWindowInsets

import android.view.WindowInsets; //导入依赖的package包/类
@Override public WindowInsets onApplyWindowInsets(final WindowInsets insets) {
    heading.setTextColor(-1);
    if(insets.isRound()) {
        heading.setGravity(Gravity.CENTER_HORIZONTAL);

        // Adjust paddings for round devices
        if(!hasAdjustedPadding) {
            final int padding = heading.getPaddingTop();
            heading.setPadding(padding, 2 * padding, padding, padding);
            list.setPadding(padding, 0, padding, 0);
            hasAdjustedPadding = true;
        }
    } else {
        heading.setGravity(Gravity.START);
    }
    return super.onApplyWindowInsets(insets);
}
 
开发者ID:LadyViktoria,项目名称:wearDrip,代码行数:18,代码来源:HeadingListView.java

示例10: onApplyWindowInsets

import android.view.WindowInsets; //导入依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
    super.onApplyWindowInsets(insets);
    // Load resources that have alternate values for round watches.
    Resources resources = SunshineWatchFace.this.getResources();
    boolean isRound = insets.isRound();
    mTimeXOffset = resources.getDimension(isRound
            ? R.dimen.digital_time_x_offset_round : R.dimen.digital_time_x_offset);
    float timeTextSize = resources.getDimension(isRound
            ? R.dimen.digital_time_text_size_round : R.dimen.digital_time_text_size);
    mTimePaint.setTextSize(timeTextSize);
    float dateTextSize = resources.getDimension(isRound
            ? R.dimen.date_text_size_round : R.dimen.date_text_size);
    mDatePaint.setTextSize(dateTextSize);
    float temperatureTextSize = resources.getDimension(isRound
            ? R.dimen.temperature_text_size_round : R.dimen.temperature_text_size);
    mTemperaturePaint.setTextSize(temperatureTextSize);
}
 
开发者ID:DmitryMalkovich,项目名称:go-ubiquitous,代码行数:19,代码来源:SunshineWatchFace.java

示例11: onApplyWindowInsets

import android.view.WindowInsets; //导入依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
    super.onApplyWindowInsets(insets);

    // Load resources that have alternate values for round watches.
    Resources resources = SunshineWatchFace.this.getResources();
    float textSize = resources.getDimension(R.dimen.digital_text_size);
    float smallTextSize = resources.getDimension(R.dimen.digital_small_text_size);
    float mediumTextSize = resources.getDimension(R.dimen.digital_medium_text_size);

    mTimePaint.setTextSize(textSize);
    mDatePaint.setTextSize(smallTextSize);
    mAmPmPaint.setTextSize(textSize);
    mMinTempPaint.setTextSize(mediumTextSize);
    mMaxTempPaint.setTextSize(mediumTextSize);

    mMinTempPaint.setARGB(240,240,240,240);
    mDatePaint.setARGB(240,240,240,240);
}
 
开发者ID:jenniferlimtan,项目名称:UdacityProject6,代码行数:20,代码来源:SunshineWatchFace.java

示例12: onApplyWindowInsets

import android.view.WindowInsets; //导入依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
    super.onApplyWindowInsets(insets);

    // Load resources that have alternate values for round watches.
    Resources resources = WatchFace.this.getResources();
    boolean isRound = insets.isRound();

    mXOffset = resources.getDimension(isRound
            ? R.dimen.digital_x_offset_round : R.dimen.digital_x_offset);

    mYOffset = resources.getDimension(isRound
            ? R.dimen.digital_y_offset_round : R.dimen.digital_y_offset);

    float textSize = resources.getDimension(isRound
            ? R.dimen.digital_text_size_round : R.dimen.digital_text_size);

    mTextPaint.setTextSize(textSize);
}
 
开发者ID:jainkamini,项目名称:Sunshinewear,代码行数:20,代码来源:WatchFace.java

示例13: 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

示例14: onApplyWindowInsets

import android.view.WindowInsets; //导入依赖的package包/类
@Override
public void onApplyWindowInsets(WindowInsets insets) {
    super.onApplyWindowInsets(insets);

    // Load resources that have alternate values for round watches.
    Resources res = MyWatchFace.this.getResources();
    boolean isRound = insets.isRound();

    // 時間部分のサイズ
    float textSize = res.getDimension(isRound
            ? R.dimen.digital_text_size_round : R.dimen.digital_text_size);
    // 日付部分のサイズ
    float dateSize = res.getDimension(isRound ? R.dimen.date_text_size_round : R.dimen.date_text_size_sq);
    // バッテリーレベルのサイズ
    float battSize = res.getDimension(isRound ? R.dimen.batt_text_size_ro : R.dimen.batt_text_size_sq);

    mHourPaint.setTextSize(textSize);
    mMinutesPaint.setTextSize(textSize);
    mSeparatorPaint.setTextSize(textSize);

    mDatePaint.setTextSize(dateSize);

    mBattTextPaint.setTextSize(battSize);
}
 
开发者ID:f97one,项目名称:MirageWatch,代码行数:25,代码来源:MyWatchFace.java

示例15: setupDecor

import android.view.WindowInsets; //导入依赖的package包/类
private void setupDecor() {
    final View decor = mWindow.getDecorView();
    final View parent = mWindow.findViewById(R.id.parentPanel);
    if (parent != null && decor != null) {
        decor.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
            @Override
            public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
                if (insets.isRound()) {
                    // TODO: Get the padding as a function of the window size.
                    int roundOffset = mContext.getResources().getDimensionPixelOffset(
                            R.dimen.alert_dialog_round_padding);
                    parent.setPadding(roundOffset, roundOffset, roundOffset, roundOffset);
                }
                return insets.consumeSystemWindowInsets();
            }
        });
        decor.setFitsSystemWindows(true);
        decor.requestApplyInsets();
    }
}
 
开发者ID:mobvoi,项目名称:ticdesign,代码行数:21,代码来源:AlertController.java


注:本文中的android.view.WindowInsets类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。