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


Java StatusBarUtils类代码示例

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


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

示例1: scrollChangeHeader

import com.example.jingbin.cloudreader.view.test.StatusBarUtils; //导入依赖的package包/类
/**
 * 根据页面滑动距离改变Header方法
 */
private void scrollChangeHeader(int scrolledY) {
    if (scrolledY < 0) {
        scrolledY = 0;
    }
    if (scrolledY < slidingDistance) {
        // 状态栏渐变
        StatusBarUtils.setTranslucentImageHeader(this, scrolledY * 50 / slidingDistance, rlHead);
        // title渐变
        rlHead.setBackgroundColor(Color.argb(scrolledY * 50 / slidingDistance, 0x00, 0x00, 0x00));
        // 背景图高度设置
        llHeader.setPadding(0, -scrolledY, 0, 0);
        currScrollY = scrolledY;
    } else {
        StatusBarUtils.setTranslucentImageHeader(this, 50, rlHead);
        rlHead.setBackgroundColor(Color.argb(50, 0x00, 0x00, 0x00));
        llHeader.setPadding(0, -slidingDistance, 0, 0);
        currScrollY = slidingDistance;
    }
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:23,代码来源:SlideScrollViewActivity.java

示例2: initSlideShapeTheme

import com.example.jingbin.cloudreader.view.test.StatusBarUtils; //导入依赖的package包/类
/**
 * *** 初始化滑动渐变 一定要实现 ******
 *
 * @param imgUrl    header头部的高斯背景imageUrl
 * @param mHeaderBg header头部高斯背景ImageView控件
 */
protected void initSlideShapeTheme(String imgUrl, ImageView mHeaderBg) {
    setImgHeaderBg(imgUrl);

    // toolbar 的高
    int toolbarHeight = bindingTitleView.tbBaseTitle.getLayoutParams().height;
    final int headerBgHeight = toolbarHeight + StatusBarUtil.getStatusBarHeight(this);

    // 使背景图向上移动到图片的最低端,保留(titlebar+statusbar)的高度
    ViewGroup.LayoutParams params = bindingTitleView.ivBaseTitlebarBg.getLayoutParams();
    ViewGroup.MarginLayoutParams ivTitleHeadBgParams = (ViewGroup.MarginLayoutParams) bindingTitleView.ivBaseTitlebarBg.getLayoutParams();
    int marginTop = params.height - headerBgHeight;
    ivTitleHeadBgParams.setMargins(0, -marginTop, 0, 0);

    bindingTitleView.ivBaseTitlebarBg.setImageAlpha(0);
    StatusBarUtils.setTranslucentImageHeader(this, 0, bindingTitleView.tbBaseTitle);

    // 上移背景图片,使空白状态栏消失(这样下方就空了状态栏的高度)
    if (mHeaderBg != null) {
        ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) mHeaderBg.getLayoutParams();
        layoutParams.setMargins(0, -StatusBarUtil.getStatusBarHeight(this), 0, 0);

        ViewGroup.LayoutParams imgItemBgparams = mHeaderBg.getLayoutParams();
        // 获得高斯图背景的高度
        imageBgHeight = imgItemBgparams.height;
    }

    // 变色
    initScrollViewListener();
    initNewSlidingParams();
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:37,代码来源:BaseHeaderActivity.java

示例3: onCreate

import com.example.jingbin.cloudreader.view.test.StatusBarUtils; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_slide_scrool_view);

        rlHead = binding.rlHead;
        rcvGoodsList = binding.rcvGoodsList;
        rcvGoodsList = binding.rcvGoodsList;
        discoverScrollView = binding.discoverScrollView;
        llHeader = binding.llHeader;

        if (getIntent() != null) {
            subjectsBean = (SubjectsBean) getIntent().getSerializableExtra("bean");
        }
        // 先设置状态栏透明
        StatusBarUtils.setTranslucentImageHeader(this, 0, rlHead);
        initNewSlidingParams();

        if (binding.include.imgItemBg != null) {
            ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) binding.include.imgItemBg.getLayoutParams();
            layoutParams.setMargins(0, -getStatusBarHeight(this), 0, 0);
//            DebugUtil.error("getStatusBarHeight:" + getStatusBarHeight(this));
        }

        initRecyclerView();
//        initScrollView();

        setTitleBar();
        setHeaderData(subjectsBean);
    }
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:31,代码来源:SlideScrollViewActivity.java

示例4: initSlideShapeTheme

import com.example.jingbin.cloudreader.view.test.StatusBarUtils; //导入依赖的package包/类
/**
 * 初始化滑动渐变
 */
