Skip to content

Commit

Permalink
add android App Age-Calculator with Readme.md file
Browse files Browse the repository at this point in the history
  • Loading branch information
Suryansh1720001 committed Oct 12, 2022
1 parent 771ade0 commit 62432e6
Show file tree
Hide file tree
Showing 49 changed files with 1,186 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Age-Calculator/.gitignore
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
3 changes: 3 additions & 0 deletions Age-Calculator/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Age-Calculator/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Age-Calculator/.idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Age-Calculator/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Age-Calculator/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Age-Calculator/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions Age-Calculator/README.md
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>



1 change: 1 addition & 0 deletions Age-Calculator/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
43 changes: 43 additions & 0 deletions Age-Calculator/app/build.gradle
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'
}
21 changes: 21 additions & 0 deletions Age-Calculator/app/proguard-rules.pro
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)
}
}
27 changes: 27 additions & 0 deletions Age-Calculator/app/src/main/AndroidManifest.xml
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>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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()



}


}
Loading

0 comments on commit 62432e6

Please sign in to comment.