Skip to content

Commit 5b4c337

Browse files
committed
App until main activity and child views for diseases
0 parents  commit 5b4c337

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1409
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'kotlin-android'
4+
}
5+
6+
android {
7+
compileSdkVersion 30
8+
buildToolsVersion "30.0.3"
9+
10+
defaultConfig {
11+
applicationId "com.kaaxkankayotl.healthforall"
12+
minSdkVersion 24
13+
targetSdkVersion 30
14+
versionCode 1
15+
versionName "1.0"
16+
17+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18+
}
19+
20+
buildTypes {
21+
release {
22+
minifyEnabled false
23+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24+
}
25+
}
26+
compileOptions {
27+
sourceCompatibility JavaVersion.VERSION_1_8
28+
targetCompatibility JavaVersion.VERSION_1_8
29+
}
30+
kotlinOptions {
31+
jvmTarget = '1.8'
32+
}
33+
34+
buildFeatures {
35+
viewBinding = true
36+
}
37+
}
38+
39+
dependencies {
40+
41+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
42+
implementation 'androidx.core:core-ktx:1.3.2'
43+
implementation 'androidx.appcompat:appcompat:1.2.0'
44+
implementation 'com.google.android.material:material:1.3.0'
45+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
46+
implementation platform('com.google.firebase:firebase-bom:26.2.0')
47+
implementation 'com.google.firebase:firebase-analytics-ktx'
48+
implementation 'com.google.firebase:firebase-auth-ktx'
49+
testImplementation 'junit:junit:4.+'
50+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
51+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
52+
}
53+
apply plugin: 'com.google.gms.google-services'

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.kaaxkankayotl.healthforall
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.kaaxkankayotl.healthforall", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.kaaxkankayotl.healthforall">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.HealthForAll">
12+
<activity android:name=".activity_diabetes"></activity>
13+
<activity android:name=".activity_cancer" />
14+
<activity android:name=".cvdlist" />
15+
<activity android:name=".Login">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN" />
18+
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
22+
<activity android:name=".MainActivity" />
23+
<activity
24+
android:name=".SignIn"
25+
android:label="Login" />
26+
</application>
27+
28+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.kaaxkankayotl.healthforall
2+
3+
import android.view.LayoutInflater
4+
import android.view.View
5+
import android.view.ViewGroup
6+
import android.view.ViewParent
7+
import android.widget.ImageView
8+
import android.widget.TextView
9+
import androidx.appcompat.view.menu.ActionMenuItemView
10+
import androidx.recyclerview.widget.RecyclerView
11+
12+
13+
class DiseaseAdapter(private var title:List<String>, private var images:List<Int>):
14+
RecyclerView.Adapter<DiseaseAdapter.ViewHolder>(){
15+
16+
inner class ViewHolder(itemView:View) : RecyclerView.ViewHolder(itemView){
17+
18+
val itemTitle: TextView = itemView.findViewById(R.id.disease_name)
19+
val itemPicture: ImageView = itemView.findViewById(R.id.disease_image)
20+
21+
22+
init {
23+
itemView.setOnClickListener { v: View? ->
24+
25+
}
26+
}
27+
28+
}
29+
30+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
31+
val v:View = LayoutInflater.from(parent.context).inflate(R.layout.disease_layout, parent, false)
32+
return ViewHolder(v)
33+
}
34+
35+
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
36+
holder.itemTitle.text = title[position]
37+
holder.itemPicture.setImageResource(images[position])
38+
}
39+
40+
override fun getItemCount(): Int {
41+
return title.size
42+
}
43+
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package com.kaaxkankayotl.healthforall
2+
3+
4+
import android.content.Context
5+
import android.content.Intent
6+
import androidx.appcompat.app.AppCompatActivity
7+
import android.os.Bundle
8+
import android.view.inputmethod.InputMethodManager
9+
import com.google.firebase.auth.FirebaseAuth
10+
import com.google.firebase.auth.FirebaseUser
11+
import com.google.firebase.auth.ktx.auth
12+
import com.google.firebase.ktx.Firebase
13+
14+
15+
import com.kaaxkankayotl.healthforall.databinding.ActivityLoginBinding
16+
17+
18+
class Login : AppCompatActivity() {
19+
20+
private lateinit var binding: ActivityLoginBinding
21+
22+
private lateinit var auth: FirebaseAuth
23+
24+
override fun onCreate(savedInstanceState: Bundle?) {
25+
super.onCreate(savedInstanceState)
26+
binding = ActivityLoginBinding.inflate(layoutInflater)
27+
setContentView(binding.root)
28+
29+
auth = Firebase.auth
30+
31+
binding.buttonsignup.setOnClickListener {
32+
if (binding.userET.text.toString().isEmpty() || binding.passET.text.toString()
33+
.isEmpty()){
34+
binding.textviewresponse.text = "Email Address or Password is not provided"
35+
} else {
36+
auth.createUserWithEmailAndPassword(
37+
binding.userET.text.toString(),
38+
binding.passET.text.toString())
39+
.addOnCompleteListener(this) { task ->
40+
if (task.isSuccessful) {
41+
binding.textviewresponse.text =
42+
"Sign Up successfully. You are registered"
43+
val user = auth.currentUser
44+
updateUI(user)
45+
} else {
46+
binding.textviewresponse.text = "You are already register or Sign Up failed"
47+
updateUI(null)
48+
}
49+
}
50+
}
51+
}
52+
53+
binding.alreadyRegistered.setOnClickListener {
54+
val intent = Intent(this, SignIn::class.java)
55+
startActivity(intent)
56+
finish()
57+
}
58+
59+
60+
}
61+
62+
private fun updateUI(currentUser: FirebaseUser?) {
63+
}
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.kaaxkankayotl.healthforall
2+
3+
import android.content.Intent
4+
import androidx.appcompat.app.AppCompatActivity
5+
import android.os.Bundle
6+
import androidx.recyclerview.widget.LinearLayoutManager
7+
import com.kaaxkankayotl.healthforall.databinding.ActivityMainBinding
8+
9+
class MainActivity : AppCompatActivity() {
10+
11+
private lateinit var binding: ActivityMainBinding
12+
13+
private var titleslist = mutableListOf<String>()
14+
private var imageslist = mutableListOf<Int>()
15+
16+
override fun onCreate(savedInstanceState: Bundle?) {
17+
super.onCreate(savedInstanceState)
18+
19+
binding = ActivityMainBinding.inflate(layoutInflater)
20+
setContentView(binding.root)
21+
22+
postList()
23+
24+
binding.recycler.layoutManager = LinearLayoutManager(this)
25+
binding.recycler.adapter = DiseaseAdapter(titleslist, imageslist)
26+
27+
}
28+
29+
private fun addtoList(title: String, image: Int){
30+
31+
titleslist.add(title)
32+
imageslist.add(image)
33+
}
34+
35+
private fun postList(){
36+
addtoList("Cancer", R.drawable.disease_cancer)
37+
addtoList("Type 2 Diabetes", R.drawable.disease_diabetestype2)
38+
addtoList(" Cardiovascular diseases", R.drawable.disease_cvd)
39+
addtoList("Osteoporosis", R.drawable.disease_osteoporosis)
40+
addtoList("Neurodegenerative diseases", R.drawable.disease_mentaldiseases)
41+
42+
}
43+
}

0 commit comments

Comments
 (0)