private void initSlideShapeTheme() {
    setImgHeaderBg();

    // toolbar 的高
    int toolbarHeight = binding.titleToolBar.getLayoutParams().height;
    Log.i(TAG, "toolbar height:" + toolbarHeight);
    final int headerBgHeight = toolbarHeight + getStatusBarHeight(this);
    Log.i(TAG, "headerBgHeight:" + headerBgHeight);

    // 使背景图向上移动到图片的最低端,保留(titlebar+statusbar)的高度
    ViewGroup.LayoutParams params = binding.ivTitleHeadBg.getLayoutParams();
    ViewGroup.MarginLayoutParams ivTitleHeadBgParams = (ViewGroup.MarginLayoutParams) binding.ivTitleHeadBg.getLayoutParams();
    int marginTop = params.height - headerBgHeight;
    ivTitleHeadBgParams.setMargins(0, -marginTop, 0, 0);

    binding.ivTitleHeadBg.setImageAlpha(0);
    StatusBarUtils.setTranslucentImageHeader(this, 0, binding.titleToolBar);

    // 上移背景图片,使空白状态栏消失(这样下方就空了状态栏的高度)
    if (binding.include.imgItemBg != null) {
        ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) binding.include.imgItemBg.getLayoutParams();
        layoutParams.setMargins(0, -StatusBarUtil.getStatusBarHeight(this), 0, 0);
    }

    ViewGroup.LayoutParams imgItemBgparams = binding.include.imgItemBg.getLayoutParams();
    // 获得高斯图背景的高度
    imageBgHeight = imgItemBgparams.height;

    // 变色
    initScrollViewListener();

    initNewSlidingParams();
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:37,代码来源:MovieDetailActivity.java

示例5: onCreate

import com.example.jingbin.cloudreader.view.test.StatusBarUtils; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_slide);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_slide);

        if (getIntent() != null) {
            subjectsBean = (SubjectsBean) getIntent().getSerializableExtra("bean");
        }


        binding.tvTitle.setText("标题");

        // 先设置状态栏透明
        StatusBarUtils.setTranslucentImageHeader(this, 0, binding.titleToolBar);
        // 高斯模糊
//        ImgLoadUtil.displayGaussian(this, subjectsBean.getImages().getLarge(), binding.imgItemBg);


        if (binding.imgItemBg != null) {
            ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) binding.imgItemBg.getLayoutParams();
            layoutParams.setMargins(0, -getStatusBarHeight(this), 0, 0);
            DebugUtil.error("getStatusBarHeight:"+getStatusBarHeight(this));
        }
        initNewSlidingParams();

        binding.scrollView.setCallBack_scrollChanged(new CallBack_ScrollChanged() {
            @Override
            public void onScrollChanged(int scrolledY) {
                if (scrolledY < 0) {
                    scrolledY = 0;
                }
                if (scrolledY < slidingDistance) {
                    // 状态栏渐变
                    StatusBarUtils.setTranslucentImageHeader(SlideActivity.this, scrolledY * 110 / slidingDistance, binding.titleToolBar);
                    // title渐变
                    binding.titleToolBar.setBackgroundColor(Color.argb(scrolledY * 110 / slidingDistance, 0x00, 0x00, 0x00));
                    // 背景图高度设置
                    binding.imgItemBg.setPadding(0, -scrolledY, 0, 0);
                    currScrollY = scrolledY;
                } else {
                    StatusBarUtils.setTranslucentImageHeader(SlideActivity.this, 110, binding.titleToolBar);
                    binding.titleToolBar.setBackgroundColor(Color.argb(110, 0x00, 0x00, 0x00));
                    binding.imgItemBg.setPadding(0, -slidingDistance, 0, 0);
                    currScrollY = slidingDistance;
                }
            }
        });
    }
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:50,代码来源:SlideActivity.java

示例6: onCreate

import com.example.jingbin.cloudreader.view.test.StatusBarUtils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_slide_shade_view);
    if (getIntent() != null) {
        subjectsBean = (SubjectsBean) getIntent().getSerializableExtra("bean");
    }
    setData();

    // toolbar 的高
    int toolbarHeight = binding.titleToolBar.getLayoutParams().height;
    Log.i(TAG, "toolbar height:" + toolbarHeight);
    final int headerBgHeight = toolbarHeight + getStatusBarHeight(this);
    Log.i(TAG, "headerBgHeight:" + headerBgHeight);

    // 使背景图向上移动到图片的最低端,保留(titlebar+statusbar)的高度
    ViewGroup.LayoutParams params = binding.ivTitleHeadBg.getLayoutParams();
    ViewGroup.MarginLayoutParams ivTitleHeadBgParams = (ViewGroup.MarginLayoutParams) binding.ivTitleHeadBg.getLayoutParams();
    int marginTop = params.height - headerBgHeight;
    ivTitleHeadBgParams.setMargins(0, -marginTop, 0, 0);

    binding.ivTitleHeadBg.setImageAlpha(0);
    StatusBarUtils.setTranslucentImageHeader(this, 0, binding.titleToolBar);

    // 上移背景图片,使空白状态栏消失
    if (binding.include.imgItemBg != null) {
        ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) binding.include.imgItemBg.getLayoutParams();
        layoutParams.setMargins(0, -StatusBarUtil.getStatusBarHeight(this), 0, 0);
    }

    ViewGroup.LayoutParams imgItemBgparams = binding.include.imgItemBg.getLayoutParams();
    // 获得高斯图背景的高度
    imageBgHeight = imgItemBgparams.height;

    // 数据配置
    setTitleBar();
    setHeaderData(subjectsBean);

    // 变色
    initScrollViewListener();

    initNewSlidingParams();
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:44,代码来源:SlideShadeViewActivity.java


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