Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MehdiSekoba committed Feb 21, 2024
0 parents commit 3d0e3df
Show file tree
Hide file tree
Showing 193 changed files with 7,391 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
123 changes: 123 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import com.android.build.gradle.internal.tasks.databinding.DataBindingGenBaseClassesTask
import org.gradle.configurationcache.extensions.capitalized
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompileTool

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.devtools.ksp")
id("androidx.navigation.safeargs")
id("dagger.hilt.android.plugin")
id("kotlin-parcelize")
}

android {
namespace = "com.mehdisekoba.weather"
compileSdk = 34

defaultConfig {
applicationId = "com.mehdisekoba.weather"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
bundle {
language {
enableSplit = false
}
density {
enableSplit = true
}
abi {
enableSplit = true
}
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
viewBinding = true
buildConfig = true
}
kotlinOptions {
jvmTarget = "17"
}
androidComponents {
onVariants(selector().all()) { variant ->
afterEvaluate {
project.tasks.getByName("ksp" + variant.name.capitalized() + "Kotlin") {
val dataBindingTask =
project.tasks.getByName(
"dataBindingGenBaseClasses" + variant.name.capitalized(),
) as DataBindingGenBaseClassesTask
(this as AbstractKotlinCompileTool<*>).setSource(dataBindingTask.sourceOutFolder)
}
}
}
}
}

dependencies {
// Android
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
// Location
implementation("com.google.android.gms:play-services-location:21.1.0")
// datastore
implementation("androidx.datastore:datastore-preferences:1.0.0")
// Navigation
implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
// Dagger - Hilt
implementation("com.google.dagger:hilt-android:2.50")
ksp("com.google.dagger:hilt-compiler:2.50")
// Retrofit
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
// OkHTTP client
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.11.0")
// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
// Lifecycle
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
// Gson
implementation("com.google.code.gson:gson:2.10.1")
// Image Loading
implementation("io.coil-kt:coil:2.5.0")
// Calligraphy
implementation("io.github.inflationx:calligraphy3:3.1.1")
implementation("io.github.inflationx:viewpump:2.0.3")
// Room components
implementation("androidx.room:room-runtime:2.6.1")
ksp("androidx.room:room-compiler:2.6.1")
implementation("androidx.room:room-ktx:2.6.1")
// lottie Animation
implementation("com.airbnb.android:lottie:6.3.0")
// Other
implementation("com.github.MrNouri:DynamicSizes:1.0")
implementation("com.github.MatteoBattilana:WeatherView:3.0.0")
implementation("com.jakewharton.threetenabp:threetenabp:1.4.6")
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

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

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

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
44 changes: 44 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

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

<application
android:name=".utils.MyApp"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Weather"
tools:targetApi="tiramisu"
android:localeConfig="@xml/locales_config">
<activity
android:name=".ui.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<service
android:name="androidx.appcompat.app.AppLocalesMetadataHolderService"
android:enabled="false"
android:exported="false">
<meta-data
android:name="autoStoreLocales"
android:value="true" />
</service>
</application>

</manifest>
Binary file added app/src/main/assets/fonts/Vazirmatn_Bold.ttf
Binary file not shown.
Binary file added app/src/main/assets/fonts/Vazirmatn_Medium.ttf
Binary file not shown.
Binary file added app/src/main/assets/fonts/Vazirmatn_Regular.ttf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.mehdisekoba.weather.data.model

data class AppLanguageModel(val selectedLan: String, val selectedLanCode: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.mehdisekoba.weather.data.model

data class PollutionModel(val title: String, val count: Double?)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.mehdisekoba.weather.data.model

import com.google.gson.annotations.SerializedName

class ResponseCurrentLocation : ArrayList<ResponseCurrentLocation.ResponseCurrentLocationItem>() {
data class ResponseCurrentLocationItem(
@SerializedName("country")
val country: String?,
@SerializedName("lat")
val lat: Double?,
@SerializedName("lon")
val lon: Double?,
@SerializedName("name")
val name: String?,
@SerializedName("state")
val state: String?,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package com.mehdisekoba.weather.data.model

import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize
import kotlinx.parcelize.RawValue

@Parcelize
@Suppress("ktlint:standard:value-parameter-comment")
data class ResponseCurrentWeather(
@SerializedName("base")
val base: String?, // stations
@SerializedName("clouds")
val clouds: @RawValue Clouds?,
@SerializedName("cod")
val cod: Int?, // 200
@SerializedName("coord")
val coord: @RawValue Coord?,
@SerializedName("dt")
val dt: Int?, // 1702460981
@SerializedName("id")
val id: Int?, // 3163858
@SerializedName("main")
val main: @RawValue Main?,
@SerializedName("name")
val name: String?, // Zocca
@SerializedName("rain")
val rain: @RawValue Rain?,
@SerializedName("sys")
val sys: @RawValue Sys?,
@SerializedName("timezone")
val timezone: Int?, // 3600
@SerializedName("visibility")
val visibility: Int?, // 10000
@SerializedName("weather")
val weather: @RawValue List<Weather?>?,
@SerializedName("wind")
val wind: @RawValue Wind?,
) : Parcelable {
data class Clouds(
@SerializedName("all")
val all: Int?, // 100
)

data class Coord(
@SerializedName("lat")
val lat: Double?, // 44.34
@SerializedName("lon")
val lon: Double?, // 10.99
)

data class Main(
@SerializedName("feels_like")
val feelsLike: Double?, // 3.88
@SerializedName("grnd_level")
val grndLevel: Int?, // 915
@SerializedName("humidity")
val humidity: Int?, // 98
@SerializedName("pressure")
val pressure: Int?, // 1001
@SerializedName("sea_level")
val seaLevel: Int?, // 1001
@SerializedName("temp")
val temp: Double?, // 3.88
@SerializedName("temp_max")
val tempMax: Double?, // 10.73
@SerializedName("temp_min")
val tempMin: Double?, // 1.49
)

data class Rain(
@SerializedName("1h")
val h: Double?, // 2.05
)

data class Sys(
@SerializedName("country")
val country: String?, // IT
@SerializedName("id")
val id: Int?, // 2004688
@SerializedName("sunrise")
val sunrise: Int?, // 1702449795
@SerializedName("sunset")
val sunset: Int?, // 1702481819
@SerializedName("type")
val type: Int?, // 2
)

data class Weather(
@SerializedName("description")
val description: String?, // بارش باران
@SerializedName("icon")
val icon: String?, // 10d
@SerializedName("id")
val id: Int?, // 501
@SerializedName("main")
val main: String?, // Rain
)

data class Wind(
@SerializedName("deg")
val deg: Int?, // 214
@SerializedName("gust")
val gust: Double?, // 5.57
@SerializedName("speed")
val speed: Double?, // 1.18
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.mehdisekoba.weather.data.model

import com.google.gson.annotations.SerializedName

@Suppress("ktlint:standard:value-parameter-comment")
data class ResponseErrors(
@SerializedName("cod")
val cod: Int?, // 401
@SerializedName("message")
val message: String?, // Invalid API key. Please see https://openweathermap.org/faq#error401 for more info.
)
Loading

0 comments on commit 3d0e3df

Please sign in to comment.