Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Home Fragment in Android #1913

Merged
merged 8 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .idea/deploymentTargetSelector.xml

This file was deleted.

26 changes: 26 additions & 0 deletions Android/.idea/appInsightsSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions Android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.google.gms.google.services)
// id("com.google.gms.google-services")
}

android {
namespace = "com.example.vigybag"
compileSdk = 34

buildFeatures{
viewBinding = true
}

defaultConfig {
applicationId = "com.example.vigybag"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
isMinifyEnabled = 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"
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.activity)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.navigation.fragment.ktx)
implementation(libs.androidx.navigation.ui.ktx)
implementation(libs.firebase.auth)
implementation(libs.firebase.database)
implementation(libs.firebase.firestore)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)

// All Necessary Dependencies

implementation("com.github.denzcoskun:ImageSlideshow:0.1.2")
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation ("com.squareup.retrofit2:converter-gson:2.9.0")

implementation ("androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1")
implementation ("androidx.lifecycle:lifecycle-livedata-ktx:2.3.1")

implementation ("com.squareup.picasso:picasso:2.8")

implementation("com.github.emreesen27:Android-Custom-Toast-Message:1.0.5")
implementation("com.github.bumptech.glide:glide:4.12.0")
annotationProcessor("com.github.bumptech.glide:compiler:4.12.0")


implementation(platform("com.google.firebase:firebase-bom:33.1.1"))
implementation("com.google.firebase:firebase-analytics")



implementation("com.google.firebase:firebase-auth:21.1.0")
implementation("com.google.android.gms:play-services-auth:20.2.0")









}
39 changes: 39 additions & 0 deletions Android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"project_info": {
"project_number": "741366849413",
"project_id": "vigybag-ac167",
"storage_bucket": "vigybag-ac167.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:741366849413:android:e33ff2f65772682bc12eec",
"android_client_info": {
"package_name": "com.example.vigybag"
}
},
"oauth_client": [
{
"client_id": "741366849413-t02gpvpj1t3svmk5d6o1306p1q4s1ujk.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBBHGtGSgScJ4J3F5pTXjOS-m5SGVqHSG4"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "741366849413-t02gpvpj1t3svmk5d6o1306p1q4s1ujk.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.vigybag

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.vigybag", appContext.packageName)
}
}
83 changes: 83 additions & 0 deletions Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

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

<application
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.VigyBag"
tools:targetApi="31">
<activity
android:name=".Activities.CartActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />


<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>


</activity>
<activity
android:name=".Activities.SplashActivity"
android:exported="true">

<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->


<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
</activity>
<activity
android:name=".Activities.OTPActivity"
android:exported="true">

<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->


<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->

</activity>
<activity
android:name=".Activities.LoginActivity"
android:exported="true">

<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->


<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
</activity>
<activity
android:name=".Activities.GetStartedActivity"
android:exported="true">

</activity>
<activity
android:name=".Activities.MainActivity"
android:exported="true">
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->

<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
</activity>

<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.vigybag.Activities

import android.content.Intent
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.example.vigybag.R
import com.example.vigybag.databinding.ActivityGetstartedBinding

class GetStartedActivity : AppCompatActivity() {
private lateinit var binding:ActivityGetstartedBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityGetstartedBinding.inflate(layoutInflater)
setContentView(binding.root)
Comment on lines +16 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add null check for binding.

Ensure that binding is not null before using it to avoid potential NullPointerException.

-  setContentView(binding.root)
+  setContentView(binding?.root ?: return)
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
binding = ActivityGetstartedBinding.inflate(layoutInflater)
setContentView(binding.root)
binding = ActivityGetstartedBinding.inflate(layoutInflater)
setContentView(binding?.root ?: return)


binding.getstart.setOnClickListener{
startActivity(Intent(this@GetStartedActivity, LoginActivity::class.java))
}
Comment on lines +19 to +21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle potential exceptions during navigation.

Wrap the navigation logic in a try-catch block to handle potential exceptions.

-  startActivity(Intent(this@GetStartedActivity, LoginActivity::class.java))
+  try {
+      startActivity(Intent(this@GetStartedActivity, LoginActivity::class.java))
+  } catch (e: Exception) {
+      e.printStackTrace()
+  }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
binding.getstart.setOnClickListener{
startActivity(Intent(this@GetStartedActivity, LoginActivity::class.java))
}
binding.getstart.setOnClickListener{
try {
startActivity(Intent(this@GetStartedActivity, LoginActivity::class.java))
} catch (e: Exception) {
e.printStackTrace()
}
}


}
}
Loading