package com.github.mzule.androidweekly.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.github.mzule.androidweekly.R;
import com.github.mzule.androidweekly.entity.Article;
import com.github.mzule.androidweekly.ui.view.ProgressView;

import butterknife.Bind;

/**
 * Created by CaoDongping on 3/24/16.
 */
public class ArticleActivity extends BaseActivity {
    @Bind(R.id.webView)
    WebView webView;
    @Bind(R.id.progressView)
    ProgressView progressView;

    public static Intent makeIntent(Context context, Article article) {
        Intent intent = new Intent(context, ArticleActivity.class);
        intent.putExtra("article", article);
        return intent;
    }

    @Override
    protected void afterInject() {
        Article article = (Article) getIntent().getSerializableExtra("article");
        webView.loadUrl(article.getLink());
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageFinished(WebView view, String url) {
                progressView.finish();
            }
        });
        webView.getSettings().setTextZoom(78);
    }

    @Override
    protected int getLayoutResourceId() {
        return R.layout.activity_article;
    }
}

@@ -46,16 +46,56 @@
 ivity;%0A%0A
+import android.annotation.SuppressLint;%0A
 import a
@@ -811,32 +811,74 @@
  intent;%0A    %7D%0A%0A
+    @SuppressLint(%22SetJavaScriptEnabled%22)%0A
     @Override%0A  
@@ -1291,16 +1291,74 @@
 om(78);%0A
+        webView.getSettings().setJavaScriptEnabled(true);%0A
     %7D%0A%0A 

enable javascript