List of usage examples for android.content Context WINDOW_SERVICE
String WINDOW_SERVICE
To view the source code for android.content Context WINDOW_SERVICE.
Click Source Link
From source file:org.cocos2dx.lib.Cocos2dxAccelerometer.java
public Cocos2dxAccelerometer(Context context) { mContext = context;/*w w w . j a v a 2s . c om*/ //Get an instance of the SensorManager mSensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); Display display = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); mNaturalOrientation = display.getOrientation(); }
From source file:com.apptentive.android.sdk.util.Util.java
public static Point getScreenSize(Context context) { Point ret = new Point(); WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); // TODO: getWidth(), getHeight(), and getOrientation() are deprecated in API 13 in favor of getSize() and getRotation(). ret.set(display.getWidth(), display.getHeight()); return ret;/*ww w .jav a 2 s. c om*/ }
From source file:com.fairphone.fplauncher3.oobe.animation.MenuTutorialAnimationView.java
private void init() { WindowManager windowMananger = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); mDisplayMetrics = new DisplayMetrics(); windowMananger.getDefaultDisplay().getMetrics(mDisplayMetrics); SCREEN_HEIGHT = mDisplayMetrics.heightPixels; SCREEN_WIDTH = mDisplayMetrics.widthPixels; if (getBackground() == null) { setBackgroundColor(0x00000000);//from w ww.java 2 s . c o m } spritePaint = new Paint(); spritePaint.setColor(0xffffffff); spriteRoot = new KWSprite(); spriteArrow = new KWSprite(); spriteHand = new KWSprite(); spriteHandShadow = new KWSprite(); spriteMenu = new KWSprite(); spriteAppIcon = new KWSprite(); spriteAppIconSelected = new KWSprite(); spriteArrow.drawable = ContextCompat.getDrawable(getContext(), R.drawable.arrow_gradient_oobe); spriteArrow.applySizeFromDrawable(); spriteHand.drawable = ContextCompat.getDrawable(getContext(), R.drawable.icn_hand_oobe); spriteHand.applySizeFromDrawable(); spriteHandShadow.drawable = ContextCompat.getDrawable(getContext(), R.drawable.oobe_hand_shadow); spriteHandShadow.applySizeFromDrawable(); spriteMenu.drawable = ContextCompat.getDrawable(getContext(), R.drawable.oobe_menu); spriteMenu.applySizeFromDrawable(); spriteAppIcon.drawable = ContextCompat.getDrawable(getContext(), R.drawable.icn_circle_oobe); spriteAppIcon.applySizeFromDrawable(); spriteAppIconSelected.drawable = ContextCompat.getDrawable(getContext(), R.drawable.icn_circle_glow_oobe); spriteAppIconSelected.applySizeFromDrawable(); spriteRoot.addChild(spriteArrow); spriteRoot.addChild(spriteHand); //spriteRoot.addChild(spriteHandShadow); spriteRoot.addChild(spriteMenu); spriteMenu.addChild(spriteAppIcon); //spriteMenu.addChild(spriteAppIconSelected); spriteRoot.alpha = 0; spriteAppIconSelected.alpha = 0; // Animation setup animationManager = new KWAnimationManager(); animationGroupSwipe = new KWAnimationGroup(animationManager); animationGroupSelectApp = new KWAnimationGroup(animationManager); mHandStopPointXinDP = SCREEN_WIDTH - DynamicGrid.pxFromDp(100, mDisplayMetrics); mArrowStopPointXinDP = SCREEN_WIDTH - DynamicGrid.pxFromDp(120, mDisplayMetrics); setupSwipeAnimation(); setupAppOpenAnimation(); }
From source file:com.kmagic.solitaire.DrawMaster.java
/** * Create a new instance of DrawMaster//w ww. j av a 2 s . c o m * @param context activity/application context */ public DrawMaster(final Context context) { mContext = context; mResources = mContext.getResources(); // Background mBGPaint = new Paint(); mBGPaint.setARGB(255, 0, 128, 0); mShadePaint = new Paint(); mShadePaint.setARGB(200, 0, 0, 0); mLightShadePaint = new Paint(); mLightShadePaint.setARGB(100, 0, 0, 0); // Card related stuff mEmptyAnchorPaint = new Paint(); mEmptyAnchorPaint.setARGB(255, 0, 64, 0); mDoneEmptyAnchorPaint = new Paint(); mDoneEmptyAnchorPaint.setARGB(128, 255, 0, 0); mFontSize = mResources.getDimensionPixelSize(R.dimen.font_size); mTimePaint = getTextPaint(mFontSize, Paint.Align.RIGHT); mLastSeconds = -1; mCardBitmap = new Bitmap[52]; Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); Point size = new Point(); display.getSize(size); setScreenSize(size.x, size.y); drawCards(false); }
From source file:com.dunrite.xpaper.utility.Utils.java
/** * Gets Device's screen resolution width * * @param context current context/*from w w w .j a v a 2 s .co m*/ * @return width value * //TODO: get actual value, if possible */ public static int getDeviceResWidth(Context context) { int width = 0; WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics metrics = new DisplayMetrics(); wm.getDefaultDisplay().getMetrics(metrics); Display display = wm.getDefaultDisplay(); int density = metrics.densityDpi; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { display.getRealMetrics(metrics); width = metrics.widthPixels; } Log.d("DEVICE WIDTH", "" + width); return width; }
From source file:com.abiansoftware.lib.reader.AbianReaderApplication.java
@Override public void onCreate() { s_singleton = this; ImageLoader theImageLoader = ImageLoader.getInstance(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) .threadPoolSize(4).threadPriority(Thread.NORM_PRIORITY - 1).memoryCacheSize(2 * 1024 * 1024) .denyCacheImageMultipleSizesInMemory() //.enableLogging() .build();/*w w w.j a v a2 s. c o m*/ theImageLoader.init(config); s_asyncHttpClient = new AsyncHttpClient(); s_asyncHttpClient.getHttpClient().getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true); m_data = new AbianReaderData(); m_dataFetcher = new AbianReaderDataFetcher(); WindowManager theWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); Display theDefaultDisplay = theWindowManager.getDefaultDisplay(); DisplayMetrics theDisplayMetrics = new DisplayMetrics(); theDefaultDisplay.getMetrics(theDisplayMetrics); s_width = theDisplayMetrics.widthPixels; s_height = theDisplayMetrics.heightPixels; m_handlerVector = new Vector<Handler>(); m_adapterVector = new Vector<BaseAdapter>(); m_bSplashScreenHasBeenShown = false; m_readUrlArrayList = null; loadReadUrlList(); super.onCreate(); }
From source file:com.example.android.animationsdemo.BoardFragment.java
public void createCol() { int colNo = board.getColNo(); Log.i("colNo", "colNo=" + colNo); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size);/* ww w . j av a 2 s. c om*/ int width = size.x; int height = size.y; Log.i("conditions", "codition start=" + Math.max(0, start) + "\n check = " + Math.min(start + MAX_COL_DISPLAYED, board.getColNo()) + "in createCOl"); for (int i = Math.max(0, start); i < Math.min(start + MAX_COL_DISPLAYED, board.getColNo()); i++) { LayoutInflater inflater = LayoutInflater.from(context); View columnView = inflater.inflate(R.layout.columns_layout, null, false); LinearLayout ll = (LinearLayout) columnView.findViewById(R.id.ll); ll.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f / MAX_COL_DISPLAYED)); TextView tv = (TextView) columnView.findViewById(R.id.tv); tv.setText(board.getColName(i)); Button addCard = (Button) columnView.findViewById(R.id.addCard); LinearLayout cardContainerLayout = (LinearLayout) columnView.findViewById(R.id.cardContainer); cardContainerLayout.setTag("col" + board.getColName(i)); cardContainerLayout.setId(position); cardContainerLayout.setMinimumHeight(height); cardContainerLayout.setMinimumWidth(width / MAX_COL_DISPLAYED); Log.i("Drag", "Calling drag constructor "); cardContainerLayout.setOnDragListener(new MyDragListener(rootViewGroup)); Log.i("Drag", "Drag Constructor Called "); addCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { BoardFragment.this.addItem(view); } }); //cardContainerLayout.setLayoutTransition(new LayoutTransition()); rootViewGroup.addView(columnView); } }
From source file:com.inductivebiblestudyapp.ui.dialogs.SimpleTooltipDialog.java
/** * Returns screen size in size 2 array./* w ww . j a v a2 s . c o m*/ * Taken directly from: * https://github.com/kvirair/Quick-Action/blob/master/src/garin/artemiy/quickaction/library/QuickAction.java * @param dimens 0 will become X size, 1 Y size. */ @SuppressWarnings("deprecation") protected void getScreenDimens(int[] dimens) { if (dimens.length < 2) { throw new IllegalArgumentException("Cannot store result in length <2"); } final int X = 0; final int Y = 1; WindowManager windowManager = (WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { Display display = windowManager.getDefaultDisplay(); Point size = new Point(); display.getSize(size); dimens[X] = size.x; dimens[Y] = size.y; } else { dimens[X] = windowManager.getDefaultDisplay().getWidth(); dimens[Y] = windowManager.getDefaultDisplay().getHeight(); } }
From source file:com.golden.android.eyecare.ForegroundService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { ////w ww . ja v a 2 s . c om //Do nothing If you already exist Manager if (mFloatingViewManager != null) { return START_REDELIVER_INTENT; } final DisplayMetrics metrics = new DisplayMetrics(); final WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); windowManager.getDefaultDisplay().getMetrics(metrics); final LayoutInflater inflater = LayoutInflater.from(this); // Vibrator v = (Vibrator) this.getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE); // // Vibrate for 500 milliseconds // v.vibrate(1000); // if(intent.getExtras()==null) // { // // } // else { // Boolean data = (Boolean) intent.getExtras().getBoolean("noticlick"); // // if (data) { // // launchCount(); // //Do your stuff here mate :) // } // } final ImageView iconView = (ImageView) inflater.inflate(R.layout.floating, null, false); iconView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // ? // final Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", getString(R.string.mail_address), null)); // intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.mail_title)); // intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.mail_content)); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // startActivity(intent); launchCount(); } }); // String ToastString = getString(R.string.Toasttext1) + " " + checkTime() + " " + getString(R.string.Toasttext2); // Toast toast = Toast.makeText(getApplicationContext(), ToastString, Toast.LENGTH_SHORT); //// Set the Gravity to Top and Left // toast.setGravity(Gravity.TOP | Gravity.LEFT, 100, 200); // toast.setDuration(Toast.LENGTH_LONG); // // ViewGroup group = (ViewGroup) toast.getView(); // TextView messageTextView = (TextView) group.getChildAt(0); // messageTextView.setTextSize(20); // toast.show(); mFloatingViewManager = new FloatingViewManager(this, this); mFloatingViewManager.setFixedTrashIconImage(R.drawable.ic_trash_fixed); mFloatingViewManager.setActionTrashIconImage(R.drawable.ic_trash_action); // Setting Options(you can change options at any time) loadDynamicOptions(); // Initial Setting Options (you can't change options after created.) final FloatingViewManager.Options options = loadOptions(metrics); mFloatingViewManager.addViewToWindow(iconView, options); mFloatingViewManager.setDisplayMode(FloatingViewManager.DISPLAY_MODE_SHOW_ALWAYS); notify(intent); return START_REDELIVER_INTENT; }
From source file:com.gitstudy.rili.liarbry.YearViewSelectLayout.java
/** * /*from w w w. j a v a 2 s . c o m*/ * * @param context context * @param view view * @return ? */ private static int getHeight(Context context, View view) { WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); assert manager != null; Display display = manager.getDefaultDisplay(); int h = display.getHeight(); int[] location = new int[2]; view.getLocationInWindow(location); view.getLocationOnScreen(location); return h - location[1]; }