List of usage examples for android.view Window setFlags
public void setFlags(int flags, int mask)
From source file:com.newshiqi.yushi.SplashScreen.java
private void init() { setContentView(R.layout.activity_first); baseInfoLoader = BaseInfoLoader.getInstance(); int flag = WindowManager.LayoutParams.FLAG_FULLSCREEN; Window w = getWindow(); w.setFlags(flag, flag); if (NetStatusReceiver.netStatus == NetStatusReceiver.NETSTATUS_INAVAILABLE) { Toast.makeText(SplashScreen.this, "???", Toast.LENGTH_SHORT).show(); return;//from www. ja v a 2 s .c o m } this.initRequest(); }
From source file:com.pkmmte.techdissected.activity.MainActivity.java
@TargetApi(Build.VERSION_CODES.KITKAT) private void initTranslucent() { // Return if user isn't on a version that supports this feature yet if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;//from www . ja v a 2 s . c om // Set translucency window flags 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); // Initialize your Tint Manager mTintManager = new SystemBarTintManager(this); // Enable status bar tint and set to resource mTintManager.setStatusBarTintEnabled(true); mTintManager.setStatusBarTintColor(getResources().getColor(R.color.action_background)); // Uncomment this line if you'd like to tint the nav bar as well //tintManager.setNavigationBarTintEnabled(true); // Set paddings & margins to main layout so they don't overlap the action/status bar SystemBarTintManager.SystemBarConfig config = mTintManager.getConfig(); int actionBarSize = getResources().getDimensionPixelSize(R.dimen.action_height); mDrawerList.setPadding(0, actionBarSize + config.getStatusBarHeight(), 0, config.getPixelInsetBottom()); ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) findViewById(R.id.feedContainer) .getLayoutParams(); params.setMargins(0, actionBarSize + config.getStatusBarHeight(), config.getPixelInsetRight(), 0); }
From source file:com.stillnojetpacks.huffr.activities.MainActivity.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void initializeToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(""); setSupportActionBar(toolbar);//from ww w . j av a 2 s . c o m if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); // Set paddingTop of toolbar to height of status bar. toolbar.setPadding(0, getStatusBarHeight(), 0, 0); } }
From source file:com.ota.updates.activities.MainActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); mContext = this; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window w = getWindow(); // in Activity's onCreate() for instance w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); }/* w w w.j a v a 2 s . co m*/ // All important compatibility check // Kills the app if not compatible Boolean doesRomSupportApp = checkRomIsCompatible(); // Download and parse our manifest if (doesRomSupportApp) { checkForUpdate(); } // Initializing Toolbar and setting it as the actionbar Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); //Initializing NavigationView NavigationView navigationView = (NavigationView) findViewById(R.id.navigation_view); // Default selected drawer item navigationView.getMenu().getItem(0).setChecked(true); // Initializing Drawer Layout and ActionBarToggle initialisingDrawerLayout(mToolbar, navigationView); }
From source file:com.vuze.android.remote.activity.LoginActivity.java
@SuppressWarnings("deprecation") @Override/*w ww . ja v a 2s. c o m*/ protected void onCreate(Bundle savedInstanceState) { // These are an attempt to make the gradient look better on some // android devices. It doesn't on the ones I tested, but it can't hurt to // have it here, right? getWindow().setFormat(PixelFormat.RGBA_8888); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window w = getWindow(); // in Activity's onCreate() for instance w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); w.setNavigationBarColor(ContextCompat.getColor(this, R.color.login_grad_color_2)); } } AndroidUtilsUI.onCreate(this); super.onCreate(savedInstanceState); if (AndroidUtils.DEBUG) { Log.d(TAG, "LoginActivity intent = " + getIntent() + "/" + getIntent().getDataString()); } appPreferences = VuzeRemoteApp.getAppPreferences(); setContentView(R.layout.activity_login); textAccessCode = (EditText) findViewById(R.id.editTextAccessCode); assert textAccessCode != null; RemoteProfile lastUsedRemote = appPreferences.getLastUsedRemote(); if (lastUsedRemote != null && lastUsedRemote.getRemoteType() == RemoteProfile.TYPE_LOOKUP && lastUsedRemote.getAC() != null) { textAccessCode.setText(lastUsedRemote.getAC()); textAccessCode.selectAll(); } textAccessCode.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { loginButtonClicked(v); return true; } }); TextView tvLoginCopyright = (TextView) findViewById(R.id.login_copyright); if (tvLoginCopyright != null) { AndroidUtilsUI.linkify(tvLoginCopyright); } TextView tvLoginGuide = (TextView) findViewById(R.id.login_guide); setupGuideText(tvLoginGuide); tvLoginGuide.setFocusable(false); TextView tvLoginGuide2 = (TextView) findViewById(R.id.login_guide2); setupGuideText(tvLoginGuide2); View coreArea = findViewById(R.id.login_core_area); if (coreArea != null) { coreArea.setVisibility(VuzeRemoteApp.isCoreAllowed() ? View.VISIBLE : View.GONE); } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowHomeEnabled(true); actionBar.setIcon(R.drawable.ic_launcher); } }
From source file:emu.project64.SplashActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Window window = getWindow(); // Don't let the activity sleep in the middle of extraction window.setFlags(LayoutParams.FLAG_KEEP_SCREEN_ON, LayoutParams.FLAG_KEEP_SCREEN_ON); // Lay out the content setContentView(R.layout.splash_activity); ((TextView) findViewById(R.id.versionText)).setText(NativeExports.appVersion()); mTextView = (TextView) findViewById(R.id.mainText); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); if ((ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) || !AndroidDevice.IS_LOLLIPOP) { StartExtraction();/*from w w w .j a v a 2 s . c o m*/ } else if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_EXTERNAL_STORAGE) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { new AlertDialog.Builder(this).setTitle(getString(R.string.assetExtractor_permissions_title)) .setMessage(getString(R.string.assetExtractor_permissions_rationale)) .setPositiveButton(getString(android.R.string.ok), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { actuallyRequestPermissions(); } }).setNegativeButton(getString(android.R.string.cancel), new OnClickListener() { //Show dialog stating that the app can't continue without proper permissions @Override public void onClick(DialogInterface dialog, int which) { new AlertDialog.Builder(SplashActivity.this) .setTitle(getString(R.string.assetExtractor_error)) .setMessage(getString(R.string.assetExtractor_failed_permissions)) .setPositiveButton(getString(android.R.string.ok), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SplashActivity.this.finish(); } }).setCancelable(false).show(); } }).setCancelable(false).show(); } else { actuallyRequestPermissions(); } }
From source file:com.github.rutvijkumar.twittfuse.fragments.ComposeDialog.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Dialog dialog = getDialog();/* w w w . j a va 2 s . co m*/ Window window = dialog.getWindow(); View view = inflater.inflate(R.layout.compose_dialog, container); window.requestFeature(Window.FEATURE_NO_TITLE); window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); setUpUI(view); getUserAccountDetails(); return view; }
From source file:openscience.crowdsource.video.experiments.MainActivity.java
public static void setTaskBarColored(android.app.Activity context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window w = context.getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); // todo: resolve default top bar height issue or find enother way to change top bar color // int statusBarHeight = 50; View view = new View(context); // view.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // view.getLayoutParams().height = statusBarHeight; // ((ViewGroup) w.getDecorView()).addView(view); view.setBackgroundColor(context.getResources().getColor(R.color.colorStatusBar)); }//w w w . j a v a2 s . c o m }
From source file:uk.org.downiesoft.slideshow.SlideShowActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Window win = getWindow(); win.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); win.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); win.requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); mUiHider = new UiHider(this); getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(mUiHider); mCacheManager = ThumbnailCacheManager.getInstance(this); SlideShowActivity.debug(1, TAG, "onCreate: %s", savedInstanceState == null ? "null" : savedInstanceState.toString()); setContentView(R.layout.activity_slide_show); PreferenceManager.setDefaultValues(this, R.xml.view_preferences, false); PreferenceManager.setDefaultValues(this, R.xml.slideshow_preferences, false); PreferenceManager.setDefaultValues(this, R.xml.cache_preferences, false); PreferenceManager.setDefaultValues(this, R.xml.wallpaper_preferences, false); PreferenceManager.setDefaultValues(this, R.xml.other_preferences, false); mSlideshowSettings = PreferenceManager.getDefaultSharedPreferences(this); int thumbSize = Integer.parseInt(mSlideshowSettings.getString(getString(R.string.PREFS_THUMBSIZE), "1")); // Hack to convert old hard-coded thumbsize settings to platform dependent sizes if (thumbSize > 2) { thumbSize = thumbSize / 90;/*from ww w . j a v a 2 s.c om*/ SharedPreferences.Editor editor = mSlideshowSettings.edit(); editor.putString(getString(R.string.PREFS_THUMBSIZE), Integer.toString(thumbSize)); editor.apply(); } FragmentManager fm = getFragmentManager(); int cacheLimit = Integer .parseInt(mSlideshowSettings.getString(getString(R.string.PREFS_CACHE_LIMIT), "10")); mPreviewButton = (ImageView) findViewById(R.id.slideShowImageButton); mPreviewView = (FrameLayout) findViewById(R.id.previewContainer); RelativeLayout divider = (RelativeLayout) findViewById(R.id.frameDivider); if (divider != null) { divider.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { return mGestureDetector.onTouchEvent(event) || view.onTouchEvent(event); } }); } mPreviewFragment = (PreviewFragment) fm.findFragmentByTag(PreviewFragment.TAG); if (mPreviewView != null && mPreviewFragment == null) { mPreviewFragment = new PreviewFragment(); fm.beginTransaction().replace(R.id.previewContainer, mPreviewFragment, PreviewFragment.TAG).commit(); } mGridViewFragment = (GridViewFragment) fm.findFragmentByTag(GridViewFragment.TAG); if (mGridViewFragment == null) { mGridViewFragment = new GridViewFragment(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.fragmentContainer, mGridViewFragment, GridViewFragment.TAG); ft.commit(); } mGestureDetector = new GestureDetector(this, new DividerGestureListener()); // restart/stop service as required Intent intent = getIntent(); if (intent != null && intent.getAction() != null && intent.getAction().equals(ACTION_STOP_WALLPAPER) && isServiceRunning()) { stopWallpaperService(); finish(); } else { if (!mSlideshowSettings.getBoolean(getString(R.string.PREFS_WALLPAPER_ENABLE), false)) { if (isServiceRunning()) { stopWallpaperService(); } } else { if (!isServiceRunning()) { Intent startIntent = new Intent(SlideShowActivity.this, WallpaperService.class); startService(startIntent); invalidateOptionsMenu(); } } } mCacheManager.tidyCache(cacheLimit); BitmapManager.setDisplayMetrics(getResources().getDisplayMetrics()); }
From source file:org.docrj.smartcard.reader.AppViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_app_view); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);//from w w w . j ava 2s . com toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); // persistent data in shared prefs SharedPreferences ss = getSharedPreferences("prefs", Context.MODE_PRIVATE); mEditor = ss.edit(); mSelectedAppPos = ss.getInt("selected_app_pos", 0); Gson gson = new Gson(); String json = ss.getString("groups", null); if (json == null) { mUserGroups = new LinkedHashSet<>(); } else { Type collectionType = new TypeToken<LinkedHashSet<String>>() { }.getType(); mUserGroups = gson.fromJson(json, collectionType); } // alphabetize, case insensitive mSortedAllGroups = new ArrayList<>(mUserGroups); mSortedAllGroups.addAll(Arrays.asList(DEFAULT_GROUPS)); Collections.sort(mSortedAllGroups, String.CASE_INSENSITIVE_ORDER); // when deleting an app results in an empty group, we remove the group; // we may need to adjust group position indices for batch select and app // browse activities, which apply to the sorted list of groups mSelectedGrpPos = ss.getInt("selected_grp_pos", 0); mSelectedGrpName = mSortedAllGroups.get(mSelectedGrpPos); mExpandedGrpPos = ss.getInt("expanded_grp_pos", -1); mExpandedGrpName = (mExpandedGrpPos == -1) ? "" : mSortedAllGroups.get(mExpandedGrpPos); Intent intent = getIntent(); mAppPos = intent.getIntExtra(EXTRA_APP_POS, 0); mName = (EditText) findViewById(R.id.app_name); mAid = (EditText) findViewById(R.id.app_aid); mType = (RadioGroup) findViewById(R.id.radio_grp_type); mNote = (TextView) findViewById(R.id.note); mGroups = (TextView) findViewById(R.id.group_list); // view only mName.setFocusable(false); mAid.setFocusable(false); for (int i = 0; i < mType.getChildCount(); i++) { mType.getChildAt(i).setClickable(false); } 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)); } }