List of usage examples for android.app Activity getWindow
public Window getWindow()
From source file:com.apptentive.android.sdk.module.messagecenter.view.MessageCenterActivityContent.java
@Override public void doOnCreate(Activity activity, Bundle onSavedInstanceState) { activity.setContentView(R.layout.apptentive_message_center); viewActivity = activity;/*from w ww .j a va 2s. c om*/ listViewSavedTopIndex = (onSavedInstanceState == null) ? -1 : onSavedInstanceState.getInt(LIST_TOP_INDEX); listViewSavedTopOffset = (onSavedInstanceState == null) ? 0 : onSavedInstanceState.getInt(LIST_TOP_OFFSET); composingViewSavedState = (onSavedInstanceState == null) ? null : onSavedInstanceState.getParcelable(COMPOSING_EDITTEXT_STATE); pendingWhoCardName = (onSavedInstanceState == null) ? null : onSavedInstanceState.getParcelable(WHO_CARD_NAME); pendingWhoCardEmail = (onSavedInstanceState == null) ? null : onSavedInstanceState.getParcelable(WHO_CARD_EMAIL); pendingWhoCardAvatarFile = (onSavedInstanceState == null) ? null : onSavedInstanceState.getString(WHO_CARD_AVATAR_FILE); pendingWhoCardMode = (onSavedInstanceState == null) ? 0 : onSavedInstanceState.getInt(WHO_CARD_MODE); String contextualMessageBody = interaction.getContextualMessageBody(); contextualMessage = CompoundMessage.createAutoMessage(null, contextualMessageBody); setup(); // This listener will run when messages are retrieved from the server, and will start a new thread to update the view. MessageManager.addInternalOnMessagesUpdatedListener(this); // Give the MessageCenterView a callback when a message is sent. MessageManager.setAfterSendMessageListener(this); // Needed to prevent the window from being pushed up when a text input area is focused. activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); if (listViewSavedTopIndex == -1) { messageCenterViewHandler.sendEmptyMessageDelayed(MSG_SCROLL_TO_BOTTOM, DEFAULT_DELAYMILLIS); } }
From source file:com.aujur.ebookreader.activity.ReadingFragment.java
private void setScreenBrightnessLevel(int level) { Activity activity = getActivity(); if (activity != null) { WindowManager.LayoutParams lp = activity.getWindow().getAttributes(); lp.screenBrightness = (float) level / 100f; activity.getWindow().setAttributes(lp); }// w w w. jav a2s.co m }
From source file:com.zoffcc.applications.zanavi.Navit.java
static void take_phone_screenshot(Activity a, String dir_name, String name_base) { try {/* w ww . j ava 2s . c o m*/ View v1 = a.getWindow().getDecorView().getRootView(); v1.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); v1.setDrawingCacheEnabled(true); Bitmap bm = v1.getDrawingCache(); FileOutputStream out = null; try { out = new FileOutputStream(dir_name + "/" + name_base + ".png"); bm.compress(Bitmap.CompressFormat.PNG, 100, out); } catch (Exception e) { e.printStackTrace(); System.out.println("TSCR:004 " + e.getMessage()); } finally { v1.setDrawingCacheEnabled(false); try { if (out != null) { out.close(); } } catch (IOException e) { e.printStackTrace(); } } } catch (Exception e4) { } }