List of usage examples for android.view Display getHeight
@Deprecated public int getHeight()
From source file:com.example.android.apis.graphics.FingerPaint.java
private Bitmap loadBitmap() { SharedPreferences shre = PreferenceManager.getDefaultSharedPreferences(this); String previouslyEncodedImage = shre.getString("paint_image_data", ""); if (!previouslyEncodedImage.equalsIgnoreCase("")) { byte[] b = Base64.decode(previouslyEncodedImage, Base64.DEFAULT); Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length); Bitmap mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true); return mutableBitmap; }//from w ww . j a v a 2 s. c o m Display display = getWindowManager().getDefaultDisplay(); @SuppressWarnings("deprecation") int width = display.getWidth(); @SuppressWarnings("deprecation") int height = display.getHeight(); Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); return bitmap; }
From source file:pt.carlos.alex.rosario.MainActivity.java
/** * Detecta a orientao do cran.//w w w . java 2s . c om * * Utiliza mtodos Deprecated, para garantir a retro compatibilidade com API * Level < 13 (Honeycomb) * * @return True se o cran estiver orientado em Landscape */ @SuppressWarnings("deprecation") private boolean isLandscape() { Display getOrient = getWindowManager().getDefaultDisplay(); if (V.DEBUG) { Log.d(TAG, "Screen Size - Width: " + getOrient.getWidth() + "; Heigth: " + getOrient.getHeight()); } return !(getOrient.getWidth() < getOrient.getHeight()); }
From source file:org.acra.collector.DisplayManagerCollector.java
@NonNull private Object collectDisplayData(@NonNull Display display) { final DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics);/* w w w .j a v a 2 s .co m*/ //noinspection deprecation return collectCurrentSizeRange(display) + collectFlags(display) + display.getDisplayId() + ".height=" + display.getHeight() + '\n' + collectMetrics(display) + collectName(display) + display.getDisplayId() + ".orientation=" + display.getRotation() + '\n' + display.getDisplayId() + ".pixelFormat=" + display.getPixelFormat() + '\n' + collectRealMetrics(display) + collectRealSize(display) + collectRectSize(display) + display.getDisplayId() + ".refreshRate=" + display.getRefreshRate() + '\n' + collectRotation(display) + collectSize(display) + display.getDisplayId() + ".width=" + display.getWidth() + '\n' + collectIsValid(display); }
From source file:com.nikola.despotoski.drawerlayoutedgetoggle.DrawerLayoutEdgeToggle.java
@SuppressLint("NewApi") @SuppressWarnings("deprecation") private int getScreenHeight() { Point size = new Point(); WindowManager w = mActivity.getWindowManager(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { w.getDefaultDisplay().getSize(size); return size.y; } else {//w ww . j a va2s.co m Display d = w.getDefaultDisplay(); return d.getHeight(); } }
From source file:com.color.kid.kidpaint.activity.OptionsActivity.java
protected void initialiseNewBitmap(Drawable drawable) { Display display = getWindowManager().getDefaultDisplay(); float width = display.getWidth(); float height = display.getHeight(); Bitmap bitmap = Bitmap.createBitmap((int) width + 200, (int) height, Bitmap.Config.ARGB_8888); bitmap.eraseColor(Color.WHITE); PaintroidApplication.drawingSurface//from www . j a va 2 s . c o m .resetBitmap(Util.overlay(bitmap, Util.drawableToBitmap(drawable, this))); PaintroidApplication.perspective.resetScaleAndTranslation(); mCurrentTool = new DrawTool(this, ToolType.BRUSH); PaintroidApplication.currentTool = mCurrentTool; PaintroidApplication.currentTool.resetInternalState(Tool.StateChange.NEW_IMAGE_LOADED); PaintroidApplication.isPlainImage = true; PaintroidApplication.isSaved = false; PaintroidApplication.savedPictureUri = null; }
From source file:com.bydavy.card.receipts.fragments.PreviewPictureFragment.java
private void updateView(Cursor c) { final boolean hasReceipt = ((c != null) && c.moveToFirst()); if (hasReceipt) { final int picturePathColumnIndex = c.getColumnIndex(Receipts.COLUMN_NAME_PICTURE_PATH); mPicturePath = c.getString(picturePathColumnIndex); final Display display = getActivity().getWindowManager().getDefaultDisplay(); // Cancel picture task if (mViewPictureWorker != null) { mViewPictureWorker.cancel(true); }/*from w ww. j a v a 2 s . c o m*/ mViewPictureWorker = new BitmapWorkerTask(mPicture, display.getWidth(), display.getHeight()) { @Override protected void onPostExecute(Bitmap bitmap) { super.onPostExecute(bitmap); if (getState() != StateFragmentListener.STATE_COMPLETED) { setState(StateFragmentListener.STATE_COMPLETED); } } }; mViewPictureWorker.execute(mPicturePath); } }
From source file:com.farmerbb.taskbar.activity.DashboardActivity.java
@SuppressWarnings("deprecation") @Override//from w w w . ja v a 2 s. c o m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); contextMenuFix = getIntent().hasExtra("context_menu_fix"); // Detect outside touches, and finish the activity when one is detected getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL); getWindow().setFlags(WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH); DisplayManager dm = (DisplayManager) getSystemService(DISPLAY_SERVICE); Display display = dm.getDisplay(Display.DEFAULT_DISPLAY); setContentView(R.layout.incognito); LinearLayout layout = (LinearLayout) findViewById(R.id.incognitoLayout); layout.setLayoutParams(new FrameLayout.LayoutParams(display.getWidth(), display.getHeight())); LocalBroadcastManager.getInstance(this).registerReceiver(addWidgetReceiver, new IntentFilter("com.farmerbb.taskbar.ADD_WIDGET_REQUESTED")); LocalBroadcastManager.getInstance(this).registerReceiver(removeWidgetReceiver, new IntentFilter("com.farmerbb.taskbar.REMOVE_WIDGET_REQUESTED")); LocalBroadcastManager.getInstance(this).registerReceiver(finishReceiver, new IntentFilter("com.farmerbb.taskbar.DASHBOARD_DISAPPEARING")); if (!DashboardHelper.getInstance().isDashboardOpen()) finish(); }
From source file:edu.berkeley.boinc.ProjectDetailsFragment.java
@SuppressWarnings("deprecation") @Override//from w w w .j a v a 2 s. com public void onAttach(Activity activity) { // first time fragment can get a valid context (before this, getActivity() will return null!) Display display = activity.getWindowManager().getDefaultDisplay(); width = display.getWidth(); height = display.getHeight(); super.onAttach(activity); }
From source file:io.github.importre.android.chromeadb.ChromeAdbService.java
@SuppressLint("NewApi") private void setCursorPosToCenter() { if (mWindowManager == null || mCursorImage == null) { return;/* www . j a v a2s . c om*/ } Display display = mWindowManager.getDefaultDisplay(); int x, y; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { Point size = new Point(); display.getSize(size); x = size.x; y = size.y; } else { x = display.getWidth(); y = display.getHeight(); } move(x >> 1, y >> 1); }
From source file:br.com.bioscada.apps.biotracks.fragments.MarkerDetailFragment.java
/** * Updates the UI./*from w ww .j a v a 2 s . c o m*/ */ @SuppressWarnings("deprecation") private void updateUi() { View waypointView = getView().findViewById(R.id.marker_detail_waypoint); View statisticsView = getView().findViewById(R.id.marker_detail_statistics); boolean isWaypoint = waypoint.getType() == Waypoint.WaypointType.WAYPOINT; waypointView.setVisibility(isWaypoint ? View.VISIBLE : View.GONE); statisticsView.setVisibility(isWaypoint ? View.GONE : View.VISIBLE); if (isWaypoint) { String photoUrl = waypoint.getPhotoUrl(); boolean hasPhoto = photoUrl != null && !photoUrl.equals(""); photo.setVisibility(hasPhoto ? View.VISIBLE : View.GONE); textGradient.setVisibility(hasPhoto ? View.VISIBLE : View.GONE); waypointInfo.setVisibility(View.VISIBLE); if (hasPhoto) { handler.removeCallbacks(hideText); Display defaultDisplay = getActivity().getWindowManager().getDefaultDisplay(); PhotoUtils.setImageVew(photo, Uri.parse(photoUrl), defaultDisplay.getWidth(), defaultDisplay.getHeight(), true); handler.postDelayed(hideText, HIDE_TEXT_DELAY); } setName(R.id.marker_detail_waypoint_name, hasPhoto); TextView category = (TextView) getView().findViewById(R.id.marker_detail_waypoint_category); ListItemUtils.setTextView(getActivity(), category, StringUtils.getCategory(waypoint.getCategory()), hasPhoto); TextView description = (TextView) getView().findViewById(R.id.marker_detail_waypoint_description); ListItemUtils.setTextView(getActivity(), description, waypoint.getDescription(), hasPhoto); setLocation(R.id.marker_detail_waypoint_location, hasPhoto); } else { setName(R.id.marker_detail_statistics_name, false); setLocation(R.id.marker_detail_statistics_location, false); Track track = myTracksProviderUtils.getTrack(waypoint.getTrackId()); ActivityType activityType = track != null ? CalorieUtils.getActivityType(getActivity(), track.getCategory()) : ActivityType.INVALID; StatsUtils.setTripStatisticsValues(getActivity(), null, getView(), waypoint.getTripStatistics(), activityType, null); StatsUtils.setLocationValues(getActivity(), null, getView(), waypoint.getLocation(), false); } }