Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Gvicho committed Mar 3, 2024
0 parents commit adcc700
Show file tree
Hide file tree
Showing 67 changed files with 1,566 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
115 changes: 115 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
//Hilt
kotlin("kapt")
id("com.google.dagger.hilt.android")

// for ksp
id("com.google.devtools.ksp")
}


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

defaultConfig {
applicationId = "com.example.beekeeper"
minSdk = 28
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"
)
buildConfigField("String","BASE_URL","\"https://rameRealuri\"")
}
debug {
buildConfigField("String","BASE_URL","\"https://run.mocky.io/v3/\"")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures{
viewBinding = true
buildConfig = true
}
}
//Hilt
// Allow references to generated code
kapt {
correctErrorTypes = true
}

dependencies {
implementation("androidx.work:work-runtime-ktx:2.9.0")//for workManager
implementation("androidx.hilt:hilt-work:1.2.0")

implementation("androidx.room:room-runtime:2.6.1")
implementation("androidx.room:room-ktx:2.6.1")
ksp("androidx.room:room-compiler:2.6.1")// for room

implementation("com.squareup.okhttp3:logging-interceptor:4.9.1")// for okHttp logger interceptor


//Datastore
implementation("androidx.datastore:datastore-preferences-core:1.0.0")// for DataStore
implementation("androidx.datastore:datastore-preferences:1.0.0")

//Hilt
implementation("com.google.dagger:hilt-android:2.49")
implementation("com.google.firebase:firebase-common-ktx:20.4.2")// for Hilt
kapt("com.google.dagger:hilt-android-compiler:2.47")

implementation ("com.squareup.retrofit2:retrofit:2.9.0") // Retrofit

implementation ("com.squareup.moshi:moshi:1.9.3") // Moshi
implementation ("com.squareup.moshi:moshi-kotlin:1.9.3") // For Kotlin support

implementation ("com.squareup.retrofit2:converter-moshi:2.9.0")// Retrofit Converter for Moshi



implementation("com.github.bumptech.glide:glide:4.16.0") // for glide


implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1") // coroutines


implementation ("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0") // For ViewModel
implementation ("androidx.activity:activity-ktx:1.8.2") // For ViewModel

implementation("androidx.navigation:navigation-fragment-ktx:2.7.7") // for navigation
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")// for navigation

implementation("androidx.fragment:fragment-ktx:1.6.2")//for fragment

implementation("androidx.recyclerview:recyclerview-selection:1.1.0") // for recycler selection


implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.beekeeper

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.beekeeper", appContext.packageName)
}
}
30 changes: 30 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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:name=".BeekeepersApp"
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.Beekeeper"
tools:targetApi="31">
<activity
android:name=".presenter.MainActivity"
android:exported="true"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
8 changes: 8 additions & 0 deletions app/src/main/java/com/example/beekeeper/BeekeepersApp.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.example.beekeeper

import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class BeekeepersApp:Application() {
}
55 changes: 55 additions & 0 deletions app/src/main/java/com/example/beekeeper/di/AppModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.example.beekeeper.di


import com.example.beekeeper.BuildConfig
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object AppModule { //stuff that are here should be singleton


@Provides
fun provideHttpLoggingInterceptor(): HttpLoggingInterceptor {
return HttpLoggingInterceptor().apply {
// Set the log level to NONE when it's not a debug build
level = if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE
}
}

@Provides
fun provideOkHttpClient(loggingInterceptor: HttpLoggingInterceptor): OkHttpClient {
val builder = OkHttpClient.Builder()
// Add the logging interceptor in debug mode
if (BuildConfig.DEBUG) {
builder.addInterceptor(loggingInterceptor)
}
return builder.build()
}

@Singleton
@Provides
fun provideRetrofitClient(okHttpClient: OkHttpClient) : Retrofit {
return Retrofit.Builder()
.baseUrl(BuildConfig.BASE_URL)
.addConverterFactory(
MoshiConverterFactory.create(
Moshi.Builder().add(KotlinJsonAdapterFactory()).build()
)
)
.client(okHttpClient)
.build()
}

// add service provide
}
30 changes: 30 additions & 0 deletions app/src/main/java/com/example/beekeeper/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.example.beekeeper.di


import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton


@Module
@InstallIn(SingletonComponent::class)
object RepositoryModule {

//add repository, here is example in comment just change names

// @Singleton
// @Provides
// fun provideVehiclesRepository(
// vehiclesApiService: VehiclesApiService,
// handleResponse: HandleResponse
// ): VehiclesRepository {
// return VehiclesRepositoryImpl(
// vehiclesApiService = vehiclesApiService,
// handleResponse = handleResponse
// )
// }


}
49 changes: 49 additions & 0 deletions app/src/main/java/com/example/beekeeper/presenter/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.example.beekeeper.presenter

import android.os.Bundle
import android.view.View
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController
import com.example.beekeeper.R
import com.example.beekeeper.databinding.ActivityMainBinding
import dagger.hilt.android.AndroidEntryPoint


@AndroidEntryPoint
class MainActivity : AppCompatActivity() {

private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

val navView: BottomNavigationView = binding.navView
// Hide the ActionBar
supportActionBar?.hide()

val navController = findNavController(R.id.nav_host_fragment_activity_main)
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
val appBarConfiguration = AppBarConfiguration(
setOf(
R.id.navigation_home, R.id.savedAnalyticsFragment, R.id.damagedBeehivesFragment,R.id.shareOrGetFragment )
)
setupActionBarWithNavController(navController, appBarConfiguration)
navView.setupWithNavController(navController)

navController.addOnDestinationChangedListener { _, destination, _ ->
when (destination.id) {
R.id.splashFragment,R.id.loginFragment,R.id.registrationFragment,R.id.resetPasswordFragment -> binding.navView.visibility = View.GONE
else -> binding.navView.visibility = View.VISIBLE
}
}

}
}
Loading

0 comments on commit adcc700

Please sign in to comment.