Skip to content

Commit

Permalink
- improve
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-sardari committed Jan 4, 2019
1 parent f7895c8 commit 6285894
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 24 deletions.
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "com.sardari.persianrangedatepicker"
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
Expand All @@ -21,7 +20,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':daterangepicker')
// implementation 'com.github.ali-sardari:PersianRangeDatePicker:1.0.2'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'

}

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ private void ShowDatePicker() {
DatePickerDialog datePickerDialog = new DatePickerDialog(MainActivity.this);
datePickerDialog.setSelectionMode(DateRangeCalendarView.SelectionMode.Range);
datePickerDialog.setEnableTimePicker(false);
// datePickerDialog.setShowGregorianDate(true);
datePickerDialog.setTextSizeTitle(18.0f);
datePickerDialog.setTextSizeWeek(12.0f);
datePickerDialog.setTextSizeDate(14.0f);
datePickerDialog.setCanceledOnTouchOutside(true);
datePickerDialog.setOnRangeDateSelectedListener(new DatePickerDialog.OnRangeDateSelectedListener() {
@Override
Expand All @@ -48,10 +52,10 @@ public void onRangeDateSelected(PersianCalendar startDate, PersianCalendar endDa
txtEndDate.setText(endDate.getPersianShortDateTime());
}
});

// datePickerDialog.setAcceptButtonColor(ContextCompat.getColor(this, R.color.colorAccent));
datePickerDialog.showDialog();
}
}


// private void ShowTimePicker() {
Expand All @@ -77,5 +81,3 @@ public void onRangeDateSelected(PersianCalendar startDate, PersianCalendar endDa
//
// timePickerDialog.showDialog();
// }

}
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
// classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
// classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.4.0'
}
Expand All @@ -30,11 +30,11 @@ task clean(type: Delete) {
}

ext {
compileSdkVersion = 27
buildToolsVersion = "27.0.3"
minSdkVersion = 16
targetSdkVersion = 27
supportLibraryVersion = "27.1.1"
compileSdkVersion = 28
buildToolsVersion = "28.0.3"
minSdkVersion = 17
targetSdkVersion = 28
supportLibraryVersion = "28.0.0"

junitVersion = "4.12"
}
7 changes: 3 additions & 4 deletions daterangepicker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.persianrangedatepicker'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 28
buildToolsVersion '28.0.3'
flavorDimensions "default"

defaultConfig {
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0.1"
vectorDrawables.useSupportLibrary = true
Expand All @@ -19,5 +18,5 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class DateRangeCalendarView extends LinearLayout {
private static final int STRIP_TYPE_RIGHT = 2;

private int headerBackgroundColor, weekColor, rangeStripColor, selectedDateCircleColor, selectedDateColor, defaultDateColor, disableDateColor, rangeDateColor, holidayColor, todayColor;
private boolean shouldEnabledTime = false;
private boolean shouldEnabledTime = true;
private float textSizeTitle, textSizeWeek, textSizeDate;
private PersianCalendar selectedCal, date;
//endregion
Expand Down Expand Up @@ -105,9 +105,12 @@ private void initView() {
}

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);
// textSizeTitle = getResources().getDimension(R.dimen.text_size_title);
// textSizeWeek = getResources().getDimension(R.dimen.text_size_week);
// textSizeDate = getResources().getDimension(R.dimen.text_size_date);
textSizeTitle = 10.0f;
textSizeWeek = 12.0f;
textSizeDate = 14.0f;

headerBackgroundColor = ContextCompat.getColor(mContext, R.color.headerBackgroundColor);

Expand All @@ -126,7 +129,7 @@ private void setDefaultValues() {
public void setAttributes() {
TypedArray ta = mContext.obtainStyledAttributes(attrs, R.styleable.DateRangeCalendarView, 0, 0);
try {
shouldEnabledTime = ta.getBoolean(R.styleable.DateRangeCalendarView_enable_time_selection, false);
shouldEnabledTime = ta.getBoolean(R.styleable.DateRangeCalendarView_enable_time_selection, shouldEnabledTime);

//text size
textSizeTitle = ta.getDimension(R.styleable.DateRangeCalendarView_text_size_title, textSizeTitle);
Expand Down Expand Up @@ -290,6 +293,8 @@ public void onCancel() {
}

if (shouldEnabledTime) {
Log.w("TAG", "DateRangeCalendarView_onClick_296-> :" );

//region shouldEnabledTime
TimePickerDialog awesomeTimePickerDialog = new TimePickerDialog(mContext, mContext.getString(R.string.select_time), new TimePickerDialog.TimePickerCallback() {
@Override
Expand Down Expand Up @@ -349,6 +354,8 @@ private PersianCalendar getCurrentMonth(PersianCalendar calendar) {
* @param month
*/
private void drawCalendarForMonth(PersianCalendar month) {
tvYearTitle.setTextSize(textSizeTitle);

tvYearTitle.setText(String.format(locale, "%s %d", month.getPersianMonthName(), month.getPersianYear()));

int _month = month.getPersianMonth() + 1;
Expand Down Expand Up @@ -411,6 +418,8 @@ private void drawCalendarForMonth(PersianCalendar month) {
container.tvDate.setTypeface(typeface);
}

container.tvDate.setTextSize(textSizeDate);

drawDayContainer(container, month);

month.setPersianDay(month.getPersianDay() + 1);
Expand Down Expand Up @@ -696,6 +705,7 @@ private void setWeekTitleColor() {
for (int i = 0; i < llTitleWeekContainer.getChildCount(); i++) {
CustomTextView textView = (CustomTextView) llTitleWeekContainer.getChildAt(i);
textView.setTextColor(weekColor);
textView.setTextSize(textSizeWeek);
}
}

Expand Down Expand Up @@ -919,6 +929,8 @@ public float getTextSizeWeek() {

public void setTextSizeWeek(float textSizeWeek) {
this.textSizeWeek = textSizeWeek != 0 ? textSizeWeek : this.textSizeWeek;


}

public float getTextSizeDate() {
Expand Down
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Aug 24 14:22:53 IRDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 comments on commit 6285894

Please sign in to comment.