Skip to content

guanshiyin28/Simple-Kotlin-Project

Navigation Drawer

This repository contains the source code for an Android application demonstrating the implementation of a Navigation Drawer integrated with API calls and a simple intent mechanism using the Kotlin language within the Android Studio environment. This project showcases how to create a user-friendly and intuitive navigation experience with dynamic content.



Purpose of This Repository

To showcase the integration of a Navigation Drawer with API calls and a simple intent mechanism to create a flexible and modular user interface within an Android application developed with Kotlin.



Demonstration

Below is a demonstration of the main function of the Navigation Drawer App:

// filepath: /home/guan/Documents/Code/Simple-Kotlin-Project/app/src/main/java/com/example/navigationdrawer/MainActivity.kt
package com.example.navigationdrawer

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.drawerlayout.widget.DrawerLayout
import com.google.android.material.navigation.NavigationView

class MainActivity : AppCompatActivity() {

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

        val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout)
        val navView: NavigationView = findViewById(R.id.nav_view)

        // Setup the navigation drawer
        navView.setNavigationItemSelectedListener { menuItem ->
            // Handle navigation view item clicks here.
            menuItem.isChecked = true
            drawerLayout.closeDrawers()

            // Simple intent mechanism
            when (menuItem.itemId) {
                R.id.nav_api -> {
                    val intent = Intent(this, ApiActivity::class.java)
                    startActivity(intent)
                }
                // Add more cases for other menu items
            }
            true
        }
    }
}


Releases

You can find the latest releases here.



Features

  • Navigation Drawer with multiple menu items
  • Fragment integration for modular UI
  • API integration for dynamic content
  • Simple intent mechanism for navigation
  • Smooth and intuitive navigation
  • Responsive design for various screen sizes


Technologies Used

  • Kotlin
  • Android Studio
  • XML for layout design
  • Retrofit for API calls


Project Setup

  1. Ensure you have Android Studio installed on your machine.
  2. Clone this Repository
git clone https://github.com/guanshiyin28/Simple-Kotlin-Project.git
  1. Open the project in Android Studio
  2. Build the project to download dependencies


Steps to Run

  1. Open the project in Android Studio
  2. Build the project to download dependencies
  3. Run the project on an emulator or physical device


License

This project is licensed under the Apache-2.0 License. See the LICENSE file for details.