Carbs0126/GregorianLunarCalendar

Question

microcian opened this issue · 27 comments

is it lunar calendar as you know there is no concept of 31 Date in Lunar Calendar

in chinese lunar calendar ,one month has 29 or 30 days, so every several lunar years ,there will be 13 months in a lunar year, the extra month is lunar leap month, and it must have 30 days. every gregorian day corresponding with a certain lunar day, and lunar day also has 24 hours. sorry for not adding a english readme file

screenshot_2016-07-19-02-17-21
Lunar Calendar when I replace chinese character into integer after 4 year integer repeat ..how can i resolve this issue

    public static final String[] lunarNumbers = {"0","1","2","3","4","5","6","7","8","9"};

public static final String[] lunarMonths = {"1","2","3","4","5","6","7","8","9","10","11","12"};

public static final String[] lunarDays = {  "1","2","3","4","5","6","7","8","9","10",
                                            "11","12","13","14","15","16","17","18","19","20",
                                            "21","22","23","24","25","26","27","28","29","30"};

hello, the character "年" to the right of "1903" and "月" right to the "闰5" are set in cn.carbs.android.gregorianlunarcalendar.library.view.GregorianLunarCalendarView's layout xml,
you can replace the NumberPickerView's npv_HintText to "year" or other word.
the "闰" to the left of "5" is set in cn.carbs.android.gregorianlunarcalendar.library.util.Util.java, you can change code in method getLunarMonthsNamesWithLeap(int monthLeap), like change monthsOut[monthLeapAbs] = "闰" + getLunarNameOfMonth(monthLeapAbs); tomonthsOut[monthLeapAbs] = "lunar " + getLunarNameOfMonth(monthLeapAbs);, and "闰"will be replaced by "lunar"

no no bro I attach snapshot, my problem is not character...problem is repeat the integer

i didnot see anything wrong in your snapshot, could you give me more infomation? there will be a lunar month every several years, but may not every 4 years

yes, i got you. eg. in lunar 1903, there was two "5 month", one is normal lunar month, one is leap lunar month, and normal lunar month next to leap lunar month,there will be a lunar "leap" month every several years, but may not every 4 years. "two 5 month" is right according to chinese lunar calendar.
you can check this web site:

https://www.baidu.com/s?wd=%E4%B8%87%E5%B9%B4%E5%8E%86%E5%86%9C%E5%8E%86%E6%9F%A5%E8%AF%A2&rsv_idx=2&tn=baiduhome_pg&usm=3&ie=utf-8&rsv_rq=2&rsv_cq=%E4%B8%87%E5%B9%B4%E5%8E%86

in each square, gregorian is up and lunar is down in chinese, you can check 1903-6-5 is "五月初十", means lunar month 5 and lunar day 10, and check 1903-7-4 is "闰五月初十", means lunar leap month 5 and lunar day 10. normal lunar month x is always next to leap lunar month x.

you can download and check this app
http://www.51wnl.com/
btw, this map may help you understand chinese char:

"一" -- 1

"二" -- 2

"三" -- 3

"四" -- 4

"五" -- 5

"六" -- 6

"七" -- 7

"八" -- 8

"九" -- 9

"十" -- 10

chinese numbers is also in decimal system.

can i goto Particular Month of solar or lunar calendar ?

you mean set the init value of this calendar?

I mean can i go by default to 1980/04/23

On Jul 19, 2016 12:41 PM, "WangJianJun" notifications@github.com wrote:

you mean set the init value of this calendar?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEbnm1OR7fdEym9ff79tcm_yi9CiGUTLks5qXFVygaJpZM4JNqle
.

of course you can, in GregorianLunarCalendarView, you can set a calendar value by using method :

public void init(Calendar calendar){
        setColor(mThemeColorG, mNormalTextColor);
        setConfigs(calendar, true, false);
    }

you can use in this way

        Calendar customizedCalendar = Calendar.getInstance();
        customizedCalendar.set(1980, 3, 23);//gregorian date
        mGregorianLunarCalendarView.init(customizedCalendar);

this is not working

On Tue, Jul 19, 2016 at 1:03 PM, WangJianJun notifications@github.com
wrote:

of course you can, in GregorianLunarCalendarView, you can set a calendar
value by using method :

setColor(mThemeColorG, mNormalTextColor);
setConfigs(calendar, true, false);
}

you can use in this way<br>

Calendar customizedCalendar = Calendar.getInstance();
customizedCalendar.set(1980, 3, 23);//gregorian date
mGregorianLunarCalendarView.init(customizedCalendar);


—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Carbs0126/GregorianLunarCalendar/issues/2#issuecomment-233533222,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEbnm227dfiBCLYC2YcAOS0z_Vi-ThkMks5qXFq6gaJpZM4JNqle
.

Abdul Rahman Majeed
Software Engineer / Developer
+92 321 6236569

could you send me more code?

you can check the sample https://github.com/Carbs0126/GregorianLunarCalendar/blob/master/sample/src/main/java/cn/carbs/android/gregorianlunarcalendar/ActivityMain.java

and the DialogGLC in ActivityMain.java
it works fine in my code

mGLCView = (GregorianLunarCalendarView) view.findViewById(R.id.calendar_view);

Calendar customizedCalendar = Calendar.getInstance();
customizedCalendar.set(1980, 3, 23);//gregorian date
mGLCView.init(customizedCalendar);
toLunarMode();

I think problem is when i am alling toLunarMode and restet it

  1. I want to LunarCalendar by default
  2. and 1980,1,1 by default of lunar

On Fri, Jul 22, 2016 at 4:41 PM, WangJianJun notifications@github.com
wrote:

could you send me more code?

you can check the sample
https://github.com/Carbs0126/GregorianLunarCalendar/blob/master/sample/src/main/java/cn/carbs/android/gregorianlunarcalendar/ActivityMain.java

and the DialogGLC in ActivityMain.java
it works fine in my code


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEbnmzJem-rYIYJblsCE1DjD929aM-PYks5qYIIcgaJpZM4JNqle
.

Abdul Rahman Majeed
Software Engineer / Developer
+92 321 6236569

I think so this is good right ??

GregorianLunarCalendarView.CalendarData calendarData =
mGLCView.getCalendarData();
Calendar calendars = calendarData.getCalendar();
calendars.set(1980, 3, 23);
mGLCView.init(calendars, false);

On Fri, Jul 22, 2016 at 4:44 PM, Abdul Rahman Majeed <a.rahman.uaf@gmail.com

wrote:

mGLCView = (GregorianLunarCalendarView) view.findViewById(R.id.calendar_view);

Calendar customizedCalendar = Calendar.getInstance();
customizedCalendar.set(1980, 3, 23);//gregorian date
mGLCView.init(customizedCalendar);
toLunarMode();

I think problem is when i am alling toLunarMode and restet it

  1. I want to LunarCalendar by default
  2. and 1980,1,1 by default of lunar

On Fri, Jul 22, 2016 at 4:41 PM, WangJianJun notifications@github.com
wrote:

could you send me more code?

you can check the sample
https://github.com/Carbs0126/GregorianLunarCalendar/blob/master/sample/src/main/java/cn/carbs/android/gregorianlunarcalendar/ActivityMain.java

and the DialogGLC in ActivityMain.java
it works fine in my code


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEbnmzJem-rYIYJblsCE1DjD929aM-PYks5qYIIcgaJpZM4JNqle
.

Abdul Rahman Majeed
Software Engineer / Developer
+92 321 6236569

Abdul Rahman Majeed
Software Engineer / Developer
+92 321 6236569

Resolved :) Cheers....just help I want to add date Chinese character as you
added in solar to make it same UI..is it possible

On Fri, Jul 22, 2016 at 4:48 PM, Abdul Rahman Majeed <a.rahman.uaf@gmail.com

wrote:

I think so this is good right ??

GregorianLunarCalendarView.CalendarData calendarData = mGLCView.getCalendarData();
Calendar calendars = calendarData.getCalendar();
calendars.set(1980, 3, 23);
mGLCView.init(calendars, false);

On Fri, Jul 22, 2016 at 4:44 PM, Abdul Rahman Majeed <
a.rahman.uaf@gmail.com> wrote:

mGLCView = (GregorianLunarCalendarView) view.findViewById(R.id.calendar_view);

Calendar customizedCalendar = Calendar.getInstance();
customizedCalendar.set(1980, 3, 23);//gregorian date
mGLCView.init(customizedCalendar);
toLunarMode();

I think problem is when i am alling toLunarMode and restet it

  1. I want to LunarCalendar by default
  2. and 1980,1,1 by default of lunar

On Fri, Jul 22, 2016 at 4:41 PM, WangJianJun notifications@github.com
wrote:

could you send me more code?

you can check the sample
https://github.com/Carbs0126/GregorianLunarCalendar/blob/master/sample/src/main/java/cn/carbs/android/gregorianlunarcalendar/ActivityMain.java

and the DialogGLC in ActivityMain.java
it works fine in my code


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEbnmzJem-rYIYJblsCE1DjD929aM-PYks5qYIIcgaJpZM4JNqle
.

Abdul Rahman Majeed
Software Engineer / Developer
+92 321 6236569

Abdul Rahman Majeed
Software Engineer / Developer
+92 321 6236569

Abdul Rahman Majeed
Software Engineer / Developer
+92 321 6236569

sorry for replying late. if you want to set a lunar date as it init, you can use

mGLCView.init(calendars, false);
false means show lunar calendar when it init.

Resolved :) Cheers.... i want to add date Chinese character with date as
you added in solar to make it same UI..is it possible

On Jul 22, 2016 9:52 PM, "WangJianJun" notifications@github.com wrote:

sorry for replying late. if you want to set a lunar date as it init, you
can use

