-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Age Calculator - [DOWNLOAD APP](https://www.mediafire.com/file/bwgnagn8uydgvij/app-debug.apk/file?dkey=bwgnagn8uydgvij) | ||
<img src ="https://user-images.githubusercontent.com/85965606/174242767-66902015-e73f-4d3c-8dc3-eabeede0df78.png" width="600" heigth="600"> | ||
|
||
## Calculate Age in Detailed view | ||
|
||
Age-Calculator is a kotlin based android application | ||
|
||
## Some Screenshots of Applicaiton | ||
|
||
.<img src= "https://user-images.githubusercontent.com/85965606/174243277-02a4d031-8c96-4a7b-9787-031444a2cfd7.jpeg" width="250" height="500"> | ||
.<img src ="https://user-images.githubusercontent.com/85965606/174243288-be21e4ca-657a-4aff-a19c-140db813cf75.jpeg" width="250" height="500"> | ||
.<img src="https://user-images.githubusercontent.com/85965606/174243315-6876b8c6-4a9f-4c25-b0f4-a8d8e76215dc.jpeg" width="250" height="500"> | ||
|
||
|
||
## Tech | ||
|
||
- Kotlin language | ||
- xml language | ||
- Android Studio | ||
|
||
And of course Age-Calculator itself is open source with a [public repository](https://github.com/Suryansh1720001/Age-Calculator) | ||
on GitHub. | ||
|
||
## Installation | ||
... (GooglePlay Store link available soon) ... | ||
|
||
- Use this link to download the app | ||
- [DOWNLOAD APP](https://www.mediafire.com/file/bwgnagn8uydgvij/app-debug.apk/file?dkey=bwgnagn8uydgvij) | ||
|
||
## Attributes | ||
|
||
Thank you for providing me images from your sources | ||
|
||
- <a href='https://www.freepik.com/vectors/office-hours'>Office hours vector created by pch.vector - www.freepik.com</a> | ||
- <a href='https://www.freepik.com/vectors/different-ages'>Different ages vector created by pch.vector - www.freepik.com</a> | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'org.jetbrains.kotlin.android' | ||
} | ||
|
||
android { | ||
compileSdk 32 | ||
|
||
defaultConfig { | ||
applicationId "com.google.suryansh7202.dobcalc" | ||
minSdk 21 | ||
targetSdk 32 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.core:core-ktx:1.7.0' | ||
implementation 'androidx.appcompat:appcompat:1.4.2' | ||
implementation 'com.google.android.material:material:1.6.1' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.google.suryansh7202.dobcalc | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.google.suryansh7202.dobcalc", appContext.packageName) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.google.suryansh7202.dobcalc"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:fullBackupContent="@xml/backup_rules" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.DOBCals" | ||
tools:targetApi="31"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package com.google.suryansh7202.dobcalc | ||
|
||
import android.app.DatePickerDialog | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.widget.Button | ||
import android.widget.TextView | ||
import java.text.SimpleDateFormat | ||
import java.util.* | ||
|
||
class MainActivity : AppCompatActivity() { | ||
private var tvSelectedDate: TextView? = null | ||
private var tvAgeinHours : TextView? = null | ||
private var tvAgeinMinutes : TextView? = null | ||
private var tvAgeinSeconds : TextView? = null | ||
private var tvAgeinDays : TextView? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
|
||
|
||
|
||
val btnDatePicker: Button = findViewById(R.id.btnDatePicker) | ||
tvSelectedDate = findViewById(R.id.tvSelectedDate) | ||
tvAgeinHours = findViewById(R.id.tvAgeInHours) | ||
tvAgeinMinutes =findViewById(R.id.tvAgeInMinutes) | ||
tvAgeinSeconds = findViewById(R.id.tvAgeInSeconds) | ||
tvAgeinDays = findViewById(R.id.tvAgeInDays) | ||
|
||
// current date show on selected date | ||
val sdf = SimpleDateFormat("dd/MM/yyyy",Locale.ENGLISH) | ||
val currentDate = sdf.parse(sdf.format(System.currentTimeMillis())) | ||
currentDate?.let { | ||
tvSelectedDate?.text = currentDate.toString() | ||
} | ||
btnDatePicker.setOnClickListener { | ||
clickDatePicker() | ||
|
||
} | ||
|
||
} | ||
|
||
private fun clickDatePicker(){ | ||
val myCalender = Calendar.getInstance() | ||
val year = myCalender.get(Calendar.YEAR) | ||
val month = myCalender.get(Calendar.MONTH) | ||
val day = myCalender.get(Calendar.DAY_OF_MONTH) | ||
|
||
val dpd = DatePickerDialog(this, | ||
{_,selectedyear,selectedmonth,selecteddayOfMonth -> | ||
|
||
val selectedDate = "$selecteddayOfMonth/${selectedmonth+1}/$selectedyear" | ||
tvSelectedDate?.text = selectedDate | ||
|
||
|
||
val sdf = SimpleDateFormat("dd/MM/yyyy",Locale.ENGLISH) | ||
val theDate = sdf.parse(selectedDate) | ||
theDate?.let { | ||
val selectedDateInDays = theDate.time/ 86400000 | ||
val selectedDateInMinutes = theDate.time/ 60000 | ||
val selectedDateInHours = theDate.time/ 3600000 | ||
val selectedDateInSeconds = theDate.time/ 1000 | ||
|
||
|
||
|
||
val currentDate = sdf.parse(sdf.format(System.currentTimeMillis())) | ||
currentDate?.let { | ||
val currentDateInDays = currentDate.time/ 86400000 | ||
val currentDateInMinutes = currentDate.time/ 60000 | ||
val currentDateInHours = currentDate.time/ 3600000 | ||
val currentDateInSeconds = currentDate.time/ 1000 | ||
|
||
val differenceInDays = currentDateInDays-selectedDateInDays | ||
val differenceInMinutes = currentDateInMinutes-selectedDateInMinutes | ||
val differenceInHours = currentDateInHours-selectedDateInHours | ||
val differenceInSeconds = currentDateInSeconds-selectedDateInSeconds | ||
|
||
|
||
tvAgeinDays?.text = differenceInDays.toString() | ||
tvAgeinMinutes?.text = differenceInMinutes.toString() | ||
tvAgeinHours?.text = differenceInHours.toString() | ||
tvAgeinSeconds?.text = differenceInSeconds.toString() | ||
|
||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
}, | ||
year, | ||
month, | ||
day | ||
) | ||
|
||
dpd.datePicker.maxDate = System.currentTimeMillis()- 86400000 | ||
|
||
dpd.show() | ||
|
||
|
||
|
||
} | ||
|
||
|
||
} |