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;
}
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);
}
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());
}
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;
}
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;
}
Aggregations