Android Point - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Point class.

This code example shows how to use the following methods:getSize
        return getDisplaySize().x;
    } 
 
    @Override 
    public Point getDisplaySize() {
        Point dimensions = new Point();
        ((WindowManager) CgeoApplication.getInstance().getSystemService(Context.WINDOW_SERVICE))
                .getDefaultDisplay().getSize(dimensions);
        return dimensions;
    } 
 
} 
8
CodeRank
This code example shows how to use the following methods:
        } 
        return bitmap;
    } 
 
    public static void provideWidthAndHeightHints(Uri uri, int width, int height) {
        widthAndHeightMap.put(uri.toString(), new Point(width, height));
    } 
 
    public static void provideWidthAndHeightHints(int resourceId, int width, int height) {
        widthAndHeightMap.put("resource:" + getResourceName(resourceId), new Point(width, height));
    } 
 
    public static void provideWidthAndHeightHints(String file, int width, int height) {
        widthAndHeightMap.put("file:" + file, new Point(width, height));
    } 
 
    private static String stringify(BitmapFactory.Options options) {
        if (options == null) return "";
        List<String> opts = new ArrayList<String>();
 
8
CodeRank
This code example shows how to use the following methods:
 
        RandomAccessFile file = null;
        try { 
            file = new RandomAccessFile(imagePath, "r");
            BitmapFactory.decodeFileDescriptor(file.getFD(), null, options);
            return new Point(options.outWidth, options.outHeight);
        } catch (IOException e) {
            Log.d(TAG, e.getMessage(), e);
            return null; 
        } finally { 
            if (file != null)
                try { 
                    file.close();
                } catch (IOException e) {
                    Log.d(TAG, e.getMessage(), e);
                } 
        } 
    } 
 
    /** 
8
CodeRank
This code example shows how to use the following methods:
    return this;
  } 
 
  public DisplayAssert hasSize(int width, int height) {
    isNotNull(); 
    Point actualSize = new Point();
    actual.getSize(actualSize);
    assertThat(actualSize.x) //
        .overridingErrorMessage("Expected size of <%s, %s> but was <%s, %s>", width, height,
            actualSize.x, actualSize.y) //
        .isEqualTo(width);
    assertThat(actualSize.y) //
        .overridingErrorMessage("Expected size of <%s, %s> but was <%s, %s>", width, height,
            actualSize.x, actualSize.y) //
        .isEqualTo(height);
    return this;
  } 
 
  public DisplayAssert hasWidth(int width) {
    isNotNull(); 
8
CodeRank
This code example shows how to use the following methods:
  private View.OnLongClickListener onLongClickListener;
  private View.OnFocusChangeListener onFocusChangeListener;
  private boolean wasInvalidated;
  private View.OnTouchListener onTouchListener;
  protected AttributeSet attributeSet;
  public Point scrollToCoordinates = new Point();
  private boolean didRequestLayout;
  private MotionEvent lastTouchEvent;
  private boolean attachedToWindow;
  private float scaleX = 1.0f;
  private float scaleY = 1.0f;
  private int hapticFeedbackPerformed = -1;
  private boolean onLayoutWasCalled;
 
  public void __constructor__(Context context, AttributeSet attributeSet, int defStyle) {
    if (context == null) throw new NullPointerException("no context");
 
    this.attributeSet = attributeSet;
 
    getConstructor(View.class, realView, Context.class, AttributeSet.class, int.class)
8
CodeRank
This code example shows how to use the following methods:equals
 
    private void runDisplaySize() throws Exception { 
        String size = nextArg();
        int w, h;
        if (size == null) {
            Point initialSize = new Point();
            Point baseSize = new Point();
            try { 
                mWm.getInitialDisplaySize(Display.DEFAULT_DISPLAY, initialSize);
                mWm.getBaseDisplaySize(Display.DEFAULT_DISPLAY, baseSize);
                System.out.println("Physical size: " + initialSize.x + "x" + initialSize.y);
                if (!initialSize.equals(baseSize)) {
                    System.out.println("Override size: " + baseSize.x + "x" + baseSize.y);
                } 
            } catch (RemoteException e) {
            } 
            return; 
        } else if ("reset".equals(size)) {
            w = h = -1;
        } else { 
7
CodeRank
This code example shows how to use the following methods:
    path = getTrianglePath(new Point(0, 0), (int) (15 * density));
    canvas.drawPath(path, DEBUG_PAINT);
  } 
 
  private static Path getTrianglePath(Point p1, int width) {
    Point p2 = new Point(p1.x + width, p1.y);
    Point p3 = new Point(p1.x, p1.y + width);
 
    Path path = new Path();
    path.moveTo(p1.x, p1.y);
    path.lineTo(p2.x, p2.y);
    path.lineTo(p3.x, p3.y);
 
    return path;
  } 
} 
8
CodeRank
This code example shows how to use the following methods:
 *  
 * @author Cyril Mottier 
 */ 
public final class MapViewUtils { 
 
    private static final Point TEMP_POINT = new Point();
 
    private MapViewUtils() { 
    } 
 
    /** 
     * Animated equivalent to {@link MapController#scrollBy(int, int)}. Scroll 
     * by a given amount using the default animation, in pixels. 
     * <p> 
     * <strong>Limitations</strong>: This method internally uses 
     * {@link MapController#animateTo(com.google.android.maps.GeoPoint)} which 
     * doesn't animate anything if the point is really far (in pixels) from the 
     * current point. In this case, nothing will be animated at all. 
     *  
     * @param mapView The {@link MapView} to scroll 
7
CodeRank
This code example shows how to use the following methods:
	public void draw(Canvas canvas, MapView mapView, boolean shadow) {
		if (shadow) {
			return; 
		} 
		Projection projection = mapView.getProjection();
		Point point = new Point();
		projection.toPixels(geoPointMarienplatz, point);
		canvas.drawBitmap(bitmap, point.x, point.y, null);
		if (geoPointCurrent != null) {
			Point pointCurrent = new Point();
			projection.toPixels(geoPointCurrent, pointCurrent);
			canvas.drawLine(point.x, point.y, pointCurrent.x, pointCurrent.y,
					paintLine);
		} 
	} 
 
	public void setGeoPointCurrent(GeoPoint geoPointCurrent) {
		this.geoPointCurrent = geoPointCurrent;
	} 
 
7
CodeRank
This code example shows how to use the following methods:
 
        RandomAccessFile file = null;
        try { 
            file = new RandomAccessFile(imagePath, "r");
            BitmapFactory.decodeFileDescriptor(file.getFD(), null, options);
            return new Point(options.outWidth, options.outHeight);
        } catch (IOException e) {
            Ln.d(e, "Could not get size.");
            return null; 
        } finally { 
            if (file != null)
                try { 
                    file.close();
                } catch (IOException e) {
                    Ln.d(e, "Could not get size.");
                } 
        } 
    } 
 
    /** 
8
CodeRank

Related Android Point Questions & Answers:

See Code Examples for Android Point Methods: