├── settings.gradle ├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── styles.xml │ │ │ ├── colors.xml │ │ │ └── strings.xml │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── background │ │ │ ├── Constant.kt │ │ │ ├── MainActivity.kt │ │ │ └── CoroutinesAsyncTask.kt │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── .project ├── ASSETS_LICENSE.md ├── gradle.properties ├── circle.yml ├── CONTRIBUTING.md ├── gradlew.bat ├── gradlew └── LICENSE /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | .project 3 | .classpath 4 | .settings/org.eclipse.buildship.core.prefs 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ladrahul25/CoroutineAsyncTask/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ladrahul25/CoroutineAsyncTask/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ladrahul25/CoroutineAsyncTask/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ladrahul25/CoroutineAsyncTask/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ladrahul25/CoroutineAsyncTask/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ladrahul25/CoroutineAsyncTask/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | secrets.txt 3 | .idea/ 4 | .gradle 5 | /local.properties 6 | .DS_Store 7 | build/ 8 | /captures 9 | .externalNativeBuild 10 | app/build 11 | build 12 | app/release/ -------------------------------------------------------------------------------- /app/src/main/java/com/example/background/Constant.kt: -------------------------------------------------------------------------------- 1 | package com.example.background 2 | 3 | class Constant{ 4 | enum class Status { 5 | PENDING, 6 | RUNNING, 7 | FINISHED 8 | } 9 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Replace Android Asynctask with Kotlin Coroutines 2 | =================================== 3 | 4 | This repository contains the class named as CoroutinesAsyncTask.kt which helps you to migrate your Asynctask to Kotlin Coroutine 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 24 11:08:55 BST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | 8 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # Rendescript 9 | -keepclasseswithmembernames class * { 10 | native ; 11 | } 12 | 13 | -keep class androidx.renderscript.** { *; } 14 | 15 | 16 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | WorkManagerSample 4 | Project WorkManagerSample created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /ASSETS_LICENSE.md: -------------------------------------------------------------------------------- 1 | # Asset Licenses 2 | 3 | The licenses for the asset files included in this demo can be found below. 4 | 5 | ## test.png 6 | 7 | Retreived from [https://www.ars.usda.gov/oc/images/photos/jun04/k11252-1/](https://www.ars.usda.gov/oc/images/photos/jun04/k11252-1/) on 28 April 2018. 8 | 9 | Photo courtesy of USDA Agricultural Research Service 10 | 11 | Photos in our Image Gallery are available free of charge and are copyright-free, public domain, images unless otherwise indicated. 12 | 13 | Please note: these photos may not be used to infer or imply ARS endorsement of any product, company, or position. 14 | 15 | When using these photos, we ask that you credit the Agricultural Research Service. You may use one of the following credit lines: 16 | 17 | Photo by (photographer's name), USDA Agricultural Research Service. 18 | Photo courtesy of USDA Agricultural Research Service. 19 | Photo courtesy of USDA ARS. -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | 19 | # Configuration on demand is not supported by the current version of the Android Gradle plugin 20 | # since you are using Gradle version 4.6 or above. 21 | org.gradle.configureondemand=false 22 | android.useAndroidX=true 23 | android.enableJetifier=true 24 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | java: 3 | version: oraclejdk8 4 | environment: 5 | GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1024m -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.compiler.execution.strategy="out-of-process" -Djava.util.concurrent.ForkJoinPool.common.parallelism=2' 6 | 7 | dependencies: 8 | pre: 9 | - sudo pip install -U crcmod 10 | - echo y | android update sdk --no-ui --all --filter "tools,platform-tools,build-tools-27.0.3,android-26,extra-android-m2repository" 11 | - echo ${GCLOUD_SERVICE_KEY} | base64 --decode > ${HOME}/client-secret.json 12 | - sudo /opt/google-cloud-sdk/bin/gcloud config set project android-devrel-ci 13 | - sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update 14 | - sudo /opt/google-cloud-sdk/bin/gcloud auth activate-service-account travis-ci-for-blueprints@android-devrel-ci.iam.gserviceaccount.com --key-file ${HOME}/client-secret.json 15 | 16 | test: 17 | override: 18 | - ./test_all_ftl.sh 19 | post: 20 | - mkdir -p $CIRCLE_TEST_REPORTS/junit/ 21 | - find $CIRCLE_ARTIFACTS -name \*.xml -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \; 22 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #607D8B 20 | #455A64 21 | #CFD8DC 22 | #7C4DFF 23 | #212121 24 | #757575 25 | #FFFFFF 26 | #BDBDBD 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 |