# FIU-IoT
This is a project to develop an inventory management system for FIU IOT Cyber Physical Lab
Android Compose Login Application

Project Structure:
- **app**: Contains the source code for the Android application.
  - **src/main/java/com/example/myapplication**: Main package for application code.
    - `MainActivity.kt`: Main activity serving as the entry point.
    - `App.kt`: Activity launched after successful login.
    - `ApiService.kt`: Retrofit API interface for login.
    - `LoginApiResponseModel.kt`: Data class representing the login response.
    - `LoginRequest.kt`: Data class representing the login request body.
    - `ui/`: Package containing Compose UI code.
      - `theme/`: Package for Compose theme configuration.
        - `LoginPageTheme.kt`: Compose theme settings.
      - `MainActivity.kt`: Composable functions for Login, Signup, and Forgot Password screens.

- **build.gradle**: Gradle build configuration file.
  plugins {
    id 'com.android.application'
    id("org.jetbrains.kotlin.android")
}

android {
    namespace 'com.example.myapplication'
    compileSdk 34

    defaultConfig {
        applicationId "com.example.myapplication"
        minSdk 29
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary = true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles(
                    getDefaultProguardFile("proguard-android-optimize.txt"),
                    "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    dataBinding{
        enabled=true
    }
    viewBinding {
        enabled = true
    }
    buildFeatures {
        dataBinding true
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.4.3"
    }
}

dependencies {

    implementation("com.squareup.retrofit2:retrofit:2.9.0")
    implementation("com.squareup.retrofit2:converter-moshi:2.9.0")
    implementation("androidx.core:core-ktx:1.9.0")
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
    implementation("androidx.activity:activity-compose:1.7.0")
    implementation(platform("androidx.compose:compose-bom:2023.03.00"))
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.10.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.2'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.7.5'
    implementation 'androidx.navigation:navigation-ui-ktx:2.7.5'
    implementation 'androidx.compose.ui:ui-text-android:1.5.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.5")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
    androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
    androidTestImplementation("androidx.compose.ui:ui-test-junit4")
    debugImplementation("androidx.compose.ui:ui-tooling")
    debugImplementation("androidx.compose.ui:ui-test-manifest")
    implementation("androidx.compose.ui:ui")
    implementation("androidx.compose.ui:ui-graphics")
    implementation("androidx.compose.ui:ui-tooling-preview")
    implementation("androidx.compose.material3:material3")
    implementation(platform("androidx.compose:compose-bom:2023.03.00"))
    implementation("androidx.activity:activity-compose:1.7.0")
}

## Overview:
This Android application uses Jetpack Compose for UI and Retrofit for network communication. It provides a simple login screen with options to sign up and reset the password. Successful login redirects the user to the main application screen.

## How to Run:
1. Open the project in Android Studio.
2. Build and run the application on an emulator or physical device.

# Android Compose Login Application
# XML file 
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.myapplication">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:enableOnBackInvokedCallback="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.MyApplication"
        tools:targetApi="31" >
        <activity
            android:name="MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:theme="@style/Theme.MyApplication.NoActionBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="App"
            android:label="@string/app_name"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

## MainActivity.kt

```kotlin
package com.example.myapplication

// ... (imports and package declaration)

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            LoginPageTheme {
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {
                    AuthScreen()
                }
            }
        }
    }
}

// ... (AuthScreen, LoginScreen, SignupScreen, ForgotPasswordScreen functions)
@Composable
fun AuthScreen() {
    // ... (showLogin, showSignup, showForgotPassword variables)
    Column(
        modifier = Modifier
            .fillMaxSize()
            .padding(16.dp),
        verticalArrangement = Arrangement.Center,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        // ... (if conditions handling different screens)
    }
}

// ... (LoginScreen, SignupScreen, ForgotPasswordScreen composable functions)
@Composable
fun LoginScreen(onForgotPasswordClick: () -> Unit) {
    // ... (launcher, Column, Text, OutlinedTextField, Button, and Text composable functions)
}

// ... (LoginRequest data class and ApiService interface)
@Composable
fun SignupScreen() {
    // ... (Column, Text, OutlinedTextField, and Button composable functions)
}
@Composable
fun ForgotPasswordScreen(onForgotPasswordClick: () -> Unit) {
    // ... (Column, Text, OutlinedTextField, Button, and Text composable functions)
}
// ... (LoginApiResponseModel data class and ApiService interface)
// ... (Usage of components in MainActivity)


