Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phone files/logs #797

Open
wants to merge 139 commits into
base: layers
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
e7462d2
iml
koush Mar 4, 2015
6c4c82f
RoundedImageView sample.
koush Mar 5, 2015
783e57e
209
koush Mar 5, 2015
0745150
RoundedImageViewSample
koush Mar 5, 2015
7d2ccd5
Fix https://github.com/koush/ion/issues/506#issuecomment-77472102
koush Mar 6, 2015
be33a24
organize variables
koush Mar 6, 2015
ba964a5
Fix timing issue in https://github.com/koush/ion/issues/506#issuecomm…
koush Mar 6, 2015
a6ac0f8
Refactor:
koush Mar 8, 2015
10caaee
remove dead code
koush Mar 8, 2015
911852a
kenburns
koush Mar 10, 2015
7bb773c
Add a ken burns sample
koush Mar 10, 2015
ce02972
use a single null bitmap
koush Mar 10, 2015
50e9801
Call into LayerDrawable super methods
koush Mar 10, 2015
b68736b
210
koush Mar 10, 2015
e60f2fc
fix build
koush Mar 10, 2015
d6a0f5e
remove iml
koush Mar 12, 2015
fc895f9
remove iml
koush Mar 13, 2015
5ca33be
Need to use per iondrawable null bitmaps, seems to throw off measuring.
koush Mar 13, 2015
680524b
211
koush Mar 13, 2015
b015ac6
fix broken ion-test link
aeharding Mar 13, 2015
b754386
Merge pull request #514 from aeharding/patch-1
koush Mar 13, 2015
5a2f786
tighten up gradle files with android studio project defaults
koush Mar 14, 2015
5917808
Fix proguard issues:
koush Mar 14, 2015
6fda0a9
more proguard fixes
koush Mar 14, 2015
56f2e66
213
koush Mar 25, 2015
327a0a6
handle gif errors.
koush Mar 25, 2015
a92adb5
Set the drawable as the last step (after scale type), to make sure th…
koush Apr 8, 2015
0b95ad4
Always null out the bitmap fetcher after executing it, to prevent ree…
koush Apr 8, 2015
31b906a
Use roudning to determine inSampleSize. Flooring the sample size can
koush Apr 8, 2015
ccfe65f
Update README.md
InsanityOnABun Apr 21, 2015
11f4db3
Merge pull request #543 from InsanityOnABun/patch-1
koush Apr 21, 2015
8d50b6c
Update README.md
Apr 22, 2015
95c2fd2
Merge pull request #546 from dakaugu/patch-1
koush Apr 24, 2015
39ae77b
Add support for injecting how the Bitmap is drawn via Drawable inject…
koush Apr 26, 2015
274ce68
Add support for injecting how the Bitmap is drawn via Drawable inject…
koush Apr 26, 2015
4fde134
Fix spdy negotiation.
koush May 13, 2015
4d14c41
Stop progress bar from updating if the request is cancelled or done
dandalf May 22, 2015
9175b4e
asDataEmitter
koush May 28, 2015
61858ca
215
koush Jun 9, 2015
5335fdd
216
koush Jun 12, 2015
15e0847
Conscrypt test of cloudflare free ssl tier thing.
koush Jun 30, 2015
376d6d0
remove derp
koush Jun 30, 2015
c0ccb1c
Update sample usage
samirshrestha Jul 29, 2015
06c2933
Update readme section for multipart/form-data
Aug 22, 2015
b44c2d7
Update docs for setMultipartFile methods
Aug 22, 2015
219c519
Merge pull request #1 from M1r1k/setMultipartFile-docs
Aug 22, 2015
8663955
Merge pull request #612 from M1r1k/master
koush Aug 22, 2015
72fd27f
api 23
koush Aug 31, 2015
8f8f94a
#641 Corrected resource evaluation to properly test against the scheme.
ToxicBakery Oct 28, 2015
34533a4
update for new gradle and gms stuff
koush Nov 30, 2015
32da7e9
Update image search sample
Dec 31, 2015
c98b9be
Test for issue reported by Versoworks
koush Jan 3, 2016
fea0743
watch for gif decode OOM
koush Feb 11, 2016
2ebb6a5
remove old apache crap
koush Feb 11, 2016
c4fb522
build.gradle updates
koush May 24, 2016
08a68ba
Update README.md
MacTEC May 25, 2016
0384f35
Merge pull request #725 from MacTEC/patch-1
koush May 26, 2016
17ef8bc
Update README
ItsSelina Jun 7, 2016
353df6b
Merge pull request #727 from ItsSelina/update-readme
koush Jun 8, 2016
e0dc966
genericify the has htables
koush Jun 14, 2016
2260a31
Add method to remove cached bitmap if it exists.
koush Jun 14, 2016
5f59e24
derp
koush Jun 14, 2016
f1f3b14
prep for build
koush Jun 14, 2016
2856e75
218
koush Jun 14, 2016
24d172f
Added fix for issue 279 as per the poster's comments.
Aug 23, 2016
ea50b56
Merge pull request #761 from diegotori/issue_279_fix
koush Aug 23, 2016
ce9180f
fix IonDrawable setAlpha(int) bug
Aug 29, 2016
21e250b
Merge pull request #766 from callkth/master
koush Aug 29, 2016
92a3e51
test for 714
koush Sep 6, 2016
9e43bcd
219
koush Sep 6, 2016
7ddf485
Update README.md
koush Sep 14, 2016
0162b5c
Merge pull request #670 from jlhonora/master
koush Sep 23, 2016
5856233
Gradle repositories, and GifDecoder line endings / indentation
davebren Nov 7, 2016
a8152fe
Issue #760 Add test that asserts the pixel values are incorrect
davebren Nov 7, 2016
194e9c4
Issue #760 Gif artifacting fix
davebren Nov 7, 2016
13f8c4b
Merge pull request #788 from eskimoapps/master
koush Nov 7, 2016
921fd88
Merge pull request #642 from ToxicBakery/issue-641
koush Nov 7, 2016
788fe5f
Merge pull request #602 from samirshrestha/master
koush Nov 7, 2016
171b51b
Merge pull request #566 from dandalf/upstream
koush Nov 7, 2016
382c396
gradle
koush Jan 6, 2017
0322a1b
Added Doogles to projects using Ion
fabLouis Jan 31, 2017
f0d5533
Merge pull request #806 from fabLouis/master
koush Feb 1, 2017
7ec16d6
use a compileOnly/provided dependency to conscrypt and stop using ref…
koush Jun 15, 2017
ecaa9f2
Merge branch 'master' of ssh://github.com/koush/ion
koush Jun 15, 2017
4c8529d
conscrypt can now hook ssl engine creation
koush Jun 15, 2017
b59c4fa
220
koush Jun 15, 2017
cb11786
Update build.gradle
koush Jun 18, 2017
16e997e
Update build.gradle
koush Jun 18, 2017
cd476af
Update build.gradle
koush Jun 18, 2017
647cecf
Update build.gradle
koush Jun 18, 2017
9aa7b95
remove unnecessary palette dependency
koush Jun 20, 2017
bd3f518
Merge branch 'master' of ssh://github.com/koush/ion
koush Jun 20, 2017
986f445
Relax the GPS version to something older when using Conscrypt.
koush Jun 21, 2017
2f6bef3
AndroidAsync is now Conscrypt aware in both platform and GPS, remove …
koush Jun 21, 2017
c5a3c86
disable spdy, it is deprecated for http2.
koush Jun 22, 2017
13657b0
221
koush Jun 22, 2017
ce98c23
Add interface for IonContext to watch for context liveness
koush Jul 3, 2017
d22de06
Initial Kotlin and async/await support.
koush Jul 3, 2017
25bcfbf
kotlin tests
koush Jul 3, 2017
78ee173
poop
koush Jul 3, 2017
2a3b7c8
Create README.md
koush Jul 3, 2017
0b501a0
Update README.md
koush Jul 3, 2017
7902596
Update README.md
koush Jul 3, 2017
17497bf
Update README.md
koush Jul 3, 2017
55d1565
Update README.md
koush Jul 3, 2017
630074b
Update README.md
koush Jul 3, 2017
1d73dcc
Update README.md
koush Jul 3, 2017
123c3e7
Update README.md
koush Jul 3, 2017
1b2e18e
Update README.md
koush Jul 3, 2017
62bdcc8
Update README.md
koush Jul 3, 2017
3d8244b
fixes
koush Jul 3, 2017
7e7e68e
kotlin
koush Dec 21, 2017
c914360
update gradle and build stuff
koush Oct 17, 2018
09fb0f1
pass some Accept header hints along when requesting json or xml
koush Nov 16, 2018
bb1594a
java 8 and android async refactor
koush Nov 22, 2018
492208a
few more helper methods for loading straight from a request
koush Nov 23, 2018
64f4cf3
setCallback no longer returns self.
koush Nov 24, 2018
5869691
update libs
koush Mar 2, 2019
6ef550c
MediaFile fixes
koush Mar 2, 2019
8af49b7
update
koush Mar 16, 2019
7edc01e
convenience method to start a background task
koush Mar 30, 2019
6e7414f
fixup file extension detection
koush Apr 4, 2019
ef57f60
newest firebase
koush Jul 2, 2019
8e3e84a
3.0.0
koush Oct 2, 2019
739ae56
3
koush Oct 2, 2019
299bf47
Update README.md
koush Oct 3, 2019
7bb15e7
Update README.md
koush Oct 3, 2019
a42ab57
v3.0.8
koush Oct 3, 2019
f224356
Merge branch 'master' of ssh://github.com/koush/ion
koush Oct 3, 2019
918ba3b
remove apache dependency
koush Nov 14, 2019
fafb9fa
merge
koush Dec 1, 2019
374efdf
update
koush Jan 19, 2020
98b292a
fixup loader bug not actually resolving as it should
koush Jan 21, 2020
1fb6562
null check the loaders
koush Feb 11, 2020
ed828e9
309
koush May 16, 2020
60bb741
Create FUNDING.yml
koush May 18, 2020
5439578
asserts
koush Nov 8, 2020
d6754ba
publishing
koush Nov 13, 2020
2e48671
update
koush Nov 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: koush
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ gradlew
gradlew.bat

