Example usage for android.view Window setFlags

List of usage examples for android.view Window setFlags

Introduction

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

Prototype

public void setFlags(int flags, int mask) 

Source Link

Document

Set the flags of the window, as per the WindowManager.LayoutParams WindowManager.LayoutParams flags.

Usage

From source file:org.docrj.smartcard.reader.MsgParseActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();/*  w  w  w.  j  ava  2  s . c  om*/
    Bundle b = intent.getBundleExtra("parsed_msg");
    String msgText = b.getString("text");

    mMsgName = b.getString("name");
    mHtml = b.getString("html");
    mActivityName = b.getString("activity");
    mTestMode = b.getInt("test_mode");

    setContentView(R.layout.activity_msg_parse);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // toolbar reference does not work for setting groupName
    getSupportActionBar().setTitle(mActivityName);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });

    TextView heading = (TextView) findViewById(R.id.heading);
    heading.setText(mMsgName);

    TextView contents = (TextView) findViewById(R.id.msg_text);
    contents.setText(msgText);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window w = getWindow();
        w.setFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
                WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
                        | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        w.setStatusBarColor(getResources().getColor(R.color.primary_dark));
    }
}

From source file:org.mariotaku.twidere.activity.BaseDialogActivity.java

public void setHardwareAcceleration() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        final SharedPreferences preferences = getSharedPreferences(SHARED_PREFERENCES_NAME,
                Context.MODE_PRIVATE);
        final boolean hardware_acceleration = mHardwareAccelerated = preferences
                .getBoolean(PREFERENCE_KEY_HARDWARE_ACCELERATION, false);
        final Window w = getWindow();
        if (hardware_acceleration) {
            w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
                    WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
        }/*  w w w.  j  a  v  a2  s. c o  m*/
    }
}

From source file:com.tdispatch.passenger.core.TDDialogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    mFragmentView = getActivity().getLayoutInflater().inflate(getLayoutId(), null);

    mFragmentView.setMinimumWidth(getResources().getDimensionPixelSize(R.dimen.dialog_min_width));

    Window w = getDialog().getWindow();
    w.requestFeature(Window.FEATURE_NO_TITLE);
    w.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    getDialog().setCanceledOnTouchOutside(false);

    setCustomFonts((ViewGroup) mFragmentView);

    onPostCreateView();/* ww  w  . ja  v a2  s  .co  m*/

    return mFragmentView;
}

From source file:com.dwdesign.tweetings.activity.BaseDialogActivity.java

public void setHardwareAcceleration() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        final SharedPreferences preferences = getSharedPreferences(SHARED_PREFERENCES_NAME,
                Context.MODE_PRIVATE);
        final boolean hardware_acceleration = mHardwareAccelerated = preferences
                .getBoolean(PREFERENCE_KEY_HARDWARE_ACCELERATION, true);
        final Window w = getWindow();
        if (hardware_acceleration) {
            w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
                    WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
        }//from w ww  .  j av a  2s.com
    }
}

From source file:net.sharermax.mword.AboutActivity.java

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onPostCreate(savedInstanceState);
    if (mImmersionEnable && android.os.Build.VERSION.SDK_INT > 18) {
        Window window = getWindow();
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        tintManager.setNavigationBarTintEnabled(true);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setTintColor(Color.parseColor("#ff009688"));
        SystemBarConfig systemBarConfig = tintManager.getConfig();
        findViewById(R.id.about_listview).setPadding(0,
                systemBarConfig.getPixelInsetTop(getActionBar().isShowing()), 0,
                systemBarConfig.getPixelInsetBottom());
    } else {/*from  www.  j a v  a  2s . c  o  m*/
        mImmersionEnable = false;
    }
}

From source file:com.mokee.setupwizard.SetupWizardActivity.java

private void checkInit() {
    int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
    Window window = SetupWizardActivity.this.getWindow();
    window.setFlags(flag, flag);
}

From source file:com.amsterdam.marktbureau.makkelijkemarkt.MainActivity.java

/**
 * Act on back-button pressed/*from  ww  w  . jav a2  s.c  o m*/
 */
@Override
public void onBackPressed() {

    // if the backstack has only one item, it is the homescreen, so we hide the toolbar
    if (getSupportFragmentManager().getBackStackEntryCount() < 2) {
        if (getSupportActionBar() != null) {

            // set the statusbar sransparency
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                Window w = getWindow();
                w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                        WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
            }

            // hide the toolbar
            mToolbar.setVisibility(View.GONE);
        }
    }

    super.onBackPressed();
}

From source file:com.kishan.exames.AboutActivity.java

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

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window w = getWindow(); // in Activity's onCreate() for instance
        w.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }//from  ww  w. ja v  a2 s.  c  o  m

    mInterstitialAd = new InterstitialAd(AboutActivity.this);
    mInterstitialAd.setAdUnitId(getString(R.string.intersticial_adId));
    mInterstitialAd.loadAd(new AdRequest.Builder().build());
    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            if (mInterstitialAd.isLoaded()) {
                mInterstitialAd.show();
            } else {
                Log.d("adMan", "woah, intersticial ad was not loaded dude!");
            }
        }
    });

    //Get the preference
    SharedPreferences sharedPreferences = getSharedPreferences("gradToggle", MODE_PRIVATE);
    final SharedPreferences.Editor editor = sharedPreferences.edit();

    View aboutPage = new AboutPage(this).isRTL(false).setImage(R.mipmap.ic_launcher)
            .setDescription(getString(R.string.about)).addItem(new Element().setTitle("Verso do app: 1.5.2"))
            .addItem(new Element().setTitle("Alternar fundo").setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    AlertDialog.Builder da = new AlertDialog.Builder(AboutActivity.this)
                            .setTitle("Deseja alternar a animao?")
                            .setMessage(
                                    "No gosta da animao das cores no fundo?\nDesligue-a clicando no boto 'desativar'. Para reativar clique no 'ativar'.\n\n(Reinicie o app aps a alterao)")
                            .setPositiveButton("Ativar", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    editor.putString("check", "true");
                                    editor.apply();
                                    isOn = true;
                                    Toast.makeText(AboutActivity.this,
                                            "Animao ativada com sucesso.\nPor favor, reinicie o app para fazer efeito.",
                                            Toast.LENGTH_SHORT).show();
                                }
                            }).setNegativeButton("Desactivar", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    editor.putString("check", "false");
                                    editor.apply();
                                    isOn = false;
                                    Toast.makeText(AboutActivity.this,
                                            "Animao desativada com sucesso.\nPor favor, reinicie o app para fazer efeito.",
                                            Toast.LENGTH_SHORT).show();
                                }
                            }).setNeutralButton("Cancel", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                }
                            });
                    da.show();
                }
            }).setIcon(R.drawable.about_icon_backgroundchange).setAutoIconColor(false)).addGroup("")
            .addItem(new Element().setTitle("www.exames.tk").setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // Open our website
                    Uri uri = Uri.parse("http://www.exames.tk"); // missing 'http://' will cause crashed
                    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                    startActivity(intent);
                }
            }).setIcon(R.drawable.about_icon_exameslink).setAutoIconColor(false)).addFacebook("exames.moz")
            .addPlayStore("com.kishan.exames").addEmail("kishan_jadav@hotmail.com").addGroup("")
            .addItem(new Element().setTitle("Agradecimentos").setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    AlertDialog.Builder da = new AlertDialog.Builder(AboutActivity.this)
                            .setTitle("Agradecimentos:").setMessage(getString(R.string.Licenses))
                            .setPositiveButton("Licena indiv.", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    Intent browserIntent = new Intent(Intent.ACTION_VIEW,
                                            Uri.parse("https://goo.gl/QxN0mI"));
                                    startActivity(browserIntent);
                                }
                            }).setNegativeButton("Fechar", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                }
                            });
                    da.show();
                }
            }).setAutoIconColor(false).setIcon(R.drawable.about_icon_agradecimentos))
            .addItem(getCopyRightsElement()).create();
    setContentView(aboutPage);

}

From source file:com.amsterdam.marktbureau.makkelijkemarkt.MainActivity.java

