Example usage for android.graphics Point Point

List of usage examples for android.graphics Point Point

Introduction

In this page you can find the example usage for android.graphics Point Point.

Prototype

public Point() 

Source Link

Usage

From source file:com.example.androidmillgame.GamePanel.java

public GamePanel(Context context, long period) {
    super(context);
    this.period = period;

    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display wsize = wm.getDefaultDisplay();
    Point size = new Point();
    wsize.getSize(size);/*w w w .j a  v a2 s  .  com*/
    DisplayMetrics displayMetrics = new DisplayMetrics();
    wsize.getMetrics(displayMetrics);
    this.dpi = displayMetrics.densityDpi;
    this.PWIDTH = size.x;
    this.PHEIGHT = size.y;

    setFocusable(true);
    requestFocus();// ...............................................the.JPane.now.has.focus,.so.receives.key.events
    imgres = new Images(context);// ..............................................................preload.resources
    generatedJoints = new SmartJointFactory(context);
    DraggablePoint = new DragPlayer();
    backgroundRect = new Rect(PWIDTH / 2 - PHEIGHT / 2, 0, PWIDTH / 2 + PHEIGHT / 2, PHEIGHT);
    background = new Rect(0, 0, imgres.getImage("background").getWidth(),
            imgres.getImage("background").getHeight());
    scale = imgres.getImage("background").getHeight() / PHEIGHT;
    int resumescaled = imgres.getImage("resumenop").getWidth();
    resumeRect = new Rect(PWIDTH / 2 - resumescaled / 2, PHEIGHT / 2 - resumescaled / 2 + Pd2px.pd2px(50),
            PWIDTH / 2 + resumescaled / 2, PHEIGHT / 2 + resumescaled / 2 + Pd2px.pd2px(50));
    GC = new GameController(generatedJoints.Joints, DraggablePoint, context);
    Display = new HUD(PWIDTH / 2, PHEIGHT / 2, imgres.getImage("hud"));
    this.startGame();
}

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;//from  w ww. jav a  2s . c o  m
}

From source file:com.breadwallet.BreadWalletApp.java

@Override
public void onCreate() {
    super.onCreate();

    WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);// w  w  w .  j  a v a 2s .co  m
    int DISPLAY_WIDTH_PX = size.x;
    DISPLAY_HEIGHT_PX = size.y;
    mFingerprintManager = (FingerprintManager) getSystemService(Context.FINGERPRINT_SERVICE);

}

From source file:io.appium.uiautomator2.core.AccessibilityNodeInfoDumper.java

private void addDisplayInfo() throws IOException {
    Display display = UiAutomatorBridge.getInstance().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);//from w  w  w .ja v  a2 s . c o m
    serializer.attribute(NAMESPACE, "rotation", Integer.toString(display.getRotation()));
    serializer.attribute(NAMESPACE, "width", Integer.toString(size.x));
    serializer.attribute(NAMESPACE, "height", Integer.toString(size.y));
}

From source file:com.qs.qswlw.view.Mypager.UltraViewPager.java

public UltraViewPager(Context context) {
    super(context);
    size = new Point();
    maxSize = new Point();
    initView();
}

From source file:com.kmagic.solitaire.DrawMaster.java

/**
 * Create a new instance of DrawMaster/*from   w w w  .jav a2 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.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 . ja v a2  s .  c  o m*/
    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.paperpad.mybox.GcmBroadcastReceiver.java

/**
* Sends the registration ID to your server over HTTP, so it can use GCM/HTTP
* or CCS to send messages to your app. Not needed for this demo since the
* device sends upstream messages to a server that echoes back the message
* using the 'from' address in the message.
 * @param regId //w  w  w.  java  2 s . co m
*/
private void sendRegistrationIdToBackend(Context context, String regId) {
    int id_menu = 0;
    String application_unique_identifier = Installation.id(context);
    String application_version = "0.2.8";
    try {
        application_version = context.getPackageManager().getPackageInfo(context.getPackageName(),
                0).versionName;
    } catch (NameNotFoundException e) {

        e.printStackTrace();
    }
    ;

    String device_type = "";
    boolean isTablet = context.getResources().getBoolean(R.bool.isTablet);
    if (isTablet) {
        device_type = "tablet";
    } else {
        device_type = "smartphone";
    }
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {

        display.getSize(size);
    } else {
        size.x = display.getWidth(); // deprecated
        size.y = display.getHeight();
    }

    String device_screen_resolution = size.x + "x" + size.y;

    //      ArrayList<AppHit> hits = new ArrayList<AppHit>();
    AppSession appSession = new AppSession(id_menu, "production", "MyBox", application_unique_identifier,
            application_version, regId, Build.MANUFACTURER, Build.MODEL, "android", device_screen_resolution, 5,
            Build.VERSION.SDK_INT + "", device_type, "", System.currentTimeMillis() / 1000,
            System.currentTimeMillis() / 1000, null);
    ArrayList<AppSession> appSessions = new ArrayList<AppSession>();
    appSessions.add(appSession);
    AppJsonWriter appJsonWriter = new AppJsonWriter();
    String str = appJsonWriter.writeJson(appSessions);
    String endpoint = SERVER_URL;
    String body = str;
    int status = 0;
    try {
        status = AppJsonWriter.post(endpoint, body);
    } catch (IOException e) {
        Log.e("GcmBroadcastReceiver", "request couldn't be sent " + status);
        e.printStackTrace();
    }
}

From source file:com.paperpad.MoulinsDuDuc.GcmBroadcastReceiver.java

/**
* Sends the registration ID to your server over HTTP, so it can use GCM/HTTP
* or CCS to send messages to your app. Not needed for this demo since the
* device sends upstream messages to a server that echoes back the message
* using the 'from' address in the message.
 * @param regId /*  w ww.  j a v a  2 s  . c  o  m*/
*/
private void sendRegistrationIdToBackend(Context context, String regId) {
    int id_menu = 0;
    String application_unique_identifier = Installation.id(context);
    String application_version = "0.2.8";
    try {
        application_version = context.getPackageManager().getPackageInfo(context.getPackageName(),
                0).versionName;
    } catch (NameNotFoundException e) {

        e.printStackTrace();
    }
    ;

    String device_type = "";
    boolean isTablet = context.getResources().getBoolean(R.bool.isTablet);
    if (isTablet) {
        device_type = "tablet";
    } else {
        device_type = "smartphone";
    }
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {

        display.getSize(size);
    } else {
        size.x = display.getWidth(); // deprecated
        size.y = display.getHeight();
    }

    String device_screen_resolution = size.x + "x" + size.y;

    //      ArrayList<AppHit> hits = new ArrayList<AppHit>();
    AppSession appSession = new AppSession(id_menu, "production", "MyBox", application_unique_identifier,
            application_version, regId, android.os.Build.MANUFACTURER, android.os.Build.MODEL, "android",
            device_screen_resolution, 5, android.os.Build.VERSION.SDK_INT + "", device_type, "",
            System.currentTimeMillis() / 1000, System.currentTimeMillis() / 1000, null);
    ArrayList<AppSession> appSessions = new ArrayList<AppSession>();
    appSessions.add(appSession);
    AppJsonWriter appJsonWriter = new AppJsonWriter();
    String str = appJsonWriter.writeJson(appSessions);
    String endpoint = SERVER_URL;
    String body = str;
    int status = 0;
    try {
        status = AppJsonWriter.post(endpoint, body);
    } catch (IOException e) {
        Log.e("GcmBroadcastReceiver", "request couldn't be sent " + status);
        e.printStackTrace();
    }
}