All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.android.sdklib.devices.Screen Maven / Gradle / Ivy

/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.sdklib.devices;

import com.android.resources.Density;
import com.android.resources.ScreenRatio;
import com.android.resources.ScreenSize;
import com.android.resources.TouchScreen;


public class Screen {
    private ScreenSize mScreenSize;
    private double mDiagonalLength;
    private Density mPixelDensity;
    private ScreenRatio mScreenRatio;
    private int mXDimension;
    private int mYDimension;
    private double mXdpi;
    private double mYdpi;
    private Multitouch mMultitouch;
    private TouchScreen mMechanism;
    private ScreenType mScreenType;

    public ScreenSize getSize() {
        return mScreenSize;
    }

    public void setSize(ScreenSize s) {
        mScreenSize = s;
    }

    public double getDiagonalLength() {
        return mDiagonalLength;
    }

    public void setDiagonalLength(double diagonalLength) {
        mDiagonalLength = diagonalLength;
    }

    public Density getPixelDensity() {
        return mPixelDensity;
    }

    public void setPixelDensity(Density pDensity) {
        mPixelDensity = pDensity;
    }

    public ScreenRatio getRatio() {
        return mScreenRatio;
    }

    public void setRatio(ScreenRatio ratio) {
        mScreenRatio = ratio;
    }

    public int getXDimension() {
        return mXDimension;
    }

    public void setXDimension(int xDimension) {
        mXDimension = xDimension;
    }

    public int getYDimension() {
        return mYDimension;
    }

    public void setYDimension(int yDimension) {
        mYDimension = yDimension;
    }

    public double getXdpi() {
        return mXdpi;
    }

    public void setXdpi(double xdpi) {
        mXdpi = xdpi;
    }

    public double getYdpi() {
        return mYdpi;
    }

    public void setYdpi(double ydpi) {
        mYdpi = ydpi;
    }

    public Multitouch getMultitouch() {
        return mMultitouch;
    }

    public void setMultitouch(Multitouch m) {
        mMultitouch = m;
    }

    public TouchScreen getMechanism() {
        return mMechanism;
    }

    public void setMechanism(TouchScreen mechanism) {
        mMechanism = mechanism;
    }

    public ScreenType getScreenType() {
        return mScreenType;
    }

    public void setScreenType(ScreenType screenType) {
        mScreenType = screenType;
    }

    /**
     * Returns a copy of the object that shares no state with it,
     * but is initialized to equivalent values.
     *
     * @return A copy of the object.
     */
    public Screen deepCopy() {
        Screen s = new Screen();
        s.mScreenSize = mScreenSize;
        s.mDiagonalLength = mDiagonalLength;
        s.mPixelDensity = mPixelDensity;
        s.mScreenRatio = mScreenRatio;
        s.mXDimension = mXDimension;
        s.mYDimension = mYDimension;
        s.mXdpi = mXdpi;
        s.mYdpi = mYdpi;
        s.mMultitouch = mMultitouch;
        s.mMechanism = mMechanism;
        s.mScreenType = mScreenType;
        return s;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof Screen)) {
            return false;
        }
        Screen s = (Screen) o;
        return s.mScreenSize == mScreenSize
                && s.mDiagonalLength == mDiagonalLength
                && s.mPixelDensity == mPixelDensity
                && s.mScreenRatio == mScreenRatio
                && s.mXDimension == mXDimension
                && s.mYDimension == mYDimension
                && s.mXdpi == mXdpi
                && s.mYdpi == mYdpi
                && s.mMultitouch == mMultitouch
                && s.mMechanism == mMechanism
                && s.mScreenType == mScreenType;
    }

    @Override
    public int hashCode() {
        int hash = 17;
        hash = 31 * hash + mScreenSize.ordinal();
        long f = Double.doubleToLongBits(mDiagonalLength);
        hash = 31 * hash + (int) (f ^ (f >>> 32));
        hash = 31 * hash + mPixelDensity.ordinal();
        hash = 31 * hash + mScreenRatio.ordinal();
        hash = 31 * hash + mXDimension;
        hash = 31 * hash + mYDimension;
        f = Double.doubleToLongBits(mXdpi);
        hash = 31 * hash + (int) (f ^ (f >>> 32));
        f = Double.doubleToLongBits(mYdpi);
        hash = 31 * hash + (int) (f ^ (f >>> 32));
        hash = 31 * hash + mMultitouch.ordinal();
        hash = 31 * hash + mMechanism.ordinal();
        hash = 31 * hash + mScreenType.ordinal();
        return hash;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy