Example usage for android.view Window clearFlags

List of usage examples for android.view Window clearFlags

Introduction

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

Prototype

public void clearFlags(int flags) 

Source Link

Document

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

Usage

From source file:me.henrytao.mdcore.core.MdCompat.java

public static void enableTranslucentStatus(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = activity.getWindow();
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(Color.TRANSPARENT);
    }/* w  ww.j a va  2s .  c  o  m*/
}

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);
    }/*  ww  w  .ja  va 2s  . co m*/
}

From source file:util.Utils.java

/**
 * ??//from  w w  w . j a v a 2  s . c  o m
 *
 * @param context
 * @param color
 */
public static void modifyStatusBar(FragmentActivity context, int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = context.getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        //            window.setStatusBarColor(color);
    }
}

From source file:com.ui.UiWindow.java

public void showProgressDialogKeyboard(Window window) {
    window.clearFlags(
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
}

From source file:com.dw.bartinter.BarTinter.java

private void statusBar(final String colorPref) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (colorPref != null && !colorPref.isEmpty()) {
            final Window window = cordova.getActivity().getWindow();
            window.clearFlags(0x04000000);
            window.addFlags(0x80000000);
            try {
                window.getClass().getDeclaredMethod("setStatusBarColor", int.class).invoke(window,
                        Color.parseColor(colorPref));
            } catch (IllegalArgumentException ignore) {
                Log.e(PLUGIN, "Invalid hexString argument.");
            } catch (Exception ignore) {
                Log.w(PLUGIN,/* w w w.jav  a2 s .  c  o  m*/
                        "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT);
            }
        }
    }
}

From source file:com.dw.bartinter.BarTinter.java

private void navigationBar(final String colorPref) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (colorPref != null && !colorPref.isEmpty()) {
            final Window window = cordova.getActivity().getWindow();
            window.clearFlags(0x04000000);
            window.addFlags(0x80000000);
            try {
                window.getClass().getDeclaredMethod("setNavigationBarColor", int.class).invoke(window,
                        Color.parseColor(colorPref));
            } catch (IllegalArgumentException ignore) {
                Log.e(PLUGIN, "Invalid hexString argument.");
            } catch (Exception ignore) {
                Log.w(PLUGIN,/*from w  w w . ja  v a  2s .c o  m*/
                        "Method window.setNavigationBarColor not found for SDK level " + Build.VERSION.SDK_INT);
            }
        }
    }
}

From source file:org.apache.cordova.statusbar.StatusBar.java

/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 *///w w w .  j  av  a2s.  com
@Override
public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
    Log.v(TAG, "StatusBar: initialization");
    super.initialize(cordova, webView);

    this.cordova.getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            // Clear flag FLAG_FORCE_NOT_FULLSCREEN which is set initially
            // by the Cordova.
            Window window = cordova.getActivity().getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

            // Read 'StatusBarBackgroundColor' from config.xml, default is #000000.
            setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#000000"));
        }
    });
}

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

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override//from  w w  w  .  ja v  a 2  s. co  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:br.com.hotforms.StatusBarManager.java

/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 *///from ww w . ja v  a  2s  .  c  o m
@Override
public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
    Log.v(TAG, "StatusBarManager: initialization");
    super.initialize(cordova, webView);

    this.cordova.getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Window window = cordova.getActivity().getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        }
    });
}