├── app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable
│ │ │ ├── ai_icon.png
│ │ │ ├── prompt_bg.xml
│ │ │ ├── custom_checkbox.xml
│ │ │ ├── baseline_check_circle_24.xml
│ │ │ ├── baseline_radio_button_unchecked_24.xml
│ │ │ ├── ic_launcher_foreground.xml
│ │ │ └── ic_launcher_background.xml
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.webp
│ │ │ └── ic_launcher_round.webp
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.webp
│ │ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.webp
│ │ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.webp
│ │ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.webp
│ │ │ └── ic_launcher_round.webp
│ │ ├── values-night
│ │ │ ├── colors.xml
│ │ │ └── themes.xml
│ │ ├── values
│ │ │ ├── colors.xml
│ │ │ ├── themes.xml
│ │ │ └── strings.xml
│ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ ├── xml
│ │ │ ├── backup_rules.xml
│ │ │ └── data_extraction_rules.xml
│ │ ├── navigation
│ │ │ └── navigation.xml
│ │ └── layout
│ │ │ ├── activity_main.xml
│ │ │ ├── fragment_downloader.xml
│ │ │ ├── list_item_models.xml
│ │ │ └── fragment_home.xml
│ │ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── imageartgenerator
│ │ │ ├── domain
│ │ │ ├── models
│ │ │ │ ├── DreamBoothModel.kt
│ │ │ │ ├── RequestState.kt
│ │ │ │ ├── DreamBoothResponse.kt
│ │ │ │ ├── DreamBoothRequest.kt
│ │ │ │ └── MetaData.kt
│ │ │ └── repository
│ │ │ │ └── ArtRepository.kt
│ │ │ ├── presentation
│ │ │ ├── artApp
│ │ │ │ └── ArtApplication.kt
│ │ │ ├── adapters
│ │ │ │ └── ModelsAdapter.kt
│ │ │ └── viewModels
│ │ │ │ └── ArtViewModel.kt
│ │ │ └── data
│ │ │ └── remote
│ │ │ ├── api
│ │ │ ├── ApiService.kt
│ │ │ └── RetrofitInjection.kt
│ │ │ └── repo
│ │ │ ├── RepositoryInjection.kt
│ │ │ └── ArtRepositoryImplementation.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle.kts
├── .idea
├── .name
├── .gitignore
├── compiler.xml
├── kotlinc.xml
├── misc.xml
└── gradle.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── screenshots
├── Screenshot_20231016-161346.png
├── Screenshot_20231016-161700.png
├── Screenshot_20231016-161715.png
└── the-best-stable-diffusion-prompts.webp
├── .gitignore
├── settings.gradle.kts
├── gradle.properties
├── gradlew.bat
├── README.md
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | Image Art Generator
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ai_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/drawable/ai_icon.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_20231016-161346.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/screenshots/Screenshot_20231016-161346.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_20231016-161700.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/screenshots/Screenshot_20231016-161700.png
--------------------------------------------------------------------------------
/screenshots/Screenshot_20231016-161715.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/screenshots/Screenshot_20231016-161715.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/screenshots/the-best-stable-diffusion-prompts.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/screenshots/the-best-stable-diffusion-prompts.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UmairOye/AI-Art-Generator/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/domain/models/DreamBoothModel.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.domain.models
2 |
3 | data class DreamBoothModel(val name: String,val model_name: String, var isSelected: Boolean = false)
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Oct 13 12:36:03 PKT 2023
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/presentation/artApp/ArtApplication.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.presentation.artApp
2 |
3 | import android.app.Application
4 | import dagger.hilt.android.HiltAndroidApp
5 |
6 | @HiltAndroidApp
7 | class ArtApplication: Application() {
8 | }
--------------------------------------------------------------------------------
/app/src/main/res/values-night/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #fff
4 | #000
5 | #333333
6 | #333333
7 | #fff
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF000000
4 | #FFFFFFFF
5 | #333333
6 | #009688
7 | #fff
8 |
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore Android Studio/IntelliJ IDE files
2 | .idea/
3 | *.iml
4 |
5 | # Ignore Gradle files
6 | .gradle/
7 | local.properties
8 | apikeys.properties
9 |
10 | # Ignore build output
11 | /build/
12 | */build/
13 |
14 | # Ignore log and cache files
15 | *.log
16 | captures/
17 |
18 | # Ignore generated assets
19 | app/release/
20 | app/debug/
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/prompt_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/domain/models/RequestState.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.domain.models
2 |
3 | sealed class RequestState {
4 | data object Idle : RequestState()
5 | data object Loading : RequestState()
6 | data class Success(val data: T) : RequestState()
7 | data class Error(val error: Throwable) : RequestState()
8 | }
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | gradlePluginPortal()
6 | }
7 | }
8 | dependencyResolutionManagement {
9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10 | repositories {
11 | google()
12 | mavenCentral()
13 | }
14 | }
15 |
16 | rootProject.name = "Image Art Generator"
17 | include(":app")
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/custom_checkbox.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_check_circle_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_radio_button_unchecked_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/data/remote/api/ApiService.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.data.remote.api
2 |
3 | import com.example.imageartgenerator.BuildConfig
4 | import com.example.imageartgenerator.domain.models.DreamBoothRequest
5 | import com.example.imageartgenerator.domain.models.DreamBoothResponse
6 | import retrofit2.Call
7 | import retrofit2.http.Body
8 | import retrofit2.http.POST
9 |
10 | interface ApiService {
11 | @POST(BuildConfig.END_POINT)
12 | fun makeApiRequest(@Body requestBody: DreamBoothRequest): Call
13 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/domain/repository/ArtRepository.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.domain.repository
2 |
3 | import com.example.imageartgenerator.domain.models.DreamBoothModel
4 | import com.example.imageartgenerator.domain.models.DreamBoothRequest
5 | import com.example.imageartgenerator.domain.models.MetaData
6 | import com.example.imageartgenerator.domain.models.RequestState
7 | import kotlinx.coroutines.flow.Flow
8 |
9 | interface ArtRepository {
10 | fun makeApiRequest(requestBody: DreamBoothRequest): Flow>
11 | fun getModelsList(): List
12 | }
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/domain/models/DreamBoothResponse.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.domain.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | data class DreamBoothResponse(
6 | val status: String,
7 | val tip: String?,
8 | @SerializedName("tip_1") val tip1: String?,
9 | val eta: Double?,
10 | val messege: String?,
11 | @SerializedName("webhook_status") val webhookStatus: String?,
12 | @SerializedName("fetch_result") val fetchResult: String?,
13 | val id: Long?,
14 | val output: List?,
15 | val meta: MetaData?,
16 | @SerializedName("future_links") val futureLinks: List?
17 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/data/remote/repo/RepositoryInjection.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.data.remote.repo
2 |
3 | import com.example.imageartgenerator.domain.repository.ArtRepository
4 | import dagger.Module
5 | import dagger.Provides
6 | import dagger.hilt.InstallIn
7 | import dagger.hilt.components.SingletonComponent
8 | import javax.inject.Singleton
9 |
10 | @Module
11 | @InstallIn(SingletonComponent::class)
12 | object RepositoryInjection {
13 |
14 | @Provides
15 | @Singleton
16 |
17 | fun provideRepository(artRepositoryImplementation: ArtRepositoryImplementation): ArtRepository{
18 | return artRepositoryImplementation
19 | }
20 |
21 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/domain/models/DreamBoothRequest.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.domain.models
2 |
3 | import com.example.imageartgenerator.BuildConfig
4 | import com.google.gson.annotations.SerializedName
5 |
6 | data class DreamBoothRequest(
7 | val key: String = BuildConfig.API_KEY,
8 | @SerializedName("model_id") val modelId: String,
9 | val prompt: String,
10 | @SerializedName("negative_prompt") val negativePrompt: String,
11 | val samples: Int,
12 | val width: Int,
13 | val height: Int,
14 | val steps: Int,
15 | @SerializedName("cfg_scale") val cfgScale: Double,
16 | val seed: String? = null,
17 | val webhook: String? = null
18 | )
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/data/remote/api/RetrofitInjection.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.data.remote.api
2 |
3 | import com.example.imageartgenerator.BuildConfig.BASE_URL
4 | import dagger.Module
5 | import dagger.Provides
6 | import dagger.hilt.InstallIn
7 | import dagger.hilt.components.SingletonComponent
8 | import retrofit2.Retrofit
9 | import retrofit2.converter.gson.GsonConverterFactory
10 | import javax.inject.Singleton
11 |
12 | @Module
13 | @InstallIn(SingletonComponent::class)
14 | object RetrofitInjection {
15 |
16 | @Provides
17 | @Singleton
18 | fun provideRetrofitClient(): Retrofit {
19 | return Retrofit.Builder()
20 | .baseUrl(BASE_URL)
21 | .addConverterFactory(GsonConverterFactory.create())
22 | .build()
23 | }
24 |
25 | @Provides
26 | @Singleton
27 | fun provideApiService(retrofit: Retrofit): ApiService {
28 | return retrofit.create(ApiService::class.java)
29 | }
30 | }
--------------------------------------------------------------------------------
/app/src/main/res/navigation/navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
16 |
17 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
19 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
20 | # Enables namespacing of each library's R class so that its R class includes only the
21 | # resources declared in the library itself and none from the library's dependencies,
22 | # thereby reducing the size of the R class for that library
23 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/domain/models/MetaData.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.domain.models
2 |
3 | import com.google.gson.annotations.SerializedName
4 |
5 | data class MetaData(
6 | val prompt: String?,
7 | @SerializedName("model_id") val modelId: String?,
8 | @SerializedName("negative_prompt") val negativePrompt: String?,
9 | val scheduler: String?,
10 | @SerializedName("safety_checker") val safetyChecker: String?,
11 | @SerializedName("W") val width: Int?,
12 | @SerializedName("H") val height: Int?,
13 | @SerializedName("guidance_scale") val guidanceScale: Double?,
14 | val seed: Long?,
15 | val steps: Int?,
16 | @SerializedName("n_samples") val nSamples: Int?,
17 | @SerializedName("instant_response") val instantResponse: String?,
18 | @SerializedName("ip_adapter_id") val ipAdapterId: String?,
19 | @SerializedName("enhance_prompt") val enhancePrompt: String?,
20 | @SerializedName("ip_adapter_scale") val ipAdapterScale: Double?,
21 | @SerializedName("ip_adapter_image") val ipAdapterImage: String?,
22 | val upscale: String?,
23 | @SerializedName("use_karras_sigmas") val useKarrasSigmas: String?,
24 | @SerializedName("algorithm_type") val algorithmType: String?,
25 | @SerializedName("safety_checker_type") val safetyCheckerType: String?,
26 | val vae: String?,
27 | val lora: String?,
28 | @SerializedName("lora_strength") val loraStrength: Double?,
29 | @SerializedName("clip_skip") val clipSkip: Int?,
30 | val watermark: String?,
31 | val temp: String?,
32 | val base64: String?,
33 | val webhook: String?,
34 | @SerializedName("track_id") val trackId: String?,
35 | val id: String?,
36 | @SerializedName("file_prefix") val filePrefix: String?,
37 | @SerializedName("is_sdxl") val isSdxl: Boolean?,
38 | val output: List?
39 | )
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_downloader.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
22 |
23 |
27 |
28 |
34 |
35 |
36 |
37 |
38 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Image Art Generator
3 |
4 | Hello blank fragment
5 | ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner
6 | output
7 | Send Request
8 | Prompt
9 | your query here...
10 | Clear
11 | Submit
12 | Result
13 | Prompt:
14 | Describe what you want the image be like?
15 | Negative Prompt:
16 | Describe what you don\'t want the image be like?
17 | Output image size:
18 | 256 x 256
19 | 512 x 512
20 | 1024 x 1024
21 | Select Model:
22 | models
23 | Generate
24 | MidJourney V4
25 | Anything V3
26 | InkMix
27 | MeinaMix
28 | F222
29 | Realistic Vision
30 | Dream Shaper
31 | Anything V4
32 | Vintedois
33 | Redream
34 | Download
35 | something went wrong! Try again
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/presentation/adapters/ModelsAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.presentation.adapters
2 |
3 | import android.view.LayoutInflater
4 | import android.view.ViewGroup
5 | import androidx.recyclerview.widget.RecyclerView
6 | import com.example.imageartgenerator.databinding.ListItemModelsBinding
7 | import com.example.imageartgenerator.domain.models.DreamBoothModel
8 |
9 | class ModelsAdapter : RecyclerView.Adapter() {
10 |
11 | private var mainList: List = ArrayList()
12 | private var listener: OnClickListener? = null
13 | private var selectedPosition: Int = RecyclerView.NO_POSITION
14 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TopicAdapterViewHolder {
15 | val binding =
16 | ListItemModelsBinding.inflate(LayoutInflater.from(parent.context), parent, false)
17 | return TopicAdapterViewHolder(binding)
18 | }
19 |
20 | override fun getItemCount(): Int {
21 | return mainList.size
22 | }
23 |
24 | override fun onBindViewHolder(holder: TopicAdapterViewHolder, position: Int) {
25 | holder.bind(mainList[position], position)
26 | }
27 |
28 | inner class TopicAdapterViewHolder(private val binding: ListItemModelsBinding) :
29 | RecyclerView.ViewHolder(binding.root) {
30 |
31 | fun bind(item: DreamBoothModel, position: Int) {
32 | binding.modelName.text = item.name
33 | binding.checkBox.isChecked = selectedPosition == position
34 |
35 | binding.cdMain.setOnClickListener {
36 | val previousPosition = selectedPosition
37 | selectedPosition = position
38 | notifyItemChanged(previousPosition)
39 | notifyItemChanged(selectedPosition)
40 | listener?.onItemClick(item.model_name)
41 | }
42 |
43 | binding.modelName.isSelected = true
44 | binding.checkBox.isClickable = false
45 | }
46 | }
47 |
48 | fun submitList(list: List) {
49 | this.mainList = list
50 | notifyDataSetChanged()
51 | }
52 |
53 | interface OnClickListener {
54 | fun onItemClick(artModel: String)
55 | }
56 |
57 | fun setOnClickListener(listener: OnClickListener) {
58 | this.listener = listener
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import java.util.Properties
2 |
3 | plugins {
4 | id("com.android.application")
5 | id("org.jetbrains.kotlin.android")
6 | id("com.google.dagger.hilt.android")
7 | id("org.jetbrains.kotlin.kapt")
8 |
9 | }
10 |
11 | android {
12 | namespace = "com.example.imageartgenerator"
13 | compileSdk = 34
14 |
15 | defaultConfig {
16 | applicationId = "com.example.imageartgenerator"
17 | minSdk = 24
18 | targetSdk = 34
19 | versionCode = 1
20 | versionName = "1.0"
21 |
22 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
23 |
24 | val keystoreFile = project.rootProject.file("apikeys.properties")
25 | val properties = Properties()
26 | properties.load(keystoreFile.inputStream())
27 | val endPoint = properties.getProperty("END_POINT") ?: ""
28 | val baseUrl = properties.getProperty("BASE_URL") ?: ""
29 | val apiKey = properties.getProperty("API_KEY") ?: ""
30 |
31 |
32 | buildConfigField(type = "String", name = "API_KEY", value = apiKey)
33 | buildConfigField(type = "String", name = "END_POINT", value = endPoint)
34 | buildConfigField(type = "String", name = "BASE_URL", value = baseUrl)
35 |
36 |
37 | }
38 |
39 | buildTypes {
40 | release {
41 | isMinifyEnabled = false
42 | proguardFiles(
43 | getDefaultProguardFile("proguard-android-optimize.txt"),
44 | "proguard-rules.pro"
45 | )
46 | }
47 | }
48 | compileOptions {
49 | sourceCompatibility = JavaVersion.VERSION_1_8
50 | targetCompatibility = JavaVersion.VERSION_1_8
51 | }
52 | kotlinOptions {
53 | jvmTarget = "1.8"
54 | }
55 |
56 | buildFeatures {
57 | viewBinding = true
58 | buildConfig = true
59 | }
60 | }
61 |
62 | dependencies {
63 |
64 | implementation("androidx.core:core-ktx:1.13.1")
65 | implementation("androidx.appcompat:appcompat:1.7.0")
66 | implementation("com.google.android.material:material:1.12.0")
67 | implementation("androidx.constraintlayout:constraintlayout:2.2.1")
68 | testImplementation("junit:junit:4.13.2")
69 | androidTestImplementation("androidx.test.ext:junit:1.2.1")
70 | androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
71 |
72 | //Retrofit
73 | implementation("com.squareup.retrofit2:retrofit:2.9.0")
74 | implementation("com.squareup.retrofit2:converter-gson:2.9.0")
75 |
76 | //Navigation Components
77 | implementation("androidx.navigation:navigation-fragment-ktx:2.8.9")
78 | implementation("androidx.navigation:navigation-ui-ktx:2.8.9")
79 |
80 | //SDP dependency
81 | implementation("com.intuit.sdp:sdp-android:1.1.1")
82 |
83 | //hilt
84 | implementation ("com.google.dagger:hilt-android:2.52")
85 | kapt ("com.google.dagger:hilt-compiler:2.52")
86 |
87 | //SDP dependency
88 | implementation("com.intuit.ssp:ssp-android:1.1.0")
89 |
90 | //Glide
91 | implementation ("com.github.bumptech.glide:glide:4.16.0")
92 |
93 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_item_models.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
29 |
30 |
42 |
43 |
44 |
54 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/presentation/viewModels/ArtViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.presentation.viewModels
2 |
3 | import android.app.DownloadManager
4 | import android.content.Context
5 | import android.net.Uri
6 | import android.os.Environment
7 | import androidx.lifecycle.ViewModel
8 | import androidx.lifecycle.viewModelScope
9 | import com.example.imageartgenerator.domain.models.DreamBoothModel
10 | import com.example.imageartgenerator.domain.models.DreamBoothRequest
11 | import com.example.imageartgenerator.domain.models.MetaData
12 | import com.example.imageartgenerator.domain.models.RequestState
13 | import com.example.imageartgenerator.domain.models.utils.showToast
14 | import com.example.imageartgenerator.domain.repository.ArtRepository
15 | import dagger.hilt.android.lifecycle.HiltViewModel
16 | import dagger.hilt.android.qualifiers.ApplicationContext
17 | import kotlinx.coroutines.flow.MutableStateFlow
18 | import kotlinx.coroutines.flow.asStateFlow
19 | import kotlinx.coroutines.flow.onCompletion
20 | import kotlinx.coroutines.flow.onStart
21 | import kotlinx.coroutines.launch
22 | import java.io.File
23 | import javax.inject.Inject
24 |
25 | @HiltViewModel
26 | class ArtViewModel @Inject constructor(private val artRepository: ArtRepository,
27 | @ApplicationContext private val context: Context): ViewModel() {
28 | private val _artState = MutableStateFlow>(RequestState.Idle)
29 | val artState = _artState.asStateFlow()
30 |
31 |
32 | fun downloadImageNew(filename: String, downloadUrlOfImage: String) {
33 | try {
34 | val dm = context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager?
35 | val downloadUri = Uri.parse(downloadUrlOfImage)
36 | val request = DownloadManager.Request(downloadUri)
37 | request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI or DownloadManager.Request.NETWORK_MOBILE)
38 | .setAllowedOverRoaming(false)
39 | .setTitle(filename)
40 | .setMimeType("image/jpeg")
41 | .setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
42 | .setDestinationInExternalPublicDir(
43 | Environment.DIRECTORY_PICTURES,
44 | File.separator + filename + ".jpg"
45 | )
46 | dm!!.enqueue(request)
47 | context.showToast("Download started.")
48 | } catch (e: Exception) {
49 | context.showToast("Download failed ${e.message}.")
50 | }
51 | }
52 |
53 |
54 | fun generateAIArt(model: String, prompt: String, negativePrompt: String, width: Int, height: Int){
55 | viewModelScope.launch {
56 | val dreamBoothRequest = DreamBoothRequest(
57 | modelId = model,
58 | prompt = prompt,
59 | negativePrompt = negativePrompt,
60 | samples = 1,
61 | width = width,
62 | height = height,
63 | steps = 30,
64 | cfgScale = 8.0,
65 | )
66 | artRepository.makeApiRequest(dreamBoothRequest)
67 | .onStart { }
68 | .onCompletion { }
69 | .collect{ response ->
70 | _artState.value = response
71 | }
72 | }
73 | }
74 |
75 |
76 | fun getModelsList(): List{
77 | return artRepository.getModelsList()
78 | }
79 |
80 | fun changeArtState(){
81 | _artState.value = RequestState.Idle
82 | }
83 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/imageartgenerator/data/remote/repo/ArtRepositoryImplementation.kt:
--------------------------------------------------------------------------------
1 | package com.example.imageartgenerator.data.remote.repo
2 |
3 | import android.content.Context
4 | import android.util.Log
5 | import com.example.imageartgenerator.R
6 | import com.example.imageartgenerator.data.remote.api.ApiService
7 | import com.example.imageartgenerator.domain.models.DreamBoothModel
8 | import com.example.imageartgenerator.domain.models.DreamBoothRequest
9 | import com.example.imageartgenerator.domain.models.DreamBoothResponse
10 | import com.example.imageartgenerator.domain.models.MetaData
11 | import com.example.imageartgenerator.domain.models.RequestState
12 | import com.example.imageartgenerator.domain.models.utils.Constants.TAG
13 | import com.example.imageartgenerator.domain.repository.ArtRepository
14 | import dagger.hilt.android.qualifiers.ApplicationContext
15 | import kotlinx.coroutines.Dispatchers
16 | import kotlinx.coroutines.flow.Flow
17 | import kotlinx.coroutines.flow.flow
18 | import kotlinx.coroutines.flow.flowOn
19 | import retrofit2.Call
20 | import retrofit2.Callback
21 | import retrofit2.Response
22 | import javax.inject.Inject
23 | import kotlin.coroutines.resume
24 | import kotlin.coroutines.resumeWithException
25 | import kotlin.coroutines.suspendCoroutine
26 |
27 | class ArtRepositoryImplementation @Inject constructor(private val artApi: ApiService,
28 | @ApplicationContext private val context: Context) :
29 | ArtRepository {
30 | override fun makeApiRequest(requestBody: DreamBoothRequest): Flow> =
31 | flow {
32 | emit(RequestState.Loading)
33 |
34 | try {
35 | val response = suspendCoroutine { continuation ->
36 | artApi.makeApiRequest(requestBody)
37 | .enqueue(object : Callback {
38 | override fun onResponse(
39 | call: Call,
40 | response: Response
41 | ) {
42 | continuation.resume(response)
43 | }
44 |
45 | override fun onFailure(call: Call, t: Throwable) {
46 | continuation.resumeWithException(t)
47 | }
48 | })
49 | }
50 |
51 | if (response.isSuccessful && response.body() != null) {
52 | emit(RequestState.Success(response.body()!!.meta))
53 | Log.d(TAG, "onResponse: ${response.body()?.meta}")
54 | } else {
55 | emit(RequestState.Error(Exception("Response not successful")))
56 | Log.d(TAG, "onResponse: not successful")
57 | }
58 |
59 | } catch (e: Exception) {
60 | emit(RequestState.Error(e))
61 | Log.d(TAG, "onFailure: ${e.message}")
62 | }
63 | }.flowOn(Dispatchers.IO)
64 |
65 |
66 | override fun getModelsList(): List {
67 | val artModels = ArrayList()
68 | artModels.apply {
69 | add(DreamBoothModel(context.getString(R.string.midjourney_v4), "midjourney"))
70 | add(DreamBoothModel(context.getString(R.string.anything_v3), "anything-v3"))
71 | add(DreamBoothModel(context.getString(R.string.anything_v4), "anything-v4"))
72 | add(DreamBoothModel(context.getString(R.string.dream_shaper), "dream-shaper-8797"))
73 | add(DreamBoothModel(context.getString(R.string.realistic_vision), "realistic-vision-v13"))
74 | add(DreamBoothModel(context.getString(R.string.f222), "f222-diffusion"))
75 | add(DreamBoothModel(context.getString(R.string.vintedois), "vintedois-diffusion"))
76 | add(DreamBoothModel(context.getString(R.string.meinamix), "meinamix"))
77 | add(DreamBoothModel(context.getString(R.string.inkmix), "inkmix"))
78 | add(DreamBoothModel(context.getString(R.string.redream), "redream"))
79 |
80 | add(DreamBoothModel("SDXL 1.0", "sdxl"))
81 | add(DreamBoothModel("Ganyu Lora", "ganyu-lora"))
82 | add(DreamBoothModel("mix4cutegirl", "mix4cutegirl"))
83 | add(DreamBoothModel("moxin_1", "moxin"))
84 | add(DreamBoothModel("Pepe Frog", "pepe-frog"))
85 | add(DreamBoothModel("TimeLessXL", "timelessxl"))
86 | add(DreamBoothModel("sdxlceshi", "sdxlceshi"))
87 | }
88 |
89 |
90 | return artModels
91 | }
92 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AI Art Generator App
2 |
3 |
4 |
5 | ## Table of Contents
6 |
7 | - [About the Project](#about-the-project)
8 | - [Getting Started](#getting-started)
9 | - [Prerequisites](#prerequisites)
10 | - [Installation](#installation)
11 | - [Usage](#usage)
12 | - [Making API Requests](#making-api-requests)
13 | - [Loading Images](#loading-images)
14 | - [Screenshots](#screenshots)
15 |
16 | ## About the Project
17 |
18 | The AI Art Generator App is an Android application that leverages the Stable Diffusion API to create unique artworks based on user-provided prompts. It follows the Clean Architectuer pattern and uses Retrofit for API communication, flows for API states and Glide for efficient image loading.
19 |
20 | ## Getting Started
21 |
22 | ### Prerequisites
23 |
24 | - Android Studio with Kotlin support
25 | - Knowledge of MVVM architecture
26 | - Retrofit and Glide dependencies added to your project
27 | - Knowledge of Kotlin Flows
28 | - Knowledge of Dagger-Hilt
29 |
30 | ### Installation
31 |
32 | 1. Clone the repository:
33 |
34 | ```bash
35 | git clone https://github.com/UmairOye/AI-Art-Generator.git
36 | cd AI-Art-Generator
37 | 2. Open the project in Android Studio.
38 | 3. Build and run the app on an emulator or physical device.
39 |
40 | ## Usage
41 | ### Making API Requests
42 | ## Retrofit Client
43 |
44 | ```bash
45 | @Module
46 | @InstallIn(SingletonComponent::class)
47 | object RetrofitInjection {
48 |
49 | @Provides
50 | @Singleton
51 | fun provideRetrofitClient(): Retrofit {
52 | return Retrofit.Builder()
53 | .baseUrl(BASE_URL)
54 | .addConverterFactory(GsonConverterFactory.create())
55 | .build()
56 | }
57 |
58 | @Provides
59 | @Singleton
60 | fun provideApiService(retrofit: Retrofit): ApiService {
61 | return retrofit.create(ApiService::class.java)
62 | }
63 | }
64 |
65 |
66 | ```
67 | ## API Service
68 |
69 | ```bash
70 | interface ApiService {
71 | @POST(BuildConfig.END_POINT)
72 | fun makeApiRequest(@Body requestBody: DreamBoothRequest): Call
73 | }
74 | ```
75 |
76 | ## Make API Request
77 |
78 | ```bash
79 | override fun makeApiRequest(requestBody: DreamBoothRequest): Flow> =
80 | flow {
81 | emit(RequestState.Loading)
82 |
83 | try {
84 | val response = suspendCoroutine { continuation ->
85 | artApi.makeApiRequest(requestBody)
86 | .enqueue(object : Callback {
87 | override fun onResponse(
88 | call: Call,
89 | response: Response
90 | ) {
91 | continuation.resume(response)
92 | }
93 |
94 | override fun onFailure(call: Call, t: Throwable) {
95 | continuation.resumeWithException(t)
96 | }
97 | })
98 | }
99 |
100 | if (response.isSuccessful && response.body() != null) {
101 | emit(RequestState.Success(response.body()!!.meta))
102 | Log.d(TAG, "onResponse: ${response.body()?.meta}")
103 | } else {
104 | emit(RequestState.Error(Exception("Response not successful")))
105 | Log.d(TAG, "onResponse: not successful")
106 | }
107 |
108 | } catch (e: Exception) {
109 | emit(RequestState.Error(e))
110 | Log.d(TAG, "onFailure: ${e.message}")
111 | }
112 | }.flowOn(Dispatchers.IO)
113 |
114 | ```
115 |
116 | ## Loading Images
117 | Glide is used for efficient image loading. Here's an example of how to load an image into an ImageView:
118 | ```bash
119 | Glide.with(this)
120 | .load("https://example.com/image.jpg")
121 | .into(imageView)
122 | ```
123 | ## Screenshots
124 |
125 |
126 | ## 💼 Hire Me
127 | Need help with Android development?
128 | I specialize in:
129 | - Custom UI components (e.g., animated bottom navigation)
130 | - API integration (AI tools, social media, ads)
131 | - Performance optimization and clean architecture
132 |
133 | 👉 [Hire me on Fiverr](https://www.fiverr.com/users/theandroiddev/)
134 |
135 |
136 | ## Don't Forget to Star ⭐
137 |
138 | If you found this project useful or had fun exploring it, please consider giving it a star. It's a great way to show your appreciation and it puts a smile on my face! 😊🌟
139 |
140 |
141 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
18 |
19 |
28 |
29 |
36 |
37 |
51 |
52 |
59 |
60 |
72 |
73 |
80 |
81 |
88 |
89 |
97 |
98 |
108 |
109 |
117 |
118 |
119 |
120 |
121 |
122 |
129 |
130 |
131 |
140 |
141 |
142 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
167 |
168 |
169 |
--------------------------------------------------------------------------------