replace everything with clean template from https://github.com/ferhatozcelik/jetpack-compose-template.git
This commit is contained in:
parent
4b8386b716
commit
e5ad6dc3c7
55 changed files with 980 additions and 337 deletions
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
6
.idea/AndroidProjectSystem.xml
generated
Normal file
6
.idea/AndroidProjectSystem.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AndroidProjectSystem">
|
||||
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
||||
</component>
|
||||
</project>
|
18
.idea/gradle.xml
generated
Normal file
18
.idea/gradle.xml
generated
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
10
.idea/migrations.xml
generated
Normal file
10
.idea/migrations.xml
generated
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
10
.idea/misc.xml
generated
Normal file
10
.idea/misc.xml
generated
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
17
.idea/runConfigurations.xml
generated
Normal file
17
.idea/runConfigurations.xml
generated
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
13
LICENSE
Normal file
13
LICENSE
Normal file
|
@ -0,0 +1,13 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
45
README.md
Normal file
45
README.md
Normal file
|
@ -0,0 +1,45 @@
|
|||
# Jetpack Compose Template
|
||||
|
||||
Welcome to the Jetpack Compose Template! This template provides a structured starting point for building Android applications using the Jetpack Compose UI toolkit. Jetpack Compose simplifies UI development with a declarative approach, allowing you to create interactive and beautiful UIs with less code.
|
||||
|
||||
## Project Overview
|
||||
|
||||
This project demonstrates the use of Jetpack Compose to create a modern Android app with a clean and maintainable architecture.
|
||||
|
||||
### Key Components
|
||||
|
||||
- **Jetpack Compose:** The modern UI toolkit for building native UIs.
|
||||
- **ViewModel:** Manage UI-related data and state using the ViewModel architecture component.
|
||||
- **Hilt:** Use Hilt for dependency injection, ensuring clean and modular code.
|
||||
- **Navigation Component:** Handle navigation between different screens seamlessly.
|
||||
- **Coroutines:** Utilize Kotlin's Coroutines for managing asynchronous tasks.
|
||||
- **Data Persistence:** Leverage Room for local data storage.
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. **Clone the Repository:** `git clone https://github.com/ferhatozcelik/jetpack-compose-template.git`
|
||||
2. **Open in Android Studio:** Import the project into Android Studio.
|
||||
3. **Build and Run:** Build and run the app to see the Jetpack Compose magic in action.
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `app` module: Contains the main application code.
|
||||
- `src/main/java or src/main/kotlin`: Kotlin source code.
|
||||
- `src/main/res`: Resources like layouts, strings, and drawables.
|
||||
|
||||
## Customize and Extend
|
||||
|
||||
Feel free to customize and extend this template to match the requirements of your specific project. Experiment with different Composables, UI layouts, and navigation flows to create your unique app.
|
||||
|
||||
## Author
|
||||
|
||||
👤 Your Name
|
||||
|
||||
- GitHub: [@ferhatozcelik](https://github.com/ferhatozcelik)
|
||||
- LinkedIn: [Ferhat OZCELIK](https://www.linkedin.com/in/ferhatozcelik/)
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
If you find this template helpful, please consider giving it a ⭐️ on GitHub. Your support is greatly appreciated!
|
1
app/.gitignore
vendored
1
app/.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
/build
|
||||
/.idea/**
|
134
app/build.gradle
Normal file
134
app/build.gradle
Normal file
|
@ -0,0 +1,134 @@
|
|||
plugins {
|
||||
alias(libs.plugins.com.android.application)
|
||||
alias(libs.plugins.org.jetbrains.kotlin.android)
|
||||
alias(libs.plugins.com.google.dagger.hilt.android)
|
||||
alias(libs.plugins.com.google.devtools.ksp)
|
||||
id('kotlin-parcelize')
|
||||
// id("com.google.gms.google-services") // Google Play Services
|
||||
// id("com.google.firebase.crashlytics") // Google Play Services
|
||||
}
|
||||
hilt {
|
||||
enableAggregatingTask = true
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.ferhatozcelik.jetpackcomposetemplate'
|
||||
compileSdk appCompileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.ferhatozcelik.jetpackcomposetemplate"
|
||||
minSdk appMinSdkVersion
|
||||
targetSdk appTargetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
buildFeatures {
|
||||
compose true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion '1.5.3'
|
||||
}
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += '/META-INF/{AL2.0,LGPL2.1}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
// Kotlin
|
||||
implementation(libs.kotlin.stdlib)
|
||||
implementation(libs.core.ktx)
|
||||
implementation(libs.appcompat)
|
||||
|
||||
// Compose
|
||||
implementation(libs.activity.compose)
|
||||
implementation(platform(libs.compose.bom))
|
||||
implementation(libs.ui)
|
||||
implementation(libs.ui.graphics)
|
||||
implementation(libs.ui.tooling.preview)
|
||||
implementation(libs.material3)
|
||||
|
||||
// JUnit
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.androidx.test.ext.junit)
|
||||
androidTestImplementation(libs.espresso.core)
|
||||
androidTestImplementation(platform(libs.compose.bom))
|
||||
androidTestImplementation(libs.ui.test.junit4)
|
||||
debugImplementation(libs.ui.tooling)
|
||||
debugImplementation(libs.ui.test.manifest)
|
||||
|
||||
// Material Design
|
||||
implementation(libs.material)
|
||||
implementation libs.androidx.viewpager2
|
||||
|
||||
// ConstraintLayout
|
||||
implementation(libs.constraintlayout)
|
||||
|
||||
// Legacy Support Library
|
||||
implementation(libs.androidx.legacy.support.v4)
|
||||
|
||||
// Multidex
|
||||
implementation(libs.androidx.multidex)
|
||||
|
||||
// DeSugar Use Java 8 language features and APIs
|
||||
coreLibraryDesugaring(libs.desugar.jdk.libs)
|
||||
|
||||
// Dagger Hilt
|
||||
implementation(libs.hilt)
|
||||
ksp(libs.hilt.compiler)
|
||||
|
||||
// Room
|
||||
implementation(libs.room)
|
||||
implementation(libs.room.runtime)
|
||||
ksp(libs.room.compiler)
|
||||
|
||||
// Coroutines
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(libs.kotlinx.coroutines.android)
|
||||
|
||||
// Lifecycle Scopes
|
||||
implementation(libs.lifecycle)
|
||||
implementation(libs.lifecycle.runtime)
|
||||
implementation(libs.lifecycle.runtime.ktx)
|
||||
|
||||
// Retrofit
|
||||
implementation(libs.retrofit)
|
||||
implementation(libs.converter.gson)
|
||||
implementation(libs.logging.interceptor)
|
||||
|
||||
// Navigation
|
||||
implementation libs.androidx.hilt.navigation.compose
|
||||
implementation libs.androidx.navigation.compose
|
||||
|
||||
|
||||
// Glide
|
||||
implementation(libs.glide)
|
||||
ksp(libs.ksp)
|
||||
|
||||
// Firebase
|
||||
// implementation(libs.firebase)
|
||||
// implementation(libs.analytics)
|
||||
// implementation(libs.crashlytics)
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
alias(libs.plugins.kotlin.compose)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.gyromin"
|
||||
compileSdk = 35
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.example.gyromin"
|
||||
minSdk = 21
|
||||
targetSdk = 35
|
||||
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_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||
implementation(libs.androidx.activity.compose)
|
||||
implementation(platform(libs.androidx.compose.bom))
|
||||
implementation(libs.androidx.ui)
|
||||
implementation(libs.androidx.ui.graphics)
|
||||
implementation(libs.androidx.ui.tooling.preview)
|
||||
implementation(libs.androidx.material3)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.androidx.junit)
|
||||
androidTestImplementation(libs.androidx.espresso.core)
|
||||
androidTestImplementation(platform(libs.androidx.compose.bom))
|
||||
androidTestImplementation(libs.androidx.ui.test.junit4)
|
||||
debugImplementation(libs.androidx.ui.tooling)
|
||||
debugImplementation(libs.androidx.ui.test.manifest)
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.gyromin
|
||||
package com.ferhatozcelik.jetpackcomposetemplate
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
@ -19,6 +19,6 @@ class ExampleInstrumentedTest {
|
|||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.example.gyromin", appContext.packageName)
|
||||
assertEquals("com.ferhatozcelik.myapplication", appContext.packageName)
|
||||
}
|
||||
}
|
|
@ -2,9 +2,10 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-feature android:name="android.hardware.sensor.gyroscope" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<application
|
||||
android:name=".App"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
|
@ -12,13 +13,12 @@
|
|||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Gyromin"
|
||||
android:theme="@style/Theme.MyApplication"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name=".ui.activitys.MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.Gyromin">
|
||||
android:theme="@style/Theme.MyApplication">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
package com.example.gyromin
|
||||
|
||||
import android.media.AudioManager
|
||||
import android.media.AudioTrack
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.example.gyromin.ui.theme.GyrominTheme
|
||||
import kotlin.math.atan
|
||||
import kotlin.math.sin
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
private lateinit var Track: AudioTrack
|
||||
private var isPlaying: MutableState<Boolean> = mutableStateOf(false)
|
||||
private val Fs: Int = 44100
|
||||
private val buffLength: Int = AudioTrack.getMinBufferSize(Fs, 4, 2)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
setContent {
|
||||
GyrominTheme {
|
||||
Scaffold { padding ->
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Button(onClick = {
|
||||
if (!isPlaying.value)
|
||||
// Create a new thread to play the audio.
|
||||
|
||||
// Performing intensive operations and computations on the main UI thread,
|
||||
// makes the app slow.
|
||||
|
||||
// That is, it is a bad idea to do intensive computations on main UI thread,
|
||||
// so it is recommended to create a new thread to do computations in the background
|
||||
|
||||
Thread {
|
||||
initTrack()
|
||||
startPlaying()
|
||||
playback()
|
||||
}.start()
|
||||
else stopPlaying()
|
||||
}) {
|
||||
Text("Play / Pause", modifier = Modifier.padding(padding))
|
||||
}
|
||||
Text(
|
||||
if (isPlaying.value) "Playing" else "Stopped",
|
||||
modifier = Modifier.padding(padding)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initTrack() {
|
||||
// Very similar to opening a stream in PyAudio
|
||||
// In Android create a AudioTrack instance and initialize it with different parameters
|
||||
|
||||
// AudioTrack is deprecated for some android versions
|
||||
// Please look up for other alternatives if this does not work
|
||||
Track = AudioTrack(
|
||||
AudioManager.MODE_NORMAL, Fs, 4,
|
||||
2, buffLength, AudioTrack.MODE_STREAM
|
||||
)
|
||||
}
|
||||
|
||||
private fun playback() {
|
||||
// simple sine wave generator
|
||||
val frame_out = ShortArray(buffLength)
|
||||
val amplitude = 32767
|
||||
val frequency = 440
|
||||
val twopi: Double = 8.0 * atan(1.0)
|
||||
var phase = 0.0
|
||||
|
||||
while (isPlaying.value) {
|
||||
for (i in 0 until buffLength) {
|
||||
frame_out[i] = (amplitude * sin(phase)).toInt().toShort()
|
||||
phase += twopi * frequency / Fs
|
||||
if (phase > twopi) {
|
||||
phase -= twopi
|
||||
}
|
||||
}
|
||||
Track.write(frame_out, 0, buffLength)
|
||||
}
|
||||
}
|
||||
|
||||
private fun startPlaying() {
|
||||
Track.play()
|
||||
isPlaying.value = true
|
||||
}
|
||||
|
||||
private fun stopPlaying() {
|
||||
if (isPlaying.value) {
|
||||
isPlaying.value = false
|
||||
// Stop playing the audio data and release the resources
|
||||
Track.stop()
|
||||
Track.release()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate
|
||||
|
||||
import android.app.Application
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
@HiltAndroidApp
|
||||
class App : Application()
|
|
@ -0,0 +1,21 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.data.dao
|
||||
|
||||
import androidx.room.*
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.entity.ExampleEntity
|
||||
|
||||
@Dao
|
||||
interface ExampleDao {
|
||||
|
||||
@Query("SELECT * FROM example_table")
|
||||
fun getExampleData(): List<ExampleEntity>
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insert(search: ExampleEntity?)
|
||||
|
||||
@Update
|
||||
suspend fun update(search: ExampleEntity)
|
||||
|
||||
@Delete
|
||||
suspend fun delete(search: ExampleEntity)
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.data.entity
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
@Entity(tableName = "example_table")
|
||||
data class ExampleEntity(
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
var id: Int? = null,
|
||||
val title: String?,
|
||||
val description: String?
|
||||
) : Parcelable
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.data.local
|
||||
|
||||
import androidx.room.Database
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.room.TypeConverters
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.dao.ExampleDao
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.entity.ExampleEntity
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.di.ApplicationScope
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Provider
|
||||
|
||||
@Database(entities = [ExampleEntity::class], version = 1)
|
||||
@TypeConverters(Converters::class)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
|
||||
abstract fun getExampleDao(): ExampleDao
|
||||
|
||||
class Callback @Inject constructor(
|
||||
private val database: Provider<AppDatabase>,
|
||||
@ApplicationScope private val applicationScope: CoroutineScope
|
||||
) : RoomDatabase.Callback()
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.data.local
|
||||
|
||||
import androidx.room.TypeConverter
|
||||
import java.util.Date
|
||||
|
||||
class Converters {
|
||||
|
||||
@TypeConverter
|
||||
fun fromTimestamp(value: Long?): Date {
|
||||
return value?.let { Date(it) } ?: Date(System.currentTimeMillis())
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toTimestamp(value: Date?): Long {
|
||||
return value?.let { value.time } ?: System.currentTimeMillis()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.data.model
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class ExampleModel(
|
||||
@SerializedName("title")
|
||||
var title: String?,
|
||||
@SerializedName("description")
|
||||
var description: String?
|
||||
)
|
|
@ -0,0 +1,7 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.data.model
|
||||
|
||||
sealed class Resource<out T : Any> {
|
||||
object Loading : Resource<Nothing>()
|
||||
data class Success<out T : Any>(val data: Any) : Resource<T>()
|
||||
data class Error(val errorMessage: String) : Resource<Nothing>()
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.data.remote
|
||||
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.model.ExampleModel
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.*
|
||||
|
||||
interface AppApi {
|
||||
|
||||
@GET("/api/v1/example")
|
||||
suspend fun getExampleResult(): Response<List<ExampleModel>>
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.data.repository
|
||||
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.dao.ExampleDao
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.remote.AppApi
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
||||
@Singleton
|
||||
class ExampleRepository @Inject constructor(private val appApi: AppApi, private val exampleDao: ExampleDao)
|
|
@ -0,0 +1,43 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.di
|
||||
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.remote.AppApi
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.util.BASE_URL
|
||||
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.gson.GsonConverterFactory
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object ApiModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideLoggingInterceptor(): HttpLoggingInterceptor {
|
||||
return HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideOkHttpClient(logging: HttpLoggingInterceptor): OkHttpClient {
|
||||
return OkHttpClient.Builder().addInterceptor(logging).build()
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideRetrofit(client: OkHttpClient): Retrofit {
|
||||
return Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create()).client(client).build()
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideAppApi(retrofit: Retrofit): AppApi {
|
||||
return retrofit.create(AppApi::class.java)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.di
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import javax.inject.Qualifier
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object AppModule {
|
||||
|
||||
@ApplicationScope
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideApplicationScope(): CoroutineScope {
|
||||
return CoroutineScope(SupervisorJob())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Qualifier
|
||||
annotation class ApplicationScope
|
|
@ -0,0 +1,27 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.di
|
||||
|
||||
import android.app.Application
|
||||
import androidx.room.Room
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.dao.ExampleDao
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.local.AppDatabase
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object DatabaseModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideDatabase(application: Application, callback: AppDatabase.Callback): AppDatabase {
|
||||
return Room.databaseBuilder(application, AppDatabase::class.java, "local_database").fallbackToDestructiveMigration().addCallback(callback).build()
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun provideExampleDao(database: AppDatabase): ExampleDao {
|
||||
return database.getExampleDao()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.navigation
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.NavType
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.navArgument
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.ui.detail.DetailScreen
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.ui.home.MainScreen
|
||||
|
||||
@Composable
|
||||
fun NavGraph(navController: NavHostController) {
|
||||
|
||||
NavHost(
|
||||
navController = navController, startDestination = Screen.Main.route
|
||||
) {
|
||||
|
||||
composable(Screen.Main.route) {
|
||||
MainScreen(navController = navController)
|
||||
}
|
||||
composable(
|
||||
"${Screen.Detail.route}/{id}",
|
||||
arguments = listOf(navArgument("id") { type = NavType.IntType })
|
||||
) {
|
||||
DetailScreen(navController = navController, id = it.arguments?.getInt("id") ?: 0)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.navigation
|
||||
|
||||
sealed class Screen(val route: String) {
|
||||
object Main : Screen("main_screen")
|
||||
object Detail : Screen("detail_screen")
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.ui.activitys
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.navigation.NavGraph
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.ui.theme.MyApplicationTheme
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
MyApplicationTheme {
|
||||
val navController = rememberNavController()
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
NavGraph(navController = navController)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.ui.detail
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.filled.*
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.navigation.NavController
|
||||
import java.util.*
|
||||
|
||||
|
||||
@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
|
||||
@Composable
|
||||
fun DetailScreen(
|
||||
viewModel: DetailViewModel = hiltViewModel(),
|
||||
navController: NavController,
|
||||
id: Int
|
||||
) {
|
||||
|
||||
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(text = id.toString())
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.ui.detail
|
||||
|
||||
data class DetailScreenState(
|
||||
val isLoading: Boolean = false,
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.ui.detail
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.repository.ExampleRepository
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@HiltViewModel
|
||||
class DetailViewModel @Inject constructor(private val exampleRepository: ExampleRepository) : ViewModel() {
|
||||
private val TAG = DetailViewModel::class.java.simpleName
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.ui.home
|
||||
|
||||
data class HomeScreenState(
|
||||
val isLoading: Boolean = false,
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.ui.home
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.data.repository.ExampleRepository
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class HomeViewModel @Inject constructor(private val exampleRepository: ExampleRepository) : ViewModel() {
|
||||
private val TAG = HomeViewModel::class.java.simpleName
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.ui.home
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.navigation.NavHostController
|
||||
import com.ferhatozcelik.jetpackcomposetemplate.navigation.Screen
|
||||
|
||||
@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
|
||||
@Composable
|
||||
fun MainScreen(
|
||||
viewModel: HomeViewModel = hiltViewModel(),
|
||||
navController: NavHostController,
|
||||
) {
|
||||
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
|
||||
Button(onClick = {
|
||||
navController.navigate(Screen.Detail.route + "/123")
|
||||
}) {
|
||||
Text(text = "Go to Detail")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.gyromin.ui.theme
|
||||
package com.ferhatozcelik.jetpackcomposetemplate.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.gyromin.ui.theme
|
||||
package com.ferhatozcelik.jetpackcomposetemplate.ui.theme
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Build
|
||||
|
@ -9,7 +9,11 @@ import androidx.compose.material3.dynamicDarkColorScheme
|
|||
import androidx.compose.material3.dynamicLightColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.core.view.WindowCompat
|
||||
|
||||
private val DarkColorScheme = darkColorScheme(
|
||||
primary = Purple80,
|
||||
|
@ -34,7 +38,7 @@ private val LightColorScheme = lightColorScheme(
|
|||
)
|
||||
|
||||
@Composable
|
||||
fun GyrominTheme(
|
||||
fun MyApplicationTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
// Dynamic color is available on Android 12+
|
||||
dynamicColor: Boolean = true,
|
||||
|
@ -49,6 +53,14 @@ fun GyrominTheme(
|
|||
darkTheme -> DarkColorScheme
|
||||
else -> LightColorScheme
|
||||
}
|
||||
val view = LocalView.current
|
||||
if (!view.isInEditMode) {
|
||||
SideEffect {
|
||||
val window = (view.context as Activity).window
|
||||
window.statusBarColor = colorScheme.primary.toArgb()
|
||||
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
|
||||
}
|
||||
}
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.gyromin.ui.theme
|
||||
package com.ferhatozcelik.jetpackcomposetemplate.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
|
@ -0,0 +1,3 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.util
|
||||
|
||||
const val BASE_URL = "https://api.ferhatozcelik.com"
|
|
@ -0,0 +1,41 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.util
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import android.widget.Toast
|
||||
|
||||
fun View.show() {
|
||||
visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
fun View.gone() {
|
||||
visibility = View.GONE
|
||||
}
|
||||
|
||||
fun Context.toast(message: String) {
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
fun String.debug(message: String) {
|
||||
Log.d(this, message)
|
||||
}
|
||||
|
||||
fun EditText.modifyText(numberText: String) {
|
||||
this.setText(numberText)
|
||||
this.setSelection(numberText.length)
|
||||
}
|
||||
|
||||
fun Context.goURL(url: String) {
|
||||
try {
|
||||
val myIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
startActivity(myIntent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
this.toast("No application can handle this request. Please install a webbrowser")
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.ferhatozcelik.jetpackcomposetemplate.util
|
||||
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.NetworkCapabilities
|
||||
|
||||
class NetworkUtil {
|
||||
companion object {
|
||||
fun hasInternetConnection(context: Context): Boolean {
|
||||
val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
|
||||
val activeNetwork = connectivityManager.activeNetwork ?: return false
|
||||
val capabilities = connectivityManager.getNetworkCapabilities(activeNetwork) ?: return false
|
||||
return when {
|
||||
capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) -> true
|
||||
capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) -> true
|
||||
capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) -> true
|
||||
else -> false
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
<resources>
|
||||
<string name="app_name">Gyromin</string>
|
||||
<string name="app_name">My Application</string>
|
||||
</resources>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Gyromin" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
<style name="Theme.MyApplication" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
</resources>
|
|
@ -2,7 +2,7 @@
|
|||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older than API 31
|
||||
Note: This file is ignored for devices older that API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.gyromin
|
||||
package com.ferhatozcelik.jetpackcomposetemplate
|
||||
|
||||
import org.junit.Test
|
||||
|
16
build.gradle
Normal file
16
build.gradle
Normal file
|
@ -0,0 +1,16 @@
|
|||
plugins {
|
||||
alias(libs.plugins.com.android.application) apply false
|
||||
alias(libs.plugins.org.jetbrains.kotlin.android) apply false
|
||||
alias(libs.plugins.com.android.library) apply false
|
||||
alias(libs.plugins.com.google.dagger.hilt.android) apply false
|
||||
alias(libs.plugins.org.jetbrains.kotlin.jvm) apply false
|
||||
alias(libs.plugins.com.google.devtools.ksp) apply false
|
||||
// alias(libs.plugins.com.google.gms.google.services) apply false // Google Play Services
|
||||
// alias(libs.plugins.com.google.firebase.crashlytics) apply false // Google Play Services
|
||||
}
|
||||
|
||||
ext {
|
||||
appCompileSdkVersion = 34
|
||||
appTargetSdkVersion = 33
|
||||
appMinSdkVersion = 21
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
alias(libs.plugins.android.application) apply false
|
||||
alias(libs.plugins.kotlin.android) apply false
|
||||
alias(libs.plugins.kotlin.compose) apply false
|
||||
}
|
|
@ -8,8 +8,8 @@
|
|||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. For more details, visit
|
||||
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
|
|
|
@ -1,32 +1,114 @@
|
|||
[versions]
|
||||
agp = "8.9.0"
|
||||
kotlin = "2.0.21"
|
||||
coreKtx = "1.10.1"
|
||||
agp = "8.1.1"
|
||||
hilt-navigation-compose = "1.0.0"
|
||||
navigation-compose = "2.5.3"
|
||||
org-jetbrains-kotlin-android = "1.9.10"
|
||||
core-ktx = "1.9.0"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.1.5"
|
||||
espressoCore = "3.5.1"
|
||||
lifecycleRuntimeKtx = "2.6.1"
|
||||
activityCompose = "1.8.0"
|
||||
composeBom = "2024.09.00"
|
||||
androidx-test-ext-junit = "1.1.5"
|
||||
espresso-core = "3.5.1"
|
||||
lifecycle-runtime-ktx = "2.6.2"
|
||||
activity-compose = "1.8.0"
|
||||
compose-bom = "2023.03.00"
|
||||
androidx-multidex = "2.0.1"
|
||||
annotation = "1.7.0"
|
||||
desugar_jdk_libs = "2.0.3"
|
||||
glide-ksp = "4.14.2"
|
||||
kotlin-stdlib = "1.9.10"
|
||||
kotlinx-coroutines-core = "1.6.4"
|
||||
legacy-support-v4 = "1.0.0"
|
||||
lifecycle-extensions = "2.2.0"
|
||||
logging-interceptor = "4.7.2"
|
||||
appcompat = "1.6.1"
|
||||
material = "1.9.0"
|
||||
constraintlayout = "2.1.4"
|
||||
preference-ktx = "1.2.1"
|
||||
retrofit = "2.9.0"
|
||||
room = "2.5.2"
|
||||
hilt = "2.48"
|
||||
multidex = "1.0.3"
|
||||
fragment = "1.6.1"
|
||||
lifecycle = "2.6.2"
|
||||
gson = "2.10.1"
|
||||
glide = "4.16.0"
|
||||
google-services = "4.4.0"
|
||||
firebase-bom = "32.3.1"
|
||||
crashlytics = "2.9.9"
|
||||
ksp = "1.9.0-1.0.12"
|
||||
squareup-logging-interceptor = "4.7.2"
|
||||
viewpager2 = "1.0.0"
|
||||
|
||||
[libraries]
|
||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||
|
||||
androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hilt-navigation-compose" }
|
||||
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation-compose" }
|
||||
androidx-viewpager2 = { module = "androidx.viewpager2:viewpager2", version.ref = "viewpager2" }
|
||||
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-stdlib" }
|
||||
androidx-legacy-support-v4 = { module = "androidx.legacy:legacy-support-v4", version.ref = "legacy-support-v4" }
|
||||
androidx-multidex = { module = "androidx.multidex:multidex", version.ref = "androidx-multidex" }
|
||||
annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
|
||||
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
||||
desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" }
|
||||
|
||||
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" }
|
||||
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
|
||||
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
|
||||
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
|
||||
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
|
||||
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
|
||||
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
||||
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
||||
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" }
|
||||
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" }
|
||||
lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle-runtime-ktx" }
|
||||
activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity-compose" }
|
||||
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
|
||||
ui = { group = "androidx.compose.ui", name = "ui" }
|
||||
ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
|
||||
ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||
ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
||||
ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
||||
ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||
material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||
|
||||
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||
|
||||
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||
fragment = { group = "androidx.fragment", name = "fragment", version.ref = "fragment" }
|
||||
preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preference-ktx" }
|
||||
|
||||
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines-core" }
|
||||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" }
|
||||
|
||||
lifecycle = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle" }
|
||||
lifecycle-runtime = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" }
|
||||
lifecycle-extensions = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "lifecycle-extensions" }
|
||||
|
||||
hilt = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
|
||||
hilt-viewmodel = { group = "com.google.dagger", name = "hilt-lifecycle-viewmodel", version.ref = "hilt" }
|
||||
hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" }
|
||||
|
||||
room = { group = "androidx.room", name = "room-ktx", version.ref = "room" }
|
||||
room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" }
|
||||
room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" }
|
||||
|
||||
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
|
||||
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" }
|
||||
logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "logging-interceptor" }
|
||||
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
||||
|
||||
glide = { group = "com.github.bumptech.glide", name = "glide", version.ref = "glide" }
|
||||
ksp = { module = "com.github.bumptech.glide:ksp", version.ref = "glide-ksp" }
|
||||
|
||||
firebase = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebase-bom" }
|
||||
analytics = { group = "com.google.firebase", name = "firebase-analytics-ktx" }
|
||||
crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics-ktx" }
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||
com-android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
com-android-library = { id = "com.android.library", version.ref = "agp" }
|
||||
|
||||
com-google-dagger-hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
|
||||
com-google-devtools-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
||||
|
||||
org-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "org-jetbrains-kotlin-android" }
|
||||
org-jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "core-ktx" }
|
||||
|
||||
com-google-gms-google-services = { id = "com.google.gms.google-services", version.ref = "google-services" }
|
||||
com-google-firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "crashlytics" }
|
||||
|
||||
[bundles]
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Tue Mar 11 00:36:37 EDT 2025
|
||||
#Wed Mar 12 01:25:15 EDT 2025
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
0
gradlew
vendored
Executable file → Normal file
0
gradlew
vendored
Executable file → Normal file
16
settings.gradle
Normal file
16
settings.gradle
Normal file
|
@ -0,0 +1,16 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
rootProject.name = "jetpack-compose-template"
|
||||
include ':app'
|
|
@ -1,23 +0,0 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
google {
|
||||
content {
|
||||
includeGroupByRegex("com\\.android.*")
|
||||
includeGroupByRegex("com\\.google.*")
|
||||
includeGroupByRegex("androidx.*")
|
||||
}
|
||||
}
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Gyromin"
|
||||
include(":app")
|
Loading…
Add table
Add a link
Reference in a new issue