com.jaeger.library.StatusBarUtil Java Examples

The following examples show how to use com.jaeger.library.StatusBarUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WelcomePage.java    From MusicPlayer_XiangDa with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_welcomepage);
    //状态栏透明化
    StatusBarUtil.setTransparent(WelcomePage.this);

    //获取开始时间
    Date date = new Date();
    final long startTime = date.getTime();

    //配置页面渐变动画
    initAnimation();

    //设置动态字段
    initScaleTextView();

    //获取结束时间
    final long endTime = date.getTime();

    //进行时间计算,证页面的展示时间一定
    calculateShowTime(startTime, endTime);


}
 
Example #2
Source File: SpashActivity.java    From OpenEyes with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //设置全屏
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_spash);
    StatusBarUtil.setTranslucent(this,0);
    requestPermission(new OnPermissionResponseListener() {
        @Override
        public void onSuccess(String[] permissions) {
                showMain();
        }

        @Override
        public void onFail() {
                showTipsDialog();
        }
    },Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
 
Example #3
Source File: MainActivity.java    From CardStackView with Apache License 2.0 6 votes vote down vote up
private void update(float fraction) {
    mCardView.setRadius(getInterpolation(startRadius, endRadius, fraction));
    int right = getInterpolation(startRight, endRight, fraction);
    int left = getInterpolation(startLeft, endLeft, fraction);
    int top = getInterpolation(startTop, endTop, fraction);
    int bottom = getInterpolation(startBottom, endBottom, fraction);
    mCardView.getLayoutParams().width = right - left;
    mCardView.layout(left, top, right, bottom);

    /**
     * 设置了一个阈值 threshold, 进度超过阈值之后才开始进行插值。
     * 也就是等到其他卡片都收起来之后,再对当前卡片做阴影动画,避免在 5.x 绘制层级问题。
     *
     * 最终阴影变为0,避免了在 4.x 上 CardView 自带边距绘制阴影,导致无法无缝切换的问题。
     */
    float elevation =
        getElevation(startElevation, endElevation, fraction, ANIMATION_DURATION_ALPHA * 1f / ANIMATION_DURATION_CARD);
    mCardView.setMaxCardElevation(elevation);
    mCardView.setCardElevation(elevation);

    mCardView.requestLayout();
    StatusBarUtil.setColor(MainActivity.this, getColor(fraction));
}
 
Example #4
Source File: BaseTitleActivity.java    From qvod with MIT License 6 votes vote down vote up
@Override
public void setContentView(int layoutResID) {
    super.setContentView(R.layout.activity_top);
    //
    llTitleMenu = $(R.id.ll_title_menu);
    llTitleMenu.setOnClickListener(this);
    toolbar = $(R.id.toolbar);
    svContent = $(R.id.sv_content);
    getLayoutInflater().inflate(layoutResID, svContent);
    //ActionBar
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        //去除默认Title显示
        actionBar.setDisplayShowTitleEnabled(false);
    }
    //
    StatusBarUtil.setColor(this,ContextCompat.getColor(this, R.color.colorTheme));
}
 
Example #5
Source File: MovieDetailsActivity.java    From qvod with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_details_movie);
    ButterKnife.bind(this);
    //
    StatusBarUtil.setTranslucentForImageView(this, 0, toolBar);
    //
    onSetToolbar(toolBar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        //是否显示默认Title
        actionBar.setDisplayShowTitleEnabled(true);
        //是否显示返回键
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    //
    initLoading();
}
 
Example #6
Source File: DetailActivity.java    From CardStackView with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_detail);

    mImageView = (ImageView) findViewById(R.id.detail_bg);
    mTextView = (TextView) findViewById(R.id.detail_title);
    mContent = findViewById(R.id.detail_content);

    Card card = getIntent().getParcelableExtra("card");
    mImageView.setImageResource(card.mImage);
    StatusBarUtil.setColor(this, card.mBgColor);
    mTextView.setText("哈哈哈 改变一下标题 ~" + card.mTitle);

    animContent();
}
 
Example #7
Source File: BaseActivity.java    From LQRWeChat with MIT License 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    MyApp.activities.add(this);
    init();

    //判断是否使用MVP模式
    mPresenter = createPresenter();
    if (mPresenter != null) {
        mPresenter.attachView((V) this);//因为之后所有的子类都要实现对应的View接口
    }

    //子类不再需要设置布局ID,也不再需要使用ButterKnife.bind()
    setContentView(provideContentViewId());
    ButterKnife.bind(this);

    setupAppBarAndToolbar();

    //沉浸式状态栏
    StatusBarUtil.setColor(this, UIUtils.getColor(R.color.colorPrimaryDark), 10);

    initView();
    initData();
    initListener();
}
 
Example #8
Source File: MainActivity.java    From meiShi with Apache License 2.0 6 votes vote down vote up
private void initView() {
    mToolbar = (Toolbar) findViewById(R.id.tool_bar);
    mToolbar.setTitle(R.string.app_name);
    setSupportActionBar(mToolbar);
    mTabLayout = (TabLayout) this.findViewById(R.id.tab_layout);
    mViewPager = (ViewPager) this.findViewById(R.id.view_pager);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    StatusBarUtil.setColorForDrawerLayout(MainActivity.this, mDrawerLayout, getResources().getColor(R
            .color.colorPrimaryDark));
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, mDrawerLayout, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    mDrawerLayout.addDrawerListener(toggle);
    toggle.syncState();
    mNavigationView = (NavigationView) findViewById(R.id.nav_view);
    mNavigationView.setNavigationItemSelectedListener(this);
    mMainNavigationHeader = new MainNavigationHeader(this, mNavigationView);
    mMainNavigationHeader.bindData();
    mAdapter = new FragmentAdapter(getSupportFragmentManager());
}
 
Example #9
Source File: BaseFragmentActivity.java    From LQRWeChat with MIT License 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    MyApp.activities.add(this);
    init();

    //判断是否使用MVP模式
    mPresenter = createPresenter();
    if (mPresenter != null) {
        mPresenter.attachView((V) this);//因为之后所有的子类都要实现对应的View接口
    }

    //子类不再需要设置布局ID,也不再需要使用ButterKnife.bind()
    setContentView(provideContentViewId());
    ButterKnife.bind(this);

    setupAppBarAndToolbar();

    //沉浸式状态栏
    StatusBarUtil.setColor(this, UIUtils.getColor(R.color.colorPrimaryDark), 10);

    initView();
    initData();
    initListener();
}
 
Example #10
Source File: LoginActivity.java    From MusicPlayer_XiangDa with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);


    //ActionBar隐藏,透明化任务栏
    StatusBarUtil.setTransparent(this);

    //设置状态栏字体颜色为黑色
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {//android6.0以后可以对状态栏文字颜色和图标进行修改
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    }

    //初始化用户名输入框
    initUserNameEditText();

    //初始化密码输入框
    initPasswordEditText();

    //初始化图片点击(清除用户名,密码,显示隐藏密码)
    initImageButton();

    //初始化登录按钮
    initLoginButton();

}
 
Example #11
Source File: MainActivity.java    From AcgClub with MIT License 5 votes vote down vote up
@Override
protected void setStatusBar() {
  StatusBarUtil.setColorForDrawerLayout(
      mContext,
      drawerLayout,
      mAppComponent.statusBarAttr().get(StatusBarConstants.COLOR),
      mAppComponent.statusBarAttr().get(StatusBarConstants.ALPHA)
  );
}
 
Example #12
Source File: Activity2.java    From Android-StatusBarColor with Artistic License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity2);

    //设置透明度,1- 255
       StatusBarUtil.setTranslucent( Activity2.this , 127 ) ;
}
 
Example #13
Source File: BasePlayVideo.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        //这里没必要,因为我们使用的是setColorForSwipeBack,并不会有这个虚拟的view,而是设置的padding
        StatusBarUtil.hideFakeStatusBarView(this);
    } else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    }
}
 
Example #14
Source File: BaseActivityUpEnable.java    From MobileGuard with MIT License 5 votes vote down vote up
/**
 * set title and setDisplayHomeAsUpEnabled
 * if you override this method, remember call super.onStart().
 */
@Override
protected void onStart() {
    super.onStart();
    ActionBar actionBar = getSupportActionBar();
    if(null != actionBar) {
        actionBar.setTitle(actionBarTitleId);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    StatusBarUtil.setColorNoTranslucent(this, getResources().getColor(R.color.colorPrimary));
}
 
Example #15
Source File: Activity4.java    From Android-StatusBarColor with Artistic License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity4);

    mDrawerLayout = (DrawerLayout) findViewById( R.id.drawer_layout );
    mDrawerLayout.setDrawerShadow(R.mipmap.ic_launcher , GravityCompat.START);

    StatusBarUtil.setColorForDrawerLayout( Activity4.this  , mDrawerLayout , Color.BLUE) ;
}
 
Example #16
Source File: AxglePlayActivity.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        //这里没必要,因为我们使用的是setColorForSwipeBack,并不会有这个虚拟的view,而是设置的padding
        StatusBarUtil.hideFakeStatusBarView(this);
    } else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    }
}
 
Example #17
Source File: BaseActivity.java    From XposedWechatHelper with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 初始化状态栏颜色
 * 更多详情https://github.com/laobie/StatusBarUtil
 */
protected void initStatusBar() {
    if (isStatusBarTransparent()) {
        StatusBarUtil.setTransparent(BaseActivity.this);
        return;
    }
    StatusBarUtil.setColor(this,
            (ContextCompat.getColor(this, getStatusBarColor())), 0);
}
 
Example #18
Source File: TencentMapLiteActivity.java    From XposedWechatHelper with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tencent_map_lite);
    ButterKnife.bind(this);
    StatusBarUtil.setTranslucentForImageView(this, findViewById(R.id.view_need_offset));

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

    initMap();
}
 
Example #19
Source File: BaseActivity.java    From XposedRimetHelper with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 初始化状态栏颜色
 * 更多详情https://github.com/laobie/StatusBarUtil
 */
protected void initStatusBar() {
    if (isStatusBarTransparent()) {
        StatusBarUtil.setTransparent(BaseActivity.this);
        return;
    }
    StatusBarUtil.setColor(this,
            (ContextCompat.getColor(this, getStatusBarColor())), 0);
}
 
Example #20
Source File: MainActivity.java    From OpenEyes with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    StatusBarUtil.setTranslucent(this);
    //获取控件
    ButterKnife.bind(this);
    //获取Fragment的管理器
    fragmentManager = getSupportFragmentManager();
    initView();
    setListener();
}
 
Example #21
Source File: AMapLiteActivity.java    From XposedRimetHelper with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_amap_lite);

    StatusBarUtil.setTranslucentForImageView(this, findViewById(R.id.view_need_offset));

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

    initMap(savedInstanceState);
}
 
Example #22
Source File: Activity3.java    From Android-StatusBarColor with Artistic License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity3);

    //设置全屏
    StatusBarUtil.setTransparent(  Activity3.this ) ;
}
 
Example #23
Source File: Activity1.java    From Android-StatusBarColor with Artistic License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity1);

    //设置颜色
     StatusBarUtil.setColor(Activity1.this, Color.BLUE );
}
 
Example #24
Source File: BasePlayVideo.java    From v9porn with MIT License 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE || newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
        //这里没必要,因为我们使用的是setColorForSwipeBack,并不会有这个虚拟的view,而是设置的padding
        StatusBarUtil.hideFakeStatusBarView(this);
    } else if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
        setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimary));
    }
}
 
Example #25
Source File: FileChooserActivity.java    From Mp3Cutter with GNU General Public License v3.0 5 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            android.transition.Transition transition = TransitionInflater.from(this).inflateTransition(R.transition.explode);
            getWindow().setEnterTransition(transition);
        }
        StatusBarUtil.setColor(this, Color.TRANSPARENT);
        mDataBinding.btnUpdate.setOnClickListener(this);
        mDataBinding.btnUpdate.measure(0, 0);
        mUpdateBtnLeft = ScreenUtils.getScreenSize(this)[0] -
                mDataBinding.btnUpdate.getMeasuredWidth() - DensityUtils.dp2px(this ,10);
        initToolbar();
        mDataBinding.rlMusice.setLayoutManager(new LinearLayoutManager(this));
        mAdapter = new CommonAdapter<MusicInfo>(this, R.layout.item_musicfile, mMusicList) {
            @Override
            protected void convert(ViewHolder holder, final MusicInfo musicInfo, int position) {
                holder.setText(R.id.tv_name, musicInfo.getTitle());
                holder.setText(R.id.tv_size, FileUtils.formetFileSize(musicInfo.getFileSize()));
                if(TextUtils.isEmpty(musicInfo.getCoverPath())){
                    holder.setImageDrawable(R.id.iv_icon, getResources().getDrawable(R.mipmap.music_icon));
                }
                else {
                    RequestOptions options = new RequestOptions().placeholder(R.mipmap.music_icon);
                    Glide.with(FileChooserActivity.this).load(musicInfo.getCoverPath())
                            .apply(options).into((ImageView) holder.getView(R.id.iv_icon));
                }
//                holder.setImageBitmap(R.id.iv_icon, CoverLoader.getInstance().loadThumbnail(musicInfo));
                holder.itemView.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        clickItem(musicInfo);
                    }
                });
            }
        };
        mDataBinding.rlMusice.setAdapter(mAdapter);
        mDataBinding.rlMusice.addItemDecoration(new DividerItemDecoration(this,
                DividerItemDecoration.VERTICAL));
        FileChooserActivityPermissionsDispatcher.refreshDataWithPermissionCheck(this, false);
    }
 
Example #26
Source File: MainActivity.java    From Mp3Cutter with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void initData(Bundle savedInstanceState) {
    initView();
    mSettingFragment = new SettingFragment();
    mHomeFragment = new HomeFragment();
    mAboutFragment = new AboutFragment();
    switchToHomePage();
    StatusBarUtil.setColorForDrawerLayout(MainActivity.this,
            mDataBinding.drawerlayout, Color.TRANSPARENT);
}
 
Example #27
Source File: SplashActivity.java    From Mp3Cutter with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    StatusBarUtil.setColor(this, Color.TRANSPARENT);
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_splash);
    setListener();
}
 
Example #28
Source File: MainActivity.java    From Android_UE with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.content_main);

    StatusBarUtil.setTranslucentForImageView(this, null);

    addLayoutListener(findViewById(R.id.llLogin));
}
 
Example #29
Source File: MainActivity.java    From qvod with MIT License 5 votes vote down vote up
public void initView() {
    //ToolBar
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        //去除默认Title显示
        actionBar.setDisplayShowTitleEnabled(false);
        //去除返回键显示
        actionBar.setDisplayHomeAsUpEnabled(false);
    }
    //
    StatusBarUtil.setColorNoTranslucentForDrawerLayout(this, drawerLayout, ContextCompat.getColor(this, R.color.colorTheme));
    //
    ivTitleSpecial.setSelected(true);
}
 
Example #30
Source File: SplashActivity.java    From LQRWeChat with MIT License 5 votes vote down vote up
@Override
public void initView() {

    StatusBarUtil.setColor(this, UIUtils.getColor(R.color.black));

    AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
    alphaAnimation.setDuration(1000);
    mRlButton.startAnimation(alphaAnimation);
}