diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..b9a076d --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,53 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/2.0/configuration-reference +# For a detailed guide to building and testing on Android, read the docs: +# https://circleci.com/docs/2.0/language-android/ for more details. +version: 2.1 + +# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects. +# See: https://circleci.com/docs/2.0/orb-intro/ +orbs: + android: circleci/android@1.0.3 + +# Define a job to be invoked later in a workflow. +# See: https://circleci.com/docs/2.0/configuration-reference/#jobs +jobs: + # Below is the definition of your job to build and test your app, you can rename and customize it as you want. + build-and-test: + # These next lines define the Android machine image executor. + # See: https://circleci.com/docs/2.0/executor-types/ + executor: + name: android/android-machine + + # Add steps to the job + # See: https://circleci.com/docs/2.0/configuration-reference/#steps + steps: + - checkout + - restore_cache: + key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} + - run: + name: Chmod permissions + command: sudo chmod +x ./gradlew + - run: + name: Download Dependencies + command: ./gradlew androidDependencies + - save_cache: + paths: + - ~/.gradle + key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }} + - run: + name: Run Tests + command: ./gradlew lint test + - store_artifacts: + path: app/build/reports + destination: reports + - store_test_results: + path: app/build/test-results + +# Invoke jobs via workflows +# See: https://circleci.com/docs/2.0/configuration-reference/#workflows +workflows: + sample: # This is the name of the workflow, feel free to change it to better match your workflow. + # Inside the workflow, you define the jobs you want to run. + jobs: + - build-and-test diff --git a/app/build.gradle b/app/build.gradle index 730742b..a28e903 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,6 +7,9 @@ apply plugin: 'kotlin-kapt' apply plugin: 'androidx.navigation.safeargs' android { + lintOptions { + abortOnError false + } compileSdkVersion 30 defaultConfig { applicationId "com.appttude.h_mal.atlas_weather" diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/notification/NotificationReceiver.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/notification/NotificationReceiver.kt index 38c58c4..8db5f0f 100644 --- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/notification/NotificationReceiver.kt +++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/notification/NotificationReceiver.kt @@ -28,10 +28,11 @@ import org.kodein.di.generic.instance * Updated by h_mal on 27/11/2020 */ const val NOTIFICATION_CHANNEL_ID = "my_notification_channel_1" + class NotificationReceiver : BroadcastReceiver() { private val kodein = LateInitKodein() - private val helper : ServicesHelper by kodein.instance() + private val helper: ServicesHelper by kodein.instance() override fun onReceive(context: Context, intent: Intent) { kodein.baseKodein = (context.applicationContext as KodeinAware).kodein @@ -41,14 +42,7 @@ class NotificationReceiver : BroadcastReceiver() { return } - if (helper.isEnabled()) { - CoroutineScope(Dispatchers.IO).launch { - helper.getData()?.let { - pushNotif(context, it) - } - } - } - helper.setFirstTimer() + // notification validation } private fun pushNotif(context: Context?, weather: FullWeather) { @@ -62,7 +56,7 @@ class NotificationReceiver : BroadcastReceiver() { val pendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT) val builder = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - Notification.Builder(context, NOTIFICATION_CHANNEL_ID ) + Notification.Builder(context, NOTIFICATION_CHANNEL_ID) } else { Notification.Builder(context) } diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/ui/WorldItemFragment.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/ui/WorldItemFragment.kt index f134378..3650cac 100644 --- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/ui/WorldItemFragment.kt +++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/ui/WorldItemFragment.kt @@ -8,11 +8,9 @@ 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.WorldItemFragmentArgs import com.appttude.h_mal.atlas_weather.atlasWeather.ui.home.adapter.WeatherRecyclerAdapter import com.appttude.h_mal.atlas_weather.utils.navigateTo import kotlinx.android.synthetic.main.fragment_home.* -import kotlinx.android.synthetic.main.fragment_main.* class WorldItemFragment : Fragment() { diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/ui/world/WorldRecyclerAdapter.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/ui/world/WorldRecyclerAdapter.kt index 26a3cfb..6a0dd44 100644 --- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/ui/world/WorldRecyclerAdapter.kt +++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/ui/world/WorldRecyclerAdapter.kt @@ -77,14 +77,14 @@ class WorldRecyclerAdapter( var conditionTV: TextView = listItemView.findViewById(R.id.db_condition) var weatherIV: ImageView = listItemView.findViewById(R.id.db_icon) var avgTempTV: TextView = listItemView.findViewById(R.id.db_main_temp) - var tempUnit: TextView = listItemView.findViewById(R.id.db_minor_temp) +// var tempUnit: TextView = listItemView.findViewById(R.id.db_minor_temp) fun bindData(weather: WeatherDisplay?){ locationTV.text = weather?.location conditionTV.text = weather?.description weatherIV.loadImage(weather?.iconURL) avgTempTV.text = weather?.forecast?.get(0)?.mainTemp - tempUnit.text = weather?.unit +// tempUnit.text = weather?.unit } } diff --git a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/widget/NewAppWidget.kt b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/widget/NewAppWidget.kt index 215c6fd..eaad60b 100644 --- a/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/widget/NewAppWidget.kt +++ b/app/src/atlasWeather/java/com/appttude/h_mal/atlas_weather/atlasWeather/widget/NewAppWidget.kt @@ -116,7 +116,7 @@ class NewAppWidget : BaseWidgetClass() { 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) +// views.setImageViewBitmap(R.id.widget_current_icon, it.icon) val clickPendingIntentTemplate = createClickingPendingIntent(context, MainActivity::class.java) views.setPendingIntentTemplate(R.id.widget_listview, clickPendingIntentTemplate) diff --git a/app/src/atlasWeather/res/layout/new_app_widget.xml b/app/src/atlasWeather/res/layout/new_app_widget.xml new file mode 100644 index 0000000..677fc44 --- /dev/null +++ b/app/src/atlasWeather/res/layout/new_app_widget.xml @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_add_location.xml b/app/src/main/res/layout/fragment_add_location.xml index 683dbb4..0ed5671 100644 --- a/app/src/main/res/layout/fragment_add_location.xml +++ b/app/src/main/res/layout/fragment_add_location.xml @@ -33,6 +33,7 @@ android:focusable="true" /> LiveData.getOrAwaitValue( time: Long = 2, timeUnit: TimeUnit = TimeUnit.SECONDS