ion.iml
*.iml
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
![](ion-sample/ion-sample.png)

#### Download
* [Jar](https://github.com/koush/ion#get-ion)
* [Maven](https://github.com/koush/ion#get-ion)
* [Git](https://github.com/koush/ion#get-ion)

#### Features
* [Kotlin coroutine/suspend support](https://github.com/koush/AndroidAsync/blob/master/AndroidAsync-Kotlin/README.md)
* Asynchronously download:
* [Images](https://github.com/koush/ion#load-an-image-into-an-imageview) into ImageViews or Bitmaps (animated GIFs supported too)
* [JSON](https://github.com/koush/ion#get-json) (via [Gson](https://code.google.com/p/google-gson/))
Expand Down Expand Up @@ -48,12 +48,12 @@ The included documented [ion-sample](https://github.com/koush/ion/tree/master/io
* Populate a ListView Adapter and fetch more data as you scroll to the end
* Put images from a URLs into ImageViews (twitter profile pictures)
* File Download with [Progress Bar Sample](https://github.com/koush/ion/blob/master/ion-sample/src/com/koushikdutta/ion/sample/ProgressBarDownload.java)
* Get JSON and show images with the [Google Image Search Sample](https://github.com/koush/ion/blob/master/ion-sample/src/com/koushikdutta/ion/sample/GoogleImageSearch.java)
* Get JSON and show images with the [Image Search Sample](https://github.com/koush/ion/blob/master/ion-sample/src/com/koushikdutta/ion/sample/ImageSearch.java)

#### More Examples

Looking for more? Check out the examples below that demonstrate some other common scenarios. You can also take a look
at 30+ ion unit tests in the [ion-test](https://github.com/koush/ion/tree/master/ion-test/src/com/koushikdutta/ion/test).
at 30+ ion unit tests in the [ion-test](https://github.com/koush/ion/tree/master/ion/test/src/com/koushikdutta/ion/test).

#### Get JSON

Expand Down Expand Up @@ -105,7 +105,7 @@ Ion.with(getContext())
.load("https://koush.clockworkmod.com/test/echo")
.uploadProgressBar(uploadProgressBar)
.setMultipartParameter("goop", "noop")
.setMultipartFile("filename.zip", new File("/sdcard/filename.zip"))
.setMultipartFile("archive", "application/zip", new File("/sdcard/filename.zip"))
.asJsonObject()
.setCallback(...)
```
Expand All @@ -121,7 +121,7 @@ Ion.with(context)
.progressDialog(progressDialog)
// can also use a custom callback
.progress(new ProgressCallback() {@Override
public void onProgress(int downloaded, int total) {
public void onProgress(long downloaded, long total) {
System.out.println("" + downloaded + " / " + total);
}
})
Expand Down Expand Up @@ -170,7 +170,7 @@ Ion.with(imageView)

The Ion Image load API has the following features:
* Disk and memory caching
* Bitmaps are held via weak references so memory is managed very effeciently
* Bitmaps are held via weak references so memory is managed very efficiently
* ListView Adapter recycling support
* Bitmap transformations via the .transform(Transform)
* Animate loading and loaded ImageView states
Expand Down Expand Up @@ -290,8 +290,8 @@ Future<JsonObject> json2 = Ion.with(activity, "http://example.com/test2.json").a
// later... in activity.onStop
@Override
protected void onStop() {
super.onStop();
Ion.getDefault(activity).cancelAll(activity);
super.onStop();
}
```

Expand Down Expand Up @@ -373,23 +373,19 @@ Ion.with(getContext())

#### Get Ion

##### Jars
* [androidasync.jar](https://search.maven.org/remote_content?g=com.koushikdutta.async&a=androidasync&v=LATEST) (dependency)
* [ion.jar](https://search.maven.org/remote_content?g=com.koushikdutta.ion&a=ion&v=LATEST)

##### Maven
```xml
<dependency>
<groupId>com.koushikdutta.ion</groupId>
<artifactId>ion</artifactId>
<version>2,</version>
<version>(insert latest version)</version>
</dependency>
```

##### Gradle
```groovy
dependencies {
compile 'com.koushikdutta.ion:ion:2.+'
compile 'com.koushikdutta.ion:ion:(insert latest version)'
}
````

Expand Down Expand Up @@ -424,3 +420,6 @@ There's hundreds of apps using ion. Feel free to contact me or submit a pull req
* [PictureCast](https://play.google.com/store/apps/details?id=com.unstableapps.picturecast.app)
* [Eventius](https://play.google.com/store/apps/details?id=com.eventius.android)
* [Plume](https://play.google.com/store/apps/details?id=com.levelup.touiteur)
* [GameRaven](https://play.google.com/store/apps/details?id=com.ioabsoftware.gameraven)
* [See You There](https://play.google.com/store/apps/details?id=com.maps.wearat&hl=en)
* [Doogles](https://play.google.com/store/apps/details?id=io.dooglesapp)
22 changes: 22 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
buildscript {
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath project.hasProperty('global_gradleAndroidPlugin') ? global_gradleAndroidPlugin : 'com.android.tools.build:gradle:3.2.0'
}
}

subprojects {
repositories {
jcenter()
google()
mavenCentral()
}

ext.global_compileSdkVersion = project.hasProperty('global_compileSdkVersion') ? global_compileSdkVersion : 28
ext.global_buildToolsVersion = project.hasProperty('global_buildToolsVersion') ? global_buildToolsVersion : '28.0.3'
ext.global_gradleAndroidPlugin = project.hasProperty('global_gradleAndroidPlugin') ? global_gradleAndroidPlugin : 'com.android.tools.build:gradle:3.2.0'
}
12 changes: 12 additions & 0 deletions ion-kotlin/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.koushikdutta.ion.kotlin"
android:versionCode="1"
android:versionName="1.0">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application>
</application>
</manifest>
109 changes: 109 additions & 0 deletions ion-kotlin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Ion Kotlin Extensions - async/await

async/await allows you to write code that looks like synchronous code, but is actually run asynchronously via coroutines.

For example, if you wanted to download a list of files with async/await in Ion:

```kotlin
fun getFiles(files: Array<String>) = async {
for (file in files) {
Ion.with(context)
.load(file)
.asString()
.await()
}
}
```
This may look like synchronous code, but it is not. The return type of getFiles is a actually [Future](https://github.com/koush/ion#futures). The operation happens asynchronously, and only when all the files are finished downloading, will the Future's callback be called.

The code in an async block is a [suspend fun, aka a coroutine](https://kotlinlang.org/docs/reference/coroutines.html).
```kotlin
async {
// the code in here is a suspend fun, a coroutine.
// execution can be suspended and resumed.
}
```

Inside an async block, you can use await on Futures to wait for their results.

```kotlin
fun getFiles(files: File) = async {
System.out.println("Bob")

val string = Ion.with(context)
.load(file)
.asString()
.await()

System.out.println("Chuck")
}

System.out.println("Alice")
getFiles(file)
System.out.println("David")
```

async blocks are run asynchronously, but look synchronous. The output from this code would be:

```
Alice
Bob
David
Chuck
```

Execution was paused at the await() call, and resumed after the file was downloaded.

Await can also be used to switch thread affinities:

```kotlin
async {
looper.await()
System.out.println("I'm running on this Looper thread.")

handler.await()
System.out.println("I'm running on this handler's Looper thread.")

executor.await()
System.out.println("I'm running on this Executor's thread pool.")

asyncServer.await()
System.out.println("I'm running on this AsyncServer's reactor thread.")
}
```

### Getting results from async functions

async lets you easily write functions that return Futures.

```kotlin
fun myStringFunction(url: String) = async {
try {
return@async Ion.with(context)
.load(url)
.asString()
.await()
}
catch (e: Exception) {
return@async "Failed to load"
}
}
```

myStringFunction returns a Future<String>. Can attach setCallback to get the result, or use it in other async code blocks

Or for brevity:

```kotlin
fun myStringFunction(url: String) = async {
try {
Ion.with(context)
.load(url)
.asString()
.await()
}
catch (e: Exception) {
"Failed to load"
}
}
```
63 changes: 63 additions & 0 deletions ion-kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
ext.kotlin_version = '1.3.61'
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

dependencies {
api project(':ion:ion')
api project(':AndroidAsync:AndroidAsync-Kotlin')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'

testImplementation 'junit:junit:4.12'
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.3.61'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

android {
kotlinOptions {
apiVersion = "1.3"
languageVersion = "1.3"
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
res.srcDirs = ['res/']
java.srcDirs = ['src/']
assets.srcDirs = ['assets/']
}
androidTest.java.srcDirs=['test/src/']
androidTest.res.srcDirs=['test/res/']
androidTest.assets.srcDirs=['test/assets/']
}

compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}

defaultConfig {
targetSdkVersion 26
minSdkVersion 14

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}

compileSdkVersion project.hasProperty('global_compileSdkVersion') ? global_compileSdkVersion : 26
buildToolsVersion project.hasProperty('global_buildToolsVersion') ? global_buildToolsVersion : '26.0.2'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.koushikdutta.ion.kotlin.test

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
import com.koushikdutta.async.kotlin.await
import com.koushikdutta.ion.Ion
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.async
import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.Semaphore
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest : CoroutineScope {
override val coroutineContext: CoroutineContext
get() = EmptyCoroutineContext

@Test
fun testIon() {
val semaphore = Semaphore(0)
async {
val ret = Ion.with(InstrumentationRegistry.getInstrumentation().targetContext)
.load("https://google.com/robots.txt")
.asString()
.await()
println(ret)
semaphore.release()
}
semaphore.acquire()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.koushikdutta.ion.kotlin.test

import kotlinx.coroutines.CoroutineScope
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext


/**
* Created by koush on 7/2/17.
*/

class KotlinTests(override val coroutineContext: CoroutineContext = EmptyCoroutineContext) : CoroutineScope {
suspend fun testIon() {

}
}
Loading