From 6087dfe47508be9cc0522cdff2aa08b87b28b853 Mon Sep 17 00:00:00 2001 From: Ali Date: Fri, 31 Aug 2018 18:05:49 +0430 Subject: [PATCH 1/3] - improve --- .idea/caches/build_file_checksums.ser | Bin 592 -> 592 bytes README.md | 1 - app/build.gradle | 2 +- .../ExampleInstrumentedTest.java | 26 -- .../persianrangedatepicker/MainActivity.java | 24 +- .../ExampleUnitTest.java | 17 - daterangepicker/build.gradle | 151 +------ .../src/main/assets/fonts/Yekan.ttf | Bin 51652 -> 0 bytes .../customviews/DateRangeCalendarView.java | 427 +++++++++++------- .../DatePickerDialog.java | 83 ++-- .../TimePickerDialog.java | 2 +- .../daterangepicker/utils/FontUtils.java | 22 + .../src/main/res/drawable/calendar_header.xml | 9 - .../main/res/layout/dialog_date_picker.xml | 6 +- .../main/res/layout/layout_calendar_day.xml | 16 +- .../main/res/layout/layout_calendar_nav.xml | 2 +- daterangepicker/src/main/res/values/attrs.xml | 8 +- .../src/main/res/values/colors.xml | 19 +- .../src/main/res/values/styles.xml | 3 +- 19 files changed, 372 insertions(+), 446 deletions(-) delete mode 100644 app/src/androidTest/java/com/sardari/ali/persianrangedatepicker/ExampleInstrumentedTest.java delete mode 100644 app/src/test/java/com/sardari/ali/persianrangedatepicker/ExampleUnitTest.java delete mode 100644 daterangepicker/src/main/assets/fonts/Yekan.ttf rename daterangepicker/src/main/java/com/sardari/daterangepicker/{dialog_fragment => dialog}/DatePickerDialog.java (77%) rename daterangepicker/src/main/java/com/sardari/daterangepicker/{dialog_fragment => dialog}/TimePickerDialog.java (98%) create mode 100644 daterangepicker/src/main/java/com/sardari/daterangepicker/utils/FontUtils.java delete mode 100644 daterangepicker/src/main/res/drawable/calendar_header.xml diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index ec7ce5fc7082417caeb9df86a25c7a953ec58b92..749c2fb14a8c446bb1d46ddd1c92c5035ea97e01 100644 GIT binary patch delta 56 zcmV-80LTB(1kePKm;{g7YVnbrcMvgP1B^m%?X8^eV38Ry O!TV+&=M-9#hylov#}`%r diff --git a/README.md b/README.md index a862625..99b055f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ Step 1. Add the JitPack repository to your build file. Add it in your root build ```groovy allprojects { repositories { - ... maven { url "https://jitpack.io" } } } diff --git a/app/build.gradle b/app/build.gradle index 04bc374..f2971b0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion 27 defaultConfig { applicationId "com.sardari.persianrangedatepicker" - minSdkVersion 16 + minSdkVersion 17 targetSdkVersion 27 versionCode 1 versionName "1.0" diff --git a/app/src/androidTest/java/com/sardari/ali/persianrangedatepicker/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/sardari/ali/persianrangedatepicker/ExampleInstrumentedTest.java deleted file mode 100644 index 3cd1644..0000000 --- a/app/src/androidTest/java/com/sardari/ali/persianrangedatepicker/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.sardari.ali.persianrangedatepicker; - -import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); - - assertEquals("com.sardari.ali.persianrangedatepicker", appContext.getPackageName()); - } -} diff --git a/app/src/main/java/com/sardari/ali/persianrangedatepicker/MainActivity.java b/app/src/main/java/com/sardari/ali/persianrangedatepicker/MainActivity.java index 0918ce2..a5ead07 100644 --- a/app/src/main/java/com/sardari/ali/persianrangedatepicker/MainActivity.java +++ b/app/src/main/java/com/sardari/ali/persianrangedatepicker/MainActivity.java @@ -7,7 +7,7 @@ import android.widget.TextView; import com.sardari.daterangepicker.customviews.DateRangeCalendarView; -import com.sardari.daterangepicker.dialog_fragment.DatePickerDialog; +import com.sardari.daterangepicker.dialog.DatePickerDialog; import com.sardari.daterangepicker.utils.PersianCalendar; public class MainActivity extends AppCompatActivity { @@ -31,32 +31,22 @@ private void initSingleDate() { btn_ShowDatePicker.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - ShowDatePicker(DateRangeCalendarView.SelectionMode.Range); + ShowDatePicker(DateRangeCalendarView.SelectionMode.None); } }); } private void ShowDatePicker(DateRangeCalendarView.SelectionMode selectionMode) { -// PersianCalendar today = new PersianCalendar(); -// -// PersianCalendar persianCalendar_Max = (PersianCalendar) today.clone(); -// persianCalendar_Max.setPersianYear(today.getPersianYear() + 1); - DatePickerDialog datePickerDialog = new DatePickerDialog(MainActivity.this); -// datePickerDialog.setTypeface(FontUtils.Default()); - datePickerDialog.setCalendarType(DateRangeCalendarView.CalendarType.Persian); - datePickerDialog.setSelectionMode(selectionMode); - datePickerDialog.setSelectableDaysCount(5); +// datePickerDialog.setCalendarType(DateRangeCalendarView.CalendarType.Persian); +// datePickerDialog.setSelectionMode(selectionMode); +// datePickerDialog.setSelectableDaysCount(5); datePickerDialog.setCanceledOnTouchOutside(true); -// datePickerDialog.setCurrentDate(today); -// datePickerDialog.setMinDate(persianCalendar_Min); -// datePickerDialog.setMaxDate(persianCalendar_Max); - datePickerDialog.setOnRangeDateSelectedListener(new DatePickerDialog.OnRangeDateSelectedListener() { @Override public void onRangeDateSelected(PersianCalendar startDate, PersianCalendar endDate) { - txtStartDate.setText(startDate.getPersianShortDate()); - txtEndDate.setText(endDate.getPersianShortDate()); + txtStartDate.setText(startDate.getPersianShortDateTime()); + txtEndDate.setText(endDate.getPersianShortDateTime()); } }); diff --git a/app/src/test/java/com/sardari/ali/persianrangedatepicker/ExampleUnitTest.java b/app/src/test/java/com/sardari/ali/persianrangedatepicker/ExampleUnitTest.java deleted file mode 100644 index 008aa27..0000000 --- a/app/src/test/java/com/sardari/ali/persianrangedatepicker/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.sardari.ali.persianrangedatepicker; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/daterangepicker/build.gradle b/daterangepicker/build.gradle index 5236381..54b21f7 100644 --- a/daterangepicker/build.gradle +++ b/daterangepicker/build.gradle @@ -1,34 +1,7 @@ apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' -group = 'com.github.persianrangedatepicker' // Maven Group ID for the artifact - -//apply plugin: 'com.github.kt3k.coveralls' - -//ext { -// bintrayRepo = 'maven' -// bintrayName = 'PersianRangeDatePicker' -// -// publishedGroupId = 'com.sardari' -// libraryName = 'PersianRangeDatePicker' -// artifact = 'PersianRangeDatePicker' -// -// libraryDescription = 'Persian Range Date Picker' -// -// siteUrl = 'https://github.com/ali-sardari/PersianRangeDatePicker' -// gitUrl = 'https://github.com/ali-sardari/PersianRangeDatePicker.git' -// -// libraryVersion = '0.1.3' -// -// developerId = 'ali-sardari' -// developerName = 'Ali Sardari' -// developerEmail = 'ali.sardari@yahoo.com' -// -// licenseName = 'The Apache Software License, Version 2.0' -// licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' -// allLicenses = ["Apache-2.0"] -//} - +group = 'com.github.persianrangedatepicker' android { compileSdkVersion 27 @@ -36,7 +9,7 @@ android { flavorDimensions "default" defaultConfig { - minSdkVersion 16 + minSdkVersion 17 targetSdkVersion 27 versionCode 1 versionName "1.0.1" @@ -47,122 +20,4 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:27.1.1' -} - -//--------------------------------------------------------------------- -//coveralls { -// jacocoReportPath = "${buildDir}/reports/coverage/debug/report.xml" -//} -// -//tasks.coveralls { -// dependsOn 'connectedAndroidTest' -// onlyIf { System.env.'CI' } -//} -// - -//apply plugin: 'com.github.dcendents.android-maven' -// -//group = publishedGroupId // Maven Group ID for the artifact -// -//install { -// repositories.mavenInstaller { -// // This generates POM.xml with proper parameters -// pom { -// project { -// packaging 'aar' -// groupId publishedGroupId -// artifactId artifact -// -// // Add your description here -// name libraryName -// description libraryDescription -// url siteUrl -// -// // Set your license -// licenses { -// license { -// name licenseName -// url licenseUrl -// } -// } -// developers { -// developer { -// id developerId -// name developerName -// email developerEmail -// } -// } -// scm { -// connection gitUrl -// developerConnection gitUrl -// url siteUrl -// -// } -// } -// } -// } -//} -// -//apply plugin: 'com.jfrog.bintray' -// -//version = libraryVersion -// -//if (project.hasProperty("android")) { // Android libraries -// task sourcesJar(type: Jar) { -// classifier = 'sources' -// from android.sourceSets.main.java.srcDirs -// } -// -// task javadoc(type: Javadoc) { -// source = android.sourceSets.main.java.srcDirs -// classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) -// } -//} else { // Java libraries -// task sourcesJar(type: Jar, dependsOn: classes) { -// classifier = 'sources' -// from sourceSets.main.allSource -// } -//} -// -//task javadocJar(type: Jar, dependsOn: javadoc) { -// classifier = 'javadoc' -// from javadoc.destinationDir -//} -// -//artifacts { -// archives javadocJar -// archives sourcesJar -//} -// -//// Bintray -//File localProps = project.rootProject.file('local.properties') -// -//if (localProps.exists()) { -// Properties properties = new Properties() -// properties.load(localProps.newDataInputStream()) -// -// bintray { -// user = properties.getProperty("bintray.user") -// key = properties.getProperty("bintray.apikey") -// -// configurations = ['archives'] -// pkg { -// repo = bintrayRepo -// name = bintrayName -// desc = libraryDescription -// websiteUrl = siteUrl -// vcsUrl = gitUrl -// licenses = allLicenses -// publish = true -// publicDownloadNumbers = true -// version { -// desc = libraryDescription -// gpg { -// sign = true //Determines whether to GPG sign the files. The default is false -// passphrase = properties.getProperty("bintray.gpg.password") -// //Optional. The passphrase for GPG signing' -// } -// } -// } -// } -//} \ No newline at end of file +} \ No newline at end of file diff --git a/daterangepicker/src/main/assets/fonts/Yekan.ttf b/daterangepicker/src/main/assets/fonts/Yekan.ttf deleted file mode 100644 index 3cd474ab126d5855ff817824fa424e2e92fa8a0f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 51652 zcmeFacR*BU-aq<0=bULUFidBd&HzJiLsiP4s30neii%jk-V64Ey+#vbda~)&G&LdF zxXEU->2;G$*^=#>WH;@XWLvUPINZ;3&NOgz_r34E_pggGXXeZ>=iB@996|{pDR>YF z88>zMsPvaAQwX72LX^K~omy1-qOQT~iUq5>*4l-$ zhwyp>A^cYhHf`|C7CP{G?LxfYy?E`CRr>n&WlWgdNyoI znfgOQUI2W`hw$E+bism#yw1`74(#=^~}8dKPUUBcxBVKcmw3vA@E_rN3lH1yK-6qF6kzV$#SxqtS6huHgcF8BPYnU>_)}zW+d}pMqAefLia7x5(S%=i~!Og9hKO#_vpUE`d~l zzgl7-sl-Jx@F@-$y^Y7o_%sK+-os-D`6Z;`DL^UUFH(qwH~=a8`P;4@2)&{Cg1Krvol`}!T4$!X?@;MiBHXl;j z4QX2lSzQd7TMCI?4#`^yxm^wUTMOx34=LOL8Quh0+yY7728rB3c7mI`z|TG4=sxiD z0JwSxa&`o~y#ms992~w1GIurjd<`V;I&k|2$lp!i`7MybTfzC;A&Yl{|93+o?}ZfH z54k)AS$GK2`3NN9G-UKFJyL-M#*!Kk*6WGKZd0I1hV^6$jb}h#Y>RlS0Fd9 zL2}-JJii5=ybX^091`>%Wa$IQ5eLprz&{Su=>VN(0B;W1Zo(tOi33Kv@VE#6IAC-X zkH-N&2WaoW<6ZbiB}h35E>41y15D50-Jb#i4%dGZkMh-IjxcVyAXOt_8LCJ%sfCRh zMMje`BuE-aBfe1!?w5e;W#Dinq@fu+9}5{64{7{Q{ARNI|MUA&{C0rblR^I}kbcJR z4m_U?iKmeH<#@gVQcfY~8}P^^oRegnLdtvbd>3SzN>a^9a?L1x4Ck3_Q%SlxNxrEh z;T&ZA2Y8oBH3yk~0FMtra%Bs^Nm9#6GRr|?U&8sf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$3|%z9 z8PIfy3L)6bqBYuXgGNOsTk%~Rd>WJ(>2soBLxMMq!d^YzEUJ8WrkdDtgAEYV( ziOZo7&PL~9mAL@Bl8dmzw*<0LhJDo)GzJOJfP}B0bLnAvgg&9?g$Bh1x-jTjdX5g$ zGxQ?8BurrmTR6fie8MjR0!LXyNaTtQ%n`7iD_cGm?65vOwlbO zqDS9Ub1Fr zaP#2#gBv#6>}8K{)0(wgwhRt!Shs$QPhPhS@+)I&V|!x{Uz;NG8slqgqrA#Dt@78_ zUil^}uQE)V4Aa)cZ`zuTt4HxH%L7eor2Wy zE3WV(b@;&v{D=*Hyn!F72ZxDt$Wo9w z6Yb_4h;~bi-3p_Op8d!9Zex3kMA0qNZIM{IB}QzSLu?V5E^`};aBd*H zj6b4&ReqUPi_Fi6Oe-SOipaEDWZp(3#)!liQE91=lEaAPr$?sMBLB8W#@{33?@{qH z578d^S3N3>iXS_sIBrW&EuYW3P zs|q7y>y`2M%J{oE&PXT!8tG*0kxn2*O_BM~E7R?j=|)w$G9RKcm8gs}s?wDyM%7iO z8&&B_yir*et?IqxAu4%@N*7ibybjQ{`u diff --git a/daterangepicker/src/main/java/com/sardari/daterangepicker/customviews/DateRangeCalendarView.java b/daterangepicker/src/main/java/com/sardari/daterangepicker/customviews/DateRangeCalendarView.java index 1e41bdd..7de49d3 100644 --- a/daterangepicker/src/main/java/com/sardari/daterangepicker/customviews/DateRangeCalendarView.java +++ b/daterangepicker/src/main/java/com/sardari/daterangepicker/customviews/DateRangeCalendarView.java @@ -1,15 +1,13 @@ package com.sardari.daterangepicker.customviews; -import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.GradientDrawable; -import android.os.Build; import android.support.annotation.ColorInt; import android.support.v4.content.ContextCompat; +import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; @@ -20,7 +18,7 @@ import android.widget.TextView; import com.sardari.daterangepicker.R; -import com.sardari.daterangepicker.dialog_fragment.TimePickerDialog; +import com.sardari.daterangepicker.dialog.TimePickerDialog; import com.sardari.daterangepicker.models.DayContainer; import com.sardari.daterangepicker.utils.MyUtils; import com.sardari.daterangepicker.utils.PersianCalendar; @@ -29,13 +27,13 @@ import java.util.Calendar; import java.util.Locale; -import static com.sardari.daterangepicker.customviews.DateRangeCalendarView.SelectionMode.Multiple; import static com.sardari.daterangepicker.customviews.DateRangeCalendarView.SelectionMode.Range; import static com.sardari.daterangepicker.customviews.DateRangeCalendarView.SelectionMode.Single; public class DateRangeCalendarView extends LinearLayout { //region Fields private Context mContext; + private AttributeSet attrs; private LinearLayout llDaysContainer; private LinearLayout llTitleWeekContainer; private CustomTextView tvYearTitle; @@ -51,37 +49,17 @@ public class DateRangeCalendarView extends LinearLayout { private static final int STRIP_TYPE_LEFT = 1; private static final int STRIP_TYPE_RIGHT = 2; - private int weekColor; - private int titleColor; - private int rangeStripColor; - private int selectedDateCircleColor; - private int selectedDateColor, defaultDateColor, disableDateColor, rangeDateColor, holidayColor, headerColor, todayColor; + private int headerBackgroundColor, weekColor, rangeStripColor, selectedDateCircleColor, selectedDateColor, defaultDateColor, disableDateColor, rangeDateColor, holidayColor, todayColor; private boolean shouldEnabledTime = false; private float textSizeTitle, textSizeWeek, textSizeDate; private PersianCalendar selectedCal, date; //endregion //region Enum - public enum CalendarType { - Persian(1), - Gregorian(2); - - private final int value; - - CalendarType(int value) { - this.value = value; - } - - public int getValue() { - return value; - } - } - public enum SelectionMode { Single(1), - Multiple(2), - Range(3), - None(4); + Range(2), + None(3); private final int value; @@ -98,110 +76,136 @@ public int getValue() { //region Constructor public DateRangeCalendarView(Context context) { super(context); - initView(context, null); } public DateRangeCalendarView(Context context, AttributeSet attrs) { super(context, attrs); - initView(context, attrs); - } - public DateRangeCalendarView(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context, attrs); - } + this.attrs = attrs; - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public DateRangeCalendarView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - initView(context, attrs); + initView(context); } - /** - * To initialize child views - * - * @param context - App context - * @param attributeSet - Attr set - */ - private void initView(Context context, AttributeSet attributeSet) { + private void initView(Context context) { mContext = context; - locale = context.getResources().getConfiguration().locale; - setAttributes(attributeSet); - - LayoutInflater layoutInflater = LayoutInflater.from(mContext); - - LinearLayout mainView = (LinearLayout) layoutInflater.inflate(R.layout.layout_calendar_month, this, true); - llDaysContainer = mainView.findViewById(R.id.llDaysContainer); - llTitleWeekContainer = mainView.findViewById(R.id.llTitleWeekContainer); - tvYearTitle = mainView.findViewById(R.id.tvYearTitle); - tvYearGeorgianTitle = mainView.findViewById(R.id.tvYearGeorgianTitle); - imgVNavLeft = mainView.findViewById(R.id.imgVNavLeft); - imgVNavRight = mainView.findViewById(R.id.imgVNavRight); - - RelativeLayout rlHeaderCalendar = mainView.findViewById(R.id.rlHeaderCalendar); - rlHeaderCalendar.setBackgroundColor(headerColor); - - setListeners(); - - if (isInEditMode()) { - return; - } - - drawCalendarForMonth(getCurrentMonth(new PersianCalendar())); - - setWeekTitleColor(weekColor); + locale = mContext.getResources().getConfiguration().locale; + + setDefaultValues(); + + setAttributes(); + + init(); +// LayoutInflater layoutInflater = LayoutInflater.from(mContext); +// +// LinearLayout mainView = (LinearLayout) layoutInflater.inflate(R.layout.layout_calendar_month, this, true); +// llDaysContainer = mainView.findViewById(R.id.llDaysContainer); +// llTitleWeekContainer = mainView.findViewById(R.id.llTitleWeekContainer); +// tvYearTitle = mainView.findViewById(R.id.tvYearTitle); +// tvYearGeorgianTitle = mainView.findViewById(R.id.tvYearGeorgianTitle); +// imgVNavLeft = mainView.findViewById(R.id.imgVNavLeft); +// imgVNavRight = mainView.findViewById(R.id.imgVNavRight); +// +// RelativeLayout rlHeaderCalendar = mainView.findViewById(R.id.rlHeaderCalendar); +// rlHeaderCalendar.setBackgroundColor(headerBackgroundColor); +// +// setListeners(); +// +// if (isInEditMode()) { +// return; +// } +// +// drawCalendarForMonth(getCurrentMonth(new PersianCalendar())); +// +// setWeekTitleColor(weekColor); } - /** - * To parse attributes from xml layout to configure calendar views. - * - * @param attributeSet - Attribute set - */ - private void setAttributes(AttributeSet attributeSet) { + private void setDefaultValues(){ textSizeTitle = getResources().getDimension(R.dimen.text_size_title); textSizeWeek = getResources().getDimension(R.dimen.text_size_week); textSizeDate = getResources().getDimension(R.dimen.text_size_date); + headerBackgroundColor = ContextCompat.getColor(mContext, R.color.headerBackgroundColor); + weekColor = ContextCompat.getColor(mContext, R.color.week_color); - titleColor = ContextCompat.getColor(mContext, R.color.title_color); - rangeStripColor = ContextCompat.getColor(mContext, R.color.range_bg_color); selectedDateCircleColor = ContextCompat.getColor(mContext, R.color.selected_date_circle_color); selectedDateColor = ContextCompat.getColor(mContext, R.color.selected_date_color); defaultDateColor = ContextCompat.getColor(mContext, R.color.default_date_color); - holidayColor = ContextCompat.getColor(mContext, R.color.holiday_date_color); - todayColor = ContextCompat.getColor(mContext, R.color.today_date_color); rangeDateColor = ContextCompat.getColor(mContext, R.color.range_date_color); disableDateColor = ContextCompat.getColor(mContext, R.color.disable_date_color); - headerColor = ContextCompat.getColor(mContext, R.color.header_color); + rangeStripColor = ContextCompat.getColor(mContext, R.color.range_bg_color); + holidayColor = ContextCompat.getColor(mContext, R.color.holiday_date_color); + todayColor = ContextCompat.getColor(mContext, R.color.today_date_color); + } -// if (attributeSet != null) { - TypedArray ta = mContext.obtainStyledAttributes(attributeSet, R.styleable.DateRangeCalendarView, 0, 0); + private void setAttributes() { + TypedArray ta = mContext.obtainStyledAttributes(attrs, R.styleable.DateRangeCalendarView, 0, 0); try { - weekColor = ta.getColor(R.styleable.DateRangeCalendarView_week_color, weekColor); - titleColor = ta.getColor(R.styleable.DateRangeCalendarView_title_color, titleColor); -// rangeStripColor = ta.getColor(R.styleable.DateRangeCalendarView_range_color, rangeStripColor); - selectedDateCircleColor = ta.getColor(R.styleable.DateRangeCalendarView_selected_date_circle_color, selectedDateCircleColor); shouldEnabledTime = ta.getBoolean(R.styleable.DateRangeCalendarView_enable_time_selection, false); + //text size textSizeTitle = ta.getDimension(R.styleable.DateRangeCalendarView_text_size_title, textSizeTitle); textSizeWeek = ta.getDimension(R.styleable.DateRangeCalendarView_text_size_week, textSizeWeek); textSizeDate = ta.getDimension(R.styleable.DateRangeCalendarView_text_size_date, textSizeDate); + //header color + headerBackgroundColor = ta.getColor(R.styleable.DateRangeCalendarView_header_background_color, headerBackgroundColor); + + //weekColor + weekColor = ta.getColor(R.styleable.DateRangeCalendarView_week_color, weekColor); + selectedDateCircleColor = ta.getColor(R.styleable.DateRangeCalendarView_selected_date_circle_color, selectedDateCircleColor); selectedDateColor = ta.getColor(R.styleable.DateRangeCalendarView_selected_date_color, selectedDateColor); defaultDateColor = ta.getColor(R.styleable.DateRangeCalendarView_default_date_color, defaultDateColor); rangeDateColor = ta.getColor(R.styleable.DateRangeCalendarView_range_date_color, rangeDateColor); disableDateColor = ta.getColor(R.styleable.DateRangeCalendarView_disable_date_color, disableDateColor); - headerColor = ta.getColor(R.styleable.DateRangeCalendarView_header_color, headerColor); + rangeStripColor = ta.getColor(R.styleable.DateRangeCalendarView_range_color, rangeStripColor); + holidayColor = ta.getColor(R.styleable.DateRangeCalendarView_holidayColor, holidayColor); + todayColor = ta.getColor(R.styleable.DateRangeCalendarView_todayColor, todayColor); - selectionMode = ta.getInt(R.styleable.DateRangeCalendarView_selectionMode, Single.getValue()); + selectionMode = ta.getInt(R.styleable.DateRangeCalendarView_selectionMode, selectionMode); + } catch (Exception e) { + Log.e("setAttributes", e.getMessage()); } finally { ta.recycle(); } -// } } + + private void init(){ + LayoutInflater layoutInflater = LayoutInflater.from(mContext); + + LinearLayout mainView = (LinearLayout) layoutInflater.inflate(R.layout.layout_calendar_month, this, true); + llDaysContainer = mainView.findViewById(R.id.llDaysContainer); + llTitleWeekContainer = mainView.findViewById(R.id.llTitleWeekContainer); + tvYearTitle = mainView.findViewById(R.id.tvYearTitle); + tvYearGeorgianTitle = mainView.findViewById(R.id.tvYearGeorgianTitle); + imgVNavLeft = mainView.findViewById(R.id.imgVNavLeft); + imgVNavRight = mainView.findViewById(R.id.imgVNavRight); + + RelativeLayout rlHeaderCalendar = mainView.findViewById(R.id.rlHeaderCalendar); + rlHeaderCalendar.setBackgroundColor(headerBackgroundColor); + + setListeners(); + + if (isInEditMode()) { + return; + } + + build(); + +// drawCalendarForMonth(getCurrentMonth(new PersianCalendar())); +// +// setWeekTitleColor(weekColor); + } + + private void build(){ + drawCalendarForMonth(getCurrentMonth(new PersianCalendar())); + + setWeekTitleColor(weekColor); + } + //endregion + //region Core //region NavigationClickListener & dayClickListener private void setListeners() { //region imgVNavLeft.setOnClickListener @@ -257,6 +261,8 @@ public void onClick(View view) { public void onTimeSelected(int hours, int mins) { selectedCal.set(Calendar.HOUR, hours); selectedCal.set(Calendar.MINUTE, mins); + selectedCal.set(Calendar.SECOND, 0); + selectedCal.set(Calendar.MILLISECOND, 0); if (calendarListener != null) { calendarListener.onDateSelected(selectedCal); @@ -278,9 +284,6 @@ public void onCancel() { //endregion } //endregion - } else if (selectionMode == Multiple.getValue()) { - //region SelectionMode.Multiple - //endregion } else if (selectionMode == Range.getValue()) { //region SelectionMode.Range if (minSelectedDate != null) { @@ -288,7 +291,9 @@ public void onCancel() { maxSelectedDate = selectedCal; drawSelectedDateRange(minSelectedDate, maxSelectedDate); } else { - MyUtils.getInstance().Toast(mContext, "تاریخ برگشت را وارد کنید"); + if (!TextUtils.isEmpty(getMessageEnterEndDate())) { + MyUtils.getInstance().Toast(mContext, getMessageEnterEndDate()); + } resetAllSelectedViews(); @@ -298,7 +303,9 @@ public void onCancel() { makeAsSelectedDate(container, 0); } } else { - MyUtils.getInstance().Toast(mContext, "تاریخ برگشت را وارد کنید"); + if (!TextUtils.isEmpty(getMessageEnterEndDate())) { + MyUtils.getInstance().Toast(mContext, getMessageEnterEndDate()); + } minSelectedDate = selectedCal; maxSelectedDate = null; @@ -313,6 +320,8 @@ public void onCancel() { public void onTimeSelected(int hours, int mins) { selectedCal.set(Calendar.HOUR, hours); selectedCal.set(Calendar.MINUTE, mins); + selectedCal.set(Calendar.SECOND, 0); + selectedCal.set(Calendar.MILLISECOND, 0); Log.i("Tag", "Time: " + selectedCal.getTime().toString()); if (calendarListener != null && minSelectedDate != null && maxSelectedDate != null) { @@ -361,49 +370,46 @@ private PersianCalendar getCurrentMonth(PersianCalendar calendar) { * * @param month */ - @SuppressLint("SetTextI18n") private void drawCalendarForMonth(PersianCalendar month) { tvYearTitle.setText(String.format(locale, "%s %d", month.getPersianMonthName(), month.getPersianYear())); - Log.w("TAG", "DateRangeCalendarView_drawCalendarForMonth_358-> :" + month.getPersianMonth()); - int _month = month.getPersianMonth() + 1; switch (_month) { case 1: - tvYearGeorgianTitle.setText("March - April " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "March - April %d", month.get(Calendar.YEAR))); break; case 2: - tvYearGeorgianTitle.setText("April - May " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "April - May %d", month.get(Calendar.YEAR))); break; case 3: - tvYearGeorgianTitle.setText("May - June " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "May - June %d", month.get(Calendar.YEAR))); break; case 4: - tvYearGeorgianTitle.setText("June - July " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "June - July %d", month.get(Calendar.YEAR))); break; case 5: - tvYearGeorgianTitle.setText("July - August " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "July - August %d", month.get(Calendar.YEAR))); break; case 6: - tvYearGeorgianTitle.setText("August - September " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "August - September %d", month.get(Calendar.YEAR))); break; case 7: - tvYearGeorgianTitle.setText("September - October " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "September - October %d", month.get(Calendar.YEAR))); break; case 8: - tvYearGeorgianTitle.setText("October - November " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "October - November %d", month.get(Calendar.YEAR))); break; case 9: - tvYearGeorgianTitle.setText("November - December " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "November - December %d", month.get(Calendar.YEAR))); break; case 10: tvYearGeorgianTitle.setText(String.format("December %s - January %s ", month.get(Calendar.YEAR), month.get(Calendar.YEAR) + 1)); break; case 11: - tvYearGeorgianTitle.setText("January - February " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "January - February %d", month.get(Calendar.YEAR))); break; case 12: - tvYearGeorgianTitle.setText("February - March " + month.get(Calendar.YEAR)); + tvYearGeorgianTitle.setText(String.format(locale, "February - March %d", month.get(Calendar.YEAR))); break; } @@ -441,15 +447,8 @@ private void drawCalendarForMonth(PersianCalendar month) { * @param calendar - Calendar obj of specific date of the month. */ private void drawDayContainer(DayContainer container, PersianCalendar calendar) { - int date; - int dateGR; - if (calendarType == CalendarType.Persian.getValue()) { - date = calendar.getPersianDay(); - dateGR = calendar.get(Calendar.DATE); - } else { - date = calendar.getPersianDay(); - dateGR = calendar.get(Calendar.DATE); - } + int date = calendar.getPersianDay(); + int dateGR = calendar.get(Calendar.DATE); //---------------------------------------------------------------- if (currentCalendarMonth.getPersianMonth() != calendar.getPersianMonth()) { @@ -458,11 +457,11 @@ private void drawDayContainer(DayContainer container, PersianCalendar calendar) disableDayContainer(container); // container.tvDate.setText(String.valueOf(date)); - isToday(container, calendar); + setToday(container, calendar); } else { int key = DayContainer.GetContainerKey(calendar); - isToday(container, calendar); + setToday(container, calendar); if (selectedDatesRange.indexOf(key) == 0) { makeAsSelectedDate(container, STRIP_TYPE_LEFT); @@ -487,29 +486,24 @@ private void drawDayContainer(DayContainer container, PersianCalendar calendar) disableDayContainer(container); // container.tvDate.setText(String.valueOf(date)); } - } container.tvDate.setText(String.valueOf(date)); container.tvDateGeorgian.setText(String.valueOf(dateGR)); - + container.tvDateGeorgian.setVisibility(showGregorianDate ? VISIBLE : GONE); container.rootView.setTag(DayContainer.GetContainerKey(calendar)); } //--------------------------------------------------------------------------------------------- - private boolean isToday(DayContainer container, PersianCalendar persianCalendar) { + private void setToday(DayContainer container, PersianCalendar persianCalendar) { if (getCurrentDate().compareTo(persianCalendar) == 0) { container.imgEvent.setVisibility(VISIBLE); container.imgEvent.setColorFilter(todayColor, android.graphics.PorterDuff.Mode.SRC_IN); // container.tvDate.setTextColor(todayColor); container.tvDate.setTypeface(typeface, Typeface.BOLD); - - return true; } else { container.imgEvent.setVisibility(GONE); container.tvDate.setTypeface(typeface, Typeface.NORMAL); - - return false; } } @@ -733,27 +727,25 @@ public void setWeekTitleColor(@ColorInt int color) { } } - /** - * To apply custom fonts to all the text views - * - * @param fonts - Typeface that you want to apply - */ - public void setFonts(Typeface fonts) { - this.typeface = fonts; - if (fonts != null) { + public void setTypeface(Typeface typeface) { + if (typeface != null) { + this.typeface = typeface; + drawCalendarForMonth(currentCalendarMonth); - tvYearTitle.setTypeface(fonts); + tvYearTitle.setTypeface(typeface); for (int i = 0; i < llTitleWeekContainer.getChildCount(); i++) { CustomTextView textView = (CustomTextView) llTitleWeekContainer.getChildAt(i); - textView.setTypeface(fonts); + textView.setTypeface(typeface); } } } + //endregion //--------------------------------------------------------------------------------------------- + //region Properties //region selectionMode -> Getter/Setter - private int selectionMode = SelectionMode.Single.getValue(); + private int selectionMode = SelectionMode.Range.getValue(); public int getSelectionMode() { return selectionMode; @@ -764,18 +756,6 @@ public void setSelectionMode(int selectionMode) { } //endregion - //region calendarType -> Getter/Setter - private int calendarType = CalendarType.Persian.getValue(); - - public int getCalendarType() { - return calendarType; - } - - public void setCalendarType(int calendarType) { - this.calendarType = calendarType; - } - //endregion - //region currentDate -> Getter/Setter private PersianCalendar currentDate = new PersianCalendar(); @@ -831,27 +811,15 @@ public void setDisableDaysAgo(boolean disableDaysAgo) { } //endregion - //region messageEnterDate - String messageEnterDate; + //region showGregorianDate -> Default = false + private boolean showGregorianDate = false; - public String getMessageEnterDate() { - return messageEnterDate; + public boolean isShowGregorianDate() { + return showGregorianDate; } - public void setMessageEnterDate(String messageEnterDate) { - this.messageEnterDate = messageEnterDate; - } - //endregion - - //region messageEnterStartDate - String messageEnterStartDate; - - public String getMessageEnterStartDate() { - return messageEnterStartDate; - } - - public void setMessageEnterStartDate(String messageEnterStartDate) { - this.messageEnterStartDate = messageEnterStartDate; + public void setShowGregorianDate(boolean showGregorianDate) { + this.showGregorianDate = showGregorianDate; } //endregion @@ -865,8 +833,128 @@ public String getMessageEnterEndDate() { public void setMessageEnterEndDate(String messageEnterEndDate) { this.messageEnterEndDate = messageEnterEndDate; } + //endregion + //-------------------------------------------------------------------------------------------- + //region theme + public int getHeaderBackgroundColor() { + return headerBackgroundColor; + } + + public void setHeaderBackgroundColor(int headerBackgroundColor) { + this.headerBackgroundColor = headerBackgroundColor; + } + + public int getWeekColor() { + return weekColor; + } + + public void setWeekColor(int weekColor) { + this.weekColor = weekColor; + } + + public int getRangeStripColor() { + return rangeStripColor; + } + + public void setRangeStripColor(int rangeStripColor) { + this.rangeStripColor = rangeStripColor; + } + + public int getSelectedDateCircleColor() { + return selectedDateCircleColor; + } + + public void setSelectedDateCircleColor(int selectedDateCircleColor) { + this.selectedDateCircleColor = selectedDateCircleColor; + } + + public int getSelectedDateColor() { + return selectedDateColor; + } + public void setSelectedDateColor(int selectedDateColor) { + this.selectedDateColor = selectedDateColor; + } + + public int getDefaultDateColor() { + return defaultDateColor; + } + + public void setDefaultDateColor(int defaultDateColor) { + this.defaultDateColor = defaultDateColor; + + build(); + } + + public int getDisableDateColor() { + return disableDateColor; + } + + public void setDisableDateColor(int disableDateColor) { + this.disableDateColor = disableDateColor; + } + + public int getRangeDateColor() { + return rangeDateColor; + } + + public void setRangeDateColor(int rangeDateColor) { + this.rangeDateColor = rangeDateColor; + } + + public int getHolidayColor() { + return holidayColor; + } + + public void setHolidayColor(int holidayColor) { + this.holidayColor = holidayColor; + + setAttributes(); + } + + public int getTodayColor() { + return todayColor; + } + + public void setTodayColor(int todayColor) { + this.todayColor = todayColor; + } + + public boolean isShouldEnabledTime() { + return shouldEnabledTime; + } + + public void setShouldEnabledTime(boolean shouldEnabledTime) { + this.shouldEnabledTime = shouldEnabledTime; + } + + public float getTextSizeTitle() { + return textSizeTitle; + } + + public void setTextSizeTitle(float textSizeTitle) { + this.textSizeTitle = textSizeTitle; + } + + public float getTextSizeWeek() { + return textSizeWeek; + } + + public void setTextSizeWeek(float textSizeWeek) { + this.textSizeWeek = textSizeWeek; + } + + public float getTextSizeDate() { + return textSizeDate; + } + + public void setTextSizeDate(float textSizeDate) { + this.textSizeDate = textSizeDate; + } + + //endregion + //-------------------------------------------------------------------------------------------- //region Listener -> Getter/Setter private CalendarListener calendarListener; @@ -878,6 +966,7 @@ public void setCalendarListener(CalendarListener calendarListener) { this.calendarListener = calendarListener; } //endregion + //endregion //-------------------------------------------------------------------------------------------- public interface CalendarListener { diff --git a/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog_fragment/DatePickerDialog.java b/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog/DatePickerDialog.java similarity index 77% rename from daterangepicker/src/main/java/com/sardari/daterangepicker/dialog_fragment/DatePickerDialog.java rename to daterangepicker/src/main/java/com/sardari/daterangepicker/dialog/DatePickerDialog.java index aa45d57..8532c9d 100644 --- a/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog_fragment/DatePickerDialog.java +++ b/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog/DatePickerDialog.java @@ -1,7 +1,8 @@ -package com.sardari.daterangepicker.dialog_fragment; +package com.sardari.daterangepicker.dialog; import android.app.Dialog; import android.content.Context; +import android.graphics.Color; import android.graphics.Typeface; import android.view.Gravity; import android.view.View; @@ -10,6 +11,7 @@ import com.sardari.daterangepicker.R; import com.sardari.daterangepicker.customviews.DateRangeCalendarView; +import com.sardari.daterangepicker.utils.FontUtils; import com.sardari.daterangepicker.utils.MyUtils; import com.sardari.daterangepicker.utils.PersianCalendar; @@ -21,6 +23,7 @@ public class DatePickerDialog extends Dialog { private DateRangeCalendarView calendar; private Button btn_Accept; private PersianCalendar date, startDate, endDate; + private Typeface typeface; //endregion public DatePickerDialog(Context context) { @@ -31,6 +34,8 @@ public DatePickerDialog(Context context) { if (getWindow() != null) getWindow().setGravity(Gravity.CENTER); + this.typeface = FontUtils.Default(mContext); + initView(); PersianCalendar today = new PersianCalendar(); @@ -47,6 +52,7 @@ private void initView() { } public void showDialog() { +// calendar=new DateRangeCalendarView(mContext); calendar.setCalendarListener(new DateRangeCalendarView.CalendarListener() { @Override public void onDateSelected(PersianCalendar _date) { @@ -103,24 +109,53 @@ public void onClick(View v) { calendar.setMaxDate(maxDate); calendar.setMinDate(minDate); calendar.setCurrentDate(currentDate); - calendar.setCalendarType(calendarType.getValue()); calendar.setSelectionMode(selectionMode.getValue()); - calendar.setDisableDaysAgo(true); + calendar.setDisableDaysAgo(disableDaysAgo); + calendar.setTypeface(typeface); + calendar.setShowGregorianDate(showGregorianDate); + + + calendar.setWeekTitleColor(Color.parseColor("#519c3f")); + calendar.setHolidayColor(Color.parseColor("#e4215d")); + calendar.setTodayColor(Color.parseColor("#e1218d")); + calendar.setRangeStripColor(Color.parseColor("#e1218d")); + calendar.setDefaultDateColor(Color.parseColor("#e1218d")); + +// calendar.(); +// calendar.setShouldEnabledTime(true); + + + + if (selectionMode.getValue() == DateRangeCalendarView.SelectionMode.None.getValue()) { + btn_Accept.setVisibility(View.GONE); + } this.show(); } //region Properties - //region Typeface -> Getter/Setter + //region DisableDaysAgo -> Default = True + private boolean disableDaysAgo = true; + + public boolean isDisableDaysAgo() { + return disableDaysAgo; + } + + public void setDisableDaysAgo(boolean disableDaysAgo) { + this.disableDaysAgo = disableDaysAgo; + } + //endregion + + //region Typeface -> Default = IranYekan public void setTypeface(Typeface typeface) { if (typeface != null) { - calendar.setFonts(typeface); + this.typeface = typeface; } } //endregion - //region SelectionMode -> Getter/Setter {Single(1),Multiple(2),Range(3),None(4)} - private DateRangeCalendarView.SelectionMode selectionMode = DateRangeCalendarView.SelectionMode.Single; + //region SelectionMode -> Default = Range | Enum -> {Single(1),Range(2),None(3)} + private DateRangeCalendarView.SelectionMode selectionMode = DateRangeCalendarView.SelectionMode.Range; public DateRangeCalendarView.SelectionMode getSelectionMode() { return selectionMode; @@ -134,22 +169,8 @@ public void setSelectionMode(DateRangeCalendarView.SelectionMode selectionMode) } //endregion - //region CalendarType -> Getter/Setter { Persian(1),Gregorian(2)} - private DateRangeCalendarView.CalendarType calendarType = DateRangeCalendarView.CalendarType.Persian; - - public DateRangeCalendarView.CalendarType getCalendarType() { - return calendarType; - } - - public void setCalendarType(DateRangeCalendarView.CalendarType calendarType) { - this.calendarType = calendarType; - - calendar.setCalendarType(calendarType.getValue()); - } - //endregion - - //region currentDate -> Getter/Setter - private PersianCalendar currentDate; + //region CurrentDate -> Default = Today + private PersianCalendar currentDate = new PersianCalendar(); public PersianCalendar getCurrentDate() { return currentDate; @@ -161,7 +182,7 @@ public void setCurrentDate(PersianCalendar currentDate) { } //endregion - //region MinDate -> Getter/Setter + //region MinDate -> Default = Today private PersianCalendar minDate; public PersianCalendar getMinDate() { @@ -174,7 +195,7 @@ public void setMinDate(PersianCalendar minDate) { } //endregion - //region MaxDate -> Getter/Setter + //region MaxDate -> Default = Today + 1 year private PersianCalendar maxDate; public PersianCalendar getMaxDate() { @@ -187,15 +208,15 @@ public void setMaxDate(PersianCalendar maxDate) { } //endregion - //region SelectableDaysCount -> Getter/Setter - private int selectableDaysCount; + //region showGregorianDate -> Default = false + private boolean showGregorianDate = false; - public int getSelectableDaysCount() { - return selectableDaysCount; + public boolean isShowGregorianDate() { + return showGregorianDate; } - public void setSelectableDaysCount(int selectableDaysCount) { - this.selectableDaysCount = selectableDaysCount; + public void setShowGregorianDate(boolean showGregorianDate) { + this.showGregorianDate = showGregorianDate; } //endregion diff --git a/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog_fragment/TimePickerDialog.java b/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog/TimePickerDialog.java similarity index 98% rename from daterangepicker/src/main/java/com/sardari/daterangepicker/dialog_fragment/TimePickerDialog.java rename to daterangepicker/src/main/java/com/sardari/daterangepicker/dialog/TimePickerDialog.java index 433a7a6..2097a94 100644 --- a/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog_fragment/TimePickerDialog.java +++ b/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog/TimePickerDialog.java @@ -1,4 +1,4 @@ -package com.sardari.daterangepicker.dialog_fragment; +package com.sardari.daterangepicker.dialog; import android.app.Dialog; import android.content.Context; diff --git a/daterangepicker/src/main/java/com/sardari/daterangepicker/utils/FontUtils.java b/daterangepicker/src/main/java/com/sardari/daterangepicker/utils/FontUtils.java new file mode 100644 index 0000000..0fa4f35 --- /dev/null +++ b/daterangepicker/src/main/java/com/sardari/daterangepicker/utils/FontUtils.java @@ -0,0 +1,22 @@ +package com.sardari.daterangepicker.utils; + +import android.content.Context; +import android.graphics.Typeface; +import android.support.v4.util.SimpleArrayMap; + +public class FontUtils { + private static String FONT_NAME = "IranYekan"; + + private static final SimpleArrayMap cache = new SimpleArrayMap<>(); + + public static Typeface Default(Context context) { + synchronized (cache) { + if (!cache.containsKey(FONT_NAME)) { + Typeface t = Typeface.createFromAsset(context.getAssets(), "fonts/" + FONT_NAME + ".ttf"); + cache.put(FONT_NAME, t); + return t; + } + return cache.get(FONT_NAME); + } + } +} diff --git a/daterangepicker/src/main/res/drawable/calendar_header.xml b/daterangepicker/src/main/res/drawable/calendar_header.xml deleted file mode 100644 index a9a8f74..0000000 --- a/daterangepicker/src/main/res/drawable/calendar_header.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/daterangepicker/src/main/res/layout/dialog_date_picker.xml b/daterangepicker/src/main/res/layout/dialog_date_picker.xml index 4d7aa7e..0485503 100644 --- a/daterangepicker/src/main/res/layout/dialog_date_picker.xml +++ b/daterangepicker/src/main/res/layout/dialog_date_picker.xml @@ -1,18 +1,16 @@ + android:layout_height="wrap_content" /> + android:text="0" /> + android:text="1" + android:textColor="@android:color/darker_gray" + android:textSize="10.5sp" /> diff --git a/daterangepicker/src/main/res/layout/layout_calendar_nav.xml b/daterangepicker/src/main/res/layout/layout_calendar_nav.xml index ed7410f..25882e7 100644 --- a/daterangepicker/src/main/res/layout/layout_calendar_nav.xml +++ b/daterangepicker/src/main/res/layout/layout_calendar_nav.xml @@ -4,7 +4,7 @@ android:id="@+id/rlHeaderCalendar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/header_color"> + android:background="@color/headerBackgroundColor"> + + @@ -8,14 +10,16 @@ + + + - - + diff --git a/daterangepicker/src/main/res/values/colors.xml b/daterangepicker/src/main/res/values/colors.xml index 6af4269..30ff309 100644 --- a/daterangepicker/src/main/res/values/colors.xml +++ b/daterangepicker/src/main/res/values/colors.xml @@ -1,7 +1,12 @@ + + #040078 + + + @color/headerBackgroundColor + - #000 #000 #717171 @@ -12,22 +17,16 @@ #FFF #deccddf7 - - - #474747 #e4215d #ffffff - #FF006B - + #bf00bf #0097e2 - - - - #51bf4b + #2b303d #ccddf7 + \ No newline at end of file diff --git a/daterangepicker/src/main/res/values/styles.xml b/daterangepicker/src/main/res/values/styles.xml index 042b1ee..203a3b8 100644 --- a/daterangepicker/src/main/res/values/styles.xml +++ b/daterangepicker/src/main/res/values/styles.xml @@ -1,4 +1,5 @@ + \ No newline at end of file From d4c5dc0401d08d4a2dad84fc8a2e44441710b9ed Mon Sep 17 00:00:00 2001 From: Ali Date: Fri, 31 Aug 2018 20:26:42 +0430 Subject: [PATCH 2/3] - improve --- .../customviews/DateRangeCalendarView.java | 95 +++++++------------ .../dialog/DatePickerDialog.java | 26 ++--- .../main/res/layout/dialog_date_picker.xml | 18 +++- 3 files changed, 59 insertions(+), 80 deletions(-) diff --git a/daterangepicker/src/main/java/com/sardari/daterangepicker/customviews/DateRangeCalendarView.java b/daterangepicker/src/main/java/com/sardari/daterangepicker/customviews/DateRangeCalendarView.java index 7de49d3..bff82fe 100644 --- a/daterangepicker/src/main/java/com/sardari/daterangepicker/customviews/DateRangeCalendarView.java +++ b/daterangepicker/src/main/java/com/sardari/daterangepicker/customviews/DateRangeCalendarView.java @@ -5,7 +5,6 @@ import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.GradientDrawable; -import android.support.annotation.ColorInt; import android.support.v4.content.ContextCompat; import android.text.TextUtils; import android.util.AttributeSet; @@ -20,6 +19,7 @@ import com.sardari.daterangepicker.R; import com.sardari.daterangepicker.dialog.TimePickerDialog; import com.sardari.daterangepicker.models.DayContainer; +import com.sardari.daterangepicker.utils.FontUtils; import com.sardari.daterangepicker.utils.MyUtils; import com.sardari.daterangepicker.utils.PersianCalendar; @@ -76,18 +76,24 @@ public int getValue() { //region Constructor public DateRangeCalendarView(Context context) { super(context); + + this.mContext = context; + this.attrs = null; + + initView(); } public DateRangeCalendarView(Context context, AttributeSet attrs) { super(context, attrs); + this.mContext = context; this.attrs = attrs; - initView(context); + initView(); } - private void initView(Context context) { - mContext = context; + private void initView() { + typeface = FontUtils.Default(mContext); locale = mContext.getResources().getConfiguration().locale; setDefaultValues(); @@ -95,31 +101,9 @@ private void initView(Context context) { setAttributes(); init(); -// LayoutInflater layoutInflater = LayoutInflater.from(mContext); -// -// LinearLayout mainView = (LinearLayout) layoutInflater.inflate(R.layout.layout_calendar_month, this, true); -// llDaysContainer = mainView.findViewById(R.id.llDaysContainer); -// llTitleWeekContainer = mainView.findViewById(R.id.llTitleWeekContainer); -// tvYearTitle = mainView.findViewById(R.id.tvYearTitle); -// tvYearGeorgianTitle = mainView.findViewById(R.id.tvYearGeorgianTitle); -// imgVNavLeft = mainView.findViewById(R.id.imgVNavLeft); -// imgVNavRight = mainView.findViewById(R.id.imgVNavRight); -// -// RelativeLayout rlHeaderCalendar = mainView.findViewById(R.id.rlHeaderCalendar); -// rlHeaderCalendar.setBackgroundColor(headerBackgroundColor); -// -// setListeners(); -// -// if (isInEditMode()) { -// return; -// } -// -// drawCalendarForMonth(getCurrentMonth(new PersianCalendar())); -// -// setWeekTitleColor(weekColor); } - private void setDefaultValues(){ + private void setDefaultValues() { textSizeTitle = getResources().getDimension(R.dimen.text_size_title); textSizeWeek = getResources().getDimension(R.dimen.text_size_week); textSizeDate = getResources().getDimension(R.dimen.text_size_date); @@ -170,7 +154,7 @@ private void setAttributes() { } } - private void init(){ + private void init() { LayoutInflater layoutInflater = LayoutInflater.from(mContext); LinearLayout mainView = (LinearLayout) layoutInflater.inflate(R.layout.layout_calendar_month, this, true); @@ -191,18 +175,7 @@ private void init(){ } build(); - -// drawCalendarForMonth(getCurrentMonth(new PersianCalendar())); -// -// setWeekTitleColor(weekColor); } - - private void build(){ - drawCalendarForMonth(getCurrentMonth(new PersianCalendar())); - - setWeekTitleColor(weekColor); - } - //endregion //region Core @@ -259,10 +232,13 @@ public void onClick(View view) { TimePickerDialog awesomeTimePickerDialog = new TimePickerDialog(mContext, mContext.getString(R.string.select_time), new TimePickerDialog.TimePickerCallback() { @Override public void onTimeSelected(int hours, int mins) { + PersianCalendar p = (PersianCalendar) selectedCal.clone(); + selectedCal.set(Calendar.HOUR, hours); selectedCal.set(Calendar.MINUTE, mins); selectedCal.set(Calendar.SECOND, 0); selectedCal.set(Calendar.MILLISECOND, 0); + selectedCal.setPersianDate(p.getPersianYear(), p.getPersianMonth(), p.getPersianDay()); if (calendarListener != null) { calendarListener.onDateSelected(selectedCal); @@ -318,12 +294,14 @@ public void onCancel() { TimePickerDialog awesomeTimePickerDialog = new TimePickerDialog(mContext, mContext.getString(R.string.select_time), new TimePickerDialog.TimePickerCallback() { @Override public void onTimeSelected(int hours, int mins) { + PersianCalendar p = (PersianCalendar) selectedCal.clone(); + selectedCal.set(Calendar.HOUR, hours); selectedCal.set(Calendar.MINUTE, mins); selectedCal.set(Calendar.SECOND, 0); selectedCal.set(Calendar.MILLISECOND, 0); + selectedCal.setPersianDate(p.getPersianYear(), p.getPersianMonth(), p.getPersianDay()); - Log.i("Tag", "Time: " + selectedCal.getTime().toString()); if (calendarListener != null && minSelectedDate != null && maxSelectedDate != null) { calendarListener.onDateRangeSelected(minSelectedDate, maxSelectedDate); } @@ -496,7 +474,7 @@ private void drawDayContainer(DayContainer container, PersianCalendar calendar) //--------------------------------------------------------------------------------------------- private void setToday(DayContainer container, PersianCalendar persianCalendar) { - if (getCurrentDate().compareTo(persianCalendar) == 0) { + if (getCurrentDate().getPersianShortDate().compareTo(persianCalendar.getPersianShortDate()) == 0) { container.imgEvent.setVisibility(VISIBLE); container.imgEvent.setColorFilter(todayColor, android.graphics.PorterDuff.Mode.SRC_IN); // container.tvDate.setTextColor(todayColor); @@ -714,16 +692,10 @@ public void resetAllSelectedViews() { } } - /** - * To set week title color - * - * @param color - resource color value - */ - public void setWeekTitleColor(@ColorInt int color) { - weekColor = color; + private void setWeekTitleColor() { for (int i = 0; i < llTitleWeekContainer.getChildCount(); i++) { CustomTextView textView = (CustomTextView) llTitleWeekContainer.getChildAt(i); - textView.setTextColor(color); + textView.setTextColor(weekColor); } } @@ -732,11 +704,11 @@ public void setTypeface(Typeface typeface) { this.typeface = typeface; drawCalendarForMonth(currentCalendarMonth); - tvYearTitle.setTypeface(typeface); + tvYearTitle.setTypeface(this.typeface); for (int i = 0; i < llTitleWeekContainer.getChildCount(); i++) { CustomTextView textView = (CustomTextView) llTitleWeekContainer.getChildAt(i); - textView.setTypeface(typeface); + textView.setTypeface(this.typeface); } } } @@ -744,6 +716,13 @@ public void setTypeface(Typeface typeface) { //endregion //--------------------------------------------------------------------------------------------- //region Properties + public void build() { + + drawCalendarForMonth(getCurrentMonth(currentDate)); + + setWeekTitleColor(); + } + //region selectionMode -> Getter/Setter private int selectionMode = SelectionMode.Range.getValue(); @@ -766,12 +745,12 @@ public PersianCalendar getCurrentDate() { public void setCurrentDate(PersianCalendar currentDate) { this.currentDate = currentDate; - if (currentDate != null) { - currentCalendarMonth = (PersianCalendar) currentDate.clone(); - currentCalendarMonth.setPersianDay(1); - - resetAllSelectedViews(); - } +// if (currentDate != null) { +// currentCalendarMonth = (PersianCalendar) currentDate.clone(); +// currentCalendarMonth.setPersianDay(1); +// +// resetAllSelectedViews(); +// } } //endregion @@ -883,8 +862,6 @@ public int getDefaultDateColor() { public void setDefaultDateColor(int defaultDateColor) { this.defaultDateColor = defaultDateColor; - - build(); } public int getDisableDateColor() { diff --git a/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog/DatePickerDialog.java b/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog/DatePickerDialog.java index 8532c9d..a2c7ece 100644 --- a/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog/DatePickerDialog.java +++ b/daterangepicker/src/main/java/com/sardari/daterangepicker/dialog/DatePickerDialog.java @@ -2,10 +2,10 @@ import android.app.Dialog; import android.content.Context; -import android.graphics.Color; import android.graphics.Typeface; import android.view.Gravity; import android.view.View; +import android.view.ViewGroup; import android.view.Window; import android.widget.Button; @@ -47,12 +47,12 @@ private void initView() { setContentView(R.layout.dialog_date_picker); btn_Accept = findViewById(R.id.btn_Accept); - calendar = findViewById(R.id.calendar); +// calendar = findViewById(R.id.calendar); //endregion } public void showDialog() { -// calendar=new DateRangeCalendarView(mContext); + calendar = new DateRangeCalendarView(mContext); calendar.setCalendarListener(new DateRangeCalendarView.CalendarListener() { @Override public void onDateSelected(PersianCalendar _date) { @@ -106,24 +106,19 @@ public void onClick(View v) { } }); - calendar.setMaxDate(maxDate); - calendar.setMinDate(minDate); - calendar.setCurrentDate(currentDate); calendar.setSelectionMode(selectionMode.getValue()); calendar.setDisableDaysAgo(disableDaysAgo); calendar.setTypeface(typeface); + calendar.setCurrentDate(currentDate); + calendar.setMaxDate(maxDate); + calendar.setMinDate(minDate); calendar.setShowGregorianDate(showGregorianDate); + calendar.setShouldEnabledTime(false); + calendar.build(); - calendar.setWeekTitleColor(Color.parseColor("#519c3f")); - calendar.setHolidayColor(Color.parseColor("#e4215d")); - calendar.setTodayColor(Color.parseColor("#e1218d")); - calendar.setRangeStripColor(Color.parseColor("#e1218d")); - calendar.setDefaultDateColor(Color.parseColor("#e1218d")); - -// calendar.(); -// calendar.setShouldEnabledTime(true); - + ViewGroup insertPoint = findViewById(R.id.content); + insertPoint.addView(calendar); if (selectionMode.getValue() == DateRangeCalendarView.SelectionMode.None.getValue()) { @@ -178,7 +173,6 @@ public PersianCalendar getCurrentDate() { public void setCurrentDate(PersianCalendar currentDate) { this.currentDate = currentDate; - calendar.setCurrentDate(currentDate); } //endregion diff --git a/daterangepicker/src/main/res/layout/dialog_date_picker.xml b/daterangepicker/src/main/res/layout/dialog_date_picker.xml index 0485503..966942a 100644 --- a/daterangepicker/src/main/res/layout/dialog_date_picker.xml +++ b/daterangepicker/src/main/res/layout/dialog_date_picker.xml @@ -1,16 +1,24 @@ - + android:layout_height="wrap_content" + android:orientation="horizontal"> + + + + + + + + Date: Fri, 31 Aug 2018 20:30:09 +0430 Subject: [PATCH 3/3] - improve --- app/src/main/res/layout/activity_main.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index aeda230..fd534e2 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -8,17 +8,17 @@ @@ -39,7 +39,7 @@ android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_marginLeft="10dp" - android:layout_marginTop="10dp" + android:layout_marginTop="50dp" android:text="انتخاب تاریخ" /> \ No newline at end of file