@@ -112,74 +112,68 @@ public static float getScreenDensity() {
112112 public static int getScreenDensityDpi () {
113113 return Resources .getSystem ().getDisplayMetrics ().densityDpi ;
114114 }
115-
116-
117-
118-
115+
119116 /**
120- * Return X (width) of the screen expressed as dots-per-inch .
117+ * Return the exact physical pixels per inch of the screen in the Y dimension .
121118 *
122- * @return the width of screen density expressed as dots-per-inch
119+ * @return the exact physical pixels per inch of the screen in the Y dimension
123120 */
124- public static int getScreenXDpi () {
121+ public static float getScreenXDpi () {
125122 return Resources .getSystem ().getDisplayMetrics ().xdpi ;
126123 }
127-
124+
128125 /**
129- * Return Y (height) of the screen expressed as dots-per-inch .
126+ * Return the exact physical pixels per inch of the screen in the Y dimension .
130127 *
131- * @return the height of screen density expressed as dots-per-inch
128+ * @return the exact physical pixels per inch of the screen in the Y dimension
132129 */
133- public static int getScreenYDpi () {
130+ public static float getScreenYDpi () {
134131 return Resources .getSystem ().getDisplayMetrics ().ydpi ;
135132 }
136-
137-
138-
133+
139134 /**
140135 * Return the distance between the given View's X (start point of View's width) and the screen width.
141136 *
142137 * @return the distance between the given View's X (start point of View's width) and the screen width.
143138 */
144- public float calculateDistanceByX (View view ) {
145- int [] point = new int [0 ];
139+ public int calculateDistanceByX (View view ) {
140+ int [] point = new int [2 ];
146141 view .getLocationOnScreen (point );
147- return ( getScreenWidth () - point [0 ]). toFloat () ;
142+ return getScreenWidth () - point [0 ];
148143 }
149144
150145 /**
151146 * Return the distance between the given View's Y (start point of View's height) and the screen height.
152147 *
153148 * @return the distance between the given View's Y (start point of View's height) and the screen height.
154149 */
155- public float calculateDistanceByY (View view ) {
156- int [] point = new int [0 ];
150+ public int calculateDistanceByY (View view ) {
151+ int [] point = new int [2 ];
157152 view .getLocationOnScreen (point );
158- return ( getScreenHeight () - point [1 ]). toFloat () ;
153+ return getScreenHeight () - point [1 ];
159154 }
160155
161156 /**
162157 * Return the X coordinate of the given View on the screen.
163158 *
164159 * @return X coordinate of the given View on the screen.
165160 */
166- public int getViewX (View view ){
167- int [] point = new int [0 ];
161+ public int getViewX (View view ) {
162+ int [] point = new int [2 ];
168163 view .getLocationOnScreen (point );
169164 return point [0 ];
170165 }
171-
166+
172167 /**
173168 * Return the Y coordinate of the given View on the screen.
174169 *
175170 * @return Y coordinate of the given View on the screen.
176171 */
177- public int getViewY (View view ){
178- int [] point = new int [0 ];
172+ public int getViewY (View view ) {
173+ int [] point = new int [2 ];
179174 view .getLocationOnScreen (point );
180175 return point [1 ];
181176 }
182-
183177
184178 /**
185179 * Set full screen.
0 commit comments