mGLCView.init(calendars, false);
false means show lunar calendar when it init.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEbnm9NalqF7RRE9t22tQv-qo-07cPxfks5qYMscgaJpZM4JNqle
.

sorry, i am not clear about what you mean , you want to change the hint in the middle unit of each column? you can change the attr of GregorianLunarCalendar's NumberPickerViews, modify the npv_HintText="year/month/day or other words here"


see:
https://github.com/Carbs0126/NumberPickerView

I just meant:
As u can see year word , month word but date month is missing in lunar
calendar ....i want to add that

On Jul 22, 2016 10:56 PM, "WangJianJun" notifications@github.com wrote:

sorry, i am not clear about what you mean , you want to change the hint in
the middle unit of each column? you can change the attr of
GregorianLunarCalendar's NumberPickerViews, modify the
npv_HintText="year/month/day or other words here"

see:
https://github.com/Carbs0126/NumberPickerView


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEbnm65S6jgd4ig5lkY29EhehbHYcInlks5qYNbbgaJpZM4JNqle
.

you can check the GregorianLunarCalendarView.java, in its layout file (view_gregorian_lunar_calendar.xml), add app:npv_HintText="@string/day" to the third NumberPickerView.


but , in GregorianLunarCalendarView.java, i just modify the hint of dayPicker to empty string if it changes to lunar calendar mode, because this will be more comfortable for chinese to read.


you can check method initValuesForD in GregorianLunarCalendarView.java

private void initValuesForD(ChineseCalendar cc, boolean isGregorian, boolean anim){
        if(isGregorian){
            int dayStart = DAY_START_GREGORIAN;
            int dayStop = Util.getSumOfDayInMonthForGregorianByMonth(cc.get(Calendar.YEAR), cc.get(Calendar.MONTH) + 1);
            int daySway = cc.get(Calendar.DAY_OF_MONTH);
            mDayPickerView.setHintText(getContext().getResources().getString(R.string.day));//<----change text hint dynamically by java code if switch to  gregorian mode.
            setValuesForPickerView(mDayPickerView, daySway, dayStart, dayStop, mDisplayDaysGregorian, false, anim);
        }else{
            int dayStart = DAY_START_LUNAR;
            int dayStop = Util.getSumOfDayInMonthForLunarByMonthLunar(cc.get(ChineseCalendar.CHINESE_YEAR), cc.get(ChineseCalendar.CHINESE_MONTH));
            int daySway = cc.get(ChineseCalendar.CHINESE_DATE);
            mDayPickerView.setHintText("");//<----change text hint dynamically by java code if switch to  lunar mode.
            setValuesForPickerView(mDayPickerView, daySway, dayStart, dayStop, mDisplayDaysLunar, false, anim);
        }
    }

if no need to change hint text, just add attr app:npv_HintText="@string/day" to the third NumberPickerView

if no need to change hint text, just add attr app:npv_HintText="@string/day" to the third NumberPickerView, and delete mDayPickerView.setHintText(""); in method initValuesForD in GregorianLunarCalendarView

Thanks Bro

On Fri, Jul 22, 2016 at 11:26 PM, WangJianJun notifications@github.com
wrote:

if no need to change hint text, just add attr
app:npv_HintText="@string/day" to the third NumberPickerView, and delete
mDayPickerView.setHintText(""); in method initValuesForD in
GregorianLunarCalendarView


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEbnmzwZv9XkLvBuSeUV4GoRI3ILNDUbks5qYOEvgaJpZM4JNqle
.

Abdul Rahman Majeed
Software Engineer / Developer
+92 321 6236569

can i ACCESS onValueChangeListener in my app ??

On Sun, Jul 24, 2016 at 12:25 AM, Abdul Rahman Majeed <
a.rahman.uaf@gmail.com> wrote:

Thanks Bro

On Fri, Jul 22, 2016 at 11:26 PM, WangJianJun notifications@github.com
wrote:

if no need to change hint text, just add attr
app:npv_HintText="@string/day" to the third NumberPickerView, and delete
mDayPickerView.setHintText(""); in method initValuesForD in
GregorianLunarCalendarView


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEbnmzwZv9XkLvBuSeUV4GoRI3ILNDUbks5qYOEvgaJpZM4JNqle
.

Abdul Rahman Majeed
Software Engineer / Developer
+92 321 6236569

Abdul Rahman Majeed
Software Engineer / Developer
+92 321 6236569

you are welcome bro.
and ,

can i ACCESS onValueChangeListener in my app ??


you can add a callback in onValueChangeListener in GregrorainLunarCalendarView to get the new picked value of year/month/day , and at same time add callback in passiveUpdateMonthAndDay() and passiveUpdateDay() to get the newest changed value.
But better not access `onValueChangeListener` in this way : just add a callback in onValueChangeListener to fetch CalendarData by using method `getCalendarData`, cause if the NumberPicker is scrolling , `getCalendarData` may get a wrong value(a value between old value and new value ) so i recommend not to add callback in `onValueChangeListener` , cause it maybe a litter complicate.