package sun.bob.mcalendarview.utils;

import android.util.Log;

import java.util.Calendar;

import sun.bob.mcalendarview.CellConfig;
import sun.bob.mcalendarview.vo.DateData;

/**
 * Created by Bigflower on 2015/12/8.
 */
public class ExpCalendarUtil {

    /**
     * the number to Week
     *
     * @param number
     * @return
     */
    public static String number2Week(int number) {
        if (number < 1 || number > 7)
            return null;
        String result = null;
        switch (number) {
            case 1:
                result = "一";
                break;
            case 2:
                result = "二";
                break;
            case 3:
                result = "三";
                break;
            case 4:
                result = "四";
                break;
            case 5:
                result = "五";
                break;
            case 6:
                result = "六";
                break;
            case 7:
                result = "日";
                break;
        }
        return result;
    }

    public static DateData position2Month(int absPos) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(CellConfig.m2wPointDate.getYear(), CellConfig.m2wPointDate.getMonth() - 1, CellConfig.m2wPointDate.getDay());
        int distance = absPos - CellConfig.Week2MonthPos;
        calendar.add(Calendar.MONTH, distance);
        Log.i("ExpDateData month", CellConfig.m2wPointDate.toString()+" distance :"+distance);
        Log.i("ExpDateData month", calendar.get(Calendar.YEAR)+"年"+calendar.get(Calendar.MONTH));
        return new DateData(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, 1);
    }

    public static DateData position2Week(int absPos) {
        Log.i("ExpDateData", CellConfig.w2mPointDate.toString());
        Calendar calendar = Calendar.getInstance();
        calendar.set(CellConfig.w2mPointDate.getYear(), CellConfig.w2mPointDate.getMonth() - 1, CellConfig.w2mPointDate.getDay());
        int distance = absPos - CellConfig.Month2WeekPos;
        calendar.add(Calendar.DATE, distance * 7);

        return new DateData(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, 1);
    }


    public static int getMonthDayNumber(int offset) {
        Calendar calendar = Calendar.getInstance();
        if (offset != 0)
            calendar.add(Calendar.MONTH, offset);
        return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
    }
}

@@ -57,16 +57,52 @@
 l.Log;%0A%0A
+import java.text.DateFormatSymbols;%0A
 import j
@@ -290,24 +290,45 @@
 %0A    /**
+ ExpCalendarUtil.java
 %0A     * 
 the numb
@@ -319,17 +319,17 @@
 %0A     * 
-t
+T
 he numbe
@@ -342,15 +342,8 @@
 eek%0A
-     *%0A
     
@@ -362,23 +362,128 @@
 mber
-%0A     * @return
+ - Number day of Week (on the code Sunday is equal 7)%0A     * @return %5BString%5D - abbreviated name of the days of the week
 %0A   
@@ -575,28 +575,16 @@
 ber %3E 7)
-%0A           
  return 
@@ -592,38 +592,26 @@
 ull;
-%0A        String result = null;
+ //Day of Week 1-7
 %0A   
@@ -619,22 +619,18 @@
     
-switch
+if
  (number
 ) %7B%0A
@@ -621,24 +621,29 @@
   if (number
+ == 7
 ) %7B%0A        
@@ -650,88 +650,36 @@
     
-case 1:%0A                result = %22%E4%B8%80%22;%0A                break;%0A            case 2:
+number = 1;%0A        %7D else %7B
 %0A   
@@ -691,446 +691,306 @@
     
-    result = %22%E4%BA%8C%22;%0A                break;%0A            case 3:%0A                result = %22%E4%B8%89%22;%0A                break;%0A            case 4:%0A                result = %22%E5%9B%9B%22;%0A                break;%0A            case 5:%0A                result = %22%E4%BA%94%22;%0A                break;%0A            case 6:%0A                result = %22%E5%85%AD%22;%0A                break;%0A            case 7:%0A                result = %22%E6%97%A5%22;%0A                break;%0A        %7D%0A        return result;
+number = number + 1;%0A        %7D%0A        final DateFormatSymbols symbols = new DateFormatSymbols(); //use user locale%0A        final String nameDayOfWeek = symbols.getShortWeekdays()%5Bnumber%5D; //Short name or getWeekdays for complete name%0A        return nameDayOfWeek.toUpperCase(); //name to uppercase
 %0A   

Add WeekColumnView Translate.