├── .gitignore ├── .idea ├── codeStyles │ └── Project.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── Images ├── 1.png ├── 2.png └── 3.png ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ └── uneversaldatetools-debug.aar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── ali │ │ └── universaldatetools │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── ali │ │ │ └── universaldatetools │ │ │ ├── DialogTestActivity.java │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_dialog_test.xml │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-fa │ │ └── strings.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── ali │ └── universaldatetools │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── uneversaldatetools ├── .gitignore ├── build.gradle ├── libs └── jars │ └── universalDateTools.jar ├── proguard-rules.pro └── src ├── androidTest └── java │ └── com │ └── ali │ └── uneversaldatetools │ └── ExampleInstrumentedTest.java ├── main ├── AndroidManifest.xml ├── java │ └── com │ │ └── ali │ │ └── uneversaldatetools │ │ ├── UDatePickerDialog.java │ │ ├── date │ │ ├── Calendar.java │ │ ├── DateConverter.java │ │ ├── DateSystem.java │ │ ├── DateValidation.java │ │ ├── DayOfWeek.java │ │ ├── DefaultCalendar.java │ │ ├── GregorianDateTime.java │ │ ├── HijriDateTime.java │ │ ├── IDate.java │ │ ├── JalaliDateTime.java │ │ ├── Season.java │ │ ├── SeasonHelper.java │ │ └── TimeZoneHelper.java │ │ ├── datePicker │ │ ├── CalenderViewFragment.java │ │ ├── DaysViewGenerator.java │ │ ├── UDatePicker.java │ │ └── ViewPagerAdapter.java │ │ ├── model │ │ ├── DateModel.java │ │ └── Month.java │ │ └── tools │ │ ├── Convert.java │ │ ├── ExpandAndCollapseAnimation.java │ │ ├── StringGenerator.java │ │ └── UnixTimeTools.java └── res │ ├── drawable │ ├── arro_left.xml │ ├── circle.xml │ └── counter_left.xml │ ├── layout │ ├── dialog_u_date_picker.xml │ ├── item_day_empty.xml │ ├── item_day_normal.xml │ ├── item_day_selected.xml │ ├── item_day_today.xml │ ├── item_month_view.xml │ ├── item_year.xml │ ├── u_date_picker_days_month.xml │ └── u_date_picker_year.xml │ ├── values-fa │ └── strings.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ └── strings.xml └── test └── java └── com └── ali └── uneversaldatetools └── ExampleUnitTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | connect.sh 11 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hooshkar/AndroidMultiCalendarTools/01ad46a40c945cd49d9287e2912ac8f1bafc4c90/Images/1.png -------------------------------------------------------------------------------- /Images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hooshkar/AndroidMultiCalendarTools/01ad46a40c945cd49d9287e2912ac8f1bafc4c90/Images/2.png -------------------------------------------------------------------------------- /Images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hooshkar/AndroidMultiCalendarTools/01ad46a40c945cd49d9287e2912ac8f1bafc4c90/Images/3.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android multi calender tools library for android 2 | android date tools and date picker for tree calendar systems Jalali , Hijri , Gregorian 3 | 4 | # Screen shots 5 | primary color will be your theme color 6 |

7 | 8 | 9 | 10 | 11 |

