diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index fdf939b63683872e0b63eacee6e9a20db9b708aa..ba964e589a961fb39bfe06627b3827286cefd727 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -4,18 +4,18 @@ <value> <entry key="LoginActivity"> <State> - <targetSelectedWithDropDown> + <runningDeviceTargetSelectedWithDropDown> <Target> - <type value="QUICK_BOOT_TARGET" /> + <type value="RUNNING_DEVICE_TARGET" /> <deviceKey> <Key> - <type value="VIRTUAL_DEVICE_PATH" /> - <value value="H:\Androidstudio_AVD\avd\Pixel_3a_API_34.avd" /> + <type value="SERIAL_NUMBER" /> + <value value="ZL55FI4XTCYPT4DQ" /> </Key> </deviceKey> </Target> - </targetSelectedWithDropDown> - <timeTargetWasSelectedWithDropDown value="2024-01-17T20:36:19.481840300Z" /> + </runningDeviceTargetSelectedWithDropDown> + <timeTargetWasSelectedWithDropDown value="2024-01-18T13:31:38.365583900Z" /> </State> </entry> <entry key="SignupActivity"> diff --git a/.idea/misc.xml b/.idea/misc.xml index 0ad17cbd33a2f389d524bc4bfef9c52e1f7ab490..8978d23db569daa721cb26dde7923f4c673d1fc9 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ -<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK"> diff --git a/app/src/main/java/com/example/mobilecomputingapp/MainActivity.kt b/app/src/main/java/com/example/mobilecomputingapp/MainActivity.kt index 2231ab2e28fa1d25c321fd58c5298a024ff99e47..7de17875bc891a6e883689de9566c643c2497dfe 100644 --- a/app/src/main/java/com/example/mobilecomputingapp/MainActivity.kt +++ b/app/src/main/java/com/example/mobilecomputingapp/MainActivity.kt @@ -1,6 +1,11 @@ package com.example.mobilecomputingapp +import androidx.appcompat.widget.Toolbar import android.os.Bundle +import android.view.Menu +import android.view.MenuInflater +import android.view.MenuItem +import android.widget.Toast import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity import androidx.core.view.ViewCompat @@ -9,12 +14,41 @@ import androidx.core.view.WindowInsetsCompat class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - enableEdgeToEdge() setContentView(R.layout.activity_main) - ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> - val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) - v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) - insets + } + override fun onCreateOptionsMenu(menu: Menu?): Boolean { + val inflater: MenuInflater = menuInflater + inflater.inflate(R.menu.mainmenu, menu) + + return true + } + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.itemOne -> { + // Handle itemOne click + showToast("Item One Clicked") + return true + } + R.id.itemTwo -> { + // Handle itemTwo click + showToast("Item Two Clicked") + return true + } + R.id.subItemOne -> { + // Handle subItemOne click + showToast("Sub Item One Clicked") + return true + } + R.id.subItemTwo -> { + // Handle subItemTwo click + showToast("Sub Item Two Clicked") + return true + } + else -> return super.onOptionsItemSelected(item) } } + + private fun showToast(message: String) { + Toast.makeText(this, message, Toast.LENGTH_SHORT).show() + } } \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_menu.png b/app/src/main/res/drawable/ic_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..df91acf507bf4e86d84a7e8616a9e476ebbd951f Binary files /dev/null and b/app/src/main/res/drawable/ic_menu.png differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 41422779c0edf1c46e8c1c9e12b9a126bcb16748..cac59b9893de349cef4858e174061bbec83ae79b 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -7,6 +7,15 @@ android:layout_height="match_parent" tools:context=".MainActivity"> + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="@color/green" + app:layout_constraintTop_toTopOf="parent" + android:layout_alignParentTop="true"> + </androidx.appcompat.widget.Toolbar> + <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/app/src/main/res/menu/mainmenu.xml b/app/src/main/res/menu/mainmenu.xml new file mode 100644 index 0000000000000000000000000000000000000000..04a998910baf2395069e6cf8bc8c43267f016a37 --- /dev/null +++ b/app/src/main/res/menu/mainmenu.xml @@ -0,0 +1,30 @@ +<menu xmlns:tools="http://schemas.android.com/tools" + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <item + android:id="@+id/itemOne" + android:title="Item One" + /> + <item + android:id="@+id/itemTwo" + android:title="Item One" + /> + <item + android:id="@+id/itemThree" + android:title="More Options"> + <menu> + <group> + <item + android:id="@+id/subItemOne" + android:title="Item One" + /> + <item + android:id="@+id/subItemTwo" + android:title="Item Two" + /> + </group> + </menu> + + </item> +</menu> \ No newline at end of file