mirror of
https://github.com/hmalik144/Weather-apps.git
synced 2025-12-10 02:05:20 +00:00
Circleci project setup completed
- Add .circleci/config.yml - Errors resolved in atlas weather flavour - continue with Lint errors enabled - update to config.yml
This commit is contained in:
53
.circleci/config.yml
Normal file
53
.circleci/config.yml
Normal file
@@ -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
|
||||||
@@ -7,6 +7,9 @@ apply plugin: 'kotlin-kapt'
|
|||||||
apply plugin: 'androidx.navigation.safeargs'
|
apply plugin: 'androidx.navigation.safeargs'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
compileSdkVersion 30
|
compileSdkVersion 30
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.appttude.h_mal.atlas_weather"
|
applicationId "com.appttude.h_mal.atlas_weather"
|
||||||
|
|||||||
@@ -28,10 +28,11 @@ import org.kodein.di.generic.instance
|
|||||||
* Updated by h_mal on 27/11/2020
|
* Updated by h_mal on 27/11/2020
|
||||||
*/
|
*/
|
||||||
const val NOTIFICATION_CHANNEL_ID = "my_notification_channel_1"
|
const val NOTIFICATION_CHANNEL_ID = "my_notification_channel_1"
|
||||||
|
|
||||||
class NotificationReceiver : BroadcastReceiver() {
|
class NotificationReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
private val kodein = LateInitKodein()
|
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) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
kodein.baseKodein = (context.applicationContext as KodeinAware).kodein
|
kodein.baseKodein = (context.applicationContext as KodeinAware).kodein
|
||||||
@@ -41,14 +42,7 @@ class NotificationReceiver : BroadcastReceiver() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (helper.isEnabled()) {
|
// notification validation
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
|
||||||
helper.getData()?.let {
|
|
||||||
pushNotif(context, it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
helper.setFirstTimer()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun pushNotif(context: Context?, weather: FullWeather) {
|
private fun pushNotif(context: Context?, weather: FullWeather) {
|
||||||
@@ -62,7 +56,7 @@ class NotificationReceiver : BroadcastReceiver() {
|
|||||||
val pendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
|
val pendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||||
|
|
||||||
val builder = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
val builder = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
Notification.Builder(context, NOTIFICATION_CHANNEL_ID )
|
Notification.Builder(context, NOTIFICATION_CHANNEL_ID)
|
||||||
} else {
|
} else {
|
||||||
Notification.Builder(context)
|
Notification.Builder(context)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,9 @@ import androidx.fragment.app.Fragment
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.appttude.h_mal.atlas_weather.R
|
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.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.atlasWeather.ui.home.adapter.WeatherRecyclerAdapter
|
||||||
import com.appttude.h_mal.atlas_weather.utils.navigateTo
|
import com.appttude.h_mal.atlas_weather.utils.navigateTo
|
||||||
import kotlinx.android.synthetic.main.fragment_home.*
|
import kotlinx.android.synthetic.main.fragment_home.*
|
||||||
import kotlinx.android.synthetic.main.fragment_main.*
|
|
||||||
|
|
||||||
|
|
||||||
class WorldItemFragment : Fragment() {
|
class WorldItemFragment : Fragment() {
|
||||||
|
|||||||
@@ -77,14 +77,14 @@ class WorldRecyclerAdapter(
|
|||||||
var conditionTV: TextView = listItemView.findViewById(R.id.db_condition)
|
var conditionTV: TextView = listItemView.findViewById(R.id.db_condition)
|
||||||
var weatherIV: ImageView = listItemView.findViewById(R.id.db_icon)
|
var weatherIV: ImageView = listItemView.findViewById(R.id.db_icon)
|
||||||
var avgTempTV: TextView = listItemView.findViewById(R.id.db_main_temp)
|
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?){
|
fun bindData(weather: WeatherDisplay?){
|
||||||
locationTV.text = weather?.location
|
locationTV.text = weather?.location
|
||||||
conditionTV.text = weather?.description
|
conditionTV.text = weather?.description
|
||||||
weatherIV.loadImage(weather?.iconURL)
|
weatherIV.loadImage(weather?.iconURL)
|
||||||
avgTempTV.text = weather?.forecast?.get(0)?.mainTemp
|
avgTempTV.text = weather?.forecast?.get(0)?.mainTemp
|
||||||
tempUnit.text = weather?.unit
|
// tempUnit.text = weather?.unit
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class NewAppWidget : BaseWidgetClass() {
|
|||||||
views.setTextViewText(R.id.widget_feel_temp, "°C")
|
views.setTextViewText(R.id.widget_feel_temp, "°C")
|
||||||
views.setTextViewText(R.id.widget_current_location, it.location)
|
views.setTextViewText(R.id.widget_current_location, it.location)
|
||||||
views.setImageViewResource(R.id.location_icon, R.drawable.location_flag)
|
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)
|
val clickPendingIntentTemplate = createClickingPendingIntent(context, MainActivity::class.java)
|
||||||
views.setPendingIntentTemplate(R.id.widget_listview, clickPendingIntentTemplate)
|
views.setPendingIntentTemplate(R.id.widget_listview, clickPendingIntentTemplate)
|
||||||
|
|||||||
294
app/src/atlasWeather/res/layout/new_app_widget.xml
Normal file
294
app/src/atlasWeather/res/layout/new_app_widget.xml
Normal file
@@ -0,0 +1,294 @@
|
|||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/whole_widget_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:background="@android:color/black"
|
||||||
|
tools:layout_height="110dp">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextClock
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:format12Hour="EEE, d MMM"
|
||||||
|
android:format24Hour="EEE, d MMM"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="16sp"
|
||||||
|
tools:text="Wed, 3 Dec" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_current_status"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:maxWidth="180dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
android:textSize="12sp"
|
||||||
|
tools:text="Last updated 16:43" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/widget_current_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@id/location_container"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_marginLeft="32dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
tools:src="@drawable/ic_baseline_cloud_off_24" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/location_container"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_marginBottom="1dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/location_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginRight="2dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:tint="@android:color/white"
|
||||||
|
tools:src="@drawable/location_flag" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_current_location"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:maxWidth="180dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
style="@style/widget_light_home_text"
|
||||||
|
tools:text="Hammersmith Bridge" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginRight="12dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_main_temp"
|
||||||
|
style="@style/textView_major"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autoSizeMaxTextSize="100sp"
|
||||||
|
android:autoSizeMinTextSize="12sp"
|
||||||
|
android:autoSizeStepGranularity="2sp"
|
||||||
|
android:autoSizeTextType="uniform"
|
||||||
|
tools:text="32" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_feel_temp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:textColor="#ffffff"
|
||||||
|
tools:text="°C" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<GridLayout
|
||||||
|
android:id="@+id/widget_listview"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:columnCount="5"
|
||||||
|
android:rowCount="1">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_columnWeight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_item_day_0"
|
||||||
|
style="@style/widget_light_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="Wed" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/widget_item_image_0"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
tools:src="@drawable/ic_baseline_cloud_off_24" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_item_temp_high_0"
|
||||||
|
style="@style/widget_light_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="20" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_columnWeight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_item_day_1"
|
||||||
|
style="@style/widget_light_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="Wed" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/widget_item_image_1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
tools:src="@drawable/ic_baseline_cloud_off_24" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_item_temp_high_1"
|
||||||
|
style="@style/widget_light_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="20" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_columnWeight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_item_day_2"
|
||||||
|
style="@style/widget_light_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="Wed" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/widget_item_image_2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
tools:src="@drawable/ic_baseline_cloud_off_24" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_item_temp_high_2"
|
||||||
|
style="@style/widget_light_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="20" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_columnWeight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_item_day_3"
|
||||||
|
style="@style/widget_light_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="Wed" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/widget_item_image_3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
tools:src="@drawable/ic_baseline_cloud_off_24" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_item_temp_high_3"
|
||||||
|
style="@style/widget_light_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="20" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_columnWeight="1"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_item_day_4"
|
||||||
|
style="@style/widget_light_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="Wed" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/widget_item_image_4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
tools:src="@drawable/ic_baseline_cloud_off_24" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/widget_item_temp_high_4"
|
||||||
|
style="@style/widget_light_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
tools:text="20" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</GridLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
android:focusable="true" />
|
android:focusable="true" />
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar2"
|
||||||
style="?android:attr/progressBarStyle"
|
style="?android:attr/progressBarStyle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -37,18 +37,16 @@ class WorldViewModelTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun name() {
|
fun fetchDataForSingleLocation_invalidLocation_invalidReturn() {
|
||||||
val location = CURRENT_LOCATION
|
val location = CURRENT_LOCATION
|
||||||
|
|
||||||
viewModel.fetchDataForSingleLocation(location)
|
viewModel.fetchDataForSingleLocation(location)
|
||||||
|
|
||||||
assertEquals(viewModel.operationRefresh.getOrAwaitValue()?.getContentIfNotHandled(), true)
|
assertEquals(viewModel.operationRefresh.getOrAwaitValue()?.getContentIfNotHandled(), false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Copyright 2019 Google LLC.
|
|
||||||
SPDX-License-Identifier: Apache-2.0 */
|
|
||||||
fun <T> LiveData<T>.getOrAwaitValue(
|
fun <T> LiveData<T>.getOrAwaitValue(
|
||||||
time: Long = 2,
|
time: Long = 2,
|
||||||
timeUnit: TimeUnit = TimeUnit.SECONDS
|
timeUnit: TimeUnit = TimeUnit.SECONDS
|
||||||
|
|||||||
Reference in New Issue
Block a user