Code Monkey home page Code Monkey logo

all4114all's Introduction

All4114All Kotlin+Dagger2+Rx

Image,Text,File downloading demo

This app just shows how to use Retrofit,Rx with Kotlin

Machine Used

  • Android Studio v3.5.0-rc02
  • Gradle v5.4.1
  • Android SDK API 29
  • Minimum SDK API 21
  • Ubuntu 19.04

Build

Import the project in Android Studio File->New->Import Project->All4114All

Let the AS build and download all dependencies or Use Build->Rebuild Project

Use Shift+F10 or Run->Run to Run the app in device/emulator

Make sure you enabled adb debugging on your device(s).

Run Test

Unit Test

Select test/java/com/dastanIqbal/all4one/RepositoryTest Right Click-> Run RepositoryTest

Instrumentation Test

Select androidTest/java/com/dastanIqbal/all4one/featured/ListFragmentTest Right Click-> Run ListFragmentTest

How to Use Fetch?

Fetch Image

   Fetch.asImage().eneque(
                   ImageRequest(
                       url,
                       MediaType.IMAGE
                   ).apply {
                   callback = { bmp ->
                       if (bmp.width > 0 && bmp.height > 0)
                           binding.imageView.setImageBitmap(bmp)
                       else binding.imageView.setImageResource(R.mipmap.ic_avatar)
                   }
               })

Fetch Text

   Fetch.asText().eneque(
                   TextRequest(
                       url,
                       MediaType.TEXT
                   ).apply {
                   callback = { text ->
                       //handle Text, parse JSON,XML or anything
                   }
               })

Fetch File(pdf,zip or any stream)

   Fetch.asFile().eneque(
                   FileRequest(
                       url,
                       MediaType.FILE
                   ).apply {
                   callback = { stream ->
                       //handle stream, convert or write into file. 
                   }
               })

all4114all's People

Contributors

dastaniqbal avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.