diff --git a/AndroidManifest.xml b/AndroidManifest.xml index aae0eff8..66f714ba 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="182" + android:versionName="1.8.2" > = 11) { - content.setLayerType(View.LAYER_TYPE_SOFTWARE, null); - } - - new Handler().postDelayed(new Runnable() { - @Override - public void run() { - if (isAdded()) { + if (m_article != null) { + + TextView title = (TextView)view.findViewById(R.id.title); + + if (title != null) { - if (m_article != null) { - - TextView title = (TextView)view.findViewById(R.id.title); - - if (title != null) { - - String titleStr; - - if (m_article.title.length() > 200) - titleStr = m_article.title.substring(0, 200) + "..."; - else - titleStr = m_article.title; - - - title.setText(Html.fromHtml(titleStr)); - //title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); - title.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - try { - URL url = new URL(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); - } catch (Exception e) { - e.printStackTrace(); - m_activity.toast(R.string.error_other_error); - } - } - }); - - registerForContextMenu(title); + String titleStr; + + if (m_article.title.length() > 200) + titleStr = m_article.title.substring(0, 200) + "..."; + else + titleStr = m_article.title; + + + title.setText(Html.fromHtml(titleStr)); + //title.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); + title.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + try { + URL url = new URL(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); + } catch (Exception e) { + e.printStackTrace(); + m_activity.toast(R.string.error_other_error); } - - TextView comments = (TextView)view.findViewById(R.id.comments); - - if (comments != null) { - if (m_activity.getApiLevel() >= 4 && m_article.comments_count > 0) { - String commentsTitle = getString(R.string.article_comments, m_article.comments_count); - comments.setText(commentsTitle); - //comments.setPaintFlags(title.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); - comments.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - try { - URL url = new URL((m_article.comments_link != null && m_article.comments_link.length() > 0) ? - 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, - Uri.parse(uri)); - startActivity(intent); - } catch (Exception e) { - e.printStackTrace(); - m_activity.toast(R.string.error_other_error); - } - } - }); - - } else { - comments.setVisibility(View.GONE); - } - } - - WebView web = (WebView)view.findViewById(R.id.content); - - if (web != null) { - registerForContextMenu(web); - - web.setWebChromeClient(new WebChromeClient() { - @Override - public void onProgressChanged(WebView view, int progress) { - m_activity.setProgress(Math.round(((float)progress / 100f) * 10000)); - if (progress == 100) { - m_activity.setProgressBarVisibility(false); - } - } - }); - - web.setOnTouchListener(new View.OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent event) { - return m_detector.onTouchEvent(event); - } - }); - - String content; - String cssOverride = ""; - - WebSettings ws = web.getSettings(); - ws.setSupportZoom(true); - ws.setBuiltInZoomControls(false); - - web.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); - - TypedValue tv = new TypedValue(); - getActivity().getTheme().resolveAttribute(R.attr.linkColor, tv, true); - - if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) { - cssOverride = "body { background : transparent; color : #e0e0e0}"; - } else if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK_GRAY")) { - cssOverride = "body { background : transparent; color : #e0e0e0}"; - } else { - cssOverride = "body { background : transparent; }"; - } - web.setBackgroundColor(getResources().getColor(android.R.color.transparent)); - - String hexColor = String.format("#%06X", (0xFFFFFF & tv.data)); - cssOverride += " a:link {color: "+hexColor+";} a:visited { color: "+hexColor+";}"; - - cssOverride += " table { width : 100%; }"; - - String articleContent = m_article.content != null ? m_article.content : ""; - - Document doc = Jsoup.parse(articleContent); - - if (doc != null) { - // thanks webview for crashing on