Search in sources :

Example 46 with WindowManager

use of android.view.WindowManager in project nmid-headline by miao1007.

the class ScreenUtils method getScreenWidth.

public static int getScreenWidth(Context c) {
    if (screenWidth == 0) {
        WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE);
        Display display = wm.getDefaultDisplay();
        Point size = new Point();
        display.getSize(size);
        screenWidth = size.x;
    }
    return screenWidth;
}
Also used : Point(android.graphics.Point) WindowManager(android.view.WindowManager) Display(android.view.Display)

Example 47 with WindowManager

use of android.view.WindowManager in project zxing-lib by kennydude.

the class CameraConfigurationManager method initFromCameraParameters.

/**
   * Reads, one time, values from the camera that are needed by the app.
   */
void initFromCameraParameters(Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    int width = display.getWidth();
    int height = display.getHeight();
    // when waking from sleep. If it's not landscape, assume it's mistaken and reverse them:
    if (width < height) {
        Log.i(TAG, "Display reports portrait orientation; assuming this is incorrect");
        int temp = width;
        width = height;
        height = temp;
    }
    screenResolution = new Point(width, height);
    Log.i(TAG, "Screen resolution: " + screenResolution);
    cameraResolution = findBestPreviewSizeValue(parameters, screenResolution);
    Log.i(TAG, "Camera resolution: " + cameraResolution);
}
Also used : Camera(android.hardware.Camera) Point(android.graphics.Point) Point(android.graphics.Point) WindowManager(android.view.WindowManager) Display(android.view.Display)

Example 48 with WindowManager

use of android.view.WindowManager in project Signal-Android by WhisperSystems.

the class WebRtcCallScreen method setPersonInfo.

private void setPersonInfo(@NonNull final Recipient recipient) {
    this.recipient = recipient;
    this.recipient.addListener(this);
    final Context context = getContext();
    new AsyncTask<Void, Void, ContactPhoto>() {

        @Override
        protected ContactPhoto doInBackground(Void... params) {
            DisplayMetrics metrics = new DisplayMetrics();
            WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
            Uri contentUri = ContactsContract.Contacts.lookupContact(context.getContentResolver(), recipient.getContactUri());
            windowManager.getDefaultDisplay().getMetrics(metrics);
            return ContactPhotoFactory.getContactPhoto(context, contentUri, null, metrics.widthPixels);
        }

        @Override
        protected void onPostExecute(final ContactPhoto contactPhoto) {
            WebRtcCallScreen.this.photo.setImageDrawable(contactPhoto.asCallCard(context));
        }
    }.execute();
    this.name.setText(recipient.getName());
    this.phoneNumber.setText(recipient.getNumber());
}
Also used : Context(android.content.Context) ContactPhoto(org.thoughtcrime.securesms.contacts.avatars.ContactPhoto) DisplayMetrics(android.util.DisplayMetrics) Uri(android.net.Uri) WindowManager(android.view.WindowManager)

Example 49 with WindowManager

use of android.view.WindowManager in project SmartAndroidSource by jaychou2012.

the class Utils method getDisplayHeight.

public static int getDisplayHeight(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    @SuppressWarnings("deprecation") int displayHeight = wm.getDefaultDisplay().getHeight();
    return displayHeight;
}
Also used : WindowManager(android.view.WindowManager)

Example 50 with WindowManager

use of android.view.WindowManager in project Android-Developers-Samples by johnjohndoe.

the class DefaultCardStreamAnimator method getAppearingAnimator.

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
@Override
public ObjectAnimator getAppearingAnimator(Context context) {
    final Point outPoint = new Point();
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    wm.getDefaultDisplay().getSize(outPoint);
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(new Object(), PropertyValuesHolder.ofFloat("alpha", 0.f, 1.f), PropertyValuesHolder.ofFloat("translationY", outPoint.y / 2.f, 0.f), PropertyValuesHolder.ofFloat("rotation", -45.f, 0.f));
    animator.setDuration((long) (200 * mSpeedFactor));
    return animator;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Point(android.graphics.Point) WindowManager(android.view.WindowManager) TargetApi(android.annotation.TargetApi)

Aggregations

WindowManager (android.view.WindowManager)409 Display (android.view.Display)185 Point (android.graphics.Point)129 DisplayMetrics (android.util.DisplayMetrics)103 View (android.view.View)43 IWindowManager (android.view.IWindowManager)37 Context (android.content.Context)36 Resources (android.content.res.Resources)25 ImageView (android.widget.ImageView)24 Configuration (android.content.res.Configuration)20 SuppressLint (android.annotation.SuppressLint)19 Camera (android.hardware.Camera)17 Intent (android.content.Intent)16 Rect (android.graphics.Rect)16 RemoteException (android.os.RemoteException)15 LayoutParams (android.view.WindowManager.LayoutParams)15 TextView (android.widget.TextView)15 Dialog (android.app.Dialog)14 Method (java.lang.reflect.Method)12 PackageManager (android.content.pm.PackageManager)11