/**
 * Set the activity layout and add a fragment to the container
 * @param savedInstanceState activity state bundle
 *///ww w .  j  a  va  2s  .c o m
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // set the used layout
    setContentView(R.layout.main_activity);

    // bind the elements to the view
    ButterKnife.bind(this);

    // setup a toolbar as supportactionbar
    setSupportActionBar(mToolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayShowTitleEnabled(false);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        // set the title texview
        mToolbarTitle.setText(R.string.login);

        // set the statusbar sransparency
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            Window w = getWindow();
            w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            w.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
        }

        // hide the toolbar
        mToolbar.setVisibility(View.GONE);
    }

    // load accounts and add mainfragment, not on rotate
    if (savedInstanceState == null) {

        // create a mainfragment and add it to the framelayout container
        mMainFragment = new MainFragment();
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.add(R.id.container, mMainFragment, MAIN_FRAGMENT_TAG);
        transaction.commit();
    } else {

        // re-use existing instance of main fragment
        mMainFragment = (MainFragment) getSupportFragmentManager().findFragmentByTag(MAIN_FRAGMENT_TAG);
    }
}

From source file:net.sharermax.mword.AboutActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.about);/* w  w  w  .  j a  v  a  2  s .  c  o m*/
    SharedPreferences sharedPreferences = PreferenceManager
            .getDefaultSharedPreferences(getApplicationContext());
    //
    mSwipeBackEnable = sharedPreferences.getBoolean(PreferenceKey.SWIPE_BACK_KEY, true);
    mSwipeBackLayout = getSwipeBackLayout();
    if (mSwipeBackEnable) {
        //               Log.v("BASIC", "YYY");
        mSwipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT);
    } else {
        setSwipeBackEnable(false);
    }

    mImmersionEnable = sharedPreferences.getBoolean(PreferenceKey.IMMERSION_KEY, true);
    if (mImmersionEnable && android.os.Build.VERSION.SDK_INT > 18) {
        Window window = getWindow();
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

    }

    getActionBar().setDisplayHomeAsUpEnabled(true);
    mlistView = (ListView) findViewById(R.id.about_listview);
    //      ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, getData());
    //      listView.setAdapter(adapter);
    //      listView.setText
    SimpleAdapter adapter = new SimpleAdapter(this, getData(), R.layout.about_item,
            new String[] { "text1", "text2" }, new int[] { R.id.text1, R.id.text2 });
    mlistView.setAdapter(adapter);
    mlistView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub

            switch (arg2) {
            case 0:
                //               Log.v("listview", "0");
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("http://sharermax.net/%E5%85%B3%E4%BA%8E%E6%88%91/"));
                startActivity(intent);
                break;
            case 1:
                //               Log.v("listview", "1");
                Intent intent1 = new Intent(Intent.ACTION_VIEW);
                intent1.setData(Uri.parse("http://git.oschina.net/watermelon/MWord"));
                startActivity(intent1);
                break;
            case 2:
                //               Log.v("listview", "2");
                Intent intent2 = new Intent(Intent.ACTION_VIEW);
                intent2.setData(Uri.parse("http://git.oschina.net/watermelon/MWord/raw/master/LICENSE"));
                startActivity(intent2);
                break;
            case 3:
                break;
            case 4:
                //               Log.v("listview", "4");
                Intent intent4 = new Intent(Intent.ACTION_SENDTO);
                intent4.setData(Uri.parse("mailto:mdcw1103@gmail.com"));
                startActivity(Intent.createChooser(intent4, ""));
                break;
            case 5:
                //               Log.v("listview", "5");
                UpdateApp updateApp = new UpdateApp(AboutActivity.this, UpdateApp.VERSION_TYPE_BETA);
                updateApp.setTaskOverListener(new TaskOverListener() {

                    @Override
                    public void taskOver(int versionCode) {
                        // TODO Auto-generated method stub
                        PackageManager packageManager = AboutActivity.this.getPackageManager();
                        try {
                            PackageInfo packageInfo = packageManager
                                    .getPackageInfo(AboutActivity.this.getPackageName(), 0);
                            //                        Log.v("UPDATE", "" + versionCode);
                            if (versionCode > packageInfo.versionCode) {

                                Toast.makeText(getApplicationContext(), "", Toast.LENGTH_LONG).show();
                                UpdateApp.updateNotification(AboutActivity.this);
                            } else {
                                Toast.makeText(getApplicationContext(), "", Toast.LENGTH_LONG)
                                        .show();
                            }
                        } catch (NameNotFoundException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    }
                });
                updateApp.startTask();
                break;
            default:
                break;
            }

        }
    });
}