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


Java SystemBarHelper类代码示例

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


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

示例1: onCreate

import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

        mNavigationView.setNavigationItemSelectedListener(this);

        int color = getResources().getColor(R.color.colorPrimary);
        //方法1:删除DrawerLayout所在布局中所有fitsSystemWindows属性,尤其是DrawerLayout的fitsSystemWindows属性
        SystemBarHelper.tintStatusBarForDrawer(this, mDrawerLayout, color);

        //方法2:可以版本判断在5.0以上不调用该方法, 使用系统自带
//        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
//            StatusBarCompat.tintStatusBarForDrawer(this, mDrawerLayout, color);
//        }

        SystemBarHelper.setPadding(this, mNavigationView.getHeaderView(0));

        HomeFragment homeFragment = HomeFragment.newInstance();
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.content, homeFragment)
                .commit();
    }
 
开发者ID:H07000223,项目名称:FlycoSystemBar,代码行数:25,代码来源:HomeActivity.java

示例2: onCreate

import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(R.string.title_couse);
    setSupportActionBar(toolbar);

    int color = getResources().getColor(R.color.colorPrimary);
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
        SystemBarHelper.tintStatusBar(this, color);
    SystemBarHelper.tintStatusBarForDrawer(this, drawerLayout, color);
    EventBus.getDefault().register(this);
    initData();
    initView();
    initUI();
}
 
开发者ID:hunao0221,项目名称:MyQlu,代码行数:19,代码来源:MainActivity.java

示例3: onCreate

import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_statusbar_darkmode);
    ButterKnife.bind(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        if (SystemBarHelper.isMIUI6Later() || SystemBarHelper.isFlyme4Later() || Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            SystemBarHelper.setStatusBarDarkMode(this);
            SystemBarHelper.tintStatusBar(this, Color.parseColor("#eaeaea"), 0);
        } else {
            SystemBarHelper.tintStatusBar(this, Color.parseColor("#bbbbbb"), 0);
        }
    }
}
 
开发者ID:H07000223,项目名称:FlycoSystemBar,代码行数:16,代码来源:StatusBarDarkModeActivity.java

示例4: onCreate

import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_statusbar_tint);
    ButterKnife.bind(this);

    setSupportActionBar(mToolbar);
    getSupportActionBar().setTitle("状态栏着色");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });

    SystemBarHelper.tintStatusBar(this, getResources().getColor(R.color.colorPrimary));

    ArrayList<String> mNames = new ArrayList<>();
    for (int i = 0; i < 20; i++) {
        mNames.add("状态栏着色");
    }
    mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    mRecyclerView.setAdapter(new SingleTypeAdapter<String>(mNames, R.layout.item_home_fragment) {
        @Override
        public void bindView(ViewHolder holder, int position, View itemView) {
            TextView mItem = ButterKnife.findById(itemView, R.id.item);
            mItem.setText(getDataList().get(holder.getAdapterPosition()) + "-" + holder.getAdapterPosition());
        }
    });
}
 
开发者ID:H07000223,项目名称:FlycoSystemBar,代码行数:32,代码来源:StatusBarTintActivity.java

示例5: onCreate

import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_statusbar_immersive_3);
        ButterKnife.bind(this);

        setSupportActionBar(mToolbar);
        getSupportActionBar().setTitle("");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });

        SystemBarHelper.immersiveStatusBar(this, 0);
        SystemBarHelper.setHeightAndPadding(this, mToolbar);

        mAppbar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
            @Override
            public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
//                boolean showTitle = mCollapsingToolbar.getHeight() + verticalOffset <= mToolbar.getHeight();
                boolean showTitle = mCollapsingToolbar.getHeight() + verticalOffset <= mToolbar.getHeight() * 2;
                mNickname.setVisibility(showTitle ? View.VISIBLE : View.GONE);
            }
        });

        SimpleViewPagerAdapter adapter = new SimpleViewPagerAdapter(getSupportFragmentManager());
        adapter.addFragment(SimpleFragment.newInstance("Android"), "Android");
        adapter.addFragment(SimpleFragment.newInstance("iOS"), "iOS");
        adapter.addFragment(SimpleFragment.newInstance("Html5"), "Html5");
        mViewpager.setAdapter(adapter);
        mTabs.setupWithViewPager(mViewpager);
    }
 
开发者ID:H07000223,项目名称:FlycoSystemBar,代码行数:36,代码来源:StatusBarImmersive3Activity.java

示例6: onCreate

import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_statusbar_immersive_2);
        ButterKnife.bind(this);

        setSupportActionBar(mToolbar);
        getSupportActionBar().setTitle("H07000223");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });

        //method 1
        SystemBarHelper.immersiveStatusBar(this);
        SystemBarHelper.setHeightAndPadding(this, mToolbar);

        //method 2,分别处理4.4调用SystemBarHelper方法,5.0以上使用系统方法
//        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
//            SystemBarHelper.immersiveStatusBar(this);
//            SystemBarHelper.setHeightAndPadding(this, mToolbar);
//        }

        ArrayList<String> mNames = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            mNames.add("状态栏沉浸");
        }
        mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        mRecyclerView.setAdapter(new SingleTypeAdapter<String>(mNames, R.layout.item_home_fragment) {
            @Override
            public void bindView(ViewHolder holder, int position, View itemView) {
                TextView mItem = ButterKnife.findById(itemView, R.id.item);
                mItem.setText(getDataList().get(holder.getAdapterPosition()) + "-" + holder.getAdapterPosition());
            }
        });
    }
 
开发者ID:H07000223,项目名称:FlycoSystemBar,代码行数:40,代码来源:StatusBarImmersive2Activity.java

示例7: onCreate

import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_school_card);
    ButterKnife.bind(this);
    toolbar.setTitle("一卡通");
    setSupportActionBar(toolbar);
    SystemBarHelper.tintStatusBar(this, getResources().getColor(R.color.colorPrimary));
    initVIew();
    initData();
    showLoginDialog();
    initListener();
}
 
开发者ID:hunao0221,项目名称:MyQlu,代码行数:14,代码来源:SchoolCardActivity.java

示例8: initStatusBar

import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
private void initStatusBar() {
    //设置StatusBar透明
    SystemBarHelper.immersiveStatusBar(this);
    SystemBarHelper.setHeightAndPadding(this, mToolbar);
}
 
开发者ID:GitLqr,项目名称:LQRBiliBlili,代码行数:6,代码来源:VideoDetailActivity.java

示例9: initStatusBar

import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
private void initStatusBar() {
    SystemBarHelper.tintStatusBarForDrawer(this, mDrawer, ArmsUtils.getColor(this, R.color.colorPrimary));
    SystemBarHelper.setPadding(this, mNav.getHeaderView(0));
    SystemBarHelper.setPadding(this, mLlRoot);
}
 
开发者ID:GitLqr,项目名称:LQRBiliBlili,代码行数:6,代码来源:MainActivity.java

示例10: onCreate

import com.flyco.systembar.SystemBarHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_statusbar_immersive_1);
    SystemBarHelper.immersiveStatusBar(this);
}
 
开发者ID:H07000223,项目名称:FlycoSystemBar,代码行数:7,代码来源:StatusBarImmersive1Activity.java


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