Merge pull request #33 from lhw/fixwhitespace
Fixed a problem with opening links containt special characters like whitespace
This commit is contained in:
commit
5eceb57e2f
@ -1,6 +1,7 @@
|
|||||||
package org.fox.ttrss;
|
package org.fox.ttrss;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -115,8 +116,10 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW,
|
URL url = new URL(m_article.link.trim());
|
||||||
Uri.parse(m_article.link.trim()));
|
String uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(),
|
||||||
|
url.getPort(), url.getPath(), url.getQuery(), url.getRef()).toString();
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -139,11 +142,12 @@ public class ArticleFragment extends Fragment implements GestureDetector.OnDoubl
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
try {
|
try {
|
||||||
String link = (m_article.comments_link != null && m_article.comments_link.length() > 0) ?
|
URL url = new URL((m_article.comments_link != null && m_article.comments_link.length() > 0) ?
|
||||||
m_article.comments_link : m_article.link;
|
m_article.comments_link : m_article.link);
|
||||||
|
String uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(),
|
||||||
|
url.getPort(), url.getPath(), url.getQuery(), url.getRef()).toString();
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW,
|
Intent intent = new Intent(Intent.ACTION_VIEW,
|
||||||
Uri.parse(link.trim()));
|
Uri.parse(uri));
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Loading…
Reference in New Issue
Block a user