Skip to content

Commit

Permalink
Added days strings
Browse files Browse the repository at this point in the history
  • Loading branch information
nirabpudasaini committed Sep 6, 2017
1 parent 75f6919 commit fba99f7
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class NepaliDate {

private int mYear, mMonth, mDayOfMonth, mDayofWeek, mHourOfDay, mMinute, mSecond, mMillisecond;
private String mMonthString;
private String mMonthString, mDayString;
private Context mContext;

HashMap<Integer, int[]> daysInMonths = new HashMap<>();
Expand Down Expand Up @@ -133,7 +133,6 @@ public void init(DateTime date){
daysInMonths.put(2090, new int[]{30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30});

DateTime base = new DateTime(1944,1,1,0,0);
date = date.withZone(DateTimeZone.forID("Asia/Kathmandu"));

long daysBetween = Days.daysBetween(base,date).getDays();

Expand Down Expand Up @@ -165,6 +164,7 @@ public void init(DateTime date){
this.mMonthString = getMonthString(nepaliMonth);
this.mDayOfMonth = nepaliDay;
this.mDayofWeek = dayOfWeek;
this.mDayString = getDayString(dayOfWeek);
this.mHourOfDay = date.getHourOfDay();
this.mMinute = date.getMinuteOfHour();
this.mSecond = date.getSecondOfMinute();
Expand Down Expand Up @@ -202,6 +202,29 @@ public String getMonthString(int month){
}
}

public String getDayString(int day){
switch (day){
case 1:
return mContext.getString(R.string.ndu_sunday);
case 2:
return mContext.getString(R.string.ndu_monday);
case 3:
return mContext.getString(R.string.ndu_tuesday);
case 4:
return mContext.getString(R.string.ndu_wednesday);
case 5:
return mContext.getString(R.string.ndu_thrusday);
case 6:
return mContext.getString(R.string.ndu_friday);
case 7:
return mContext.getString(R.string.ndu_saturday);
default:
return "Error";
}
}



public int getYear() {
return mYear;
}
Expand All @@ -226,11 +249,11 @@ public void setDayOfMonth(int mDayOfMonth) {
this.mDayOfMonth = mDayOfMonth;
}

public int getDayofWeek() {
public int getDayOfWeek() {
return mDayofWeek;
}

public void setDayofWeek(int mDayofWeek) {
public void setDayOfWeek(int mDayofWeek) {
this.mDayofWeek = mDayofWeek;
}

Expand Down Expand Up @@ -266,4 +289,6 @@ public void setMillisecond(int mMillisecond) {
this.mMillisecond = mMillisecond;
}



}
7 changes: 7 additions & 0 deletions src/main/res/values-ne/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@
<string name="ndu_mansir">मंसिर</string>
<string name="ndu_poush">पुष</string>
<string name="ndu_shrawan">श्रावण</string>
<string name="ndu_sunday">आइतबार</string>
<string name="ndu_monday">सोमबार</string>
<string name="ndu_tuesday">मंगलबार</string>
<string name="ndu_wednesday">बुधबार</string>
<string name="ndu_thrusday">बिहिबार</string>
<string name="ndu_friday">शुक्रबार</string>
<string name="ndu_saturday">शनिबार</string>
</resources>
7 changes: 7 additions & 0 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@
<string name="ndu_magh">Magh</string>
<string name="ndu_falgun">Falgun</string>
<string name="ndu_chaitra">Chaitra</string>
<string name="ndu_sunday">Aaitabaar</string>
<string name="ndu_monday">Sombaar</string>
<string name="ndu_tuesday">Mangalbaar</string>
<string name="ndu_wednesday">Budhabaar</string>
<string name="ndu_thrusday">Bihibaar</string>
<string name="ndu_friday">Shukrabaar</string>
<string name="ndu_saturday">Shanibaar</string>

</resources>

0 comments on commit fba99f7

Please sign in to comment.