diff --git a/README.md b/README.md index 40bde77..857c664 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MEDMAPPER -The purpose of this application is to assist a user with medication administration. This application recieves input from the user about their medications and when they should be administered. The application sends alerts and reminders to the user to take their medications at the appropriate time, and logs successful administration for the user as well as other parties that the user may choose to share their information with. This will allow a user to track their medication usage, and help ensure that they are taking each medication at the appropriate time each day. +The purpose of this application is to assist a user with medication administration. This application receives input from the user about their medications and when they should be administered. The application sends alerts and reminders to the user to take their medications at the appropriate time, and logs successful administration for the user as well as other parties that the user may choose to share their information with. This will allow a user to track their medication usage, and help ensure that they are taking each medication at the appropriate time each day. STORYBOARD / MOCKUP DEMO: @@ -74,7 +74,7 @@ https://github.com/jakeFarrish/MedMapper/files/10531467/ClassDescription.docx SCRUM ROLES: - Intergration Developer: Cherissa Tan + Integration Developer: Cherissa Tan Backend Developers: Logan Farwick, Jacob Farrish diff --git a/app/build.gradle b/app/build.gradle index acbca27..84b8ce5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -55,6 +55,8 @@ dependencies { implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version" implementation 'androidx.compose.material:material:1.3.1' implementation 'junit:junit:4.13.2' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'com.google.android.material:material:1.8.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' diff --git a/app/src/main/UI.xml b/app/src/main/AndroidManifest.xml similarity index 81% rename from app/src/main/UI.xml rename to app/src/main/AndroidManifest.xml index baa140e..0909c2d 100644 --- a/app/src/main/UI.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + + android:theme="@style/Theme.MedMapper"> diff --git a/app/src/main/java/com/medmapper/v33001/MainActivity.kt b/app/src/main/java/com/medmapper/v33001/MainActivity.kt index a5822eb..06dc390 100644 --- a/app/src/main/java/com/medmapper/v33001/MainActivity.kt +++ b/app/src/main/java/com/medmapper/v33001/MainActivity.kt @@ -1,43 +1,47 @@ package com.medmapper.v33001 import android.os.Bundle -import androidx.activity.ComponentActivity -import androidx.activity.compose.setContent -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import com.medmapper.v33001.ui.theme.MedMapperTheme - -class MainActivity : ComponentActivity() { +import android.view.Menu +import android.view.MenuItem +import androidx.appcompat.app.AppCompatActivity +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentManager + +class MainActivity : AppCompatActivity() { + + private val fragmentManager: FragmentManager = supportFragmentManager + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContent { - MedMapperTheme { - // A surface container using the 'background' color from the theme - Surface( - modifier = Modifier.fillMaxSize(), - color = MaterialTheme.colors.background - ) { - Greeting("Android") - } + setContentView(layoutInflater.inflate(R.layout.main_activity, null)) + setSupportActionBar(findViewById(R.id.toolbar)) + setFragment(ScheduleFragment()) + } + + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + menuInflater.inflate(R.menu.main, menu) + return super.onCreateOptionsMenu(menu) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.schedule_menu_item -> { + setFragment(ScheduleFragment()) + } + R.id.medication_menu_item -> { + setFragment(MedicationsFragment()) + } + R.id.share_menu_item -> { + //todo: share() } + else -> return false } + + return true } -} - -@Composable -fun Greeting(name: String) { - Text(text = "Hello $name!") -} - -@Preview(showBackground = true) -@Composable -fun DefaultPreview() { - MedMapperTheme { - Greeting("Android") + + private fun setFragment(fragment: Fragment){ + fragmentManager.beginTransaction() + .replace(R.id.fragment_view, fragment).commit() } } \ No newline at end of file diff --git a/app/src/main/java/com/medmapper/v33001/MedRecyclerAdapter.kt b/app/src/main/java/com/medmapper/v33001/MedRecyclerAdapter.kt new file mode 100644 index 0000000..dbbecc6 --- /dev/null +++ b/app/src/main/java/com/medmapper/v33001/MedRecyclerAdapter.kt @@ -0,0 +1,26 @@ +package com.medmapper.v33001 + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import com.medmapper.v33001.dto.Medicine + +class MedRecyclerAdapter(private val inflater: LayoutInflater, var meds: ArrayList): RecyclerView.Adapter() { + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + return ViewHolder(inflater.inflate(R.layout.medication_line_item, parent, false)) + } + + override fun getItemCount(): Int { + return meds.size + } + + override fun onBindViewHolder(holder: ViewHolder, position: Int) { + holder.name.text = meds[position].name + } + + class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + val name: TextView = itemView.findViewById(R.id.medication_name) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/medmapper/v33001/MedicationsFragment.kt b/app/src/main/java/com/medmapper/v33001/MedicationsFragment.kt new file mode 100644 index 0000000..3fe21d6 --- /dev/null +++ b/app/src/main/java/com/medmapper/v33001/MedicationsFragment.kt @@ -0,0 +1,24 @@ +package com.medmapper.v33001 + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView + +class MedicationsFragment : Fragment() { + lateinit var recyclerView: RecyclerView + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + val view = inflater.inflate(R.layout.medications_fragment, container, false) + recyclerView = view.findViewById(R.id.medications) + recyclerView.layoutManager = LinearLayoutManager(context) + recyclerView.adapter = MedRecyclerAdapter(inflater, ArrayList()) + return view + } +} \ No newline at end of file diff --git a/app/src/main/java/com/medmapper/v33001/ScheduleFragment.kt b/app/src/main/java/com/medmapper/v33001/ScheduleFragment.kt new file mode 100644 index 0000000..dda4794 --- /dev/null +++ b/app/src/main/java/com/medmapper/v33001/ScheduleFragment.kt @@ -0,0 +1,24 @@ +package com.medmapper.v33001 + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.EditText +import android.widget.TextView +import androidx.fragment.app.Fragment + +class ScheduleFragment: Fragment() { + lateinit var email: EditText + lateinit var schedule: TextView + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + val view = inflater.inflate(R.layout.schedule_fragment, container, false) + schedule = view.findViewById(R.id.schedule) + email = view.findViewById(R.id.editTextTextEmailAddress) + return view + } +} \ No newline at end of file diff --git a/app/src/main/java/com/medmapper/v33001/room/MedicineRoomDatabase.kt b/app/src/main/java/com/medmapper/v33001/room/MedicineRoomDatabase.kt index a37fcf9..3edbfba 100644 --- a/app/src/main/java/com/medmapper/v33001/room/MedicineRoomDatabase.kt +++ b/app/src/main/java/com/medmapper/v33001/room/MedicineRoomDatabase.kt @@ -7,7 +7,7 @@ import androidx.room.RoomDatabase import com.medmapper.v33001.dao.MedicineDAO import com.medmapper.v33001.dto.Medicine -@Database(entities = arrayOf(Medicine::class), version = 1, exportSchema = false) +@Database(entities = [Medicine::class], version = 1, exportSchema = false) public abstract class MedicineRoomDatabase : RoomDatabase() { abstract fun medicineDao(): MedicineDAO diff --git a/app/src/main/res/drawable/pill.xml b/app/src/main/res/drawable/pill.xml new file mode 100644 index 0000000..dce761c --- /dev/null +++ b/app/src/main/res/drawable/pill.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/schedule.xml b/app/src/main/res/drawable/schedule.xml new file mode 100644 index 0000000..500ef7f --- /dev/null +++ b/app/src/main/res/drawable/schedule.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/drawable/share.xml b/app/src/main/res/drawable/share.xml new file mode 100644 index 0000000..024b964 --- /dev/null +++ b/app/src/main/res/drawable/share.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/layout.xml b/app/src/main/res/layout/layout.xml deleted file mode 100644 index bc1c77c..0000000 --- a/app/src/main/res/layout/layout.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - -