diff --git a/app/WikiSpot/app/src/main/java/com/example/wikispot/activities/MainActivity.kt b/app/WikiSpot/app/src/main/java/com/example/wikispot/activities/MainActivity.kt index 1a62fad..5673be7 100644 --- a/app/WikiSpot/app/src/main/java/com/example/wikispot/activities/MainActivity.kt +++ b/app/WikiSpot/app/src/main/java/com/example/wikispot/activities/MainActivity.kt @@ -2,23 +2,26 @@ package com.example.wikispot.activities import androidx.appcompat.app.AppCompatActivity import android.os.Bundle -import android.view.Window -import android.view.WindowManager +import androidx.appcompat.app.AlertDialog import androidx.navigation.findNavController import androidx.navigation.ui.setupWithNavController import com.example.wikispot.R -import com.example.wikispot.databinding.ActivityMainBinding import com.google.android.material.bottomnavigation.BottomNavigationView class MainActivity : AppCompatActivity() { - //private lateinit var binding: ActivityMainBinding + override fun onBackPressed() { + val builder = AlertDialog.Builder(this) + builder.setTitle("Confirm") + builder.setMessage("Do you want to quit the application?") + builder.setPositiveButton("Yes") {_, _ -> finish()} + builder.setNegativeButton("No") {_, _ -> } + builder.show() + } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - //binding = ActivityMainBinding.inflate(layoutInflater) - //setContentView(binding.root) val navController = findNavController(R.id.mainFragmentHost) val bottomNavView = findViewById(R.id.mainBottomNavigationView) diff --git a/app/WikiSpot/app/src/main/res/navigation/main_activity_navigation.xml b/app/WikiSpot/app/src/main/res/navigation/main_activity_navigation.xml index 8941056..d2b6544 100644 --- a/app/WikiSpot/app/src/main/res/navigation/main_activity_navigation.xml +++ b/app/WikiSpot/app/src/main/res/navigation/main_activity_navigation.xml @@ -3,7 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main_activity_navigation" - app:startDestination="@id/chatFragment"> + app:startDestination="@id/homeFragment"> + tools:layout="@layout/fragment_explore"> @@ -28,7 +28,11 @@ android:id="@+id/mapFragment" android:name="com.example.wikispot.fragments.mapFragment" android:label="fragment_map" - tools:layout="@layout/fragment_map" /> + tools:layout="@layout/fragment_map"> + +