Skip to content
This repository has been archived by the owner on Jul 25, 2019. It is now read-only.

Commit

Permalink
Fix bug that prevented browsing articles
Browse files Browse the repository at this point in the history
  • Loading branch information
austintaylor committed Jan 12, 2015
1 parent be81830 commit cc13773
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;

import com.uservoice.uservoicesdk.R;
Expand All @@ -20,21 +24,24 @@

public class ArticleActivity extends SearchActivity {

private WebView webView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.uv_article_layout);
final Article article = getIntent().getParcelableExtra("article");
setTitle(article.getTitle());
WebView webView = (WebView) findViewById(R.id.uv_webview);
webView = (WebView) findViewById(R.id.uv_webview);
final View helpfulSection = findViewById(R.id.uv_helpful_section);
Utils.displayArticle(webView, article, this);
findViewById(R.id.uv_container).setBackgroundColor(Utils.isDarkTheme(this) ? Color.BLACK : Color.WHITE);
webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
findViewById(R.id.uv_helpful_section).setVisibility(View.VISIBLE);
helpfulSection.setVisibility(View.VISIBLE);
}
});
findViewById(R.id.uv_helpful_button).setOnClickListener(new View.OnClickListener() {
Expand All @@ -55,6 +62,13 @@ public void onClick(View v) {
Babayaga.track(Babayaga.Event.VIEW_ARTICLE, article.getId());
}

@Override
public ListView getListView() {
// This is called by setupScopedSearch(menu) to make sure the list is added,
// but we don't want a list. Should probably refactor this somehow.
return null;
}

@Override
@SuppressLint("NewApi")
public boolean onCreateOptionsMenu(Menu menu) {
Expand All @@ -75,8 +89,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
@Override
public void finish() {
// This is what you have to do to make it stop the flash player
WebView webview = (WebView) findViewById(R.id.uv_webview);
webview.loadData("", "text/html", "utf-8");
webView.loadData("", "text/html", "utf-8");
super.finish();
}
}

0 comments on commit cc13773

Please sign in to comment.