12 | 13 | # Add to your project 14 | copy [this](https://github.com/hooshkar/AndroidMultiCalenderTools/releases/download/1.5.0/uneversaldatetools-release.aar) to "yourProject/app/libs"
[have problem?](https://github.com/hooshkar/AndroidMultiCalenderTools/wiki/install) 15 | 16 | # How to use 17 | date converter: more 18 | [here](https://github.com/hooshkar/AndroidMultiCalenderTools/wiki/Convert). 19 | ~~~java 20 | DateModel hijri = DateConverter.GregorianToHijri(2018, 1, 1); 21 | //hijri.day; 22 | //hijri.month; 23 | //hijri.year; 24 | ~~~ 25 | 26 | date picker:
27 | xml:(don't change height and width) 28 | ~~~xml 29 | 33 | ~~~ 34 | java: 35 | ~~~java 36 | UDatePicker uDatePicker = findViewById(R.id.date_picker); 37 | 38 | //push date to show in first time 39 | uDatePicker.ShowDatePicker(dateSystem); 40 | 41 | //or use current date 42 | uDatePicker.ShowDatePicker(Calendar.Jalali); 43 | 44 | //get on day selected event 45 | uDatePicker.setOnDateSelected((dateSystem, unixTime) -> { 46 | //do something... 47 | }); 48 | 49 | //or get date when ever you want 50 | uDatePicker.getSelectedUnixTime();//as a unix time 51 | uDatePicker.getSelectedDate();//as a DateSystem object 52 | 53 | ~~~ 54 | 55 | # Supported language: 56 | 1.persian
57 | 2.english
58 | and its easy to add new language see 59 | [here](https://github.com/hooshkar/AndroidMultiCalenderTools/wiki/language). 60 | 61 | # LICENCE 62 | under [MIT](https://github.com/hooshkar/AndroidMultiCalenderTools/blob/master/LICENSE) licence 63 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | signingConfigs { 5 | config { 6 | keyAlias 'ali' 7 | keyPassword 'ali' 8 | storeFile file('ali') 9 | storePassword 'ali' 10 | } 11 | } 12 | compileSdkVersion 27 13 | defaultConfig { 14 | applicationId "com.ali.universaldatetools" 15 | minSdkVersion 21 16 | targetSdkVersion 27 17 | versionCode 1 18 | versionName "1.0" 19 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 20 | } 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 25 | } 26 | } 27 | compileOptions { 28 | sourceCompatibility JavaVersion.VERSION_1_8 29 | targetCompatibility JavaVersion.VERSION_1_8 30 | } 31 | lintOptions { 32 | checkReleaseBuilds false 33 | // Or, if you prefer, you can continue to check for errors in release builds, 34 | // but continue the build even when errors are found: 35 | abortOnError false 36 | } 37 | } 38 | 39 | dependencies { 40 | implementation fileTree(include: ['*.jar'], dir: 'libs') 41 | implementation 'com.android.support:appcompat-v7:27.1.0' 42 | implementation 'com.android.support.constraint:constraint-layout:1.0.2' 43 | testImplementation 'junit:junit:4.12' 44 | androidTestImplementation 'com.android.support.test:runner:0.5' 45 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2' 46 | //implementation project(':uneversaldatetools') 47 | implementation project(':uneversaldatetools') 48 | } 49 | -------------------------------------------------------------------------------- /app/libs/uneversaldatetools-debug.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hooshkar/AndroidMultiCalendarTools/01ad46a40c945cd49d9287e2912ac8f1bafc4c90/app/libs/uneversaldatetools-debug.aar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/ali/universaldatetools/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.ali.universaldatetools; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.assertEquals; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.ali.universaldatetools", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/ali/universaldatetools/DialogTestActivity.java: -------------------------------------------------------------------------------- 1 | package com.ali.universaldatetools; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.widget.Button; 6 | import android.widget.Toast; 7 | 8 | import com.ali.uneversaldatetools.UDatePickerDialog; 9 | import com.ali.uneversaldatetools.date.DateSystem; 10 | 11 | public class DialogTestActivity extends AppCompatActivity implements UDatePickerDialog.UDatePickerDialogListener { 12 | 13 | @Override 14 | protected void onCreate(Bundle savedInstanceState) { 15 | super.onCreate(savedInstanceState); 16 | setContentView(R.layout.activity_dialog_test); 17 | 18 | Button showDialog = findViewById(R.id.btn_show_dialog); 19 | 20 | showDialog.setOnClickListener(v -> { 21 | UDatePickerDialog uDatePickerDialog = new UDatePickerDialog(); 22 | 23 | uDatePickerDialog.setListener(this); 24 | uDatePickerDialog.show(getSupportFragmentManager(), ""); 25 | }); 26 | } 27 | 28 | @Override 29 | public void onCancel() { 30 | Toast.makeText(this, "cancel", Toast.LENGTH_SHORT).show(); 31 | } 32 | 33 | @Override 34 | public void onSelect(long unixTime, DateSystem dateSystem) { 35 | Toast.makeText(this, dateSystem.toString(), Toast.LENGTH_SHORT).show(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/ali/universaldatetools/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.ali.universaldatetools; 2 | 3 | import android.content.Intent; 4 | import android.content.res.Resources; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.util.DisplayMetrics; 8 | import android.widget.Button; 9 | import android.widget.TextView; 10 | import android.widget.Toast; 11 | 12 | import com.ali.uneversaldatetools.date.Calendar; 13 | import com.ali.uneversaldatetools.datePicker.UDatePicker; 14 | 15 | import java.util.Locale; 16 | 17 | public class MainActivity extends AppCompatActivity { 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_main); 23 | 24 | UDatePicker a = findViewById(R.id.date_picker); 25 | Button lang = findViewById(R.id.btn_lang); 26 | Button getTime = findViewById(R.id.btn_get_time); 27 | TextView timeView = findViewById(R.id.text_time_show); 28 | 29 | a.ShowDatePicker(getSupportFragmentManager(), Calendar.Jalali); 30 | a.setOnDateSelected((dateSystem, unixTime) -> { 31 | timeView.setText("unix time is: " + unixTime); 32 | timeView.append("\ndate is: " + dateSystem); 33 | }); 34 | 35 | getTime.setOnClickListener(v -> { 36 | if (a.getSelectedUnixTime() == null) { 37 | Toast.makeText(this, "plz select day", Toast.LENGTH_SHORT).show(); 38 | } else { 39 | timeView.setText("unix time is: " + a.getSelectedUnixTime()); 40 | timeView.append("\ndate is: " + a.getSelectedDate()); 41 | } 42 | }); 43 | 44 | lang.setOnClickListener(v -> { 45 | if (getString(R.string.LangId).equals("en")) { 46 | setLocale("fa"); 47 | } else { 48 | setLocale("en"); 49 | } 50 | }); 51 | } 52 | 53 | private void setLocale(String lng) { 54 | Resources res = getResources(); 55 | // Change locale settings in the app. 56 | DisplayMetrics dm = res.getDisplayMetrics(); 57 | android.content.res.Configuration conf = res.getConfiguration(); 58 | conf.setLocale(new Locale(lng.toLowerCase())); // API 17+ only. 59 | // Use conf.locale = new Locale(...) if targeting lower versions 60 | res.updateConfiguration(conf, dm); 61 | finishAndRemoveTask(); 62 | startActivity(new Intent(this, MainActivity.class)); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_dialog_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 |