diff --git a/.gitignore b/.gitignore
index e96e488..0ea4711 100644
--- a/.gitignore
+++ b/.gitignore
@@ -88,3 +88,11 @@ gen-external-apklibs
.idea/assetWizardSettings.xml
.idea/gradle.xml
.idea/jarRepositorie
+
+# Gem/fastlane
+/Gemfile.lock
+/fastlane/report.xml
+# Google play files
+/google-play-key.json
+
+/.idea/androidTestResultsUserPreferences.xml
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index db291c6..7643783 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -1,24 +1,13 @@
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..7a118b4
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,3 @@
+source "https://rubygems.org"
+
+gem "fastlane"
diff --git a/app/build.gradle b/app/build.gradle
index 9cf85aa..81833e1 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,9 +1,9 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
+ id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs'
- id 'kotlin-parcelize'
}
android {
lintOptions {
@@ -11,12 +11,12 @@ android {
}
compileSdkVersion 33
defaultConfig {
- applicationId "com.appttude.h_mal"
+ applicationId "com.appttude.h_mal.atlas_weather"
minSdkVersion 26
targetSdkVersion 33
versionCode 5
versionName "3.0"
- testInstrumentationRunner "com.appttude.h_mal.application.TestRunner"
+ testInstrumentationRunner "com.appttude.h_mal.atlas_weather.application.TestRunner"
vectorDrawables.useSupportLibrary = true
Properties properties = new Properties()
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/BaseTest.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/BaseTest.kt
new file mode 100644
index 0000000..89b4479
--- /dev/null
+++ b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/BaseTest.kt
@@ -0,0 +1,70 @@
+package com.appttude.h_mal.atlas_weather
+
+import android.Manifest
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import androidx.test.core.app.ActivityScenario
+import androidx.test.espresso.internal.inject.InstrumentationContext
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.rule.GrantPermissionRule
+import com.appttude.h_mal.atlas_weather.application.TestAppClass
+import com.appttude.h_mal.atlas_weather.helper.GenericsHelper.getGenericClassAt
+import com.appttude.h_mal.atlas_weather.helpers.SnapshotRule
+import com.appttude.h_mal.atlas_weather.utils.Stubs
+import kotlinx.coroutines.runBlocking
+import org.junit.After
+import org.junit.Before
+import org.junit.Rule
+import tools.fastlane.screengrab.Screengrab
+import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy
+
+open class BaseTest(
+ private val activity: Class,
+ private val intentBundle: Bundle? = null,
+) {
+
+ lateinit var scenario: ActivityScenario
+ private lateinit var testApp: TestAppClass
+
+ @get:Rule
+ var permissionRule = GrantPermissionRule.grant(Manifest.permission.ACCESS_COARSE_LOCATION)
+
+ @get:Rule
+ var snapshotRule: SnapshotRule = SnapshotRule()
+
+ @Before
+ fun setUp() {
+ Screengrab.setDefaultScreenshotStrategy(UiAutomatorScreenshotStrategy())
+ val startIntent = Intent(InstrumentationRegistry.getInstrumentation().targetContext, activity)
+ if (intentBundle != null) {
+ startIntent.replaceExtras(intentBundle)
+ }
+
+ scenario = ActivityScenario.launch(startIntent)
+ scenario.onActivity {
+ runBlocking {
+ testApp = it.application as TestAppClass
+ beforeLaunch()
+ }
+ }
+ afterLaunch()
+ }
+
+ fun stubEndpoint(url: String, stub: Stubs) {
+ testApp.stubUrl(url, stub.id)
+ }
+
+ fun unstubEndpoint(url: String) {
+ testApp.removeUrlStub(url)
+ }
+
+ @After
+ fun tearDown() {
+ testFinished()
+ }
+
+ open fun beforeLaunch() {}
+ open fun afterLaunch() {}
+ open fun testFinished() {}
+}
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/utils/BaseTestRobot.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/BaseTestRobot.kt
similarity index 90%
rename from app/src/androidTest/java/com/appttude/h_mal/atlas_weather/utils/BaseTestRobot.kt
rename to app/src/androidTest/java/com/appttude/h_mal/atlas_weather/BaseTestRobot.kt
index 9a0893f..349c768 100644
--- a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/utils/BaseTestRobot.kt
+++ b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/BaseTestRobot.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.utils
+package com.appttude.h_mal.atlas_weather
import android.content.res.Resources
import android.view.View
@@ -16,14 +16,9 @@ import androidx.test.espresso.action.ViewActions.swipeDown
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.PickerActions
import androidx.test.espresso.contrib.RecyclerViewActions
-import androidx.test.espresso.matcher.ViewMatchers
-import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
-import androidx.test.espresso.matcher.ViewMatchers.isRoot
-import androidx.test.espresso.matcher.ViewMatchers.withClassName
-import androidx.test.espresso.matcher.ViewMatchers.withId
-import androidx.test.espresso.matcher.ViewMatchers.withText
-import com.appttude.h_mal.atlas_weather.checkErrorMessage
-import com.appttude.h_mal.atlas_weather.checkImage
+import androidx.test.espresso.matcher.ViewMatchers.*
+import com.appttude.h_mal.atlas_weather.helpers.checkErrorMessage
+import com.appttude.h_mal.atlas_weather.helpers.checkImage
import com.appttude.h_mal.atlas_weather.helpers.EspressoHelper.waitForView
import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.anything
@@ -46,6 +41,8 @@ open class BaseTestRobot {
fun matchViewWaitFor(resId: Int): ViewInteraction = waitForView(withId(resId))
+ fun matchDisplayed(resId: Int): ViewInteraction = matchView(resId).check(matches(isDisplayed()))
+
fun matchText(viewInteraction: ViewInteraction, text: String): ViewInteraction = viewInteraction
.check(matches(withText(text)))
@@ -142,7 +139,7 @@ open class BaseTestRobot {
Resources.getSystem().getString(resId)
fun pullToRefresh(resId: Int){
- onView(allOf(withId(resId), ViewMatchers.isDisplayed())).perform(swipeDown())
+ onView(allOf(withId(resId), isDisplayed())).perform(swipeDown())
}
fun selectDateInPicker(year: Int, month: Int, day: Int) {
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/BaseUiTest.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/BaseUiTest.kt
deleted file mode 100644
index 91d7665..0000000
--- a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/BaseUiTest.kt
+++ /dev/null
@@ -1,141 +0,0 @@
-//package com.appttude.h_mal.atlas_weather
-//
-//import android.Manifest
-//import android.R
-//import android.app.Activity
-//import android.content.Context
-//import android.os.Build
-//import android.view.View
-//import android.view.WindowManager
-//import androidx.annotation.StringRes
-//import androidx.test.core.app.ActivityScenario
-//import androidx.test.espresso.*
-//import androidx.test.espresso.Espresso.onView
-//import androidx.test.espresso.assertion.ViewAssertions.matches
-//import androidx.test.espresso.matcher.ViewMatchers.*
-//import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
-//import androidx.test.rule.GrantPermissionRule
-//import com.appttude.h_mal.atlas_weather.atlasWeather.ui.BaseActivity
-////import h_mal.appttude.com.driver.base.BaseActivity
-//import com.appttude.h_mal.atlas_weather.helpers.BaseViewAction
-//import com.appttude.h_mal.atlas_weather.helpers.SnapshotRule
-//import org.hamcrest.CoreMatchers
-//import org.hamcrest.Description
-//import org.hamcrest.Matcher
-//import org.hamcrest.TypeSafeMatcher
-//import org.hamcrest.core.AllOf
-//import org.junit.After
-//import org.junit.Before
-//import org.junit.Rule
-//import tools.fastlane.screengrab.Screengrab
-//import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy
-//import tools.fastlane.screengrab.locale.LocaleTestRule
-//
-//
-//open class BaseUiTest(
-// private val activity: Class
-//) {
-//
-// private lateinit var mActivityScenarioRule: ActivityScenario
-// private var mIdlingResource: IdlingResource? = null
-//
-// private lateinit var currentActivity: Activity
-//
-// @get:Rule
-// var permissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE)
-//
-// @get:Rule
-// var snapshotRule: SnapshotRule = SnapshotRule()
-//
-// @Rule
-// @JvmField
-// var localeTestRule = LocaleTestRule()
-//
-// @Before
-// fun setup() {
-// Screengrab.setDefaultScreenshotStrategy(UiAutomatorScreenshotStrategy())
-// beforeLaunch()
-// mActivityScenarioRule = ActivityScenario.launch(activity)
-// mActivityScenarioRule.onActivity {
-//// mIdlingResource = it.getIdlingResource()!!
-//// IdlingRegistry.getInstance().register(mIdlingResource)
-// afterLaunch(it)
-// }
-// }
-//
-// @After
-// fun tearDown() {
-// mIdlingResource?.let {
-// IdlingRegistry.getInstance().unregister(it)
-// }
-// }
-//
-// fun getResourceString(@StringRes stringRes: Int): String {
-// return getInstrumentation().targetContext.resources.getString(
-// stringRes
-// )
-// }
-//
-// fun waitFor(delay: Long) {
-// onView(isRoot()).perform(object : ViewAction {
-// override fun getConstraints(): Matcher = isRoot()
-// override fun getDescription(): String = "wait for $delay milliseconds"
-// override fun perform(uiController: UiController, v: View?) {
-// uiController.loopMainThreadForAtLeast(delay)
-// }
-// })
-// }
-//
-// open fun beforeLaunch() {}
-// open fun afterLaunch(context: Context) {}
-//
-//
-// @Suppress("DEPRECATION")
-// fun checkToastMessage(message: String) {
-// onView(withText(message)).inRoot(object : TypeSafeMatcher() {
-// override fun describeTo(description: Description?) {
-// description?.appendText("is toast")
-// }
-//
-// override fun matchesSafely(root: Root): Boolean {
-// root.run {
-// if (windowLayoutParams.get().type == WindowManager.LayoutParams.TYPE_TOAST) {
-// decorView.run {
-// if (windowToken === applicationWindowToken) {
-// // windowToken == appToken means this window isn't contained by any other windows.
-// // if it was a window for an activity, it would have TYPE_BASE_APPLICATION.
-// return true
-// }
-// }
-// }
-// }
-// return false
-// }
-// }
-// ).check(matches(isDisplayed()))
-// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
-// waitFor(3500)
-// }
-// }
-//
-// fun checkSnackBarDisplayedByMessage(message: String) {
-// onView(
-// CoreMatchers.allOf(
-// withId(com.google.android.material.R.id.snackbar_text),
-// withText(message)
-// )
-// ).check(matches(isDisplayed()))
-// }
-//
-// private fun getCurrentActivity(): Activity {
-// onView(AllOf.allOf(withId(R.id.content), isDisplayed()))
-// .perform(object : BaseViewAction() {
-// override fun setPerform(uiController: UiController?, view: View?) {
-// if (view?.context is Activity) {
-// currentActivity = view.context as Activity
-// }
-// }
-// })
-// return currentActivity
-// }
-//}
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/data/location/LocationProviderImplTest.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/data/location/LocationProviderImplTest.kt
index 1f257e6..981abb1 100644
--- a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/data/location/LocationProviderImplTest.kt
+++ b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/data/location/LocationProviderImplTest.kt
@@ -4,6 +4,7 @@ package com.appttude.h_mal.atlas_weather.data.location
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
+import com.appttude.h_mal.atlas_weather.data.location.LocationProviderImpl
import com.appttude.h_mal.atlas_weather.model.types.LocationType
import kotlinx.coroutines.runBlocking
import org.hamcrest.Matcher.*
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/data/location/MockLocationProvider.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/data/location/MockLocationProvider.kt
index 8f36fe7..fb27741 100644
--- a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/data/location/MockLocationProvider.kt
+++ b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/data/location/MockLocationProvider.kt
@@ -1,5 +1,6 @@
package com.appttude.h_mal.atlas_weather.data.location
+import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
import com.appttude.h_mal.atlas_weather.model.types.LocationType
class MockLocationProvider : LocationProvider {
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/helpers/Constants.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/helpers/Constants.kt
deleted file mode 100644
index 1469ff0..0000000
--- a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/helpers/Constants.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.appttude.h_mal.atlas_weather.helpers
-
-import android.os.Environment
-import java.io.File
-
-/**
- * File paths for images on device
- */
-fun getImagePath(imageConst: String): String {
- return File(
- Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM),
- "/Camera/images/$imageConst"
- ).absolutePath
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/CustomViewMatchers.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/helpers/CustomViewMatchers.kt
similarity index 96%
rename from app/src/androidTest/java/com/appttude/h_mal/atlas_weather/CustomViewMatchers.kt
rename to app/src/androidTest/java/com/appttude/h_mal/atlas_weather/helpers/CustomViewMatchers.kt
index a0abde6..1cf3a8e 100644
--- a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/CustomViewMatchers.kt
+++ b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/helpers/CustomViewMatchers.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather
+package com.appttude.h_mal.atlas_weather.helpers
import android.graphics.drawable.BitmapDrawable
import android.view.View
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/helpers/DataHelper.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/helpers/DataHelper.kt
deleted file mode 100644
index 6b0bb0b..0000000
--- a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/helpers/DataHelper.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.appttude.h_mal.atlas_weather.helpers
-
-import android.content.ClipData
-import android.content.ClipData.Item
-import android.net.Uri
-import java.io.File
-
-object DataHelper {
-
- fun createClipItem(filePath: String) = Item(
- Uri.fromFile(
- File(filePath)
- )
- )
-
- fun createClipData(item: Item, mimeType: String = "text/uri-list") =
- ClipData(null, arrayOf(mimeType), item)
-
- fun createClipData(filePath: String) = createClipData(createClipItem(filePath))
-
- fun createClipData(filePaths: Array): ClipData {
- val clipData = createClipData(filePaths[0])
- val remainingFiles = filePaths.copyOfRange(1, filePaths.size - 1)
- clipData.addFilePaths(remainingFiles)
- return clipData
- }
-
- fun createClipData(uri: Uri) = createClipData(Item(uri))
-
- fun ClipData.addFilePaths(filePaths: Array) {
- filePaths.forEach { addItem(createClipItem(it)) }
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/monoWeather/testsuite/BaseTest.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/monoWeather/testsuite/BaseTest.kt
deleted file mode 100644
index c87b4a0..0000000
--- a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/monoWeather/testsuite/BaseTest.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.appttude.h_mal.atlas_weather.testsuite
-
-import android.Manifest
-import android.app.Activity
-import androidx.test.espresso.Espresso.onView
-import androidx.test.espresso.action.ViewActions
-import androidx.test.espresso.assertion.ViewAssertions.matches
-import androidx.test.espresso.matcher.RootMatchers.isDialog
-import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
-import androidx.test.espresso.matcher.ViewMatchers.withText
-import androidx.test.platform.app.InstrumentationRegistry
-import androidx.test.rule.ActivityTestRule
-import androidx.test.rule.GrantPermissionRule
-import com.appttude.h_mal.atlas_weather.application.TestAppClass
-import com.appttude.h_mal.atlas_weather.helper.GenericsHelper.getGenericClassAt
-import com.appttude.h_mal.atlas_weather.helpers.SnapshotRule
-import com.appttude.h_mal.atlas_weather.utils.Stubs
-import org.junit.After
-import org.junit.Rule
-import tools.fastlane.screengrab.Screengrab
-import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy
-
-open class BaseTest {
-
- lateinit var testApp: TestAppClass
-
- @get:Rule
- var permissionRule = GrantPermissionRule.grant(Manifest.permission.ACCESS_COARSE_LOCATION)
-
- @get:Rule
- var snapshotRule: SnapshotRule = SnapshotRule()
-
- @Rule
- @JvmField
- var mActivityTestRule: ActivityTestRule =
- object : ActivityTestRule(getGenericClassAt(0).java) {
- override fun beforeActivityLaunched() {
- super.beforeActivityLaunched()
- Screengrab.setDefaultScreenshotStrategy(UiAutomatorScreenshotStrategy())
-
- testApp =
- InstrumentationRegistry.getInstrumentation().targetContext.applicationContext as TestAppClass
- setupFeed()
- }
-
- override fun afterActivityLaunched() {
-
- // Dismiss dialog
- onView(withText("AGREE")).inRoot(isDialog()).check(matches(isDisplayed()))
- .perform(ViewActions.click())
- }
- }
-
- fun stubEndpoint(url: String, stub: Stubs) {
- testApp.stubUrl(url, stub.id)
- }
-
- fun unstubEndpoint(url: String) {
- testApp.removeUrlStub(url)
- }
-
- @After
- fun tearDown() {
- }
-
- open fun setupFeed() {}
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/monoWeather/testsuite/HomePageUITestScenario.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/monoWeather/testsuite/HomePageUITestScenario.kt
deleted file mode 100644
index 464e8ea..0000000
--- a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/monoWeather/testsuite/HomePageUITestScenario.kt
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.appttude.h_mal.atlas_weather.testsuite
-
-
-import android.Manifest
-import androidx.test.core.app.ActivityScenario
-import androidx.test.core.app.ActivityScenario.launch
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.action.ViewActions
-import androidx.test.espresso.assertion.ViewAssertions
-import androidx.test.espresso.matcher.RootMatchers
-import androidx.test.espresso.matcher.ViewMatchers
-import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
-import androidx.test.rule.GrantPermissionRule
-import com.appttude.h_mal.atlas_weather.application.TestAppClass
-import com.appttude.h_mal.atlas_weather.robot.homeScreen
-import com.appttude.h_mal.atlas_weather.ui.MainActivity
-import com.appttude.h_mal.atlas_weather.utils.Stubs
-import kotlinx.coroutines.runBlocking
-import org.junit.After
-import org.junit.Before
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-
-@RunWith(AndroidJUnit4ClassRunner::class)
-class HomePageUITestScenario : BaseMainScenario() {
-
- override fun setupFeed() {
- stubEndpoint("https://api.openweathermap.org/data/2.5/onecall", Stubs.Valid)
- }
-
- @Test
- fun loadApp_validWeatherResponse_returnsValidPage() {
- homeScreen {
- verifyCurrentTemperature(2)
- verifyCurrentLocation("Mock Location")
- }
- }
-}
-
-open class BaseMainScenario {
-
- lateinit var scenario: ActivityScenario
- private lateinit var testApp: TestAppClass
-
- @get:Rule
- var permissionRule = GrantPermissionRule.grant(Manifest.permission.ACCESS_COARSE_LOCATION)
-
- @Before
- fun setUp() {
- scenario = launch(MainActivity::class.java)
- scenario.onActivity {
- runBlocking {
- testApp = it.application as TestAppClass
- setupFeed()
- }
- }
-
- // Dismiss dialog on start up
- Espresso.onView(ViewMatchers.withText("AGREE"))
- .inRoot(RootMatchers.isDialog())
- .check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
- .perform(ViewActions.click())
- }
-
- fun stubEndpoint(url: String, stub: Stubs) {
- testApp.stubUrl(url, stub.id)
- }
-
- fun unstubEndpoint(url: String) {
- testApp.removeUrlStub(url)
- }
-
- @After
- fun tearDown() {
- testFinished()
- }
-
- open fun setupFeed() {}
- open fun testFinished() {}
-}
diff --git a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/monoWeather/ui/widget/WidgetLocationPermissionActivityTest.kt b/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/monoWeather/ui/widget/WidgetLocationPermissionActivityTest.kt
deleted file mode 100644
index 1305aeb..0000000
--- a/app/src/androidTest/java/com/appttude/h_mal/atlas_weather/monoWeather/ui/widget/WidgetLocationPermissionActivityTest.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.appttude.h_mal.atlas_weather.ui.widget
-
-import android.appwidget.AppWidgetManager
-import android.content.Intent
-import androidx.test.espresso.Espresso
-import androidx.test.espresso.assertion.ViewAssertions.matches
-import androidx.test.espresso.matcher.ViewMatchers
-import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
-import androidx.test.rule.ActivityTestRule
-import com.appttude.h_mal.atlas_weather.R
-import org.junit.Rule
-import org.junit.Test
-
-
-class WidgetLocationPermissionActivityTest {
- @Rule
- @JvmField
- var mActivityTestRule : ActivityTestRule =
- ActivityTestRule(WidgetLocationPermissionActivity::class.java, false, false)
-
- @Test
- fun demo_test() {
- val startIntent = Intent().apply {
- putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 112)
- }
- mActivityTestRule.launchActivity(startIntent)
-
- Espresso.onView((ViewMatchers.withId(R.id.declaration_text))).check(matches(isDisplayed()));
- }
-}
\ No newline at end of file
diff --git a/app/src/androidTestAtlasWeather/java/com/appttude/h_mal/atlas_weather/robot/HomeScreenRobot.kt b/app/src/androidTestAtlasWeather/java/com/appttude/h_mal/atlas_weather/robot/HomeScreenRobot.kt
index d956a52..47bd16b 100644
--- a/app/src/androidTestAtlasWeather/java/com/appttude/h_mal/atlas_weather/robot/HomeScreenRobot.kt
+++ b/app/src/androidTestAtlasWeather/java/com/appttude/h_mal/atlas_weather/robot/HomeScreenRobot.kt
@@ -1,7 +1,7 @@
package com.appttude.h_mal.atlas_weather.robot
+import com.appttude.h_mal.atlas_weather.BaseTestRobot
import com.appttude.h_mal.atlas_weather.R
-import com.appttude.h_mal.atlas_weather.utils.BaseTestRobot
fun homeScreen(func: HomeScreenRobot.() -> Unit) = HomeScreenRobot().apply { func() }
class HomeScreenRobot : BaseTestRobot() {
diff --git a/app/src/androidTestAtlasWeather/java/com/appttude/h_mal/atlas_weather/tests/HomePageUITest.kt b/app/src/androidTestAtlasWeather/java/com/appttude/h_mal/atlas_weather/tests/HomePageUITest.kt
index 5ac8d66..5b346b3 100644
--- a/app/src/androidTestAtlasWeather/java/com/appttude/h_mal/atlas_weather/tests/HomePageUITest.kt
+++ b/app/src/androidTestAtlasWeather/java/com/appttude/h_mal/atlas_weather/tests/HomePageUITest.kt
@@ -1,23 +1,15 @@
package com.appttude.h_mal.atlas_weather.tests
-import androidx.test.rule.GrantPermissionRule
-import com.appttude.h_mal.atlas_weather.atlasWeather.ui.MainActivity
+import com.appttude.h_mal.atlas_weather.BaseTest
import com.appttude.h_mal.atlas_weather.robot.homeScreen
-import com.appttude.h_mal.atlas_weather.testsuite.BaseTest
+import com.appttude.h_mal.atlas_weather.ui.MainActivity
import com.appttude.h_mal.atlas_weather.utils.Stubs
-import org.junit.Rule
import org.junit.Test
-class HomePageUITest : BaseTest() {
+class HomePageUITest : BaseTest(activity = MainActivity::class.java) {
- @Rule
- @JvmField
- var mGrantPermissionRule: GrantPermissionRule =
- GrantPermissionRule.grant(
- "android.permission.ACCESS_COARSE_LOCATION")
-
- override fun setupFeed() {
+ override fun beforeLaunch() {
stubEndpoint("https://api.openweathermap.org/data/2.5/onecall", Stubs.Valid)
}
diff --git a/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/MonoBaseTest.kt b/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/MonoBaseTest.kt
new file mode 100644
index 0000000..301b780
--- /dev/null
+++ b/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/MonoBaseTest.kt
@@ -0,0 +1,20 @@
+package com.appttude.h_mal.monoWeather
+
+import androidx.test.espresso.Espresso
+import androidx.test.espresso.action.ViewActions
+import androidx.test.espresso.assertion.ViewAssertions
+import androidx.test.espresso.matcher.RootMatchers
+import androidx.test.espresso.matcher.ViewMatchers
+import com.appttude.h_mal.atlas_weather.BaseTest
+import com.appttude.h_mal.atlas_weather.ui.MainActivity
+
+open class MonoBaseTest: BaseTest(MainActivity::class.java) {
+
+ override fun afterLaunch() {
+ // Dismiss dialog on start up
+ Espresso.onView(ViewMatchers.withText("AGREE"))
+ .inRoot(RootMatchers.isDialog())
+ .check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
+ .perform(ViewActions.click())
+ }
+}
\ No newline at end of file
diff --git a/app/src/androidTestMonoWeather/java/com/appttude/h_mal/atlas_weather/robot/HomeScreenRobot.kt b/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/robot/HomeScreenRobot.kt
similarity index 79%
rename from app/src/androidTestMonoWeather/java/com/appttude/h_mal/atlas_weather/robot/HomeScreenRobot.kt
rename to app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/robot/HomeScreenRobot.kt
index d956a52..76afa28 100644
--- a/app/src/androidTestMonoWeather/java/com/appttude/h_mal/atlas_weather/robot/HomeScreenRobot.kt
+++ b/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/robot/HomeScreenRobot.kt
@@ -1,7 +1,7 @@
-package com.appttude.h_mal.atlas_weather.robot
+package com.appttude.h_mal.monoWeather.robot
import com.appttude.h_mal.atlas_weather.R
-import com.appttude.h_mal.atlas_weather.utils.BaseTestRobot
+import com.appttude.h_mal.atlas_weather.BaseTestRobot
fun homeScreen(func: HomeScreenRobot.() -> Unit) = HomeScreenRobot().apply { func() }
class HomeScreenRobot : BaseTestRobot() {
diff --git a/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/robot/WidgetPermissionScreenRobot.kt b/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/robot/WidgetPermissionScreenRobot.kt
new file mode 100644
index 0000000..01790cb
--- /dev/null
+++ b/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/robot/WidgetPermissionScreenRobot.kt
@@ -0,0 +1,11 @@
+package com.appttude.h_mal.monoWeather.robot
+
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.BaseTestRobot
+
+fun widgetPermissionScreen(func: WidgetPermissionScreenRobot.() -> Unit) =
+ WidgetPermissionScreenRobot().apply { func() }
+
+class WidgetPermissionScreenRobot : BaseTestRobot() {
+ fun declarationDisplayed() = matchDisplayed(R.id.declaration_text)
+}
\ No newline at end of file
diff --git a/app/src/androidTestMonoWeather/java/com/appttude/h_mal/atlas_weather/tests/HomePageUITest.kt b/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/tests/HomePageUITest.kt
similarity index 55%
rename from app/src/androidTestMonoWeather/java/com/appttude/h_mal/atlas_weather/tests/HomePageUITest.kt
rename to app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/tests/HomePageUITest.kt
index e128499..5a1dc63 100644
--- a/app/src/androidTestMonoWeather/java/com/appttude/h_mal/atlas_weather/tests/HomePageUITest.kt
+++ b/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/tests/HomePageUITest.kt
@@ -1,15 +1,14 @@
-package com.appttude.h_mal.atlas_weather.tests
+package com.appttude.h_mal.monoWeather.tests
-import com.appttude.h_mal.atlas_weather.robot.homeScreen
-import com.appttude.h_mal.atlas_weather.testsuite.BaseTest
-import com.appttude.h_mal.atlas_weather.ui.MainActivity
+import com.appttude.h_mal.monoWeather.robot.homeScreen
import com.appttude.h_mal.atlas_weather.utils.Stubs
+import com.appttude.h_mal.monoWeather.MonoBaseTest
import org.junit.Test
-class HomePageUITest : BaseTest() {
+class HomePageUITest : MonoBaseTest() {
- override fun setupFeed() {
+ override fun beforeLaunch() {
stubEndpoint("https://api.openweathermap.org/data/2.5/onecall", Stubs.Valid)
}
diff --git a/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/tests/WidgetLocationPermissionActivityTest.kt b/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/tests/WidgetLocationPermissionActivityTest.kt
new file mode 100644
index 0000000..419e03d
--- /dev/null
+++ b/app/src/androidTestMonoWeather/java/com/appttude/h_mal/monoWeather/tests/WidgetLocationPermissionActivityTest.kt
@@ -0,0 +1,26 @@
+package com.appttude.h_mal.monoWeather.tests
+
+import android.appwidget.AppWidgetManager
+import android.content.Intent
+import android.os.Bundle
+import androidx.test.rule.ActivityTestRule
+import com.appttude.h_mal.atlas_weather.BaseTest
+import com.appttude.h_mal.monoWeather.robot.widgetPermissionScreen
+import com.appttude.h_mal.monoWeather.ui.widget.WidgetLocationPermissionActivity
+import org.junit.Test
+
+
+class WidgetLocationPermissionActivityTest : BaseTest(
+ activity = WidgetLocationPermissionActivity::class.java,
+ intentBundle = Bundle().apply {
+ putInt(AppWidgetManager.EXTRA_APPWIDGET_ID, 112)
+ }
+) {
+
+ @Test
+ fun demo_test() {
+ widgetPermissionScreen {
+ declarationDisplayed()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/atlasWeather/AndroidManifest.xml b/app/src/atlasWeather/AndroidManifest.xml
index b6866d8..bc115db 100644
--- a/app/src/atlasWeather/AndroidManifest.xml
+++ b/app/src/atlasWeather/AndroidManifest.xml
@@ -5,7 +5,7 @@
tools:node="merge">
-
-
-
-
@@ -49,11 +43,6 @@
android:name="android.appwidget.provider"
android:resource="@xml/new_app_widget_info" />
-
-
-
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/notification/NotificationData.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/notification/NotificationData.kt
index 89525fd..f7dedd9 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/notification/NotificationData.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/notification/NotificationData.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.notification
+package com.appttude.h_mal.atlas_weather.notification
import android.graphics.Bitmap
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/notification/NotificationReceiver.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/notification/NotificationReceiver.kt
index 8db5f0f..38d3efc 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/notification/NotificationReceiver.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/notification/NotificationReceiver.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.notification
+package com.appttude.h_mal.atlas_weather.notification
import android.Manifest
import android.app.Notification
@@ -12,13 +12,10 @@ import android.content.pm.PackageManager
import android.os.Build
import androidx.core.app.ActivityCompat
import com.appttude.h_mal.atlas_weather.R
-import com.appttude.h_mal.atlas_weather.atlasWeather.ui.MainActivity
+import com.appttude.h_mal.atlas_weather.ui.MainActivity
import com.appttude.h_mal.atlas_weather.helper.ServicesHelper
import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
import com.appttude.h_mal.atlas_weather.utils.displayToast
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.launch
import org.kodein.di.KodeinAware
import org.kodein.di.LateInitKodein
import org.kodein.di.generic.instance
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/BaseActivity.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/BaseActivity.kt
index c8b3a5a..79778f4 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/BaseActivity.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/BaseActivity.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui
+package com.appttude.h_mal.atlas_weather.ui
import androidx.appcompat.app.AppCompatActivity
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/BaseFragment.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/BaseFragment.kt
index 5e091cf..a748605 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/BaseFragment.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/BaseFragment.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui
+package com.appttude.h_mal.atlas_weather.ui
import android.annotation.SuppressLint
import android.content.pm.PackageManager
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/Tabs.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/Tabs.kt
new file mode 100644
index 0000000..9f13728
--- /dev/null
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/Tabs.kt
@@ -0,0 +1,5 @@
+package com.appttude.h_mal.atlas_weather.ui
+
+import com.appttude.h_mal.atlas_weather.R
+
+val tabs = setOf(R.id.nav_home, R.id.nav_world)
\ No newline at end of file
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/WorldItemFragment.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/WorldItemFragment.kt
index 3650cac..6732b97 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/WorldItemFragment.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/WorldItemFragment.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui
+package com.appttude.h_mal.atlas_weather.ui
import android.os.Bundle
import android.view.LayoutInflater
@@ -8,7 +8,7 @@ import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
-import com.appttude.h_mal.atlas_weather.atlasWeather.ui.home.adapter.WeatherRecyclerAdapter
+import com.appttude.h_mal.atlas_weather.ui.home.adapter.WeatherRecyclerAdapter
import com.appttude.h_mal.atlas_weather.utils.navigateTo
import kotlinx.android.synthetic.main.fragment_home.*
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/details/FurtherInfoFragment.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/details/FurtherInfoFragment.kt
index d0288fc..21f7853 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/details/FurtherInfoFragment.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/details/FurtherInfoFragment.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.details
+package com.appttude.h_mal.atlas_weather.ui.details
import android.os.Bundle
import android.view.LayoutInflater
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/HomeFragment.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/HomeFragment.kt
index ec3f633..8dbce4c 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/HomeFragment.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/HomeFragment.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.home
+package com.appttude.h_mal.atlas_weather.ui.home
import android.Manifest
import android.annotation.SuppressLint
@@ -13,8 +13,8 @@ import androidx.lifecycle.observe
import androidx.recyclerview.widget.LinearLayoutManager
import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.atlas_weather.application.LOCATION_PERMISSION_REQUEST
-import com.appttude.h_mal.atlas_weather.atlasWeather.ui.BaseFragment
-import com.appttude.h_mal.atlas_weather.atlasWeather.ui.home.adapter.WeatherRecyclerAdapter
+import com.appttude.h_mal.atlas_weather.ui.BaseFragment
+import com.appttude.h_mal.atlas_weather.ui.home.adapter.WeatherRecyclerAdapter
import com.appttude.h_mal.atlas_weather.utils.displayToast
import com.appttude.h_mal.atlas_weather.utils.navigateTo
import com.appttude.h_mal.atlas_weather.viewmodel.ApplicationViewModelFactory
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/EmptyViewHolder.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/EmptyViewHolder.kt
index d0bdd52..e342b63 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/EmptyViewHolder.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/EmptyViewHolder.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.home.adapter
+package com.appttude.h_mal.atlas_weather.ui.home.adapter
import android.view.View
import androidx.recyclerview.widget.RecyclerView
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderCurrent.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderCurrent.kt
index eadc3e8..26d5ad6 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderCurrent.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderCurrent.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.home.adapter
+package com.appttude.h_mal.atlas_weather.ui.home.adapter
import android.view.View
import android.widget.ImageView
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderForecast.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderForecast.kt
index a5a5674..a95efd7 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderForecast.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderForecast.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.home.adapter
+package com.appttude.h_mal.atlas_weather.ui.home.adapter
import android.view.View
import android.widget.ImageView
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderFurtherDetails.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderFurtherDetails.kt
index d5fa7ef..c752019 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderFurtherDetails.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/ViewHolderFurtherDetails.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.home.adapter
+package com.appttude.h_mal.atlas_weather.ui.home.adapter
import android.view.View
import android.widget.TextView
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/WeatherRecyclerAdapter.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/WeatherRecyclerAdapter.kt
index 4d777e9..58dbd43 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/WeatherRecyclerAdapter.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/home/adapter/WeatherRecyclerAdapter.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.home.adapter
+package com.appttude.h_mal.atlas_weather.ui.home.adapter
import android.annotation.SuppressLint
import android.view.View
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/settings/SettingsFragment.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/settings/SettingsFragment.kt
new file mode 100644
index 0000000..e2816e6
--- /dev/null
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/settings/SettingsFragment.kt
@@ -0,0 +1,61 @@
+package com.appttude.h_mal.atlas_weather.ui.settings
+
+import android.app.AlarmManager
+import android.app.PendingIntent
+import android.appwidget.AppWidgetManager
+import android.content.ComponentName
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import androidx.preference.PreferenceFragmentCompat
+import androidx.preference.PreferenceManager
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.notification.NotificationReceiver
+import com.appttude.h_mal.atlas_weather.widget.NewAppWidget
+import java.util.Calendar
+
+class SettingsFragment : PreferenceFragmentCompat() {
+
+ override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
+ setPreferencesFromResource(R.xml.prefs, rootKey)
+
+ //listener on changed sort order preference:
+ val prefs = PreferenceManager.getDefaultSharedPreferences(requireContext())
+ prefs.registerOnSharedPreferenceChangeListener { _, key ->
+ if (key == "temp_units") {
+ val intent = Intent(requireContext(), NewAppWidget::class.java)
+ intent.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
+ val ids = AppWidgetManager.getInstance(requireContext())
+ .getAppWidgetIds(ComponentName(requireContext(), NewAppWidget::class.java))
+ intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
+ requireContext().sendBroadcast(intent)
+ }
+ if (key == "notif_boolean") {
+ setupNotificationBroadcaster(requireContext())
+ }
+
+ if (key == "widget_black_background"){
+ val intent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE)
+ val widgetManager = AppWidgetManager.getInstance(requireContext())
+ val ids =
+ widgetManager.getAppWidgetIds(ComponentName(requireContext(), NewAppWidget::class.java))
+ AppWidgetManager.getInstance(requireContext())
+ .notifyAppWidgetViewDataChanged(ids, R.id.whole_widget_view)
+ intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
+ requireContext().sendBroadcast(intent)
+ }
+ }
+ }
+
+ fun setupNotificationBroadcaster(context: Context) {
+ val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
+ val notificationIntent = Intent(context, NotificationReceiver::class.java)
+ val broadcast = PendingIntent.getBroadcast(context, 100, notificationIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT)
+ val cal: Calendar = Calendar.getInstance()
+ cal.set(Calendar.HOUR_OF_DAY, 6)
+ cal.set(Calendar.MINUTE, 8)
+ cal.set(Calendar.SECOND, 5)
+ alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, cal.timeInMillis, AlarmManager.INTERVAL_DAY, broadcast)
+ }
+}
\ No newline at end of file
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/settings/UnitSettingsActivity.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/settings/UnitSettingsActivity.kt
deleted file mode 100644
index b95ee82..0000000
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/settings/UnitSettingsActivity.kt
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.settings
-
-import android.app.AlarmManager
-import android.app.PendingIntent
-import android.appwidget.AppWidgetManager
-import android.content.ComponentName
-import android.content.Context
-import android.content.Intent
-import android.content.SharedPreferences.OnSharedPreferenceChangeListener
-import android.os.Bundle
-import android.preference.PreferenceActivity
-import android.preference.PreferenceFragment
-import androidx.preference.PreferenceManager
-import com.appttude.h_mal.atlas_weather.R
-import com.appttude.h_mal.atlas_weather.atlasWeather.notification.NotificationReceiver
-import com.appttude.h_mal.atlas_weather.atlasWeather.widget.NewAppWidget
-import java.util.*
-
-
-class UnitSettingsActivity : PreferenceActivity() {
- private var prefListener: OnSharedPreferenceChangeListener? = null
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- PreferenceManager.setDefaultValues(this, R.xml.prefs, false)
- fragmentManager.beginTransaction().replace(android.R.id.content, MyPreferenceFragment()).commit()
-
- //listener on changed sort order preference:
- val prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext)
- prefListener = OnSharedPreferenceChangeListener { _, key ->
- if (key == "temp_units") {
- val intent = Intent(baseContext, NewAppWidget::class.java)
- intent.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
- val ids = AppWidgetManager.getInstance(application).getAppWidgetIds(ComponentName(application, NewAppWidget::class.java))
- intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
- sendBroadcast(intent)
- }
- if (key == "notif_boolean") {
- setupNotificationBroadcaster(baseContext)
- }
-
- if (key == "widget_black_background"){
- val intent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE)
- val widgetManager = AppWidgetManager.getInstance(this)
- val ids = widgetManager.getAppWidgetIds(ComponentName(this, NewAppWidget::class.java))
- AppWidgetManager.getInstance(this).notifyAppWidgetViewDataChanged(ids, R.id.whole_widget_view)
- intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
- sendBroadcast(intent)
- }
- }
- prefs.registerOnSharedPreferenceChangeListener(prefListener)
- }
-
- fun setupNotificationBroadcaster(context: Context) {
- val alarmManager = context.getSystemService(Context.ALARM_SERVICE) as AlarmManager
- val notificationIntent = Intent(context, NotificationReceiver::class.java)
- val broadcast = PendingIntent.getBroadcast(context, 100, notificationIntent,
- PendingIntent.FLAG_UPDATE_CURRENT)
- val cal: Calendar = Calendar.getInstance()
- cal.set(Calendar.HOUR_OF_DAY, 6)
- cal.set(Calendar.MINUTE, 8)
- cal.set(Calendar.SECOND, 5)
- alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, cal.timeInMillis, AlarmManager.INTERVAL_DAY, broadcast)
- }
-
- override fun onBackPressed() {
- super.onBackPressed()
- }
-
- // @Override
- // public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
- // Log.i(TAG, "onSharedPreferenceChanged: " + s);
- // if (s == "temp_units"){
- // Intent intent = new Intent(getBaseContext(), NewAppWidget.class);
- // intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
- //
- // int[] ids = AppWidgetManager.getInstance(getApplication()).getAppWidgetIds(new ComponentName(getApplication(), NewAppWidget.class));
- // intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids);
- // sendBroadcast(intent);
- // }
- // }
- class MyPreferenceFragment : PreferenceFragment() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- addPreferencesFromResource(R.xml.prefs)
- }
- }
-}
-
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/AddLocationFragment.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/AddLocationFragment.kt
index 0ac4234..fab3591 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/AddLocationFragment.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/AddLocationFragment.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.world
+package com.appttude.h_mal.atlas_weather.ui.world
import android.os.Bundle
import android.view.LayoutInflater
@@ -7,7 +7,7 @@ import android.view.ViewGroup
import androidx.fragment.app.viewModels
import androidx.lifecycle.observe
import com.appttude.h_mal.atlas_weather.R
-import com.appttude.h_mal.atlas_weather.atlasWeather.ui.BaseFragment
+import com.appttude.h_mal.atlas_weather.ui.BaseFragment
import com.appttude.h_mal.atlas_weather.utils.displayToast
import com.appttude.h_mal.atlas_weather.utils.goBack
import com.appttude.h_mal.atlas_weather.viewmodel.ApplicationViewModelFactory
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/WorldFragment.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/WorldFragment.kt
index 4bef5b4..4171cfa 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/WorldFragment.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/WorldFragment.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.world
+package com.appttude.h_mal.atlas_weather.ui.world
import android.os.Bundle
import android.view.LayoutInflater
@@ -9,9 +9,9 @@ import androidx.fragment.app.viewModels
import androidx.lifecycle.observe
import androidx.recyclerview.widget.LinearLayoutManager
import com.appttude.h_mal.atlas_weather.R
-import com.appttude.h_mal.atlas_weather.atlasWeather.ui.world.WorldRecyclerAdapter
-import com.appttude.h_mal.atlas_weather.atlasWeather.ui.BaseFragment
-import com.appttude.h_mal.atlas_weather.atlasWeather.ui.world.WorldFragmentDirections
+import com.appttude.h_mal.atlas_weather.ui.world.WorldRecyclerAdapter
+import com.appttude.h_mal.atlas_weather.ui.BaseFragment
+import com.appttude.h_mal.atlas_weather.ui.world.WorldFragmentDirections
import com.appttude.h_mal.atlas_weather.utils.navigateTo
import com.appttude.h_mal.atlas_weather.viewmodel.ApplicationViewModelFactory
import com.appttude.h_mal.atlas_weather.viewmodel.WorldViewModel
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/WorldRecyclerAdapter.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/WorldRecyclerAdapter.kt
index 6a0dd44..9f83bab 100644
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/WorldRecyclerAdapter.kt
+++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/ui/world/WorldRecyclerAdapter.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.ui.world
+package com.appttude.h_mal.atlas_weather.ui.world
import android.view.View
import android.view.ViewGroup
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/BaseWidgetClass.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/BaseWidgetClass.kt
deleted file mode 100644
index 980042c..0000000
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/BaseWidgetClass.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.widget
-
-import android.app.Activity
-import android.app.PendingIntent
-import android.app.TaskStackBuilder
-import android.appwidget.AppWidgetManager
-import android.appwidget.AppWidgetProvider
-import android.content.Context
-import android.content.Intent
-import android.widget.RemoteViews
-import androidx.annotation.LayoutRes
-
-abstract class BaseWidgetClass : AppWidgetProvider(){
-
- fun createRemoteView(context: Context, @LayoutRes id: Int): RemoteViews {
- return RemoteViews(context.packageName, id)
- }
-
- fun AppWidgetProvider.createUpdatePendingIntent(context: Context, appWidgetId: Int): PendingIntent? {
- val seconds = (System.currentTimeMillis() / 1000L).toInt()
- val intentUpdate = Intent(context, this::class.java)
- intentUpdate.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
- val idArray = intArrayOf(appWidgetId)
- intentUpdate.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, idArray)
-
- return PendingIntent.getBroadcast(
- context, seconds, intentUpdate,
- PendingIntent.FLAG_UPDATE_CURRENT)
- }
-
- fun createClickingPendingIntent(context: Context, activityClass: Class): PendingIntent {
- val clickIntentTemplate = Intent(context, activityClass)
-
- return TaskStackBuilder.create(context)
- .addNextIntentWithParentStack(clickIntentTemplate)
- .getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
- }
-}
\ No newline at end of file
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/MyWidgetRemoteViewsFactory.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/MyWidgetRemoteViewsFactory.kt
deleted file mode 100644
index a53ae26..0000000
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/MyWidgetRemoteViewsFactory.kt
+++ /dev/null
@@ -1,77 +0,0 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.widget
-
-import android.appwidget.AppWidgetManager
-import android.content.Context
-import android.content.Intent
-import android.widget.RemoteViews
-import android.widget.RemoteViewsService.RemoteViewsFactory
-import com.appttude.h_mal.atlas_weather.R
-import com.appttude.h_mal.atlas_weather.helper.ServicesHelper
-import com.appttude.h_mal.atlas_weather.model.widget.InnerWidgetData
-import kotlinx.coroutines.runBlocking
-import org.kodein.di.KodeinAware
-import org.kodein.di.LateInitKodein
-import org.kodein.di.generic.instance
-
-
-class MyWidgetRemoteViewsFactory(
- private val context: Context,
- val intent: Intent
-) : RemoteViewsFactory{
- private val TAG = "MyWidgetRemoteViewsFactory"
-
- private val kodein = LateInitKodein()
- private val helper : ServicesHelper by kodein.instance()
-
- private var appWidgetId: Int? = 0
- private var list: List? = null
-
- init {
- appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
- AppWidgetManager.INVALID_APPWIDGET_ID)
- kodein.baseKodein = (context.applicationContext as KodeinAware).kodein
-
- }
-
- override fun onCreate() {}
- override fun onDataSetChanged() {
- runBlocking {
- list = helper.getWidgetInnerWeather()
- }
- }
- override fun onDestroy() {}
-
- override fun getCount(): Int = list?.size ?: 5
-
- override fun getViewAt(i: Int): RemoteViews {
- val rv = RemoteViews(context.packageName, R.layout.widget_item)
-
- if (list.isNullOrEmpty()) return rv
-
-
- list?.get(i)?.let {
- rv.setTextViewText(R.id.widget_item_day, it.date)
- rv.setImageViewBitmap(R.id.widget_item_image, it.icon)
- rv.setTextViewText(R.id.widget_item_temp_high, it.highTemp)
- rv.setOnClickFillInIntent(R.id.widget_item_layout, intent)
- }
-
- return rv
- }
-
- override fun getLoadingView(): RemoteViews {
- return RemoteViews(context.packageName, R.layout.widget_item_loading)
- }
-
- override fun getViewTypeCount(): Int = 1
-
-
- override fun getItemId(i: Int): Long = i.toLong()
-
-
- override fun hasStableIds(): Boolean {
- return true
- }
-
-
-}
\ No newline at end of file
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/NewAppWidget.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/NewAppWidget.kt
deleted file mode 100644
index eaad60b..0000000
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/NewAppWidget.kt
+++ /dev/null
@@ -1,141 +0,0 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.widget
-
-import android.Manifest
-import android.app.PendingIntent
-import android.appwidget.AppWidgetManager
-import android.content.ComponentName
-import android.content.Context
-import android.content.Intent
-import android.content.pm.PackageManager
-import android.net.Uri
-import android.util.Log
-import android.widget.RemoteViews
-import androidx.core.app.ActivityCompat
-import com.appttude.h_mal.atlas_weather.R
-import com.appttude.h_mal.atlas_weather.atlasWeather.ui.MainActivity
-import com.appttude.h_mal.atlas_weather.helper.ServicesHelper
-import com.appttude.h_mal.atlas_weather.model.widget.WidgetData
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.withContext
-import org.kodein.di.KodeinAware
-import org.kodein.di.LateInitKodein
-import org.kodein.di.generic.instance
-
-/**
- * Implementation of App Widget functionality.
- */
-private val TAG = NewAppWidget::class.java.simpleName
-class NewAppWidget : BaseWidgetClass() {
-
- private val kodein = LateInitKodein()
- private val helper : ServicesHelper by kodein.instance()
-
- override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
- kodein.baseKodein = (context.applicationContext as KodeinAware).kodein
- // There may be multiple widgets active, so update all of them
- if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
- return
- }
-
- CoroutineScope(Dispatchers.IO).launch {
- val results = helper.fetchData()
- if (results) return@launch
- val weatherWidgetCurrent = helper.getWidgetWeather()
-
- withContext(Dispatchers.Main){
- for (appWidgetId in appWidgetIds) {
- val updatePendingIntent = createUpdatePendingIntent(context, appWidgetId)
- val views = createRemoteView(context, R.layout.new_app_widget)
- bindView(context, appWidgetId, views, updatePendingIntent, weatherWidgetCurrent)
- }
- super.onUpdate(context, appWidgetManager, appWidgetIds)
- }
-
- }
- }
-
- override fun onEnabled(context: Context) {
- try {
- val appWidgetManager = AppWidgetManager.getInstance(context)
- val thisAppWidget = ComponentName(context.packageName, NewAppWidget::class.java.name)
- val appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget)
- onUpdate(context, appWidgetManager, appWidgetIds)
- appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_listview)
- } catch (e: Exception) {
- Log.e(TAG, "onEnabled: ", e)
- }
- }
-
- override fun onDisabled(context: Context) {
- // Enter relevant functionality for when the last widget is disabled
- }
-
- override fun onReceive(context: Context, intent: Intent) {
- if (intent.action ==
- AppWidgetManager.ACTION_APPWIDGET_UPDATE) {
- val appWidgetManager = AppWidgetManager.getInstance(context)
- val thisAppWidget = ComponentName(context.packageName, NewAppWidget::class.java.name)
- val appWidgetIds = appWidgetManager.getAppWidgetIds(thisAppWidget)
- appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_listview)
- }
- super.onReceive(context, intent)
- }
-
- private fun createForecastListIntent(
- context: Context,
- appWidgetId: Int
- ): Intent {
- return Intent(context, WidgetRemoteViewsService::class.java).apply {
- putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
- data = Uri.parse(toUri(Intent.URI_INTENT_SCHEME))
- }
- }
-
- private fun bindView(
- context: Context,
- appWidgetId: Int,
- views: RemoteViews,
- updatePendingIntent: PendingIntent?,
- weather: WidgetData?){
-
- val appWidgetManager = AppWidgetManager.getInstance(context)
-
- views.setInt(R.id.whole_widget_view, "setBackgroundColor", helper.getWidgetBackground())
-
- weather?.let {
-
- val intent = createForecastListIntent(
- context,
- appWidgetId
- )
-
- views.setRemoteAdapter(R.id.widget_listview, intent)
- views.setTextViewText(R.id.widget_main_temp, it.currentTemp)
- views.setTextViewText(R.id.widget_feel_temp, "°C")
- views.setTextViewText(R.id.widget_current_location, it.location)
- views.setImageViewResource(R.id.location_icon, R.drawable.location_flag)
-// views.setImageViewBitmap(R.id.widget_current_icon, it.icon)
-
- val clickPendingIntentTemplate = createClickingPendingIntent(context, MainActivity::class.java)
- views.setPendingIntentTemplate(R.id.widget_listview, clickPendingIntentTemplate)
-
- views.setOnClickPendingIntent(R.id.widget_current_icon, updatePendingIntent)
- views.setOnClickPendingIntent(R.id.widget_current_location, updatePendingIntent)
-
- // Instruct the widget manager to update the widget
- appWidgetManager.updateAppWidget(appWidgetId, views)
- appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.widget_listview)
- return
- }
-
- Log.i(TAG, "onPostExecute: weather is empty")
- views.setTextViewText(R.id.widget_current_location, "Refresh")
- views.setImageViewResource(R.id.widget_current_icon, R.drawable.widget_error_icon)
- views.setImageViewResource(R.id.location_icon, R.drawable.refreshing)
- views.setOnClickPendingIntent(R.id.widget_current_icon, updatePendingIntent)
- views.setOnClickPendingIntent(R.id.widget_current_location, updatePendingIntent)
- appWidgetManager.updateAppWidget(appWidgetId, views)
- }
-}
\ No newline at end of file
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/WidgetRemoteViewsService.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/WidgetRemoteViewsService.kt
deleted file mode 100644
index d8dbf77..0000000
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/WidgetRemoteViewsService.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.widget
-
-import android.content.Intent
-import android.widget.RemoteViewsService
-
-class WidgetRemoteViewsService : RemoteViewsService() {
- override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
- return MyWidgetRemoteViewsFactory(applicationContext, intent)
- }
-}
\ No newline at end of file
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/WidgetUtils.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/WidgetUtils.kt
deleted file mode 100644
index 969ec86..0000000
--- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/widget/WidgetUtils.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.appttude.h_mal.atlas_weather.atlasWeather.widget
-
-import android.app.Activity
-import android.app.PendingIntent
-import android.app.TaskStackBuilder
-import android.content.Context
-import android.content.Intent
-
-fun createClickingPendingIntent(context: Context, activityClass: Class): PendingIntent {
- val clickIntentTemplate = Intent(context, activityClass)
-
- return TaskStackBuilder.create(context)
- .addNextIntentWithParentStack(clickIntentTemplate)
- .getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
-}
\ No newline at end of file
diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/ui/Tabs.kt b/app/src/atlasWeather/java/com/appttude/h_mal/ui/Tabs.kt
deleted file mode 100644
index 7982cf4..0000000
--- a/app/src/atlasWeather/java/com/appttude/h_mal/ui/Tabs.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.appttude.h_mal.ui
-
-import com.appttude.h_mal.R
-
-val tabs = setOf(R.id.nav_home, R.id.nav_world)
\ No newline at end of file
diff --git a/app/src/atlasWeather/res/navigation/main_navigation.xml b/app/src/atlasWeather/res/navigation/main_navigation.xml
index ad81a1e..7727719 100644
--- a/app/src/atlasWeather/res/navigation/main_navigation.xml
+++ b/app/src/atlasWeather/res/navigation/main_navigation.xml
@@ -8,21 +8,17 @@
+ app:destination="@id/furtherDetailsFragment" />
+ app:destination="@id/addLocationFragment"/>
+ app:destination="@id/worldItemFragment" />
+ app:destination="@id/furtherDetailsFragment" />
diff --git a/app/src/atlasWeather/res/xml/new_app_widget_info.xml b/app/src/atlasWeather/res/xml/new_app_widget_info.xml
index 3ae11de..ff000cc 100644
--- a/app/src/atlasWeather/res/xml/new_app_widget_info.xml
+++ b/app/src/atlasWeather/res/xml/new_app_widget_info.xml
@@ -1,6 +1,6 @@
+ package="com.appttude.h_mal.atlas_weather">
diff --git a/app/src/main/java/com/appttude/h_mal/application/AppClass.kt b/app/src/main/java/com/appttude/h_mal/application/AppClass.kt
deleted file mode 100644
index 7f229df..0000000
--- a/app/src/main/java/com/appttude/h_mal/application/AppClass.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.appttude.h_mal.application
-
-import com.appttude.h_mal.data.location.LocationProviderImpl
-import com.appttude.h_mal.data.network.NetworkModule
-import com.appttude.h_mal.data.network.WeatherApi
-import com.appttude.h_mal.data.network.interceptors.NetworkConnectionInterceptor
-import com.appttude.h_mal.data.network.interceptors.QueryParamsInterceptor
-import com.appttude.h_mal.data.network.networkUtils.loggingInterceptor
-import com.appttude.h_mal.data.room.AppDatabase
-
-const val LOCATION_PERMISSION_REQUEST = 505
-
-class AppClass : BaseAppClass() {
-
- override fun createNetworkModule(): WeatherApi {
- return NetworkModule().invoke(
- NetworkConnectionInterceptor(this),
- QueryParamsInterceptor(),
- loggingInterceptor
- ) as WeatherApi
- }
-
- override fun createLocationModule() = LocationProviderImpl(this)
-
- override fun createRoomDatabase(): AppDatabase = AppDatabase(this)
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/atlas_weather/application/AppClass.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/application/AppClass.kt
new file mode 100644
index 0000000..793577d
--- /dev/null
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/application/AppClass.kt
@@ -0,0 +1,27 @@
+package com.appttude.h_mal.atlas_weather.application
+
+import com.appttude.h_mal.atlas_weather.data.location.LocationProviderImpl
+import com.appttude.h_mal.atlas_weather.data.network.NetworkModule
+import com.appttude.h_mal.atlas_weather.data.network.WeatherApi
+import com.appttude.h_mal.atlas_weather.data.network.interceptors.NetworkConnectionInterceptor
+import com.appttude.h_mal.atlas_weather.data.network.interceptors.QueryParamsInterceptor
+import com.appttude.h_mal.atlas_weather.data.network.networkUtils.loggingInterceptor
+import com.appttude.h_mal.atlas_weather.data.room.AppDatabase
+
+const val LOCATION_PERMISSION_REQUEST = 505
+
+class AppClass : BaseAppClass() {
+
+ override fun createNetworkModule(): WeatherApi {
+ return NetworkModule().invoke(
+ NetworkConnectionInterceptor(this),
+ QueryParamsInterceptor(),
+ loggingInterceptor
+ ) as WeatherApi
+ }
+
+ override fun createLocationModule() = LocationProviderImpl(this)
+
+ override fun createRoomDatabase(): AppDatabase = AppDatabase(this)
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/application/BaseAppClass.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/application/BaseAppClass.kt
similarity index 68%
rename from app/src/main/java/com/appttude/h_mal/application/BaseAppClass.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/application/BaseAppClass.kt
index b4a4957..ebd54a1 100644
--- a/app/src/main/java/com/appttude/h_mal/application/BaseAppClass.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/application/BaseAppClass.kt
@@ -1,14 +1,14 @@
-package com.appttude.h_mal.application
+package com.appttude.h_mal.atlas_weather.application
import android.app.Application
-import com.appttude.h_mal.data.location.LocationProvider
-import com.appttude.h_mal.data.network.WeatherApi
-import com.appttude.h_mal.data.prefs.PreferenceProvider
-import com.appttude.h_mal.data.repository.RepositoryImpl
-import com.appttude.h_mal.data.repository.SettingsRepositoryImpl
-import com.appttude.h_mal.data.room.AppDatabase
-import com.appttude.h_mal.helper.ServicesHelper
-import com.appttude.h_mal.viewmodel.ApplicationViewModelFactory
+import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
+import com.appttude.h_mal.atlas_weather.data.network.WeatherApi
+import com.appttude.h_mal.atlas_weather.data.prefs.PreferenceProvider
+import com.appttude.h_mal.atlas_weather.data.repository.RepositoryImpl
+import com.appttude.h_mal.atlas_weather.data.repository.SettingsRepositoryImpl
+import com.appttude.h_mal.atlas_weather.data.room.AppDatabase
+import com.appttude.h_mal.atlas_weather.helper.ServicesHelper
+import com.appttude.h_mal.atlas_weather.viewmodel.ApplicationViewModelFactory
import com.google.gson.Gson
import org.kodein.di.Kodein
import org.kodein.di.KodeinAware
diff --git a/app/src/main/java/com/appttude/h_mal/data/location/LocationHelper.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/location/LocationHelper.kt
similarity index 84%
rename from app/src/main/java/com/appttude/h_mal/data/location/LocationHelper.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/location/LocationHelper.kt
index 8521d0e..a8be8c5 100644
--- a/app/src/main/java/com/appttude/h_mal/data/location/LocationHelper.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/location/LocationHelper.kt
@@ -1,9 +1,9 @@
-package com.appttude.h_mal.data.location
+package com.appttude.h_mal.atlas_weather.data.location
import android.content.Context
import android.location.Location
-import com.appttude.h_mal.BuildConfig
-import com.appttude.h_mal.utils.createSuspend
+import com.appttude.h_mal.atlas_weather.BuildConfig
+import com.appttude.h_mal.atlas_weather.utils.createSuspend
import com.tomtom.online.sdk.search.OnlineSearchApi
import com.tomtom.online.sdk.search.data.common.Address
import com.tomtom.online.sdk.search.data.reversegeocoder.ReverseGeocoderSearchQueryBuilder
diff --git a/app/src/main/java/com/appttude/h_mal/data/location/LocationProvider.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/location/LocationProvider.kt
similarity index 72%
rename from app/src/main/java/com/appttude/h_mal/data/location/LocationProvider.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/location/LocationProvider.kt
index 8cae968..1fd35f6 100644
--- a/app/src/main/java/com/appttude/h_mal/data/location/LocationProvider.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/location/LocationProvider.kt
@@ -1,6 +1,6 @@
-package com.appttude.h_mal.data.location
+package com.appttude.h_mal.atlas_weather.data.location
-import com.appttude.h_mal.model.types.LocationType
+import com.appttude.h_mal.atlas_weather.model.types.LocationType
interface LocationProvider {
suspend fun getCurrentLatLong(): Pair
diff --git a/app/src/main/java/com/appttude/h_mal/data/location/LocationProviderImpl.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/location/LocationProviderImpl.kt
similarity index 94%
rename from app/src/main/java/com/appttude/h_mal/data/location/LocationProviderImpl.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/location/LocationProviderImpl.kt
index d070795..194aeec 100644
--- a/app/src/main/java/com/appttude/h_mal/data/location/LocationProviderImpl.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/location/LocationProviderImpl.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.location
+package com.appttude.h_mal.atlas_weather.data.location
import android.Manifest.permission.ACCESS_COARSE_LOCATION
import android.annotation.SuppressLint
@@ -8,7 +8,7 @@ import android.location.Location
import android.location.LocationManager
import android.os.HandlerThread
import androidx.annotation.RequiresPermission
-import com.appttude.h_mal.model.types.LocationType
+import com.appttude.h_mal.atlas_weather.model.types.LocationType
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationCallback
import com.google.android.gms.location.LocationRequest
@@ -26,7 +26,7 @@ import kotlin.coroutines.suspendCoroutine
class LocationProviderImpl(
private val applicationContext: Context
-) : LocationProvider, LocationHelper(applicationContext) {
+) : com.appttude.h_mal.atlas_weather.data.location.LocationProvider, com.appttude.h_mal.atlas_weather.data.location.LocationHelper(applicationContext) {
private var locationManager =
applicationContext.getSystemService(Context.LOCATION_SERVICE) as LocationManager?
private val client = FusedLocationProviderClient(applicationContext)
diff --git a/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/Api.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/Api.kt
new file mode 100644
index 0000000..4a3d64d
--- /dev/null
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/Api.kt
@@ -0,0 +1,3 @@
+package com.appttude.h_mal.atlas_weather.data.network
+
+interface Api
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/BaseNetworkModule.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/BaseNetworkModule.kt
similarity index 66%
rename from app/src/main/java/com/appttude/h_mal/data/network/BaseNetworkModule.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/BaseNetworkModule.kt
index c45d9ff..bb02716 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/BaseNetworkModule.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/BaseNetworkModule.kt
@@ -1,7 +1,7 @@
-package com.appttude.h_mal.data.network
+package com.appttude.h_mal.atlas_weather.data.network
-import com.appttude.h_mal.data.network.networkUtils.buildOkHttpClient
-import com.appttude.h_mal.data.network.networkUtils.createRetrofit
+import com.appttude.h_mal.atlas_weather.data.network.networkUtils.buildOkHttpClient
+import com.appttude.h_mal.atlas_weather.data.network.networkUtils.createRetrofit
import okhttp3.Interceptor
open class BaseNetworkModule {
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/NetworkModule.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/NetworkModule.kt
similarity index 70%
rename from app/src/main/java/com/appttude/h_mal/data/network/NetworkModule.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/NetworkModule.kt
index 05e39e7..93cae53 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/NetworkModule.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/NetworkModule.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.network
+package com.appttude.h_mal.atlas_weather.data.network
class NetworkModule : BaseNetworkModule() {
override fun baseUrl(): String = "https://api.openweathermap.org/data/2.5/"
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/ResponseUnwrap.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/ResponseUnwrap.kt
similarity index 93%
rename from app/src/main/java/com/appttude/h_mal/data/network/ResponseUnwrap.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/ResponseUnwrap.kt
index f63e32c..106237c 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/ResponseUnwrap.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/ResponseUnwrap.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.network
+package com.appttude.h_mal.atlas_weather.data.network
import org.json.JSONException
import org.json.JSONObject
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/WeatherApi.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/WeatherApi.kt
similarity index 73%
rename from app/src/main/java/com/appttude/h_mal/data/network/WeatherApi.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/WeatherApi.kt
index a9eb6f2..00bb356 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/WeatherApi.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/WeatherApi.kt
@@ -1,6 +1,6 @@
-package com.appttude.h_mal.data.network
+package com.appttude.h_mal.atlas_weather.data.network
-import com.appttude.h_mal.data.network.response.forecast.WeatherResponse
+import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Query
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/interceptors/NetworkConnectionInterceptor.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/interceptors/NetworkConnectionInterceptor.kt
similarity index 78%
rename from app/src/main/java/com/appttude/h_mal/data/network/interceptors/NetworkConnectionInterceptor.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/interceptors/NetworkConnectionInterceptor.kt
index 685d5b6..5467db8 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/interceptors/NetworkConnectionInterceptor.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/interceptors/NetworkConnectionInterceptor.kt
@@ -1,7 +1,7 @@
-package com.appttude.h_mal.data.network.interceptors
+package com.appttude.h_mal.atlas_weather.data.network.interceptors
import android.content.Context
-import com.appttude.h_mal.utils.isInternetAvailable
+import com.appttude.h_mal.atlas_weather.utils.isInternetAvailable
import okhttp3.Interceptor
import java.io.IOException
diff --git a/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/interceptors/NetworkInterceptor.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/interceptors/NetworkInterceptor.kt
new file mode 100644
index 0000000..8a23bb8
--- /dev/null
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/interceptors/NetworkInterceptor.kt
@@ -0,0 +1,5 @@
+package com.appttude.h_mal.atlas_weather.data.network.interceptors
+
+import okhttp3.Interceptor
+
+interface NetworkInterceptor : Interceptor
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/interceptors/QueryParamsInterceptor.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/interceptors/QueryParamsInterceptor.kt
similarity index 84%
rename from app/src/main/java/com/appttude/h_mal/data/network/interceptors/QueryParamsInterceptor.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/interceptors/QueryParamsInterceptor.kt
index 7c27a2d..4cfffd7 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/interceptors/QueryParamsInterceptor.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/interceptors/QueryParamsInterceptor.kt
@@ -1,6 +1,6 @@
-package com.appttude.h_mal.data.network.interceptors
+package com.appttude.h_mal.atlas_weather.data.network.interceptors
-import com.appttude.h_mal.BuildConfig
+import com.appttude.h_mal.atlas_weather.BuildConfig
import okhttp3.Interceptor
import okhttp3.Request
import okhttp3.Response
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/networkUtils/RetrofitComponents.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/networkUtils/RetrofitComponents.kt
similarity index 85%
rename from app/src/main/java/com/appttude/h_mal/data/network/networkUtils/RetrofitComponents.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/networkUtils/RetrofitComponents.kt
index 9dbb587..b514d11 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/networkUtils/RetrofitComponents.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/networkUtils/RetrofitComponents.kt
@@ -1,7 +1,6 @@
-package com.appttude.h_mal.data.network.networkUtils
+package com.appttude.h_mal.atlas_weather.data.network.networkUtils
-import com.appttude.h_mal.data.network.interceptors.NetworkConnectionInterceptor
-import com.appttude.h_mal.data.network.interceptors.NetworkInterceptor
+import com.appttude.h_mal.atlas_weather.data.network.interceptors.NetworkInterceptor
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Current.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Current.kt
similarity index 93%
rename from app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Current.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Current.kt
index 7b2846c..4859de6 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Current.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Current.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.network.response.forecast
+package com.appttude.h_mal.atlas_weather.data.network.response.forecast
import com.google.gson.annotations.SerializedName
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/DailyItem.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/DailyItem.kt
similarity index 93%
rename from app/src/main/java/com/appttude/h_mal/data/network/response/forecast/DailyItem.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/DailyItem.kt
index 389c74e..d04a820 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/DailyItem.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/DailyItem.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.network.response.forecast
+package com.appttude.h_mal.atlas_weather.data.network.response.forecast
import com.google.gson.annotations.SerializedName
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/FeelsLike.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/FeelsLike.kt
similarity index 81%
rename from app/src/main/java/com/appttude/h_mal/data/network/response/forecast/FeelsLike.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/FeelsLike.kt
index 0299144..f08d021 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/FeelsLike.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/FeelsLike.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.network.response.forecast
+package com.appttude.h_mal.atlas_weather.data.network.response.forecast
import com.google.gson.annotations.SerializedName
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Hour.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Hour.kt
similarity index 93%
rename from app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Hour.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Hour.kt
index 254aa11..48d1f5b 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Hour.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Hour.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.network.response.forecast
+package com.appttude.h_mal.atlas_weather.data.network.response.forecast
import com.google.gson.annotations.SerializedName
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Response.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Response.kt
similarity index 86%
rename from app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Response.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Response.kt
index d9f6fac..f9b1c23 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Response.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Response.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.network.response.forecast
+package com.appttude.h_mal.atlas_weather.data.network.response.forecast
import com.google.gson.annotations.SerializedName
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Temp.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Temp.kt
similarity index 85%
rename from app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Temp.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Temp.kt
index d662e53..09ffabd 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/Temp.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/Temp.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.network.response.forecast
+package com.appttude.h_mal.atlas_weather.data.network.response.forecast
import com.google.gson.annotations.SerializedName
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/WeatherItem.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/WeatherItem.kt
similarity index 81%
rename from app/src/main/java/com/appttude/h_mal/data/network/response/forecast/WeatherItem.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/WeatherItem.kt
index e2e5f7a..da25be4 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/WeatherItem.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/WeatherItem.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.network.response.forecast
+package com.appttude.h_mal.atlas_weather.data.network.response.forecast
import com.google.gson.annotations.SerializedName
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/WeatherResponse.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/WeatherResponse.kt
similarity index 88%
rename from app/src/main/java/com/appttude/h_mal/data/network/response/forecast/WeatherResponse.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/WeatherResponse.kt
index 298b855..9347ca8 100644
--- a/app/src/main/java/com/appttude/h_mal/data/network/response/forecast/WeatherResponse.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/network/response/forecast/WeatherResponse.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.network.response.forecast
+package com.appttude.h_mal.atlas_weather.data.network.response.forecast
import com.google.gson.annotations.SerializedName
diff --git a/app/src/main/java/com/appttude/h_mal/data/prefs/PreferencesProvider.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/prefs/PreferencesProvider.kt
similarity index 90%
rename from app/src/main/java/com/appttude/h_mal/data/prefs/PreferencesProvider.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/prefs/PreferencesProvider.kt
index f5b4f4f..b5e8631 100644
--- a/app/src/main/java/com/appttude/h_mal/data/prefs/PreferencesProvider.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/prefs/PreferencesProvider.kt
@@ -1,9 +1,9 @@
-package com.appttude.h_mal.data.prefs
+package com.appttude.h_mal.atlas_weather.data.prefs
import android.content.Context
import android.content.SharedPreferences
import androidx.preference.PreferenceManager
-import com.appttude.h_mal.data.room.entity.CURRENT_LOCATION
+import com.appttude.h_mal.atlas_weather.data.room.entity.CURRENT_LOCATION
/**
* Shared preferences to save & load last timestamp
diff --git a/app/src/main/java/com/appttude/h_mal/data/repository/Repository.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/Repository.kt
similarity index 78%
rename from app/src/main/java/com/appttude/h_mal/data/repository/Repository.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/Repository.kt
index 33efb70..56a9f4c 100644
--- a/app/src/main/java/com/appttude/h_mal/data/repository/Repository.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/Repository.kt
@@ -1,8 +1,8 @@
-package com.appttude.h_mal.data.repository
+package com.appttude.h_mal.atlas_weather.data.repository
import androidx.lifecycle.LiveData
-import com.appttude.h_mal.data.network.response.forecast.WeatherResponse
-import com.appttude.h_mal.data.room.entity.EntityItem
+import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
+import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
interface Repository {
diff --git a/app/src/main/java/com/appttude/h_mal/data/repository/RepositoryImpl.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/RepositoryImpl.kt
similarity index 77%
rename from app/src/main/java/com/appttude/h_mal/data/repository/RepositoryImpl.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/RepositoryImpl.kt
index 8d04ce1..dcd2272 100644
--- a/app/src/main/java/com/appttude/h_mal/data/repository/RepositoryImpl.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/RepositoryImpl.kt
@@ -1,13 +1,13 @@
-package com.appttude.h_mal.data.repository
+package com.appttude.h_mal.atlas_weather.data.repository
-import com.appttude.h_mal.data.network.ResponseUnwrap
-import com.appttude.h_mal.data.network.WeatherApi
-import com.appttude.h_mal.data.network.response.forecast.WeatherResponse
-import com.appttude.h_mal.data.prefs.LOCATION_CONST
-import com.appttude.h_mal.data.prefs.PreferenceProvider
-import com.appttude.h_mal.data.room.AppDatabase
-import com.appttude.h_mal.data.room.entity.EntityItem
-import com.appttude.h_mal.utils.FALLBACK_TIME
+import com.appttude.h_mal.atlas_weather.data.network.ResponseUnwrap
+import com.appttude.h_mal.atlas_weather.data.network.WeatherApi
+import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
+import com.appttude.h_mal.atlas_weather.data.prefs.LOCATION_CONST
+import com.appttude.h_mal.atlas_weather.data.prefs.PreferenceProvider
+import com.appttude.h_mal.atlas_weather.data.room.AppDatabase
+import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
+import com.appttude.h_mal.atlas_weather.utils.FALLBACK_TIME
class RepositoryImpl(
diff --git a/app/src/main/java/com/appttude/h_mal/data/repository/SettingsRepository.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/SettingsRepository.kt
similarity index 69%
rename from app/src/main/java/com/appttude/h_mal/data/repository/SettingsRepository.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/SettingsRepository.kt
index 60707cb..8eb6b51 100644
--- a/app/src/main/java/com/appttude/h_mal/data/repository/SettingsRepository.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/SettingsRepository.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.data.repository
+package com.appttude.h_mal.atlas_weather.data.repository
interface SettingsRepository {
fun isNotificationsEnabled(): Boolean
diff --git a/app/src/main/java/com/appttude/h_mal/data/repository/SettingsRepositoryImpl.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/SettingsRepositoryImpl.kt
similarity index 71%
rename from app/src/main/java/com/appttude/h_mal/data/repository/SettingsRepositoryImpl.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/SettingsRepositoryImpl.kt
index e5fefd4..b6785dc 100644
--- a/app/src/main/java/com/appttude/h_mal/data/repository/SettingsRepositoryImpl.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/repository/SettingsRepositoryImpl.kt
@@ -1,6 +1,6 @@
-package com.appttude.h_mal.data.repository
+package com.appttude.h_mal.atlas_weather.data.repository
-import com.appttude.h_mal.data.prefs.PreferenceProvider
+import com.appttude.h_mal.atlas_weather.data.prefs.PreferenceProvider
class SettingsRepositoryImpl(
private val prefs: PreferenceProvider
diff --git a/app/src/main/java/com/appttude/h_mal/data/room/AppDatabase.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/AppDatabase.kt
similarity index 90%
rename from app/src/main/java/com/appttude/h_mal/data/room/AppDatabase.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/AppDatabase.kt
index 2368bc4..123f16e 100644
--- a/app/src/main/java/com/appttude/h_mal/data/room/AppDatabase.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/AppDatabase.kt
@@ -1,11 +1,11 @@
-package com.appttude.h_mal.data.room
+package com.appttude.h_mal.atlas_weather.data.room
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
-import com.appttude.h_mal.data.room.entity.EntityItem
+import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
@Database(
entities = [EntityItem::class],
diff --git a/app/src/main/java/com/appttude/h_mal/data/room/Converter.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/Converter.kt
similarity index 85%
rename from app/src/main/java/com/appttude/h_mal/data/room/Converter.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/Converter.kt
index ce1ef71..8e0a7f4 100644
--- a/app/src/main/java/com/appttude/h_mal/data/room/Converter.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/Converter.kt
@@ -1,9 +1,9 @@
-package com.appttude.h_mal.data.room
+package com.appttude.h_mal.atlas_weather.data.room
import android.content.Context
import androidx.room.ProvidedTypeConverter
import androidx.room.TypeConverter
-import com.appttude.h_mal.model.weather.FullWeather
+import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
import com.google.gson.Gson
import org.kodein.di.KodeinAware
import org.kodein.di.android.kodein
diff --git a/app/src/main/java/com/appttude/h_mal/data/room/WeatherDao.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/WeatherDao.kt
similarity index 84%
rename from app/src/main/java/com/appttude/h_mal/data/room/WeatherDao.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/WeatherDao.kt
index 745b232..703cbc2 100644
--- a/app/src/main/java/com/appttude/h_mal/data/room/WeatherDao.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/WeatherDao.kt
@@ -1,12 +1,12 @@
-package com.appttude.h_mal.data.room
+package com.appttude.h_mal.atlas_weather.data.room
import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
-import com.appttude.h_mal.data.room.entity.CURRENT_LOCATION
-import com.appttude.h_mal.data.room.entity.EntityItem
+import com.appttude.h_mal.atlas_weather.data.room.entity.CURRENT_LOCATION
+import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
@Dao
interface WeatherDao {
diff --git a/app/src/main/java/com/appttude/h_mal/data/room/entity/EntityItem.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/entity/EntityItem.kt
similarity index 64%
rename from app/src/main/java/com/appttude/h_mal/data/room/entity/EntityItem.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/entity/EntityItem.kt
index e65ab18..a9c5667 100644
--- a/app/src/main/java/com/appttude/h_mal/data/room/entity/EntityItem.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/data/room/entity/EntityItem.kt
@@ -1,8 +1,8 @@
-package com.appttude.h_mal.data.room.entity
+package com.appttude.h_mal.atlas_weather.data.room.entity
import androidx.room.Entity
import androidx.room.PrimaryKey
-import com.appttude.h_mal.model.weather.FullWeather
+import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
const val CURRENT_LOCATION = "CurrentLocation"
diff --git a/app/src/main/java/com/appttude/h_mal/helper/GenericsHelper.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/helper/GenericsHelper.kt
similarity index 97%
rename from app/src/main/java/com/appttude/h_mal/helper/GenericsHelper.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/helper/GenericsHelper.kt
index b943e98..9b112c2 100644
--- a/app/src/main/java/com/appttude/h_mal/helper/GenericsHelper.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/helper/GenericsHelper.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.helper
+package com.appttude.h_mal.atlas_weather.helper
import android.view.LayoutInflater
import android.view.ViewGroup
diff --git a/app/src/main/java/com/appttude/h_mal/helper/ServicesHelper.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/helper/ServicesHelper.kt
similarity index 85%
rename from app/src/main/java/com/appttude/h_mal/helper/ServicesHelper.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/helper/ServicesHelper.kt
index a534d59..361842f 100644
--- a/app/src/main/java/com/appttude/h_mal/helper/ServicesHelper.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/helper/ServicesHelper.kt
@@ -1,21 +1,21 @@
-package com.appttude.h_mal.helper
+package com.appttude.h_mal.atlas_weather.helper
import android.Manifest
import android.graphics.Bitmap
import android.graphics.Color
import android.graphics.drawable.Drawable
import androidx.annotation.RequiresPermission
-import com.appttude.h_mal.data.location.LocationProvider
-import com.appttude.h_mal.data.repository.Repository
-import com.appttude.h_mal.data.repository.SettingsRepository
-import com.appttude.h_mal.data.room.entity.CURRENT_LOCATION
-import com.appttude.h_mal.data.room.entity.EntityItem
-import com.appttude.h_mal.model.weather.FullWeather
-import com.appttude.h_mal.model.widget.InnerWidgetCellData
-import com.appttude.h_mal.model.widget.InnerWidgetData
-import com.appttude.h_mal.model.widget.WidgetData
-import com.appttude.h_mal.model.widget.WidgetWeatherCollection
-import com.appttude.h_mal.utils.toSmallDayName
+import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
+import com.appttude.h_mal.atlas_weather.data.repository.Repository
+import com.appttude.h_mal.atlas_weather.data.repository.SettingsRepository
+import com.appttude.h_mal.atlas_weather.data.room.entity.CURRENT_LOCATION
+import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
+import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
+import com.appttude.h_mal.atlas_weather.model.widget.InnerWidgetCellData
+import com.appttude.h_mal.atlas_weather.model.widget.InnerWidgetData
+import com.appttude.h_mal.atlas_weather.model.widget.WidgetData
+import com.appttude.h_mal.atlas_weather.model.widget.WidgetWeatherCollection
+import com.appttude.h_mal.atlas_weather.utils.toSmallDayName
import com.squareup.picasso.Picasso
import com.squareup.picasso.Target
import kotlinx.coroutines.Dispatchers
diff --git a/app/src/main/java/com/appttude/h_mal/atlas_weather/model/forecast/Forecast.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/forecast/Forecast.kt
new file mode 100644
index 0000000..b774973
--- /dev/null
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/forecast/Forecast.kt
@@ -0,0 +1,93 @@
+package com.appttude.h_mal.atlas_weather.model.forecast
+
+import android.os.Parcel
+import android.os.Parcelable
+import com.appttude.h_mal.atlas_weather.model.weather.DailyWeather
+import com.appttude.h_mal.atlas_weather.utils.toDayName
+import com.appttude.h_mal.atlas_weather.utils.toDayString
+import com.appttude.h_mal.atlas_weather.utils.toTime
+
+
+data class Forecast(
+ val date: String?,
+ val day: String?,
+ val condition: String?,
+ val weatherIcon: String?,
+ val mainTemp: String?,
+ val minorTemp: String?,
+ val averageTemp: String?,
+ val windText: String?,
+ val precipitation: String?,
+ val humidity: String?,
+ val uvi: String?,
+ val sunrise: String?,
+ val sunset: String?,
+ val cloud: String?
+): Parcelable{
+
+ constructor(parcel: Parcel) : this(
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString()
+ ) {
+ }
+
+ constructor(dailyWeather: DailyWeather) : this(
+ dailyWeather.dt?.toDayString(),
+ dailyWeather.dt?.toDayName(),
+ dailyWeather.description,
+ dailyWeather.icon,
+ dailyWeather.max?.toInt().toString(),
+ dailyWeather.min?.toInt().toString(),
+ dailyWeather.average?.toInt().toString(),
+ dailyWeather.windSpeed?.toInt().toString(),
+ (dailyWeather.pop?.times(100))?.toInt().toString(),
+ dailyWeather.humidity?.toString(),
+ dailyWeather.uvi?.toInt().toString(),
+ dailyWeather.sunrise?.toTime(),
+ dailyWeather.sunset?.toTime(),
+ dailyWeather.clouds?.toString()
+ )
+
+ override fun writeToParcel(parcel: Parcel, flags: Int) {
+ parcel.writeString(date)
+ parcel.writeString(day)
+ parcel.writeString(condition)
+ parcel.writeString(weatherIcon)
+ parcel.writeString(mainTemp)
+ parcel.writeString(minorTemp)
+ parcel.writeString(averageTemp)
+ parcel.writeString(windText)
+ parcel.writeString(precipitation)
+ parcel.writeString(humidity)
+ parcel.writeString(uvi)
+ parcel.writeString(sunrise)
+ parcel.writeString(sunset)
+ parcel.writeString(cloud)
+ }
+
+ override fun describeContents(): Int {
+ return 0
+ }
+
+ companion object CREATOR : Parcelable.Creator {
+ override fun createFromParcel(parcel: Parcel): Forecast {
+ return Forecast(parcel)
+ }
+
+ override fun newArray(size: Int): Array {
+ return arrayOfNulls(size)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/atlas_weather/model/forecast/WeatherDisplay.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/forecast/WeatherDisplay.kt
new file mode 100644
index 0000000..f6287d0
--- /dev/null
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/forecast/WeatherDisplay.kt
@@ -0,0 +1,97 @@
+package com.appttude.h_mal.atlas_weather.model.forecast
+
+import android.os.Parcel
+import android.os.Parcelable
+import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
+import com.appttude.h_mal.atlas_weather.model.weather.Hour
+
+
+data class WeatherDisplay(
+ val averageTemp: Double?,
+ var unit: String?,
+ var location: String?,
+ val iconURL: String?,
+ val description: String?,
+ val hourly: List?,
+ val forecast: List?,
+ val windSpeed: String?,
+ val windDirection: String?,
+ val precipitation: String?,
+ val humidity: String?,
+ val clouds: String?,
+ val lat: Double = 0.00,
+ val lon: Double = 0.00,
+ var displayName: String?
+): Parcelable {
+
+ constructor(parcel: Parcel) : this(
+ parcel.readValue(Double::class.java.classLoader) as? Double,
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.createTypedArrayList(Hour),
+ parcel.createTypedArrayList(Forecast),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readString(),
+ parcel.readDouble(),
+ parcel.readDouble(),
+ parcel.readString()
+ ) {
+ }
+
+ constructor(entity: EntityItem) : this(
+ entity.weather.current?.temp,
+ entity.weather.temperatureUnit,
+ entity.id,
+ entity.weather.current?.icon,
+ entity.weather.current?.description,
+ entity.weather.hourly,
+ entity.weather.daily?.drop(1)?.map { Forecast(it) },
+ entity.weather.current?.windSpeed?.toString(),
+ entity.weather.current?.windDeg?.toString(),
+ entity.weather.daily?.get(0)?.pop?.times(100)?.toInt()?.toString(),
+ entity.weather.current?.humidity?.toString(),
+ entity.weather.current?.clouds?.toString(),
+ entity.weather.lat,
+ entity.weather.lon,
+ entity.weather.locationString
+ )
+
+ override fun writeToParcel(parcel: Parcel, flags: Int) {
+ parcel.writeValue(averageTemp)
+ parcel.writeString(unit)
+ parcel.writeString(location)
+ parcel.writeString(iconURL)
+ parcel.writeString(description)
+ parcel.writeTypedList(hourly)
+ parcel.writeTypedList(forecast)
+ parcel.writeString(windSpeed)
+ parcel.writeString(windDirection)
+ parcel.writeString(precipitation)
+ parcel.writeString(humidity)
+ parcel.writeString(clouds)
+ parcel.writeDouble(lat)
+ parcel.writeDouble(lon)
+ parcel.writeString(displayName)
+ }
+
+ override fun describeContents(): Int {
+ return 0
+ }
+
+ companion object CREATOR : Parcelable.Creator {
+ override fun createFromParcel(parcel: Parcel): WeatherDisplay {
+ return WeatherDisplay(parcel)
+ }
+
+ override fun newArray(size: Int): Array {
+ return arrayOfNulls(size)
+ }
+ }
+
+}
+
diff --git a/app/src/main/java/com/appttude/h_mal/atlas_weather/model/types/LocationType.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/types/LocationType.kt
new file mode 100644
index 0000000..17498f3
--- /dev/null
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/types/LocationType.kt
@@ -0,0 +1,6 @@
+package com.appttude.h_mal.atlas_weather.model.types
+
+enum class LocationType{
+ City,
+ Town
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/model/weather/Current.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/Current.kt
similarity index 84%
rename from app/src/main/java/com/appttude/h_mal/model/weather/Current.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/Current.kt
index 8d8d0c9..c35d82b 100644
--- a/app/src/main/java/com/appttude/h_mal/model/weather/Current.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/Current.kt
@@ -1,7 +1,7 @@
-package com.appttude.h_mal.model.weather
+package com.appttude.h_mal.atlas_weather.model.weather
-import com.appttude.h_mal.data.network.response.forecast.Current
-import com.appttude.h_mal.utils.generateIconUrlString
+import com.appttude.h_mal.atlas_weather.data.network.response.forecast.Current
+import com.appttude.h_mal.atlas_weather.utils.generateIconUrlString
data class Current(
val dt: Int? = null,
diff --git a/app/src/main/java/com/appttude/h_mal/model/weather/DailyWeather.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/DailyWeather.kt
similarity index 87%
rename from app/src/main/java/com/appttude/h_mal/model/weather/DailyWeather.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/DailyWeather.kt
index bffba59..59770bd 100644
--- a/app/src/main/java/com/appttude/h_mal/model/weather/DailyWeather.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/DailyWeather.kt
@@ -1,7 +1,7 @@
-package com.appttude.h_mal.model.weather
+package com.appttude.h_mal.atlas_weather.model.weather
-import com.appttude.h_mal.data.network.response.forecast.DailyItem
-import com.appttude.h_mal.utils.generateIconUrlString
+import com.appttude.h_mal.atlas_weather.data.network.response.forecast.DailyItem
+import com.appttude.h_mal.atlas_weather.utils.generateIconUrlString
data class DailyWeather(
diff --git a/app/src/main/java/com/appttude/h_mal/model/weather/FullWeather.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/FullWeather.kt
similarity index 82%
rename from app/src/main/java/com/appttude/h_mal/model/weather/FullWeather.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/FullWeather.kt
index 4643f95..2f8de61 100644
--- a/app/src/main/java/com/appttude/h_mal/model/weather/FullWeather.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/FullWeather.kt
@@ -1,6 +1,6 @@
-package com.appttude.h_mal.model.weather
+package com.appttude.h_mal.atlas_weather.model.weather
-import com.appttude.h_mal.data.network.response.forecast.WeatherResponse
+import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
data class FullWeather(
val current: Current? = null,
diff --git a/app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/Hour.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/Hour.kt
new file mode 100644
index 0000000..9c77e19
--- /dev/null
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/weather/Hour.kt
@@ -0,0 +1,47 @@
+package com.appttude.h_mal.atlas_weather.model.weather
+
+import android.os.Parcel
+import android.os.Parcelable
+import com.appttude.h_mal.atlas_weather.utils.generateIconUrlString
+import com.appttude.h_mal.atlas_weather.data.network.response.forecast.Hour as ForecastHour
+
+
+data class Hour(
+ val dt: Int? = null,
+ val temp: Double? = null,
+ val icon: String? = null
+): Parcelable {
+
+ constructor(parcel: Parcel) : this(
+ parcel.readValue(Int::class.java.classLoader) as? Int,
+ parcel.readValue(Double::class.java.classLoader) as? Double,
+ parcel.readString()
+ ) {
+ }
+
+ constructor(hour: ForecastHour) : this(
+ hour.dt,
+ hour.temp,
+ generateIconUrlString(hour.weather?.getOrNull(0)?.icon)
+ )
+
+ override fun writeToParcel(parcel: Parcel, flags: Int) {
+ parcel.writeValue(dt)
+ parcel.writeValue(temp)
+ parcel.writeString(icon)
+ }
+
+ override fun describeContents(): Int {
+ return 0
+ }
+
+ companion object CREATOR : Parcelable.Creator {
+ override fun createFromParcel(parcel: Parcel): Hour {
+ return Hour(parcel)
+ }
+
+ override fun newArray(size: Int): Array {
+ return arrayOfNulls(size)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/model/widget/WidgetData.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/widget/WidgetData.kt
similarity index 90%
rename from app/src/main/java/com/appttude/h_mal/model/widget/WidgetData.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/model/widget/WidgetData.kt
index 93ca3ae..c33b42c 100644
--- a/app/src/main/java/com/appttude/h_mal/model/widget/WidgetData.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/model/widget/WidgetData.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.model.widget
+package com.appttude.h_mal.atlas_weather.model.widget
import android.graphics.Bitmap
diff --git a/app/src/main/java/com/appttude/h_mal/ui/MainActivity.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/ui/MainActivity.kt
similarity index 93%
rename from app/src/main/java/com/appttude/h_mal/ui/MainActivity.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/ui/MainActivity.kt
index 95d1da6..35d7681 100644
--- a/app/src/main/java/com/appttude/h_mal/ui/MainActivity.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/ui/MainActivity.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.ui
+package com.appttude.h_mal.atlas_weather.ui
import android.content.Intent
import android.os.Bundle
@@ -10,8 +10,7 @@ import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController
-import com.appttude.h_mal.R
-import com.appttude.h_mal.monoWeather.ui.settings.UnitSettingsActivity
+import com.appttude.h_mal.atlas_weather.R
import com.google.android.material.bottomnavigation.BottomNavigationView
import kotlinx.android.synthetic.main.activity_main_navigation.*
diff --git a/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/Constants.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/Constants.kt
new file mode 100644
index 0000000..84fd85c
--- /dev/null
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/Constants.kt
@@ -0,0 +1,3 @@
+package com.appttude.h_mal.atlas_weather.utils
+
+val FALLBACK_TIME: Long = 300000L
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/utils/Event.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/Event.kt
similarity index 91%
rename from app/src/main/java/com/appttude/h_mal/utils/Event.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/utils/Event.kt
index fa128bd..b7040b5 100644
--- a/app/src/main/java/com/appttude/h_mal/utils/Event.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/Event.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.utils
+package com.appttude.h_mal.atlas_weather.utils
/**
* Used with livedata to make observation lifecycle aware
diff --git a/app/src/main/java/com/appttude/h_mal/utils/GenericTypeUtils.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/GenericTypeUtils.kt
similarity index 95%
rename from app/src/main/java/com/appttude/h_mal/utils/GenericTypeUtils.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/utils/GenericTypeUtils.kt
index b15bd10..894fbb1 100644
--- a/app/src/main/java/com/appttude/h_mal/utils/GenericTypeUtils.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/GenericTypeUtils.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.utils
+package com.appttude.h_mal.atlas_weather.utils
import android.os.Parcel
import android.os.Parcelable
diff --git a/app/src/main/java/com/appttude/h_mal/utils/LoggingUtils.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/LoggingUtils.kt
similarity index 59%
rename from app/src/main/java/com/appttude/h_mal/utils/LoggingUtils.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/utils/LoggingUtils.kt
index 259a0e3..c2b71b6 100644
--- a/app/src/main/java/com/appttude/h_mal/utils/LoggingUtils.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/LoggingUtils.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.utils
+package com.appttude.h_mal.atlas_weather.utils
fun printToLog(msg: String) {
println("widget monitoring: $msg")
diff --git a/app/src/main/java/com/appttude/h_mal/utils/NavigationUtils.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/NavigationUtils.kt
similarity index 88%
rename from app/src/main/java/com/appttude/h_mal/utils/NavigationUtils.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/utils/NavigationUtils.kt
index 12be575..f66a0cb 100644
--- a/app/src/main/java/com/appttude/h_mal/utils/NavigationUtils.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/NavigationUtils.kt
@@ -1,10 +1,10 @@
-package com.appttude.h_mal.utils
+package com.appttude.h_mal.atlas_weather.utils
import android.view.View
import androidx.fragment.app.Fragment
import androidx.navigation.NavDirections
import androidx.navigation.Navigation
-import com.appttude.h_mal.R
+import com.appttude.h_mal.atlas_weather.R
fun Fragment.navigateToFragment(newFragment: Fragment){
childFragmentManager.beginTransaction()
diff --git a/app/src/main/java/com/appttude/h_mal/utils/NetworkUtils.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/NetworkUtils.kt
similarity index 93%
rename from app/src/main/java/com/appttude/h_mal/utils/NetworkUtils.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/utils/NetworkUtils.kt
index df1169b..d095ca6 100644
--- a/app/src/main/java/com/appttude/h_mal/utils/NetworkUtils.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/NetworkUtils.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.utils
+package com.appttude.h_mal.atlas_weather.utils
import android.content.Context
import android.net.ConnectivityManager
diff --git a/app/src/main/java/com/appttude/h_mal/utils/SecondsToDateUtils.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/SecondsToDateUtils.kt
similarity index 97%
rename from app/src/main/java/com/appttude/h_mal/utils/SecondsToDateUtils.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/utils/SecondsToDateUtils.kt
index 174c532..ed63e3f 100644
--- a/app/src/main/java/com/appttude/h_mal/utils/SecondsToDateUtils.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/SecondsToDateUtils.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.utils
+package com.appttude.h_mal.atlas_weather.utils
import android.os.Build
diff --git a/app/src/main/java/com/appttude/h_mal/utils/StringUtils.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/StringUtils.kt
similarity index 84%
rename from app/src/main/java/com/appttude/h_mal/utils/StringUtils.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/utils/StringUtils.kt
index 1efb23e..b91c05f 100644
--- a/app/src/main/java/com/appttude/h_mal/utils/StringUtils.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/StringUtils.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.utils
+package com.appttude.h_mal.atlas_weather.utils
fun generateIconUrlString(icon: String?): String?{
diff --git a/app/src/main/java/com/appttude/h_mal/utils/ViewUtils.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/ViewUtils.kt
similarity index 93%
rename from app/src/main/java/com/appttude/h_mal/utils/ViewUtils.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/utils/ViewUtils.kt
index 3ddafee..e0fd948 100644
--- a/app/src/main/java/com/appttude/h_mal/utils/ViewUtils.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/utils/ViewUtils.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.utils
+package com.appttude.h_mal.atlas_weather.utils
import android.app.Activity
import android.content.Context
@@ -10,7 +10,7 @@ import android.view.inputmethod.InputMethodManager
import android.widget.ImageView
import android.widget.Toast
import androidx.fragment.app.Fragment
-import com.appttude.h_mal.R
+import com.appttude.h_mal.atlas_weather.R
import com.squareup.picasso.Picasso
fun View.show() {
diff --git a/app/src/main/java/com/appttude/h_mal/viewmodel/ApplicationViewModelFactory.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/ApplicationViewModelFactory.kt
similarity index 79%
rename from app/src/main/java/com/appttude/h_mal/viewmodel/ApplicationViewModelFactory.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/ApplicationViewModelFactory.kt
index 635bdd3..84a1591 100644
--- a/app/src/main/java/com/appttude/h_mal/viewmodel/ApplicationViewModelFactory.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/ApplicationViewModelFactory.kt
@@ -1,9 +1,9 @@
-package com.appttude.h_mal.viewmodel
+package com.appttude.h_mal.atlas_weather.viewmodel
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
-import com.appttude.h_mal.data.location.LocationProvider
-import com.appttude.h_mal.data.repository.RepositoryImpl
+import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
+import com.appttude.h_mal.atlas_weather.data.repository.RepositoryImpl
class ApplicationViewModelFactory(
diff --git a/app/src/main/java/com/appttude/h_mal/viewmodel/MainViewModel.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/MainViewModel.kt
similarity index 76%
rename from app/src/main/java/com/appttude/h_mal/viewmodel/MainViewModel.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/MainViewModel.kt
index 0a8bf30..d957bc0 100644
--- a/app/src/main/java/com/appttude/h_mal/viewmodel/MainViewModel.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/MainViewModel.kt
@@ -1,22 +1,22 @@
-package com.appttude.h_mal.viewmodel
+package com.appttude.h_mal.atlas_weather.viewmodel
import android.Manifest
import androidx.annotation.RequiresPermission
import androidx.lifecycle.MutableLiveData
-import com.appttude.h_mal.data.location.LocationProvider
-import com.appttude.h_mal.data.repository.Repository
-import com.appttude.h_mal.data.room.entity.CURRENT_LOCATION
-import com.appttude.h_mal.data.room.entity.EntityItem
-import com.appttude.h_mal.model.forecast.WeatherDisplay
-import com.appttude.h_mal.utils.Event
-import com.appttude.h_mal.viewmodel.baseViewModels.WeatherViewModel
+import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
+import com.appttude.h_mal.atlas_weather.data.repository.Repository
+import com.appttude.h_mal.atlas_weather.data.room.entity.CURRENT_LOCATION
+import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
+import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
+import com.appttude.h_mal.atlas_weather.utils.Event
+import com.appttude.h_mal.atlas_weather.viewmodel.baseViewModels.WeatherViewModel
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class MainViewModel(
- private val locationProvider: LocationProvider,
- private val repository: Repository
+ private val locationProvider: LocationProvider,
+ private val repository: Repository
): WeatherViewModel(){
val weatherLiveData = MutableLiveData()
diff --git a/app/src/main/java/com/appttude/h_mal/viewmodel/WorldViewModel.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/WorldViewModel.kt
similarity index 89%
rename from app/src/main/java/com/appttude/h_mal/viewmodel/WorldViewModel.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/WorldViewModel.kt
index 65567c7..3599b24 100644
--- a/app/src/main/java/com/appttude/h_mal/viewmodel/WorldViewModel.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/WorldViewModel.kt
@@ -1,14 +1,14 @@
-package com.appttude.h_mal.viewmodel
+package com.appttude.h_mal.atlas_weather.viewmodel
import androidx.lifecycle.MutableLiveData
-import com.appttude.h_mal.data.location.LocationProvider
-import com.appttude.h_mal.data.network.response.forecast.WeatherResponse
-import com.appttude.h_mal.data.repository.Repository
-import com.appttude.h_mal.data.room.entity.EntityItem
-import com.appttude.h_mal.model.forecast.WeatherDisplay
-import com.appttude.h_mal.model.types.LocationType
-import com.appttude.h_mal.utils.Event
-import com.appttude.h_mal.viewmodel.baseViewModels.WeatherViewModel
+import com.appttude.h_mal.atlas_weather.data.location.LocationProvider
+import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
+import com.appttude.h_mal.atlas_weather.data.repository.Repository
+import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
+import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
+import com.appttude.h_mal.atlas_weather.model.types.LocationType
+import com.appttude.h_mal.atlas_weather.utils.Event
+import com.appttude.h_mal.atlas_weather.viewmodel.baseViewModels.WeatherViewModel
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -16,8 +16,8 @@ import java.io.IOException
const val ALL_LOADED = "all_loaded"
class WorldViewModel(
- private val locationProvider: LocationProvider,
- private val repository: Repository
+ private val locationProvider: LocationProvider,
+ private val repository: Repository
) : WeatherViewModel() {
val weatherLiveData = MutableLiveData>()
diff --git a/app/src/main/java/com/appttude/h_mal/viewmodel/baseViewModels/WeatherViewModel.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/baseViewModels/WeatherViewModel.kt
similarity index 66%
rename from app/src/main/java/com/appttude/h_mal/viewmodel/baseViewModels/WeatherViewModel.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/baseViewModels/WeatherViewModel.kt
index 8d2fc54..0880017 100644
--- a/app/src/main/java/com/appttude/h_mal/viewmodel/baseViewModels/WeatherViewModel.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/viewmodel/baseViewModels/WeatherViewModel.kt
@@ -1,9 +1,9 @@
-package com.appttude.h_mal.viewmodel.baseViewModels
+package com.appttude.h_mal.atlas_weather.viewmodel.baseViewModels
import androidx.lifecycle.ViewModel
-import com.appttude.h_mal.data.network.response.forecast.WeatherResponse
-import com.appttude.h_mal.data.room.entity.EntityItem
-import com.appttude.h_mal.model.weather.FullWeather
+import com.appttude.h_mal.atlas_weather.data.network.response.forecast.WeatherResponse
+import com.appttude.h_mal.atlas_weather.data.room.entity.EntityItem
+import com.appttude.h_mal.atlas_weather.model.weather.FullWeather
abstract class WeatherViewModel : ViewModel(){
diff --git a/app/src/main/java/com/appttude/h_mal/widget/BaseWidgetServiceIntentClass.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/widget/BaseWidgetServiceIntentClass.kt
similarity index 98%
rename from app/src/main/java/com/appttude/h_mal/widget/BaseWidgetServiceIntentClass.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/widget/BaseWidgetServiceIntentClass.kt
index dc45dbb..f85283f 100644
--- a/app/src/main/java/com/appttude/h_mal/widget/BaseWidgetServiceIntentClass.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/widget/BaseWidgetServiceIntentClass.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.widget
+package com.appttude.h_mal.atlas_weather.widget
import android.app.Activity
import android.app.PendingIntent
diff --git a/app/src/main/java/com/appttude/h_mal/widget/NewAppWidget.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/widget/NewAppWidget.kt
similarity index 84%
rename from app/src/main/java/com/appttude/h_mal/widget/NewAppWidget.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/widget/NewAppWidget.kt
index 16c34c0..23afa27 100644
--- a/app/src/main/java/com/appttude/h_mal/widget/NewAppWidget.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/widget/NewAppWidget.kt
@@ -1,10 +1,10 @@
-package com.appttude.h_mal.widget
+package com.appttude.h_mal.atlas_weather.widget
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.Context
import android.content.Intent
-import com.appttude.h_mal.widget.WidgetJobServiceIntent.Companion.enqueueWork
+import com.appttude.h_mal.atlas_weather.widget.WidgetJobServiceIntent.Companion.enqueueWork
/**
* Implementation of App Widget functionality.
diff --git a/app/src/main/java/com/appttude/h_mal/widget/WidgetJobServiceIntent.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/widget/WidgetJobServiceIntent.kt
similarity index 92%
rename from app/src/main/java/com/appttude/h_mal/widget/WidgetJobServiceIntent.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/widget/WidgetJobServiceIntent.kt
index 95ada62..913a9b9 100644
--- a/app/src/main/java/com/appttude/h_mal/widget/WidgetJobServiceIntent.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/widget/WidgetJobServiceIntent.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.widget
+package com.appttude.h_mal.atlas_weather.widget
import android.Manifest.permission.ACCESS_COARSE_LOCATION
import android.annotation.SuppressLint
@@ -12,15 +12,15 @@ import android.os.PowerManager
import android.widget.RemoteViews
import android.os.Build
import androidx.core.app.ActivityCompat.checkSelfPermission
-import com.appttude.h_mal.R
-import com.appttude.h_mal.widget.WidgetState.*
-import com.appttude.h_mal.widget.WidgetState.Companion.getWidgetState
-import com.appttude.h_mal.helper.ServicesHelper
-import com.appttude.h_mal.model.widget.InnerWidgetCellData
-import com.appttude.h_mal.model.widget.WidgetWeatherCollection
-import com.appttude.h_mal.ui.MainActivity
-import com.appttude.h_mal.utils.isInternetAvailable
-import com.appttude.h_mal.utils.tryOrNullSuspended
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.widget.WidgetState.*
+import com.appttude.h_mal.atlas_weather.widget.WidgetState.Companion.getWidgetState
+import com.appttude.h_mal.atlas_weather.helper.ServicesHelper
+import com.appttude.h_mal.atlas_weather.model.widget.InnerWidgetCellData
+import com.appttude.h_mal.atlas_weather.model.widget.WidgetWeatherCollection
+import com.appttude.h_mal.atlas_weather.ui.MainActivity
+import com.appttude.h_mal.atlas_weather.utils.isInternetAvailable
+import com.appttude.h_mal.atlas_weather.utils.tryOrNullSuspended
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
diff --git a/app/src/main/java/com/appttude/h_mal/widget/WidgetState.kt b/app/src/main/java/com/appttude/h_mal/atlas_weather/widget/WidgetState.kt
similarity index 94%
rename from app/src/main/java/com/appttude/h_mal/widget/WidgetState.kt
rename to app/src/main/java/com/appttude/h_mal/atlas_weather/widget/WidgetState.kt
index ea8a659..51c5a07 100644
--- a/app/src/main/java/com/appttude/h_mal/widget/WidgetState.kt
+++ b/app/src/main/java/com/appttude/h_mal/atlas_weather/widget/WidgetState.kt
@@ -1,4 +1,4 @@
-package com.appttude.h_mal.widget
+package com.appttude.h_mal.atlas_weather.widget
enum class WidgetState {
NO_LOCATION,
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/Api.kt b/app/src/main/java/com/appttude/h_mal/data/network/Api.kt
deleted file mode 100644
index e6e4624..0000000
--- a/app/src/main/java/com/appttude/h_mal/data/network/Api.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.appttude.h_mal.data.network
-
-interface Api
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/data/network/interceptors/NetworkInterceptor.kt b/app/src/main/java/com/appttude/h_mal/data/network/interceptors/NetworkInterceptor.kt
deleted file mode 100644
index cc2c023..0000000
--- a/app/src/main/java/com/appttude/h_mal/data/network/interceptors/NetworkInterceptor.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.appttude.h_mal.data.network.interceptors
-
-import okhttp3.Interceptor
-
-interface NetworkInterceptor : Interceptor
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/model/forecast/Forecast.kt b/app/src/main/java/com/appttude/h_mal/model/forecast/Forecast.kt
deleted file mode 100644
index a8b17a7..0000000
--- a/app/src/main/java/com/appttude/h_mal/model/forecast/Forecast.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.appttude.h_mal.model.forecast
-
-import android.os.Parcelable
-import com.appttude.h_mal.model.weather.DailyWeather
-import com.appttude.h_mal.utils.toDayName
-import com.appttude.h_mal.utils.toDayString
-import com.appttude.h_mal.utils.toTime
-import kotlinx.parcelize.Parcelize
-
-
-@Parcelize
-data class Forecast(
- val date: String?,
- val day: String?,
- val condition: String?,
- val weatherIcon: String?,
- val mainTemp: String?,
- val minorTemp: String?,
- val averageTemp: String?,
- val windText: String?,
- val precipitation: String?,
- val humidity: String?,
- val uvi: String?,
- val sunrise: String?,
- val sunset: String?,
- val cloud: String?
-) : Parcelable {
-
- constructor(dailyWeather: DailyWeather) : this(
- dailyWeather.dt?.toDayString(),
- dailyWeather.dt?.toDayName(),
- dailyWeather.description,
- dailyWeather.icon,
- dailyWeather.max?.toInt().toString(),
- dailyWeather.min?.toInt().toString(),
- dailyWeather.average?.toInt().toString(),
- dailyWeather.windSpeed?.toInt().toString(),
- (dailyWeather.pop?.times(100))?.toInt().toString(),
- dailyWeather.humidity?.toString(),
- dailyWeather.uvi?.toInt().toString(),
- dailyWeather.sunrise?.toTime(),
- dailyWeather.sunset?.toTime(),
- dailyWeather.clouds?.toString()
- )
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/model/forecast/WeatherDisplay.kt b/app/src/main/java/com/appttude/h_mal/model/forecast/WeatherDisplay.kt
deleted file mode 100644
index 066561c..0000000
--- a/app/src/main/java/com/appttude/h_mal/model/forecast/WeatherDisplay.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.appttude.h_mal.model.forecast
-
-import android.os.Parcelable
-import com.appttude.h_mal.data.room.entity.EntityItem
-import com.appttude.h_mal.model.weather.Hour
-import kotlinx.parcelize.Parcelize
-
-
-@Parcelize
-data class WeatherDisplay(
- val averageTemp: Double?,
- var unit: String?,
- var location: String?,
- val iconURL: String?,
- val description: String?,
- val hourly: List?,
- val forecast: List?,
- val windSpeed: String?,
- val windDirection: String?,
- val precipitation: String?,
- val humidity: String?,
- val clouds: String?,
- val lat: Double = 0.00,
- val lon: Double = 0.00,
- var displayName: String?
-) : Parcelable {
-
- constructor(entity: EntityItem) : this(
- entity.weather.current?.temp,
- entity.weather.temperatureUnit,
- entity.id,
- entity.weather.current?.icon,
- entity.weather.current?.description,
- entity.weather.hourly,
- entity.weather.daily?.drop(1)?.map { Forecast(it) },
- entity.weather.current?.windSpeed?.toString(),
- entity.weather.current?.windDeg?.toString(),
- entity.weather.daily?.get(0)?.pop?.times(100)?.toInt()?.toString(),
- entity.weather.current?.humidity?.toString(),
- entity.weather.current?.clouds?.toString(),
- entity.weather.lat,
- entity.weather.lon,
- entity.weather.locationString
- )
-
-}
-
diff --git a/app/src/main/java/com/appttude/h_mal/model/types/LocationType.kt b/app/src/main/java/com/appttude/h_mal/model/types/LocationType.kt
deleted file mode 100644
index 71e7673..0000000
--- a/app/src/main/java/com/appttude/h_mal/model/types/LocationType.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.appttude.h_mal.model.types
-
-enum class LocationType{
- City,
- Town
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/model/weather/Hour.kt b/app/src/main/java/com/appttude/h_mal/model/weather/Hour.kt
deleted file mode 100644
index 02011ad..0000000
--- a/app/src/main/java/com/appttude/h_mal/model/weather/Hour.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.appttude.h_mal.model.weather
-
-import android.os.Parcelable
-import com.appttude.h_mal.utils.generateIconUrlString
-import kotlinx.parcelize.Parcelize
-import com.appttude.h_mal.data.network.response.forecast.Hour as ForecastHour
-
-
-@Parcelize
-data class Hour(
- val dt: Int? = null,
- val temp: Double? = null,
- val icon: String? = null
-) : Parcelable {
-
- constructor(hour: ForecastHour) : this(
- hour.dt,
- hour.temp,
- generateIconUrlString(hour.weather?.getOrNull(0)?.icon)
- )
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/appttude/h_mal/utils/Constants.kt b/app/src/main/java/com/appttude/h_mal/utils/Constants.kt
deleted file mode 100644
index 7c8efa2..0000000
--- a/app/src/main/java/com/appttude/h_mal/utils/Constants.kt
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.appttude.h_mal.utils
-
-val FALLBACK_TIME: Long = 300000L
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_add_forecast.xml b/app/src/main/res/layout/activity_add_forecast.xml
index fa4ad40..4a73dc5 100644
--- a/app/src/main/res/layout/activity_add_forecast.xml
+++ b/app/src/main/res/layout/activity_add_forecast.xml
@@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- tools:context="com.appttude.h_mal.ui.world.AddLocationFragment">
+ tools:context="com.appttude.h_mal.atlas_weather.ui.world.AddLocationFragment">
+ tools:context="com.appttude.h_mal.atlas_weather.ui.world.WorldFragment">
+ tools:context="com.appttude.h_mal.atlas_weather.ui.world.AddLocationFragment">
-
@@ -49,7 +49,7 @@
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/atlas_weather/ui/Tabs.kt b/app/src/monoWeather/java/com/appttude/h_mal/atlas_weather/ui/Tabs.kt
new file mode 100644
index 0000000..9f13728
--- /dev/null
+++ b/app/src/monoWeather/java/com/appttude/h_mal/atlas_weather/ui/Tabs.kt
@@ -0,0 +1,5 @@
+package com.appttude.h_mal.atlas_weather.ui
+
+import com.appttude.h_mal.atlas_weather.R
+
+val tabs = setOf(R.id.nav_home, R.id.nav_world)
\ No newline at end of file
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/BaseFragment.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/BaseFragment.kt
index 0541aad..0897437 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/BaseFragment.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/BaseFragment.kt
@@ -13,12 +13,12 @@ import androidx.fragment.app.viewModels
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModel
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
-import com.appttude.h_mal.application.LOCATION_PERMISSION_REQUEST
-import com.appttude.h_mal.utils.Event
-import com.appttude.h_mal.utils.displayToast
-import com.appttude.h_mal.utils.hide
-import com.appttude.h_mal.utils.show
-import com.appttude.h_mal.viewmodel.ApplicationViewModelFactory
+import com.appttude.h_mal.atlas_weather.application.LOCATION_PERMISSION_REQUEST
+import com.appttude.h_mal.atlas_weather.viewmodel.ApplicationViewModelFactory
+import com.appttude.h_mal.atlas_weather.utils.Event
+import com.appttude.h_mal.atlas_weather.utils.displayToast
+import com.appttude.h_mal.atlas_weather.utils.hide
+import com.appttude.h_mal.atlas_weather.utils.show
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/EmptyViewHolder.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/EmptyViewHolder.kt
index 4cd5f3e..b70748e 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/EmptyViewHolder.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/EmptyViewHolder.kt
@@ -5,7 +5,7 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.DrawableRes
import androidx.recyclerview.widget.RecyclerView
-import com.appttude.h_mal.R
+import com.appttude.h_mal.atlas_weather.R
class EmptyViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){
val icon: ImageView = itemView.findViewById(R.id.icon)
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/Tabs.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/Tabs.kt
deleted file mode 100644
index 17fb6ad..0000000
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/Tabs.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.appttude.h_mal.monoWeather.ui
-
-import com.appttude.h_mal.R
-
-val tabs = setOf(R.id.nav_home, R.id.nav_world)
\ No newline at end of file
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/WorldItemFragment.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/WorldItemFragment.kt
index 90102c8..bea6bb2 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/WorldItemFragment.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/WorldItemFragment.kt
@@ -5,10 +5,10 @@ import android.os.Bundle
import android.view.View
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
-import com.appttude.h_mal.R
+import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.monoWeather.ui.home.adapter.WeatherRecyclerAdapter
-import com.appttude.h_mal.utils.navigateTo
-import com.appttude.h_mal.viewmodel.WorldViewModel
+import com.appttude.h_mal.atlas_weather.utils.navigateTo
+import com.appttude.h_mal.atlas_weather.viewmodel.WorldViewModel
import kotlinx.android.synthetic.main.fragment_home.*
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/details/FurtherInfoFragment.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/details/FurtherInfoFragment.kt
index 2b7c6f5..8abaec1 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/details/FurtherInfoFragment.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/details/FurtherInfoFragment.kt
@@ -5,8 +5,8 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
-import com.appttude.h_mal.R
-import com.appttude.h_mal.model.forecast.Forecast
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.model.forecast.Forecast
import kotlinx.android.synthetic.main.activity_further_info.*
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/HomeFragment.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/HomeFragment.kt
index 4e581d5..45411c2 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/HomeFragment.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/HomeFragment.kt
@@ -10,14 +10,14 @@ import android.view.View
import androidx.fragment.app.Fragment
import androidx.navigation.Navigation.findNavController
import androidx.navigation.ui.onNavDestinationSelected
-import com.appttude.h_mal.R
-import com.appttude.h_mal.application.LOCATION_PERMISSION_REQUEST
-import com.appttude.h_mal.model.forecast.Forecast
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.application.LOCATION_PERMISSION_REQUEST
+import com.appttude.h_mal.atlas_weather.model.forecast.Forecast
import com.appttude.h_mal.monoWeather.dialog.PermissionsDeclarationDialog
import com.appttude.h_mal.monoWeather.ui.BaseFragment
import com.appttude.h_mal.monoWeather.ui.home.adapter.WeatherRecyclerAdapter
-import com.appttude.h_mal.utils.navigateTo
-import com.appttude.h_mal.viewmodel.MainViewModel
+import com.appttude.h_mal.atlas_weather.utils.navigateTo
+import com.appttude.h_mal.atlas_weather.viewmodel.MainViewModel
import kotlinx.android.synthetic.main.fragment_home.*
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/ViewHolderCurrent.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/ViewHolderCurrent.kt
index d9aabad..902174e 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/ViewHolderCurrent.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/ViewHolderCurrent.kt
@@ -4,9 +4,9 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
-import com.appttude.h_mal.R
-import com.appttude.h_mal.model.forecast.WeatherDisplay
-import com.appttude.h_mal.utils.loadImage
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
+import com.appttude.h_mal.atlas_weather.utils.loadImage
class ViewHolderCurrent(listItemView: View) : RecyclerView.ViewHolder(listItemView) {
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/WeatherRecyclerAdapter.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/WeatherRecyclerAdapter.kt
index 7511486..2e2da9d 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/WeatherRecyclerAdapter.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/WeatherRecyclerAdapter.kt
@@ -2,14 +2,14 @@ package com.appttude.h_mal.monoWeather.ui.home.adapter
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
-import com.appttude.h_mal.R
-import com.appttude.h_mal.model.forecast.Forecast
-import com.appttude.h_mal.model.forecast.WeatherDisplay
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.model.forecast.Forecast
+import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
import com.appttude.h_mal.monoWeather.ui.EmptyViewHolder
import com.appttude.h_mal.monoWeather.ui.home.adapter.forecast.ViewHolderForecast
import com.appttude.h_mal.monoWeather.ui.home.adapter.forecastDaily.ViewHolderForecastDaily
import com.appttude.h_mal.monoWeather.ui.home.adapter.further.ViewHolderFurtherDetails
-import com.appttude.h_mal.utils.generateView
+import com.appttude.h_mal.atlas_weather.utils.generateView
class WeatherRecyclerAdapter(
private val itemClick: (Forecast) -> Unit
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/GridCellHolder.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/GridCellHolder.kt
index 5a10c60..f1ce9c5 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/GridCellHolder.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/GridCellHolder.kt
@@ -4,10 +4,10 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
-import com.appttude.h_mal.R
-import com.appttude.h_mal.model.weather.Hour
-import com.appttude.h_mal.utils.loadImage
-import com.appttude.h_mal.utils.toTime
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.model.weather.Hour
+import com.appttude.h_mal.atlas_weather.utils.loadImage
+import com.appttude.h_mal.atlas_weather.utils.toTime
class GridCellHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/GridForecastAdapter.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/GridForecastAdapter.kt
index 3ffa0da..e868950 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/GridForecastAdapter.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/GridForecastAdapter.kt
@@ -2,9 +2,9 @@ package com.appttude.h_mal.monoWeather.ui.home.adapter.forecast
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
-import com.appttude.h_mal.R
-import com.appttude.h_mal.model.weather.Hour
-import com.appttude.h_mal.utils.generateView
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.model.weather.Hour
+import com.appttude.h_mal.atlas_weather.utils.generateView
class GridForecastAdapter(): RecyclerView.Adapter(){
var weather: MutableList = mutableListOf()
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/ViewHolderForecast.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/ViewHolderForecast.kt
index f3e210c..57c27d1 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/ViewHolderForecast.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecast/ViewHolderForecast.kt
@@ -2,8 +2,8 @@ package com.appttude.h_mal.monoWeather.ui.home.adapter.forecast
import android.view.View
import androidx.recyclerview.widget.RecyclerView
-import com.appttude.h_mal.R
-import com.appttude.h_mal.model.weather.Hour
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.model.weather.Hour
class ViewHolderForecast(
itemView: View
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecastDaily/ViewHolderForecastDaily.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecastDaily/ViewHolderForecastDaily.kt
index db4b815..b2d5448 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecastDaily/ViewHolderForecastDaily.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/forecastDaily/ViewHolderForecastDaily.kt
@@ -4,9 +4,9 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
-import com.appttude.h_mal.R
-import com.appttude.h_mal.model.forecast.Forecast
-import com.appttude.h_mal.utils.loadImage
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.model.forecast.Forecast
+import com.appttude.h_mal.atlas_weather.utils.loadImage
class ViewHolderForecastDaily(itemView: View) : RecyclerView.ViewHolder(itemView) {
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/further/GridAdapter.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/further/GridAdapter.kt
index 9fc4a19..22d55d3 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/further/GridAdapter.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/further/GridAdapter.kt
@@ -4,8 +4,8 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
-import com.appttude.h_mal.R
-import com.appttude.h_mal.utils.generateView
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.utils.generateView
import kotlinx.android.synthetic.monoWeather.mono_item_two_cell.view.*
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/further/ViewHolderFurtherDetails.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/further/ViewHolderFurtherDetails.kt
index f0a8626..e90b313 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/further/ViewHolderFurtherDetails.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/home/adapter/further/ViewHolderFurtherDetails.kt
@@ -3,8 +3,8 @@ package com.appttude.h_mal.monoWeather.ui.home.adapter.further
import android.view.View
import android.widget.GridView
import androidx.recyclerview.widget.RecyclerView
-import com.appttude.h_mal.R
-import com.appttude.h_mal.model.forecast.WeatherDisplay
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
class ViewHolderFurtherDetails(itemView: View) : RecyclerView.ViewHolder(itemView) {
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/settings/SettingsFragment.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/settings/SettingsFragment.kt
index d1f6521..e85ef9b 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/settings/SettingsFragment.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/settings/SettingsFragment.kt
@@ -6,8 +6,8 @@ import android.content.Intent
import android.os.Bundle
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceManager
-import com.appttude.h_mal.R
-import com.appttude.h_mal.widget.NewAppWidget
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.widget.NewAppWidget
class SettingsFragment : PreferenceFragmentCompat() {
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/settings/UnitSettingsActivity.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/settings/UnitSettingsActivity.kt
deleted file mode 100644
index a22f090..0000000
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/settings/UnitSettingsActivity.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.appttude.h_mal.monoWeather.ui.settings
-
-import android.appwidget.AppWidgetManager
-import android.content.ComponentName
-import android.content.Intent
-import android.content.SharedPreferences.OnSharedPreferenceChangeListener
-import android.os.Bundle
-import android.preference.PreferenceActivity
-import android.preference.PreferenceFragment
-import androidx.preference.PreferenceManager
-import com.appttude.h_mal.R
-import com.appttude.h_mal.widget.NewAppWidget
-
-
-class UnitSettingsActivity : PreferenceActivity() {
- private var prefListener: OnSharedPreferenceChangeListener? = null
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- PreferenceManager.setDefaultValues(this, R.xml.prefs_screen, false)
- fragmentManager.beginTransaction().replace(android.R.id.content, MyPreferenceFragment()).commit()
-
- //listener on changed sort order preference:
- val prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext)
- prefListener = OnSharedPreferenceChangeListener { _, key ->
- if (key == "temp_units") {
- val intent = Intent(baseContext, NewAppWidget::class.java)
- intent.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
- val ids = AppWidgetManager.getInstance(application).getAppWidgetIds(ComponentName(application, NewAppWidget::class.java))
- intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
- sendBroadcast(intent)
- }
-
- if (key == "widget_black_background"){
- val intent = Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE)
- val widgetManager = AppWidgetManager.getInstance(this)
- val ids = widgetManager.getAppWidgetIds(ComponentName(this, NewAppWidget::class.java))
- AppWidgetManager.getInstance(this).notifyAppWidgetViewDataChanged(ids, R.id.whole_widget_view)
- intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
- sendBroadcast(intent)
- }
- }
- prefs.registerOnSharedPreferenceChangeListener(prefListener)
- }
-
-
- class MyPreferenceFragment : PreferenceFragment() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- addPreferencesFromResource(R.xml.prefs_screen)
- }
- }
-}
-
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/widget/WidgetLocationPermissionActivity.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/widget/WidgetLocationPermissionActivity.kt
index 886776b..095c5bf 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/widget/WidgetLocationPermissionActivity.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/widget/WidgetLocationPermissionActivity.kt
@@ -10,9 +10,9 @@ import android.text.method.LinkMovementMethod
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat.checkSelfPermission
-import com.appttude.h_mal.R
+import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.monoWeather.dialog.DeclarationBuilder
-import com.appttude.h_mal.utils.displayToast
+import com.appttude.h_mal.atlas_weather.utils.displayToast
import kotlinx.android.synthetic.monoWeather.permissions_declaration_dialog.*
const val PERMISSION_CODE = 401
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/AddLocationFragment.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/AddLocationFragment.kt
index 4d63339..1974335 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/AddLocationFragment.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/AddLocationFragment.kt
@@ -3,12 +3,12 @@ package com.appttude.h_mal.monoWeather.ui.world
import android.os.Bundle
import android.view.View
import androidx.lifecycle.observe
-import com.appttude.h_mal.R
+import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.monoWeather.ui.BaseFragment
-import com.appttude.h_mal.utils.displayToast
-import com.appttude.h_mal.utils.goBack
-import com.appttude.h_mal.utils.hideKeyboard
-import com.appttude.h_mal.viewmodel.WorldViewModel
+import com.appttude.h_mal.atlas_weather.utils.displayToast
+import com.appttude.h_mal.atlas_weather.utils.goBack
+import com.appttude.h_mal.atlas_weather.utils.hideKeyboard
+import com.appttude.h_mal.atlas_weather.viewmodel.WorldViewModel
import kotlinx.android.synthetic.main.activity_add_forecast.*
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/WorldFragment.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/WorldFragment.kt
index 99004b6..24fef43 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/WorldFragment.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/WorldFragment.kt
@@ -5,11 +5,11 @@ import android.view.View
import androidx.fragment.app.Fragment
import androidx.lifecycle.observe
import androidx.recyclerview.widget.LinearLayoutManager
-import com.appttude.h_mal.R
+import com.appttude.h_mal.atlas_weather.R
import com.appttude.h_mal.monoWeather.ui.BaseFragment
import com.appttude.h_mal.monoWeather.ui.world.WorldFragmentDirections.actionWorldFragmentToWorldItemFragment
-import com.appttude.h_mal.utils.navigateTo
-import com.appttude.h_mal.viewmodel.WorldViewModel
+import com.appttude.h_mal.atlas_weather.utils.navigateTo
+import com.appttude.h_mal.atlas_weather.viewmodel.WorldViewModel
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.android.synthetic.main.fragment__two.*
import kotlinx.android.synthetic.main.fragment_add_location.floatingActionButton
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/WorldRecyclerAdapter.kt b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/WorldRecyclerAdapter.kt
index f6c4abc..6f06e01 100644
--- a/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/WorldRecyclerAdapter.kt
+++ b/app/src/monoWeather/java/com/appttude/h_mal/monoWeather/ui/world/WorldRecyclerAdapter.kt
@@ -5,11 +5,11 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
-import com.appttude.h_mal.R
-import com.appttude.h_mal.model.forecast.WeatherDisplay
+import com.appttude.h_mal.atlas_weather.R
+import com.appttude.h_mal.atlas_weather.model.forecast.WeatherDisplay
import com.appttude.h_mal.monoWeather.ui.EmptyViewHolder
-import com.appttude.h_mal.utils.generateView
-import com.appttude.h_mal.utils.loadImage
+import com.appttude.h_mal.atlas_weather.utils.generateView
+import com.appttude.h_mal.atlas_weather.utils.loadImage
class WorldRecyclerAdapter(
private val itemClick: (WeatherDisplay) -> Unit,
diff --git a/app/src/monoWeather/java/com/appttude/h_mal/ui/Tabs.kt b/app/src/monoWeather/java/com/appttude/h_mal/ui/Tabs.kt
deleted file mode 100644
index 7982cf4..0000000
--- a/app/src/monoWeather/java/com/appttude/h_mal/ui/Tabs.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.appttude.h_mal.ui
-
-import com.appttude.h_mal.R
-
-val tabs = setOf(R.id.nav_home, R.id.nav_world)
\ No newline at end of file
diff --git a/app/src/monoWeather/res/navigation/main_navigation.xml b/app/src/monoWeather/res/navigation/main_navigation.xml
index 5c49644..414c80b 100644
--- a/app/src/monoWeather/res/navigation/main_navigation.xml
+++ b/app/src/monoWeather/res/navigation/main_navigation.xml
@@ -21,7 +21,7 @@
android:label="Further Details">
diff --git a/fastlane/Appfile b/fastlane/Appfile
new file mode 100644
index 0000000..2636069
--- /dev/null
+++ b/fastlane/Appfile
@@ -0,0 +1,2 @@
+json_key_file("") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
+package_name("") # e.g. com.krausefx.app
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
new file mode 100644
index 0000000..19c557c
--- /dev/null
+++ b/fastlane/Fastfile
@@ -0,0 +1,38 @@
+# This file contains the fastlane.tools configuration
+# You can find the documentation at https://docs.fastlane.tools
+#
+# For a list of all available actions, check out
+#
+# https://docs.fastlane.tools/actions
+#
+# For a list of all available plugins, check out
+#
+# https://docs.fastlane.tools/plugins/available-plugins
+#
+
+# Uncomment the line if you want fastlane to automatically update itself
+# update_fastlane
+
+default_platform(:android)
+
+platform :android do
+ desc "Runs all the tests"
+ lane :test do
+ gradle(task: "test")
+ end
+
+ desc "Submit a new Beta Build to Crashlytics Beta"
+ lane :beta do
+ gradle(task: "clean assembleRelease")
+ crashlytics
+
+ # sh "your_script.sh"
+ # You can also use other beta testing services here
+ end
+
+ desc "Deploy a new version to the Google Play"
+ lane :deploy do
+ gradle(task: "clean assembleRelease")
+ upload_to_play_store
+ end
+end