Skip to content

Commit

Permalink
Handle imgur gallary links that are actually only pointing to an image
Browse files Browse the repository at this point in the history
  • Loading branch information
c99koder committed Sep 17, 2016
1 parent 4643dac commit 21ef38d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Expand Up @@ -354,7 +354,7 @@ dependencies {
//debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-SNAPSHOT'

//enterprisedebugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-SNAPSHOT'
compile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-SNAPSHOT'
enterprisereleaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-SNAPSHOT'
debugTestCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-SNAPSHOT'
compile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4'
enterprisereleaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4'
debugTestCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4'
}
24 changes: 12 additions & 12 deletions irccloud-android.iml
Expand Up @@ -56,14 +56,6 @@
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/tests/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/tests/src" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/tests/assets" type="java-test-resource" />
Expand All @@ -72,6 +64,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/.DS_Store" />
<excludeFolder url="file://$MODULE_DIR$/build/filtered_resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
Expand Down Expand Up @@ -116,7 +116,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-wearable/9.4.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.infstory/switch-preference-compat/1.0.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.raizlabs.android/DBFlow/2.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.squareup.leakcanary/leakcanary-android-no-op/1.4-SNAPSHOT/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.squareup.leakcanary/leakcanary-android-no-op/1.4/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.vandalsoftware.android/dslv/0.6.3/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/io.fabric.sdk.android/fabric/1.3.11/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/org.solovyev.android.views/linear-layout-manager/0.5/jars" />
Expand Down Expand Up @@ -151,9 +151,8 @@
<orderEntry type="library" exported="" name="baseLibrary-2.1.3" level="project" />
<orderEntry type="library" exported="" name="design-24.2.0" level="project" />
<orderEntry type="library" exported="" name="play-services-wearable-9.4.0" level="project" />
<orderEntry type="library" exported="" name="leakcanary-android-no-op-1.4-SNAPSHOT" level="project" />
<orderEntry type="library" exported="" name="antlr4-runtime-4.5" level="project" />
<orderEntry type="library" exported="" name="antlr4-annotations-4.5" level="project" />
<orderEntry type="library" exported="" name="antlr4-runtime-4.5" level="project" />
<orderEntry type="library" exported="" name="linear-layout-manager-0.5" level="project" />
<orderEntry type="library" exported="" name="org.abego.treelayout.core-1.0.1" level="project" />
<orderEntry type="library" exported="" name="DBFlow-2.2.1" level="project" />
Expand All @@ -168,15 +167,16 @@
<orderEntry type="library" exported="" name="appcompat-v7-24.2.0" level="project" />
<orderEntry type="library" exported="" name="beta-1.1.5" level="project" />
<orderEntry type="library" exported="" name="handy-uri-templates-2.0.2" level="project" />
<orderEntry type="library" exported="" name="kotlin-stdlib-1.0.0" level="project" />
<orderEntry type="library" exported="" name="jackson-databind-2.5.4" level="project" />
<orderEntry type="library" exported="" name="kotlin-stdlib-1.0.0" level="project" />
<orderEntry type="library" exported="" name="play-services-tasks-9.4.0" level="project" />
<orderEntry type="library" exported="" name="play-services-auth-9.4.0" level="project" />
<orderEntry type="library" exported="" name="compilerCommon-2.1.3" level="project" />
<orderEntry type="library" exported="" name="library-1.1" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-9.4.0" level="project" />
<orderEntry type="library" exported="" name="commons-codec-1.10" level="project" />
<orderEntry type="library" exported="" name="answers-1.3.7" level="project" />
<orderEntry type="library" exported="" name="leakcanary-android-no-op-1.4" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.4.0" level="project" />
<orderEntry type="library" exported="" name="DBFlow-Core-2.2.1" level="project" />
<orderEntry type="library" exported="" name="animated-vector-drawable-24.2.0" level="project" />
Expand Down
5 changes: 3 additions & 2 deletions src/com/irccloud/android/activity/ImageViewerActivity.java
Expand Up @@ -177,8 +177,9 @@ protected String doInBackground(String... params) {
JSONObject o = NetworkConnection.getInstance().fetchJSON(GALLERY_URL + type + "/" + params[0], headers);
if (o.getBoolean("success")) {
JSONObject data = o.getJSONObject("data");
if(data.getInt("images_count") == 1) {
data = data.getJSONArray("images").getJSONObject(0);
if((data.has("images_count") && data.getInt("images_count") == 1) || !data.getBoolean("is_album")) {
if(data.getBoolean("is_album"))
data = data.getJSONArray("images").getJSONObject(0);
if (data.getString("type").startsWith("image/") && !data.getBoolean("animated"))
return data.getString("link");
else if (data.getBoolean("animated"))
Expand Down

0 comments on commit 21ef38d

Please sign in to comment.