Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #545 from l3d00m/minor_fixes
Browse files Browse the repository at this point in the history
url fixes
  • Loading branch information
SlideCI committed Nov 15, 2015
2 parents 4e59870 + 61c424a commit d36bd0c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/me/ccrama/redditslide/ContentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static ImageType getImageType(Submission s) {
}
if (s.isSelfPost()) {
return ImageType.SELF;
} else if ((url.contains("reddit.com") || url.contains("redd.it")) && !url.contains("wiki")) {
} else if ((url.contains("reddit.com") || url.contains("redd.it")) && !url.contains("/wiki") && !url.contains("/live")) {
return ImageType.REDDIT;
}

Expand Down Expand Up @@ -122,7 +122,7 @@ public static ImageType getImageType(Submission s) {
if (url.contains("gfy"))
return ImageType.NONE_GFY;
return ImageType.NONE_GIF;
} else if ((url.contains("reddit.com") || url.contains("redd.it")) && !url.contains("wiki")) {
} else if ((url.contains("reddit.com") || url.contains("redd.it")) && !url.contains("/wiki") && !url.contains("/live")) {
return ImageType.REDDIT;
} else if (!url.isEmpty()) {
return ImageType.LINK;
Expand Down Expand Up @@ -174,7 +174,7 @@ public static ImageType getImageType(String url) {
if (url.startsWith("/")) {
url = "reddit.com" + url;
}
if ((url.contains("reddit.com") || url.contains("redd.it")) && !url.contains("wiki")) {
if ((url.contains("reddit.com") || url.contains("redd.it")) && !url.contains("/wiki") && !url.contains("/live")) {
return ImageType.REDDIT;
} else if (url.contains("youtu")) {
return ImageType.VIDEO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public OpenRedditLink(Context c, String url) {


}
if (url.contains("wiki")) {
if (url.contains("/wiki")) {
Intent i = new Intent(c, Wiki.class);
i.putExtra("subreddit", parts[2]);
c.startActivity(i);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package me.ccrama.redditslide.Views;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.customtabs.CustomTabsIntent;
import android.support.design.widget.Snackbar;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.style.ClickableSpan;
import android.text.style.URLSpan;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;

Expand Down Expand Up @@ -184,7 +187,11 @@ public void onClick(String url) {
builder.setStartAnimations(c, R.anim.slideright, R.anim.fading_out_real);
builder.setExitAnimations(c, R.anim.fade_out, R.anim.fade_in_real);
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(c, Uri.parse(url));
try {
customTabsIntent.launchUrl(c, Uri.parse(url));
} catch (ActivityNotFoundException anfe) {
Log.w("MakeTextViewClickable", "Unknown url: " + anfe);
}
} else {
Reddit.defaultShare(url, c);
}
Expand All @@ -198,7 +205,11 @@ public void onClick(String url) {
builder.setStartAnimations(c, R.anim.slideright, R.anim.fading_out_real);
builder.setExitAnimations(c, R.anim.fade_out, R.anim.fade_in_real);
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(c, Uri.parse(url));
try {
customTabsIntent.launchUrl(c, Uri.parse(url));
} catch (ActivityNotFoundException anfe) {
Log.w("MakeTextViewClickable", "Unknown url: " + anfe);
}
} else {
Reddit.defaultShare(url, c);
}
Expand All @@ -212,7 +223,11 @@ public void onClick(String url) {
builder.setStartAnimations(c, R.anim.slideright, R.anim.fading_out_real);
builder.setExitAnimations(c, R.anim.fade_out, R.anim.fade_in_real);
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(c, Uri.parse(url));
try {
customTabsIntent.launchUrl(c, Uri.parse(url));
} catch (ActivityNotFoundException anfe) {
Log.w("MakeTextViewClickable", "Unknown url: " + anfe);
}
} else {
Reddit.defaultShare(url, c);
}
Expand Down Expand Up @@ -269,7 +284,11 @@ public void onClick(String url) {
builder.setStartAnimations(c, R.anim.slideright, R.anim.fading_out_real);
builder.setExitAnimations(c, R.anim.fade_out, R.anim.fade_in_real);
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(c, Uri.parse(url));
try {
customTabsIntent.launchUrl(c, Uri.parse(url));
} catch (ActivityNotFoundException anfe) {
Log.w("MakeTextViewClickable", "Unknown url: " + anfe);
}
} else {
Reddit.defaultShare(url, c);
}
Expand Down Expand Up @@ -352,7 +371,11 @@ public void onClick(String url) {
builder.setStartAnimations(c, R.anim.slideright, R.anim.fading_out_real);
builder.setExitAnimations(c, R.anim.fade_out, R.anim.fade_in_real);
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(c, Uri.parse(url));
try {
customTabsIntent.launchUrl(c, Uri.parse(url));
} catch (ActivityNotFoundException anfe) {
Log.w("MakeTextViewClickable", "Unknown url: " + anfe);
}
} else {
Reddit.defaultShare(url, c);
}
Expand All @@ -366,7 +389,11 @@ public void onClick(String url) {
builder.setStartAnimations(c, R.anim.slideright, R.anim.fading_out_real);
builder.setExitAnimations(c, R.anim.fade_out, R.anim.fade_in_real);
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(c, Uri.parse(url));
try {
customTabsIntent.launchUrl(c, Uri.parse(url));
} catch (ActivityNotFoundException anfe) {
Log.w("MakeTextViewClickable", "Unknown url: " + anfe);
}
} else {
Reddit.defaultShare(url, c);
}
Expand All @@ -380,7 +407,11 @@ public void onClick(String url) {
builder.setStartAnimations(c, R.anim.slideright, R.anim.fading_out_real);
builder.setExitAnimations(c, R.anim.fade_out, R.anim.fade_in_real);
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(c, Uri.parse(url));
try {
customTabsIntent.launchUrl(c, Uri.parse(url));
} catch (ActivityNotFoundException anfe) {
Log.w("MakeTextViewClickable", "Unknown url: " + anfe);
}
} else {
Reddit.defaultShare(url, c);
}
Expand Down Expand Up @@ -437,7 +468,11 @@ public void onClick(String url) {
builder.setStartAnimations(c, R.anim.slideright, R.anim.fading_out_real);
builder.setExitAnimations(c, R.anim.fade_out, R.anim.fade_in_real);
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(c, Uri.parse(url));
try {
customTabsIntent.launchUrl(c, Uri.parse(url));
} catch (ActivityNotFoundException anfe) {
Log.w("MakeTextViewClickable", "Unknown url: " + anfe);
}
} else {
Reddit.defaultShare(url, c);
}
Expand Down

0 comments on commit d36bd0c

Please sign in to comment.