Skip to content

Commit

Permalink
compatible API level under 13
Browse files Browse the repository at this point in the history
  • Loading branch information
misakuo committed Jan 27, 2016
1 parent 00575df commit dfd3069
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
* OR OTHER DEALINGS IN THE SOFTWARE.
*/

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
Expand Down Expand Up @@ -105,7 +107,12 @@ private void init(Context context, AttributeSet attrs) {

WindowManager wm = (WindowManager) getContext() .getSystemService(Context.WINDOW_SERVICE);
Point point = new Point();
wm.getDefaultDisplay().getSize(point);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
wm.getDefaultDisplay().getSize(point);
} else {
point.x = wm.getDefaultDisplay().getWidth();
point.y = wm.getDefaultDisplay().getHeight();
}
int screenWidth = point.x;
int screenHeight = point.y;
minSize = screenHeight < screenWidth ? screenHeight : screenWidth;
Expand Down Expand Up @@ -216,6 +223,7 @@ protected void onDetachedFromWindow() {
handler.removeCallbacksAndMessages(null);
}

@SuppressLint("WrongCall")
private void updateChild() {
onLayout(false, left,top,right,bottom);
}
Expand Down

0 comments on commit dfd3069

Please sign in to comment.