Example usage for android.view Window addFlags

List of usage examples for android.view Window addFlags

Introduction

In this page you can find the example usage for android.view Window addFlags.

Prototype

public void addFlags(int flags) 

Source Link

Document

Convenience function to set the flag bits as specified in flags, as per #setFlags .

Usage

From source file:org.huxizhijian.sdk.util.StatusBarUtil.java

public static void setFullScreen(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = activity.getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        window.getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(Color.TRANSPARENT);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        // ???,? ContentView ?
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }/*from  ww  w .j av a 2 s . c  o m*/
}

From source file:org.kaaproject.kaa.examples.robotrun.android.RobotRunActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.robotrun_activity);

    FragmentManager fragmentManager = getSupportFragmentManager();
    mRobotRunFragment = RobotRunFragment.newInstance();
    fragmentManager.beginTransaction().replace(R.id.container, mRobotRunFragment).commit();

}

From source file:com.devolta.dailyremind.AboutActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/*from   ww w  .j  a  v  a2s.  c  o m*/

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
    }

    FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
    mFirebaseAnalytics.setAnalyticsCollectionEnabled(true);

}

From source file:edu.uwp.alga.SplashActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override/*from  w  ww . j  av  a 2  s  . c o  m*/
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_splash);

    //set status bar color
    if (Build.VERSION.SDK_INT >= 21) {
        // Call some material design APIs here
        Window window = this.getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(ContextCompat.getColor(this, R.color.WBackground));
    }

    /*Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.spash);
    ImageView image = (ImageView)findViewById(R.id.image_splash);
            
    if(bitmap.getHeight()>=2048||bitmap.getWidth()>=2048){
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int width = metrics.widthPixels;
    int height = metrics.heightPixels;
    bitmap = Bitmap.createScaledBitmap(bitmap, width, height, true);
            
    }
    image.setImageBitmap(bitmap);*/

    new Handler().postDelayed(() -> {
        startActivity(new Intent(SplashActivity.this, MainActivity.class));

        finish();
    }, 1500);
}

From source file:com.grarak.kerneladiutor.BaseActivity.java

public void setStatusBarColor() {
    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.setStatusBarColor(ContextCompat.getColor(this, R.color.color_primary_dark));
}

From source file:com.qiscus.sdk.ui.QiscusChatActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    chatConfig = Qiscus.getChatConfig();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(ContextCompat.getColor(this, chatConfig.getStatusBarColor()));
    }//from   ww  w .j  a  v a 2s  . c om
    setContentView(R.layout.activity_qiscus_chat);

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    tvTitle = (TextView) findViewById(R.id.tv_title);
    tvSubtitle = (TextView) findViewById(R.id.tv_subtitle);

    onViewReady(savedInstanceState);
}

From source file:com.qasp.diego.arsp.SettingsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(Color.parseColor("#202020"));
    }/* w  w  w.j av  a  2 s.c om*/

    // TOOLBAR
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        findViewById(R.id.gradientShadow).setVisibility(View.GONE);
        ViewCompat.setElevation(toolbar, 8);
    }

    /* Setar ICONE */
    setSupportActionBar(toolbar);

    // Inflar frag
    getFragmentManager().beginTransaction().replace(R.id.fragment_container, new preferencesFrag()).commit();

}

From source file:org.dmfs.tasks.ViewTaskActivity.java

@SuppressLint("NewApi")
@Override//from www  .j  av  a  2  s .co m
public void updateColor(int color) {

    if (VERSION.SDK_INT >= 21) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(darkenColor(color));
    }
}

From source file:com.qiscus.sdk.filepicker.FilePickerActivity.java

protected void onSetStatusBarColor() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(ContextCompat.getColor(this, chatConfig.getStatusBarColor()));
    }//from w w  w  .java 2s  .co m
}

From source file:com.qiscus.sdk.ui.QiscusAccountLinkingActivity.java

protected void onSetStatusBarColor() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(ContextCompat.getColor(this, Qiscus.getChatConfig().getStatusBarColor()));
    }//from   w w  w. j ava  2s  .c  om
}