Skip to content

Commit

Permalink
Version 1.00
Browse files Browse the repository at this point in the history
  • Loading branch information
swapnilsparsh committed May 22, 2021
0 parents commit 7403ccf
Show file tree
Hide file tree
Showing 78 changed files with 1,759 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .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 .idea/.gitignore

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

1 change: 1 addition & 0 deletions .idea/.name

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

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

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

22 changes: 22 additions & 0 deletions .idea/gradle.xml

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

25 changes: 25 additions & 0 deletions .idea/jarRepositories.xml

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

9 changes: 9 additions & 0 deletions .idea/misc.xml

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

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
47 changes: 47 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"

defaultConfig {
applicationId "com.example.covidapp"
minSdkVersion 22
targetSdkVersion 29
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 fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.android.material:material:1.2.0-alpha03'
}
21 changes: 21 additions & 0 deletions 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.example.covidapp

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.example.covidapp", appContext.packageName)
}
}
33 changes: 33 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.covidapp">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@drawable/launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.CovidApp">

<activity android:name=".PrecautionActivity" />
<activity android:name=".SymptomsActivity" />


<uses-library
android:name="org.apache.http.legacy"
android:required="false" />

<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" />
</application>

</manifest>
110 changes: 110 additions & 0 deletions app/src/main/java/com/example/covidapp/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package com.example.covidapp

import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.LinearLayout
import android.widget.Toast
import androidx.recyclerview.widget.LinearLayoutManager
import com.android.volley.Request
import com.android.volley.Response
import com.android.volley.toolbox.StringRequest
import com.android.volley.toolbox.Volley
import kotlinx.android.synthetic.main.activity_main.*
import org.json.JSONObject

class MainActivity : AppCompatActivity() {

@SuppressLint("WrongConstant")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

recyclerView.layoutManager = LinearLayoutManager(this,LinearLayout.HORIZONTAL,false)
val symptomsList = ArrayList<Model>()
symptomsList.add(Model(R.drawable.cough,"Dry Cough","A dry cough is one that does not produce phlegm or mucus."))
symptomsList.add(Model(R.drawable.fever,"Fever","A fever is a temporary increase in your body temperature."))
symptomsList.add(Model(R.drawable.headache,"Head Ache","A painful sensation in any part of the head, ranging from sharp to dull, that may occur with other symptoms."))

val symptomsAdapter = SymptomsAdapter(symptomsList)

recyclerView.adapter = symptomsAdapter


recyclerViewPrecautions.layoutManager = LinearLayoutManager(this,LinearLayout.HORIZONTAL,false)
val precautionsList = ArrayList<Model>()
precautionsList.add(Model(R.drawable.vaccine,"Get Vaccinated","Get vaccinated and protect yourself and others from corona"))
precautionsList.add(Model(R.drawable.handwash,"Hand Wash"," Wash your hands well and often. Use hand sanitizer when you’re not near soap and water."))
precautionsList.add(Model(R.drawable.mask,"Wear Mask","Masks are a key measure to suppress transmission and save lives."))

val precautionsAdapter = PrecautionsAdapter(precautionsList)

recyclerViewPrecautions.adapter = precautionsAdapter

txtViewSymptoms.setOnClickListener {
var intent = Intent(this@MainActivity,SymptomsActivity::class.java)
startActivity(intent)
}

btnKnowMore.setOnClickListener {
var intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.who.int/emergencies/diseases/novel-coronavirus-2019"))
startActivity(intent)
}

btnWebsite.setOnClickListener {
var intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://swapnilsparsh.github.io/"))
startActivity(intent)
}

btnGithub.setOnClickListener {
var intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/swapnilsparsh"))
startActivity(intent)
}

btnLinkedIn.setOnClickListener {
var intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.linkedin.com/in/swapnil-srivastava-sparsh/"))
startActivity(intent)
}


txtViewPrecautions.setOnClickListener {
var intent = Intent(this@MainActivity,PrecautionActivity::class.java)
startActivity(intent)
}


getGlobalData()
}

fun getGlobalData(){
val url:String ="https://corona.lmao.ninja/v2/all/"

val stringRequest = StringRequest(
Request.Method.GET,
url,
{

var jsonObject = JSONObject(it.toString())

//now set values in textview
txtInfected.text = jsonObject.getString("cases")
txtRecoverd.text = jsonObject.getString("recovered")
txtDeceased.text = jsonObject.getString("deaths")

},
{
Toast.makeText(this@MainActivity,it.toString(),Toast.LENGTH_LONG).show()
txtInfected.text = "-"
txtRecoverd.text = "-"
txtDeceased.text = "-"

}
)

val requestQueue = Volley.newRequestQueue(this@MainActivity)
requestQueue.add(stringRequest)
}

}
4 changes: 4 additions & 0 deletions app/src/main/java/com/example/covidapp/Model.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.example.covidapp

class Model(var imageview:Int, var symptomsText:String, var symptomsDetail:String) {
}
31 changes: 31 additions & 0 deletions app/src/main/java/com/example/covidapp/PrecautionActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.example.covidapp

import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.activity_precaution.*

class PrecautionActivity : AppCompatActivity() {

@SuppressLint("WrongConstant")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_precaution)

recyclerView.layoutManager = LinearLayoutManager(this, LinearLayout.VERTICAL,false)
val precautionsList = ArrayList<Model>()
precautionsList.add(Model(R.drawable.vaccine,"Get Vaccinated","Get vaccinated and protect yourself and others from corona"))
precautionsList.add(Model(R.drawable.handwash,"Hand Wash"," Wash your hands well and often. Use hand sanitizer when you’re not near soap and water."))
precautionsList.add(Model(R.drawable.mask,"Wear Mask","Masks are a key measure to suppress transmission and save lives."))
precautionsList.add(Model(R.drawable.home,"Stay at Home","When you stay home, you help stop the spread to others, too."))
precautionsList.add(Model(R.drawable.socialdistance,"Social Distance","When going out in public, maintain distance from other people ."))



val precautionsAdapter = PrecautionsAdapter(precautionsList)

recyclerView.adapter = precautionsAdapter
}
}
Loading

0 comments on commit 7403ccf

Please sign in to comment.