|
|
@@ -5,7 +5,6 @@ import android.graphics.Canvas;
|
|
|
import android.graphics.Color;
|
|
|
import android.graphics.Paint;
|
|
|
import android.graphics.Path;
|
|
|
-import android.graphics.Typeface;
|
|
|
import android.util.AttributeSet;
|
|
|
import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
|
@@ -17,7 +16,7 @@ import java.util.Date;
|
|
|
* 日历控件 功能:获得点选的日期区间
|
|
|
* update by:Bitliker 2016/07/11
|
|
|
*/
|
|
|
-public class CalendarView extends View implements View.OnTouchListener {
|
|
|
+public class CalendarView extends View implements View.OnTouchListener {
|
|
|
private final static String TAG = "anCalendar";
|
|
|
private Date selectedStartDate;
|
|
|
private Date selectedEndDate;
|
|
|
@@ -192,10 +191,10 @@ public class CalendarView extends View implements View.OnTouchListener {
|
|
|
int y = getYByIndex(index);
|
|
|
float cellY = surface.monthHeight + surface.weekHeight + (y - 1)
|
|
|
* surface.cellHeight + //当前日期框最上方
|
|
|
- surface.cellHeight / 2;//当前框的中心Y
|
|
|
+ surface.cellHeight * 9 / 16f;//当前框的中心Y
|
|
|
float cellX = (surface.cellWidth * (x - 1)) //当前日期框左边框
|
|
|
+ surface.cellWidth / 2;//当前中心X
|
|
|
- float radius = Math.min(surface.cellHeight, surface.cellWidth) / 2 - 10;//获取最短的长度的
|
|
|
+ float radius = Math.min(surface.cellHeight, surface.cellWidth) * (3 / 8f);//获取最短的长度的
|
|
|
// 绘制圆,参数一是中心点的x轴,参数二是中心点的y轴,参数三是半径,参数四是paint对象;
|
|
|
canvas.drawCircle(cellX, cellY, radius, surface.circlePaint);
|
|
|
}
|
|
|
@@ -237,10 +236,10 @@ public class CalendarView extends View implements View.OnTouchListener {
|
|
|
// - surface.borderWidth, surface.cellBgPaint);
|
|
|
float cellY = surface.monthHeight + surface.weekHeight + (y - 1)
|
|
|
* surface.cellHeight + //当前日期框最上方
|
|
|
- surface.cellHeight / 2;//当前框的中心Y
|
|
|
+ surface.cellHeight * 9 / 16f;//当前框的中心Y
|
|
|
float cellX = (surface.cellWidth * (x - 1)) //当前日期框左边框
|
|
|
+ surface.cellWidth / 2;//当前中心X
|
|
|
- float radius = Math.min(surface.cellHeight, surface.cellWidth) / 2 - 10;//获取最短的长度的
|
|
|
+ float radius = Math.min(surface.cellHeight, surface.cellWidth) * (3 / 8f);//获取最短的长度的
|
|
|
// 绘制圆,参数一是中心点的x轴,参数二是中心点的y轴,参数三是半径,参数四是paint对象;
|
|
|
canvas.drawCircle(cellX, cellY, radius, surface.cellBgPaint);
|
|
|
|
|
|
@@ -426,13 +425,13 @@ public class CalendarView extends View implements View.OnTouchListener {
|
|
|
monthPaint.setAntiAlias(true);
|
|
|
float textSize = cellHeight * 0.4f;
|
|
|
monthPaint.setTextSize(textSize);
|
|
|
- monthPaint.setTypeface(Typeface.DEFAULT_BOLD);
|
|
|
+ //monthPaint.setTypeface(Typeface.DEFAULT_BOLD);
|
|
|
weekPaint = new Paint();
|
|
|
weekPaint.setColor(textColor);
|
|
|
weekPaint.setAntiAlias(true);
|
|
|
float weekTextSize = weekHeight * 0.6f;
|
|
|
weekPaint.setTextSize(weekTextSize);
|
|
|
- weekPaint.setTypeface(Typeface.DEFAULT_BOLD);
|
|
|
+ //weekPaint.setTypeface(Typeface.DEFAULT_BOLD);
|
|
|
datePaint = new Paint();
|
|
|
|
|
|
datePaint.setColor(textColor);
|
|
|
@@ -445,7 +444,7 @@ public class CalendarView extends View implements View.OnTouchListener {
|
|
|
circlePaint.setStrokeWidth(3);
|
|
|
float cellTextSize = cellHeight * 0.5f;
|
|
|
datePaint.setTextSize(cellTextSize);
|
|
|
- datePaint.setTypeface(Typeface.DEFAULT_BOLD);
|
|
|
+ //datePaint.setTypeface(Typeface.DEFAULT_BOLD);
|
|
|
boxPath = new Path();
|
|
|
boxPath.rLineTo(width, 0);
|
|
|
boxPath.moveTo(0, monthHeight + weekHeight);
|