use of android.view.Window in project HoloEverywhere by Prototik.
the class ActionBarActivityDelegateICS method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
// Set framework uiOptions from the support metadata value
if (UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata())) {
mActivity.getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW, ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
}
super.onCreate(savedInstanceState);
if (mHasActionBar) {
// If action bar is requested by inheriting from the appcompat theme,
// the system will not know about that. So explicitly request for an action bar.
mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
}
if (mOverlayActionBar) {
mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
}
/*
* This goofy move needs some explanation.
*
* The verifier on older platform versions has some interesting side effects if
* a class defines a method that takes a parameter of a type that doesn't exist.
* In this case, that type is android.view.ActionMode. Therefore, ActionBarActivity
* cannot override the onActionModeStarted/Finished methods without causing nastiness
* when it is loaded on older platform versions.
*
* Since these methods are actually part of the window callback and not intrinsic to
* Activity itself, we can install a little shim with the window instead that knows
* about the ActionMode class. Note that this means that any new methods added to
* Window.Callback in the future won't get proxied without updating the support lib,
* but we shouldn't be adding new methods to public interfaces that way anyway...right? ;)
*/
final Window w = mActivity.getWindow();
w.setCallback(createWindowCallbackWrapper(w.getCallback()));
}
use of android.view.Window in project Anki-Android by Ramblurr.
the class DeckPicker method onAttachedToWindow.
@Override
public void onAttachedToWindow() {
if (!mFragmented) {
Window window = getWindow();
window.setFormat(PixelFormat.RGBA_8888);
}
}
use of android.view.Window in project material-intro-screen by TangoAgency.
the class MaterialIntroActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
setContentView(R.layout.activity_material_intro);
overScrollLayout = (OverScrollViewPager) findViewById(R.id.view_pager_slides);
viewPager = overScrollLayout.getOverScrollView();
pageIndicator = (InkPageIndicator) findViewById(R.id.indicator);
backButton = (ImageButton) findViewById(R.id.button_back);
nextButton = (ImageButton) findViewById(R.id.button_next);
skipButton = (ImageButton) findViewById(R.id.button_skip);
messageButton = (Button) findViewById(R.id.button_message);
coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinator_layout_slide);
navigationView = (LinearLayout) findViewById(R.id.navigation_view);
adapter = new SlidesAdapter(getSupportFragmentManager());
viewPager.setAdapter(adapter);
viewPager.setOffscreenPageLimit(2);
pageIndicator.setViewPager(viewPager);
nextButtonTranslationWrapper = new NextButtonTranslationWrapper(nextButton);
initOnPageChangeListeners();
permissionNotGrantedClickListener = new PermissionNotGrantedClickListener(this, nextButtonTranslationWrapper);
finishScreenClickListener = new FinishScreenClickListener();
setBackButtonVisible();
viewPager.post(new Runnable() {
@Override
public void run() {
if (adapter.getCount() == 0) {
finish();
} else {
int currentItem = viewPager.getCurrentItem();
messageButtonBehaviourOnPageSelected.pageSelected(currentItem);
nextButtonBehaviour(currentItem, adapter.getItem(currentItem));
}
}
});
}
use of android.view.Window in project android-extendedactionbar by Takhion.
the class ExtendedActionBarActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
final Resources res = getResources();
final boolean isKitkat = Build.VERSION.SDK_INT >= 19;
// replace window background to reduce overdraw
final Window window = getWindow();
final ViewGroup contentView = (ViewGroup) findViewById(android.R.id.content);
final View content = contentView.getChildAt(0);
final Drawable extendedWindowBackground = window.getDecorView().getBackground();
final Drawable windowBackground = !isKitkat ? extendedWindowBackground : getWindowBackgroundLayer(extendedWindowBackground, R.id.window_background, "window_background");
window.setBackgroundDrawable(null);
setBackground(content, windowBackground);
// add statusbar background
if (isKitkat) {
// check if translucent bars are enabled
final int config_enableTranslucentDecor_id = res.getIdentifier("config_enableTranslucentDecor", "bool", "android");
if (config_enableTranslucentDecor_id > 0 && res.getBoolean(config_enableTranslucentDecor_id)) {
// get ActionBar container
final View actionBarContainer = findViewById("action_bar_container", "android");
if (actionBarContainer != null) {
// add layout listener (can't get margin before layout)
//noinspection ConstantConditions
actionBarContainer.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@SuppressWarnings("ConstantConditions")
@Override
public void onGlobalLayout() {
// remove layout listener
final ViewTreeObserver vto = actionBarContainer.getViewTreeObserver();
if (Build.VERSION.SDK_INT < 16)
vto.removeGlobalOnLayoutListener(this);
else
vto.removeOnGlobalLayoutListener(this);
// create and add statusbar background view
final Drawable statusBarBackground = getWindowBackgroundLayer(extendedWindowBackground, R.id.statusbar_background, "statusbar_background");
final int statusBarHeight = ((ViewGroup.MarginLayoutParams) actionBarContainer.getLayoutParams()).topMargin;
final View statusBarView = new View(ExtendedActionBarActivity.this);
setBackground(statusBarView, statusBarBackground);
final FrameLayout.LayoutParams statusBarBackground_lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, statusBarHeight, Gravity.TOP | Gravity.FILL_HORIZONTAL);
contentView.addView(statusBarView, 0, statusBarBackground_lp);
// shift content under actionbar
final ViewGroup.MarginLayoutParams content_lp = (ViewGroup.MarginLayoutParams) content.getLayoutParams();
content_lp.topMargin = getActionBar().getHeight() + statusBarHeight;
content.setLayoutParams(content_lp);
}
});
}
}
}
}
use of android.view.Window in project Notes by MiCode.
the class AlarmAlertActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
final Window win = getWindow();
win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
if (!isScreenOn()) {
win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
}
Intent intent = getIntent();
try {
mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1));
mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId);
mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0, SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info) : mSnippet;
} catch (IllegalArgumentException e) {
e.printStackTrace();
return;
}
mPlayer = new MediaPlayer();
if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
showActionDialog();
playAlarmSound();
} else {
finish();
}
}
Aggregations