Пример #1
0
  private void initViewer() {
    settings.setLoadsImagesAutomatically(true);
    settings.setUseWideViewPort(true);
    settings.setLoadWithOverviewMode(true);
    settings.setLightTouchEnabled(true);
    settings.setBuiltInZoomControls(true);
    settings.setJavaScriptEnabled(true);

    viewer.setInitialScale(0);
    viewer.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    viewer.setHorizontalScrollBarEnabled(false);
    viewer.setVerticalScrollBarEnabled(false);
    viewer.setBackgroundColor(0x000000);
    viewer.clearCache(true);
    viewer.setFocusable(false);

    viewer.setWebViewClient(
        new WebViewClient() {
          @Override
          public void onPageFinished(WebView view, String url) {}

          @Override
          public void onReceivedError(
              WebView view, int errorCode, String description, String failingUrl) {}

          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return false;
          }
        });
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

    int rowIndex = getIntent().getExtras().getInt("rowIndex");
    WebView webview = null;
    String content = "";
    webview = new WebView(this);
    setContentView(webview);
    webview.setBackgroundResource(R.drawable.white);
    webview.setBackgroundColor(0);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title_bar);
    TextView title = (TextView) findViewById(R.id.myTitle);
    switch (rowIndex) {
      case 0:
        title.setText("Profile");
        content =
            "<html><body>"
                + "<p>Complete your academic information, activate privacy settings and opt&#45;in or out of"
                + " receiving system alerts </p></body></html>";
        break;
      case 1:
        title.setText("Documents");
        content =
            "<html><body><p>Upload resume(s), cover letter(s), unofficial transcripts, writing samples and other documents for "
                + "review by Career Services and to be used in your job or internship search </p></body></html>";
        break;
      case 2:
        title.setText("Jobs");
        content =
            "<html><body><p>Roo Jobs are all of "
                + "the jobs posted by employers directly in the system; Extended Job Search Tool will provide access to DirectEmployers and "
                + "jobs across the United States; a link to the Work Study Jobs database (requires additional login); UMKC SEARCH, "
                + "Serve 2 Learn, and Study&#45;Abroad links are available for you to utilize; Going Global provides internship"
                + " and full&#45;time job information for more than 32 countries including the United States and Canada; "
                + "Internships&#45;USA provides an internship directory in several for&#45;profit and non&#45;profit fields; and "
                + "KC Nonprofit Connect to review full&#45;time, internship and volunteer opportunities in the Kansas City non&#45;profit "
                + "community</p> </body></html>";
        break;
      case 3:
        title.setText("Events");
        content =
            "<html><body>"
                + "<p>Review upcoming employer information sessions and career fairs sponsored by UMKC "
                + "Career Services</p></body></html>";
        break;
      case 4:
        title.setText("Appointments");
        content =
            "<html><body>"
                + "<p>Schedule an appointment with Career Services using the short&#45;cut option on your <font color=\"red\"><a href=\"https://umkc-csm.symplicity.com/\" >Roo Career Network</a></font> homepage </p></body></html>";
      default:
        break;
    }

    webview.loadData(content, "text/html", null);
  }
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {

    int resId = 0;

    Bundle bundle = getArguments();
    if (bundle != null) {
      resId = bundle.getInt(HTML_RESOURCE_ID_KEY, -1);
    }

    LayoutInflater inflater = LayoutInflater.from(getActivity());
    View view = inflater.inflate(R.layout.fragment_help, null);
    final WebView webView = (WebView) view.findViewById(R.id.webview);
    webView.setBackgroundColor(getDefaultBackgroundColor());
    disableHardwareAccelaration(webView);

    if (resId != 0) {
      webView.loadData(fromRawResource(resId), "text/html", Encoding.UTF_16.name());
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(getText(R.string.help));
    builder.setView(view);
    builder.setPositiveButton(
        getString(android.R.string.ok),
        new OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
          }
        });

    return builder.create();
  }
 private void createWebView() {
   mWebView = new WebView(this);
   mWebView.setInitialScale(300);
   mWebView.measure(800, 1280);
   mWebView.layout(0, 0, 800, 1280);
   WebSettings webSettings = mWebView.getSettings();
   webSettings.setJavaScriptEnabled(false);
   mWebView.setBackgroundColor(0xff202020);
 }
Пример #5
0
  private void setupButtons(View v) {
    webViewRulesOfServices = (WebView) v.findViewById(R.id.webViewRules);
    webViewRulesOfServices.setBackgroundColor(0);

    if (RuleBookFragment.bIsFromNFLRuleBook) {
      showNFLRuleBook();
    } else {
      showTackleRuleBook();
    }
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   View rootView = inflater.inflate(R.layout.fragment_main, container, false);
   WebView webView = (WebView) rootView.findViewById(R.id.webView);
   String fileName =
       ((MainActivity) getActivity()).getRight()[getArguments().getInt(ARG_SECTION_NUMBER)];
   L.i("File Name: " + fileName);
   webView.getSettings().setJavaScriptEnabled(true);
   webView.setInitialScale(1);
   webView.loadUrl("file:///android_asset/web/" + fileName);
   webView.setBackgroundColor(0x00000000);
   return rootView;
 }
Пример #7
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.infos);
   ivChargement = new ProgressBar(this);
   // LinearLayout llInfos = (LinearLayout) findViewById(R.id.llInfos);
   // llInfos.addView(ivChargement);
   WebView wv = (WebView) findViewById(R.id.wvInfos);
   // wv.setVisibility(WebView.INVISIBLE);
   wv.setBackgroundColor(Color.TRANSPARENT);
   wv.loadUrl("file:///android_asset/infos.html");
   // llInfos.removeView(ivChargement);
   // wv.setVisibility(WebView.VISIBLE);
 }
Пример #8
0
  private void initWebView() {
    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setPluginsEnabled(true);
    settings.setAllowFileAccess(false);
    settings.setPluginState(WebSettings.PluginState.ON);

    webView.setBackgroundColor(0x00000000); // transparent
    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebChromeClient(new OpenXAdWebChromeClient());

    addView(webView);
  }
Пример #9
0
  public void showHTML(String advice) {
    if (advice.substring(0, 10).contains("://")) {
      Uri uri = Uri.parse(advice);
      Intent intent = new Intent(Intent.ACTION_VIEW, uri);
      startActivity(intent);
    } else {
      Toast.makeText(getApplicationContext(), advice, Toast.LENGTH_SHORT).show();
      WebView web = new WebView(this);
      web.loadData(advice, "text/html", null);
      web.setBackgroundColor(Color.TRANSPARENT);
      web.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);

      layout.addView(web);
    }
  }
Пример #10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //		this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    // set action bar stuff
    ActionBar ab = getActionBar();
    ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    ab.setCustomView(R.layout.actionbar);

    // receive info
    Intent intent = getIntent();
    String fromAddress = intent.getStringExtra(SafewalkApplication.EXTRA_FROM);
    String toAddress = intent.getStringExtra(SafewalkApplication.EXTRA_TO);

    setContentView(R.layout.safewalk_map);

    // init javascript interface class
    mapJS = new MapJS(getApplication().getApplicationContext());
    mapJS.setFromAddress(fromAddress);
    mapJS.setToAddress(toAddress);

    // link android elements
    wv = (WebView) findViewById(R.id.wv_map);
    wv.getSettings().setJavaScriptEnabled(true);
    wv.setWebChromeClient(new WebChromeClient());
    wv.addJavascriptInterface(mapJS, "Safewalk");
    wv.getSettings().setRenderPriority(RenderPriority.HIGH);
    wv.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    wv.getSettings().setAllowFileAccess(true);
    wv.setBackgroundColor(
        0x00000000); // must set background to zero for background to show through.
    wv.setLayerType(
        View.LAYER_TYPE_SOFTWARE, null); // solves a flickering issue of webview content.
    wv.loadUrl("file:///android_asset/index.html");

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    // get relative layout
    llRoutes = (LinearLayout) findViewById(R.id.ll_routes);

    //		TextView testFrom = (TextView) findViewById(R.id.test_from);
    //		TextView testTo = (TextView) findViewById(R.id.test_to);

    //		testFrom.setText(fromAddress);
    //		testTo.setText(toAddress);

  }
  public View getView(int position, View convertView, ViewGroup parent) {
    MovieYoutubeGridViewHolder viewHolder;
    TextView tvTitle;
    TextView tvPublishTime;
    WebView wvWebViewImage;
    if (convertView == null) {
      convertView = inflater.inflate(R.layout.movie_youtube_item_gridview, null);
      viewHolder = new MovieYoutubeGridViewHolder();

      viewHolder.title = tvTitle = (TextView) convertView.findViewById(R.id.title); // title
      viewHolder.publishTime =
          tvPublishTime = (TextView) convertView.findViewById(R.id.publishTime);
      wvWebViewImage = (WebView) convertView.findViewById(R.id.webViewImage);
      wvWebViewImage.setBackgroundColor(0);
      wvWebViewImage.setFocusableInTouchMode(false);
      wvWebViewImage.setFocusable(false);
      wvWebViewImage.setClickable(false);
      wvWebViewImage.setLongClickable(false);
      viewHolder.webViewImage = wvWebViewImage;
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (MovieYoutubeGridViewHolder) convertView.getTag();
      tvTitle = viewHolder.title; // title
      tvPublishTime = viewHolder.publishTime;
      wvWebViewImage = viewHolder.webViewImage;
    }
    YouTubeVideo movie = data.get(position);

    // Setting all values in listview
    tvTitle.setText(movie.getTitle());
    tvTitle.setTag(movie.getID());
    tvPublishTime.setText("Đăng lúc " + movie.getPublishedTime());

    String contentImage =
        "<!DOCTYPE html><head> <meta http-equiv=\"Content-Type\" "
            + "content=\"text/html; charset=utf-8\"> </head><body><div style=\"background-color: rgba(10,10,10,0.5); "
            + "\"> "
            + "<img width='100%' src='"
            + movie.getThumbnailDefaut()
            + "'></img>"
            + "</div> </body></html>";
    wvWebViewImage.loadDataWithBaseURL(null, contentImage, "text/html", "utf-8", null);

    return convertView;
  }
Пример #12
0
  private void loadWebView(WebView v) {
    // Set basic style
    v.setBackgroundColor(ContextCompat.getColor(this, R.color.color_background_dark));
    v.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

    // Open links in external browser
    v.setWebViewClient(
        new WebViewClient() {
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            startActivity(intent);
            return true;
          }
        });

    // Load HTML content from assets
    v.loadUrl(ASSETS_URI + Const.LocalAssets.LICENSE);
  }
Пример #13
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.fragment_proposal_proposal, container, false);

    TextView title = (TextView) v.findViewById(R.id.fragment_proposal_proposal_title);
    TextView fullname = (TextView) v.findViewById(R.id.fragment_proposal_proposal_fullname);
    WebView description =
        (WebView) v.findViewById(R.id.fragment_proposal_proposal_description_webview);

    title.setText(proposal.getTitle());
    fullname.setText(proposal.getFullname());

    description.loadData(proposal.getDescription(), "text/html; charset=UTF-8", null);
    description.setBackgroundColor(0x00000000);

    return v;
  }
Пример #14
0
 private void initView() {
   myLoadingDialog = new MyLoadingDialog(getActivity(), R.style.custom_dialog);
   activity = (MainActivity) getActivity();
   news_tital = (TextView) view.findViewById(R.id.news_tital);
   news_list = (ListView) view.findViewById(R.id.news_list);
   gold_button = (Button) view.findViewById(R.id.gold_button);
   world_button = (Button) view.findViewById(R.id.world_button);
   news_list = (ListView) view.findViewById(R.id.news_list);
   webView = (WebView) view.findViewById(R.id.web_view);
   webView.setBackgroundColor(getActivity().getResources().getColor(R.color.forgettextcolor));
   webView.getSettings().setJavaScriptEnabled(true);
   webView.getSettings().setBuiltInZoomControls(true);
   webView.getSettings().setUseWideViewPort(true);
   webView.getSettings().setLoadWithOverviewMode(true);
   webView.getSettings().setDomStorageEnabled(true);
   webView.getSettings().setDefaultFontSize(Util.dip2px(getActivity(), 24));
   webView.getSettings().setSupportZoom(true);
   webView.setWebViewClient(new WebViewClient());
   settab(1);
 }
Пример #15
0
  protected HtmlAlertDialog(Context context, int resourceId, String title, int iconId) {
    super(context);

    WebView wv = new WebView(context);
    wv.setBackgroundColor(0); // transparent

    String htmlString = HtmlAlertDialog.loadRawResourceString(context.getResources(), resourceId);
    wv.loadData(htmlString, "text/html", "utf-8");

    if (!title.equals("")) this.setTitle(title);
    if (iconId != 0) this.setIcon(iconId);
    this.setView(wv);
    this.setButton(
        context.getResources().getString(R.string.Ok),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
          }
        });
  }
Пример #16
0
  public static void initWebView(Context context, WebView mWebView) {
    if (mWebView != null) {
      mWebView.setDrawingCacheBackgroundColor(0x00000000);
      mWebView.setFocusableInTouchMode(true);
      mWebView.setFocusable(true);
      mWebView.setAnimationCacheEnabled(false);
      mWebView.setDrawingCacheEnabled(true);
      mWebView.setBackgroundColor(context.getResources().getColor(android.R.color.white));
      mWebView.getRootView().setBackgroundDrawable(null);
      mWebView.setWillNotCacheDrawing(false);
      mWebView.setAlwaysDrawnWithCacheEnabled(true);
      mWebView.setScrollbarFadingEnabled(true);
      mWebView.setHorizontalScrollBarEnabled(false);
      mWebView.setVerticalScrollBarEnabled(true);
      mWebView.setSaveEnabled(true);
      mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

      initializeSettings(mWebView.getSettings(), context);
    }
  }
Пример #17
0
  private AlertDialog getDialog(boolean full) {
    WebView wv = new WebView(this.context);

    wv.setBackgroundColor(Color.BLACK);
    wv.loadDataWithBaseURL(null, this.getLog(full), "text/html", "UTF-8", null);

    AlertDialog.Builder builder =
        new AlertDialog.Builder(
            new ContextThemeWrapper(this.context, android.R.style.Theme_Dialog));
    builder
        .setTitle(
            context
                .getResources()
                .getString(full ? R.string.changelog_full_title : R.string.changelog_title))
        .setView(wv)
        .setCancelable(false)
        // OK button
        .setPositiveButton(
            context.getResources().getString(R.string.changelog_ok_button),
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                updateVersionInPreferences();
              }
            });

    if (!full) {
      // "more ..." button
      builder.setNegativeButton(
          R.string.changelog_show_full,
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int id) {
              getFullLogDialog().show();
            }
          });
    }

    return builder.create();
  }
Пример #18
0
  private void loadWebViewContent() {
    // TODO Auto-generated method stub
    WebSettings webSettings = mWebView.getSettings();
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setUseWideViewPort(true);
    // 启用支持javascript
    webSettings.setJavaScriptEnabled(true);
    mWebView.setBackgroundColor(Color.TRANSPARENT);
    // WebView加载web资源
    mWebView.loadUrl("http://www.baidu.com/");
    // 覆盖WebView默认使用第三方或系统默认浏览器打开网页的行为,使网页用WebView打开
    mWebView.setWebViewClient(
        new WebViewClient() {

          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            // TODO Auto-generated method stub
            // 返回值是true的时候控制去WebView打开,为false调用系统浏览器或第三方浏览器
            view.loadUrl(url);
            return true;
          }

          @Override
          public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            if (progressDialog != null) {
              progressDialog.dismiss();
              progressDialog = null;
            }
          }

          @Override
          public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            if (progressDialog != null) {
              progressDialog.show();
            }
          }
        });
  }
Пример #19
0
    @Override
    public final Dialog onCreateDialog(final Bundle savedInstanceState) {
      String message = getArguments().getString(PARAM_MESSAGE);
      final int key = getArguments().getInt(PARAM_PREFERENCE_KEY);
      String title = getArguments().getString(PARAM_TITLE);
      int iconResource = getArguments().getInt(PARAM_ICON);

      WebView webView = new WebView(getActivity());
      webView.setBackgroundColor(0x00000000);
      DisplayHtmlFragment.setOpenLinksInExternalBrowser(webView, null);

      message = ReleaseNotesUtil.HTML_PREFIX + message + ReleaseNotesUtil.HTML_POSTFIX;
      webView.loadDataWithBaseURL(
          "file:///android_res/drawable/", message, "text/html", "utf-8", "");

      AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
      builder
          .setTitle(title)
          .setIcon(iconResource)
          .setView(webView)
          .setNegativeButton(
              R.string.button_show_later,
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(@NonNull final DialogInterface dialog, final int id) {
                  PreferenceUtil.setSharedPreferenceBoolean(key, false);
                  dialog.dismiss();
                }
              })
          .setPositiveButton(
              R.string.button_dont_show,
              new DialogInterface.OnClickListener() {
                @Override
                public void onClick(@NonNull final DialogInterface dialog, final int id) {
                  PreferenceUtil.setSharedPreferenceBoolean(key, true);
                  dialog.dismiss();
                }
              });
      return builder.create();
    }
Пример #20
0
  private void loadAndShowCaptcha(String kantonShort, String kantonLong) {
    String capchaUrl = null;
    if (Kantone.isWebFormKantonWithCaptcha(kantonLong)) {
      if (Util.isNetworkAvailable(context)) {
        try {

          WebView myWebView = new WebView(context);
          myWebView.getSettings().setJavaScriptEnabled(true);
          myWebView.getSettings().setUserAgentString(Constants.USER_AGENT_FIREFOX);
          myWebView = (WebView) findViewById(R.id.webViewCaptcha);
          myWebView.setWebViewClient(new MyWebViewClient());
          // myWebView.loadUrl(Constants.BASE_URL_AG_LU_SH_ZG_ZH
          // + kantonShort);

          capchaUrl =
              WebUtil.getCaptchaAndHiddenVars(
                  context, Constants.BASE_URL_AG_LU_SH_ZG_ZH + kantonShort);

          myWebView.setInitialScale(200);
          myWebView.setBackgroundColor(Color.WHITE);
          myWebView.setVisibility(View.VISIBLE);
          myWebView.loadUrl(capchaUrl);

          EditText textCaptcha = (EditText) findViewById(R.id.editTextCaptcha);
          textCaptcha.setVisibility(View.VISIBLE);

        } catch (InterruptedException e) {
          Toast.makeText(context, "Oh no! " + e.getMessage(), Toast.LENGTH_LONG).show();
          Log.e(TAG, "Exception:\n" + e);
        } catch (ExecutionException e) {
          Toast.makeText(context, "Oh no! " + e.getMessage(), Toast.LENGTH_LONG).show();
          Log.e(TAG, "Exception:\n" + e);
        }
      } else {
        Util.showNoNetworkAlert(context);
      }
    }
  }
Пример #21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ksatria2);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    String htmlText2 =
        "<html><body style=\"text-align:justify\" > <style=\"background-color:transparent\"> %s </body></Html>";
    String Pahlawan2 =
        "Pattimura(atau Thomas Matulessy) (lahir di Haria, pulau Saparua, Maluku, 8 Juni 1783 – meninggal di Ambon, Maluku, 16 Desember 1817 pada umur 34 tahun), juga dikenal dengan nama Kapitan Pattimura adalah pahlawan Maluku dan merupakan Pahlawan nasional Indonesia."
            + "</br></br>Menurut buku biografi Pattimura versi pemerintah yang pertama kali terbit, M Sapija menulis, 'Bahwa pahlawan Pattimura tergolong turunan bangsawan dan berasal dari Nusa Ina (Seram). Ayah beliau yang bernama Antoni Mattulessy adalah anak dari Kasimiliali Pattimura Mattulessy. Yang terakhir ini adalah putra raja Sahulau. Sahulau merupakan nama orang di negeri yang terletak dalam sebuah teluk di Seram Selatan'</body>"
            + "</br></br>Namun berbeda dengan sejarawan Mansyur Suryanegara. Dia mengatakan dalam bukunya Api Sejarah bahwa Ahmad Lussy atau dalam bahasa Maluku disebut Mat Lussy, lahir di Hualoy, Seram Selatan (bukan Saparua seperti yang dikenal dalam sejarah versi pemerintah). Dia adalah bangsawan dari kerajaan Islam Sahulau, yang saat itu diperintah Sultan Abdurrahman. Raja ini dikenal pula dengan sebutan Sultan Kasimillah (Kazim Allah/Asisten Allah). Dalam bahasa Maluku disebut Kasimiliali."
            + "</br></br><b>Perjuangan</b>"
            + "</br></br>Sebelum melakukan perlawanan terhadap VOC ia pernah berkarier dalam militer sebagai mantan sersan Militer Inggris.[3] Kata 'Maluku' berasal dari bahasa Arab Al Mulk atau Al Malik yang berarti Tanah Raja-Raja.[4] mengingat pada masa itu banyaknya kerajaan."
            + "</br></br>Pada tahun 1816 pihak Inggris menyerahkan kekuasaannya kepada pihak Belanda dan kemudian Belanda menetapkan kebijakan politik monopoli, pajak atas tanah (landrente), pemindahan penduduk serta pelayaran Hongi (Hongi Tochten), serta mengabaikan Traktat London I antara lain dalam pasal 11 memuat ketentuan bahwa Residen Inggris di Ambon harus merundingkan dahulu pemindahan koprs Ambon dengan Gubenur dan dalam perjanjian tersebut juga dicantumkan dengan jelas bahwa jika pemerintahan Inggris berakhir di Maluku maka para serdadu-serdadu Ambon harus dibebaskan dalam artian berhak untuk memilih untuk memasuki dinas militer pemerintah baru atau keluar dari dinas militer, akan tetapi dalam pratiknya pemindahan dinas militer ini dipaksakan [5] Kedatangan kembali kolonial Belanda pada tahun 1817 mendapat tantangan keras dari rakyat. Hal ini disebabkan karena kondisi politik, ekonomi, dan hubungan kemasyarakatan yang buruk selama dua abad. Rakyat Maluku akhirnya bangkit mengangkat senjata di bawah pimpinan Kapitan Pattimura [4] Maka pada waktu pecah perang melawan penjajah Belanda tahun 1817, Raja-raja Patih, Para Kapitan, Tua-tua Adat dan rakyat mengangkatnya sebagai pemimpin dan panglima perang karena berpengalaman dan memiliki sifat-sfat kesatria (kabaressi). Sebagai panglima perang, Kapitan Pattimura mengatur strategi perang bersama pembantunya. Sebagai pemimpin dia berhasil mengkoordinir Raja-raja Patih dalam melaksanakan kegiatan pemerintahan, memimpin rakyat, mengatur pendidikan, menyediakan pangan dan membangun benteng-benteng pertahanan. Kewibawaannya dalam kepemimpinan diakui luas oleh para Raja Patih maupun rakyat biasa. Dalam perjuangan menentang Belanda ia juga menggalang persatuan dengan kerajaan Ternate dan Tidore, raja-raja di Bali, Sulawesi dan Jawa. Perang Pattimura yang berskala nasional itu dihadapi Belanda dengan kekuatan militer yang besar dan kuat dengan mengirimkan sendiri Laksamana Buykes, salah seorang Komisaris Jenderal untuk menghadapi Patimura."
            + "</br></br>Pertempuran-pertempuran yang hebat melawan angkatan perang Belanda di darat dan di laut dikoordinir Kapitan Pattimura yang dibantu oleh para penglimanya antara lain Melchior Kesaulya, Anthoni Rebhok, Philip Latumahina dan Ulupaha. Pertempuran yang menghancurkan pasukan Belanda tercatat seperti perebutan benteng Belanda Duurstede, pertempuran di pantai Waisisil dan jasirah Hatawano, Ouw- Ullath, Jasirah Hitu di Pulau Ambon dan Seram Selatan. Perang Pattimura hanya dapat dihentikan dengan politik adu domba, tipu muslihat dan bumi hangus oleh Belanda. Para tokoh pejuang akhirnya dapat ditangkap dan mengakhiri pengabdiannya di tiang gantungan pada tanggal 16 Desember 1817 di kota Ambon. Untuk jasa dan pengorbanannya itu, Kapitan Pattimura dikukuhkan sebagai “PAHLAWAN PERJUANGAN KEMERDEKAAN” oleh pemerintah Republik Indonesia.";

    WebView webView2 = (WebView) findViewById(R.id.webview2);
    WebSettings webSettings = webView2.getSettings();
    webView2.setBackgroundColor(0x00FFFFFF);
    webView2.loadData(String.format(htmlText2, Pahlawan2), "text/html", "utf-8");
    webSettings.setDefaultFontSize(13);
  }
  @Override
  public void show(Activity activity) {
    super.show(activity);
    activity.setContentView(R.layout.apptentive_upgrade_message_interaction);

    EngagementModule.engageInternal(activity, interaction.getType().name(), CODE_POINT_LAUNCH);

    ImageView iconView = (ImageView) activity.findViewById(R.id.icon);
    Drawable icon = getIconDrawableResourceId(activity);
    if (icon != null) {
      iconView.setImageDrawable(icon);
    } else {
      iconView.setVisibility(View.GONE);
    }
    WebView webview = (WebView) activity.findViewById(R.id.webview);
    webview.loadData(interaction.getBody(), "text/html", "UTF-8");
    webview.setBackgroundColor(
        Color.TRANSPARENT); // Hack to keep webview background from being colored after load.

    // If branding is not desired, turn the view off.
    if (!interaction.isShowPoweredBy()) {
      activity.findViewById(R.id.apptentive_branding_view).setVisibility(View.GONE);
    }
  }
Пример #23
0
  private void initComponent(Intent intent) {
    LinearLayout llHeaderBase = (LinearLayout) findViewById(R.id.llHeaderBase);
    ThemeUtil.setSecondaryImageHeader(llHeaderBase);

    if (intent == null) {
      return;
    }

    Bundle bundle = intent.getExtras();
    realPath = bundle.getString("image-path");
    imageUrl = Uri.fromFile(new File(realPath)).toString();

    String html = String.format(WEB_HTML, getMaxWidth(), imageUrl);

    webViewer = (WebView) findViewById(R.id.wvImageViewer);
    webViewer.getSettings().setSupportZoom(true);
    webViewer.getSettings().setBuiltInZoomControls(true);
    webViewer.setBackgroundColor(Color.BLACK);
    webViewer.setVerticalScrollBarEnabled(false);
    webViewer.setHorizontalScrollBarEnabled(false);
    // webViewer.setOnTouchListener(new ImageWebViewDoubleClickListener());

    webViewer.loadDataWithBaseURL("", html, "text/html", "UTF-8", "");
  }
Пример #24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Context c = this;
    setContentView(R.layout.activity_main);
    SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE);
    pagenumber = sharedPreferences.getInt("pagenumber", 1);
    webView = (WebView) findViewById(R.id.webView1);
    webView.getSettings().setAppCacheEnabled(true);
    webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setLoadWithOverviewMode(true);

    webView.setWebViewClient(
        new WebViewClient() {
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {

            if (url.contains("share")) {
              // Toast.makeText(c, webView.getUrl(),Toast.LENGTH_SHORT).show();
              view.goBack();
              Share.share(webView.getUrl(), c);
              url = webView.getUrl();
            }
            if (url.contains("exit")) {
              view.goBack();
              finish();
              // Toast.makeText(c, webView.getUrl(),Toast.LENGTH_SHORT).show();
              AlertDialog.Builder builder = new AlertDialog.Builder(c);
              builder
                  .setMessage("Are you sure to exit?")
                  .setPositiveButton("Yes", dialogClickListener)
                  .setNegativeButton("No", dialogClickListener)
                  .show();

            } else {
              view.loadUrl(url);
            }
            return false;
          }

          @Override
          public void onReceivedError(
              WebView view, int errorCode, String description, String failingUrl) {

            Toast.makeText(c, webView.getUrl() + description, Toast.LENGTH_SHORT).show();
            // webView.loadUrl("file://android_asset/image.html#98.jpg");

            Toast.makeText(c, description + failingUrl, Toast.LENGTH_LONG).show();
          }

          @Override
          public void onPageFinished(WebView view, String url) {
            // TODO Auto-generated method stub
            super.onPageFinished(view, url);
            // String id = "98.jpg";
            //  webView.loadUrl("javascript:as(" + id + ");");
          }
        });
    /* Timer timer = new Timer();
    timer.schedule(new TimerTask() {
        @Override
        public void run() {String id = "98.jpg";
        webView.loadUrl("javascript:as(" + id + ");");

        }
    }, 250);*/

    BufferedReader br = null;
    try {
      br = new BufferedReader(new InputStreamReader(this.getAssets().open("image.txt")));
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    String s = "";
    String b = "";
    try {
      while ((s = br.readLine()) != null) {
        b = b + s;
      }
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    b = b.replace("*###*", "98.jpg");
    // b=b+"]]>";

    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setSupportZoom(true);
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.getSettings().setUseWideViewPort(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.setPadding(0, 0, 0, 0);
    webView.setBackgroundColor(Color.WHITE);

    webView.setWebChromeClient(
        new WebChromeClient() {

          // The undocumented magic method override
          // Eclipse will swear at you if you try to put @Override here
          // For Android 3.0+
          public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {

            Intent i = new Intent(Intent.ACTION_GET_CONTENT);
            i.addCategory(Intent.CATEGORY_OPENABLE);
            i.setType("image/*");
            startActivityForResult(
                Intent.createChooser(i, "File Chooser"), MainActivity.FILECHOOSER_RESULTCODE);
          }

          // For Android < 3.0
          public void openFileChooser(ValueCallback<Uri> uploadMsg) {
            openFileChooser(uploadMsg, "");
          }
        });

    //    Toast.makeText(c, b, Toast.LENGTH_LONG).show();
    webView.loadDataWithBaseURL("file:///android_asset/", b + "", "text/html", "UTF-8", null);
    //  String s ="http://marsapparel.co.jp/app";
    //  webView.loadUrl("file:///android_asset/image.html");
    // webView.loadUrl(url, additionalHttpHeaders)
    //    webView.loadUrl("http://lilit.com/gallery/server.ph?imagenum"+surl);
    //  webView.loadUrl("http://"+surl);

  }
Пример #25
0
  /**
   * Return a change log string. Releases occur often enough that we don't expect change sets to be
   * localized.
   *
   * @param from
   * @param to
   * @return
   */
  @SuppressWarnings("nls")
  public void showChangeLog(Context context, int from) {
    if (!(context instanceof Activity) || from == 0) return;

    StringBuilder changeLog = new StringBuilder();

    if (from <= V2_14_4)
      newVersionString(
          changeLog,
          "3.3.0 (8/25/10)",
          new String[] {
            "Astrid is brand new inside and out! In addition to a new "
                + "look and feel, a new add-on system allows Astrid to become "
                + "more powerful, while other improvements have made it faster "
                + "and easier to use. Hope you like it!",
            "If you liked the old version, you can also go back by "
                + "<a href='http://bit.ly/oldastrid'>clicking here</a>",
          });
    if (from >= V3_0_0 && from < V3_3_0)
      newVersionString(
          changeLog,
          "3.3.0 (        )",
          new String[] {
            "something!",
          });
    if (from >= V3_0_0 && from < V3_2_0)
      newVersionString(
          changeLog,
          "3.2.0 (8/16/10)",
          new String[] {
            "Build your own custom filters from the Filter page",
            "Easy task sorting (in the task list menu)",
            "Create widgets from any of your filters",
            "Synchronize with Producteev! (producteev.com)",
            "Select tags by drop-down box",
            "Cosmetic improvements, calendar & sync bug fixes",
          });
    if (from >= V3_0_0 && from < V3_1_0)
      newVersionString(
          changeLog,
          "3.1.0 (8/9/10)",
          new String[] {
            "Linkify phone numbers, e-mails, and web pages",
            "Swipe L => R to go from tasks to filters",
            "Moved task priority bar to left side",
            "Added ability to create fixed alerts for a task",
            "Restored tag hiding when tag begins with underscore (_)",
            "FROYO: disabled moving app to SD card, it would break alarms and widget",
            "Also gone: a couple force closes, bugs with repeating tasks",
          });

    if (changeLog.length() == 0) return;

    changeLog.append("Enjoy!</body></html>");
    String changeLogHtml = "<html><body style='color: white'>" + changeLog;

    WebView webView = new WebView(context);
    webView.loadData(changeLogHtml, "text/html", "utf-8");
    webView.setBackgroundColor(0);

    new AlertDialog.Builder(context)
        .setTitle(R.string.UpS_changelog_title)
        .setView(webView)
        .setIcon(android.R.drawable.ic_dialog_info)
        .setPositiveButton(android.R.string.ok, null)
        .show();
  }
Пример #26
0
  public final void run() {
    Log.i("jtwitter", "TwitterAuth run!");
    final WebView webview = new WebView(context);
    webview.setBackgroundColor(Color.BLACK);
    webview.setVisibility(View.VISIBLE);
    final Dialog dialog = new Dialog(context, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
    dialog.setContentView(webview);
    dialog.show();

    webview.getSettings().setJavaScriptEnabled(true);
    webview.setWebViewClient(
        new WebViewClient() {

          @Override
          public void onPageStarted(WebView view, String url, Bitmap favicon) {
            Log.d("jtwitter", "url: " + url);
            if (!url.contains(callbackUrl)) return;
            Uri uri = Uri.parse(url);
            String verifier = uri.getQueryParameter("oauth_verifier");
            if (verifier == null) {
              // denied!
              Log.i("jtwitter", "Auth-fail: " + url);
              dialog.dismiss();
              onFail(new Exception(url));
              return;
            }
            client.setAuthorizationCode(verifier);
            String[] tokens = client.getAccessToken();
            Twitter jtwitter = new Twitter(null, client);
            Log.i("jtwitter", "Authorised :)");
            dialog.dismiss();
            onSuccess(jtwitter, tokens);
          }

          @Override
          public void onPageFinished(WebView view, String url) {
            Log.i("jtwitter", "url finished: " + url);
          }
        });
    // Workaround for http://code.google.com/p/android/issues/detail?id=7189
    webview.requestFocus(View.FOCUS_DOWN);
    webview.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent e) {
            if (e.getAction() == MotionEvent.ACTION_DOWN
                || e.getAction() == MotionEvent.ACTION_UP) {
              if (!v.hasFocus()) {
                v.requestFocus();
              }
            }
            return false;
          }
        });

    // getting the url to load involves a web call -- let the UI update first
    Toast.makeText(context, authoriseMessage, Toast.LENGTH_SHORT).show();
    final Handler handler = new Handler();
    handler.postDelayed(
        new Runnable() {
          @Override
          public void run() {
            try {
              URI authUrl = client.authorizeUrl();
              webview.loadUrl(authUrl.toString());
            } catch (Exception e) {
              onFail(e);
            }
          }
        },
        10);
  }
Пример #27
0
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mHideTimer = new Timer("actionbar-hide-timer");
    if (savedInstanceState == null)
      overridePendingTransition(R.anim.slide_in_right, R.anim.fade_out);
    setContentView(R.layout.activity_imageviewer);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    try {
      setSupportActionBar(toolbar);
    } catch (Throwable t) {
    }
    if (Build.VERSION.SDK_INT >= 14 && Build.VERSION.SDK_INT < 19)
      getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    else if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) {
      ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
      int resid = getResources().getIdentifier("status_bar_height", "dimen", "android");
      if (resid > 0) lp.topMargin = getResources().getDimensionPixelSize(resid);
      else lp.topMargin = getResources().getDimensionPixelSize(R.dimen.status_bar_height);
      toolbar.setLayoutParams(lp);
    }
    getSupportActionBar().setTitle("Image Viewer");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar()
        .setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_translucent));

    mImage = (WebView) findViewById(R.id.image);
    mImage.setBackgroundColor(0);
    mImage.addJavascriptInterface(new JSInterface(), "Android");
    mImage.getSettings().setBuiltInZoomControls(true);
    if (Integer.parseInt(Build.VERSION.SDK) >= 19)
      mImage.getSettings().setDisplayZoomControls(false);
    mImage.getSettings().setJavaScriptEnabled(true);
    mImage.getSettings().setLoadWithOverviewMode(true);
    mImage.getSettings().setUseWideViewPort(true);
    mImage.setWebChromeClient(
        new WebChromeClient() {
          @Override
          public void onProgressChanged(WebView view, int newProgress) {
            mProgress.setProgress(newProgress);
          }
        });
    mImage.setWebViewClient(
        new WebViewClient() {
          @Override
          public void onPageFinished(WebView view, String url) {
            mSpinner.setVisibility(View.GONE);
            mProgress.setVisibility(View.GONE);
            mImage.setVisibility(View.VISIBLE);
            hide_actionbar();
          }

          @Override
          public void onReceivedError(
              WebView view, int errorCode, String description, String failingUrl) {
            fail();
          }

          @Override
          public void onLoadResource(WebView view, String url) {
            mSpinner.setVisibility(View.GONE);
            mProgress.setVisibility(View.VISIBLE);
          }
        });
    mSpinner = (ProgressBar) findViewById(R.id.spinner);
    mProgress = (ProgressBar) findViewById(R.id.progress);

    findViewById(R.id.video)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                if (toolbar.getVisibility() == View.VISIBLE) {
                  if (mHideTimerTask != null) mHideTimerTask.cancel();
                  if (Build.VERSION.SDK_INT > 16) {
                    toolbar
                        .animate()
                        .alpha(0)
                        .translationY(-toolbar.getHeight())
                        .withEndAction(
                            new Runnable() {
                              @Override
                              public void run() {
                                toolbar.setVisibility(View.GONE);
                              }
                            });
                  } else {
                    toolbar.setVisibility(View.GONE);
                  }
                } else {
                  if (Build.VERSION.SDK_INT > 16) {
                    toolbar.setAlpha(0);
                    toolbar.animate().alpha(1).translationY(0);
                  }
                  toolbar.setVisibility(View.VISIBLE);
                  hide_actionbar();
                }
              }
            });

    if (getIntent() != null && getIntent().getDataString() != null) {
      String url =
          getIntent()
              .getDataString()
              .replace(getResources().getString(R.string.IMAGE_SCHEME), "http");
      String lower = url.toLowerCase().replace("https://", "").replace("http://", "");
      if (lower.startsWith("www.dropbox.com/")) {
        if (lower.startsWith("www.dropbox.com/s/")) {
          url = url.replace("://www.dropbox.com/s/", "://dl.dropboxusercontent.com/s/");
        } else {
          url = url + "?dl=1";
        }
      } else if ((lower.startsWith("d.pr/i/") || lower.startsWith("droplr.com/i/"))
          && !lower.endsWith("+")) {
        url += "+";
      } else if (lower.startsWith("imgur.com/") || lower.startsWith("www.imgur.com/")) {
        String id = url.replace("https://", "").replace("http://", "");
        id = id.substring(id.indexOf("/") + 1);

        if (!id.contains("/") && id.length() > 0) {
          new ImgurImageTask().execute(id);
        } else if (id.startsWith("gallery/") && id.length() > 8) {
          new ImgurGalleryTask().execute(id.substring(8));
        } else {
          fail();
        }
        return;
      } else if (lower.startsWith("i.imgur.com") && lower.endsWith(".gifv")) {
        String id = url.replace("https://", "").replace("http://", "");
        id = id.substring(id.indexOf("/") + 1);
        id = id.substring(0, id.length() - 5);
        new ImgurImageTask().execute(id);
        return;
      } else if (lower.startsWith("gfycat.com/") || lower.startsWith("www.gfycat.com/")) {
        String id = url;
        if (id.endsWith("/")) id = id.substring(0, id.length() - 1);
        id = id.substring(id.lastIndexOf("/") + 1, id.length());
        new GfyCatTask().execute(id);
        return;
      } else if (lower.startsWith("giphy.com/")
          || lower.startsWith("www.giphy.com/")
          || lower.startsWith("gph.is/")) {
        if (lower.contains("/gifs/") && lower.lastIndexOf("/") > lower.indexOf("/gifs/") + 6)
          url = url.substring(0, lower.lastIndexOf("/"));
        new OEmbedTask().execute("https://giphy.com/services/oembed/?url=" + url);
        return;
      } else if (lower.startsWith("flickr.com/") || lower.startsWith("www.flickr.com/")) {
        new OEmbedTask().execute("https://www.flickr.com/services/oembed/?format=json&url=" + url);
        return;
      } else if (lower.startsWith("instagram.com/")
          || lower.startsWith("www.instagram.com/")
          || lower.startsWith("instagr.am/")
          || lower.startsWith("www.instagr.am/")) {
        new OEmbedTask().execute("http://api.instagram.com/oembed?url=" + url);
        return;
      } else if (lower.startsWith("cl.ly")) {
        new ClLyTask().execute(url);
        return;
      } else if (url.contains("/wiki/File:")) {
        new WikiTask()
            .execute(
                url.replace(
                    "/wiki/",
                    "/w/api.php?action=query&format=json&prop=imageinfo&iiprop=url&titles="));
      } else if (lower.startsWith("leetfiles.com/") || lower.startsWith("www.leetfiles.com/")) {
        url =
            url.replace("www.", "")
                .replace("leetfiles.com/image/", "i.leetfiles.com/")
                .replace("?id=", "");
      } else if (lower.startsWith("leetfil.es/") || lower.startsWith("www.leetfil.es/")) {
        url =
            url.replace("www.", "")
                .replace("leetfil.es/image/", "i.leetfiles.com/")
                .replace("?id=", "");
      }
      loadImage(url);
    } else {
      finish();
    }
  }
 /** Prepare the webview, set Invisible & transparent background Must call injectHeader next */
 public static void preLoadInjectHeader(WebView mWebView) {
   mWebView.setBackgroundColor(Color.TRANSPARENT);
   mWebView.setVisibility(View.INVISIBLE);
 }
Пример #29
0
 public void setWebBackgroundColor(int color) {
   view.setBackgroundColor(color);
   webView.setBackgroundColor(color);
 }
Пример #30
0
  private void renderView() {
    // reference
    final WebView webView = (WebView) mRootView.findViewById(R.id.fragment_main_webview);
    final AdView adView = (AdView) mRootView.findViewById(R.id.fragment_main_adview);

    // webview settings
    webView.getSettings().setBuiltInZoomControls(false);
    webView.getSettings().setSupportZoom(true);
    webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setBackgroundColor(getResources().getColor(R.color.global_bg_front));
    webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); // fixes scrollbar on Froyo
    webView.setWebChromeClient(
        new WebChromeClient() {
          public void openFileChooser(ValueCallback<Uri> filePathCallback) {
            mFilePathCallback4 = filePathCallback;
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.addCategory(Intent.CATEGORY_OPENABLE);
            intent.setType("*/*");
            startActivityForResult(
                Intent.createChooser(intent, "File Chooser"), REQUEST_FILE_PICKER);
          }

          public void openFileChooser(ValueCallback filePathCallback, String acceptType) {
            mFilePathCallback4 = filePathCallback;
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.addCategory(Intent.CATEGORY_OPENABLE);
            intent.setType("*/*");
            startActivityForResult(
                Intent.createChooser(intent, "File Chooser"), REQUEST_FILE_PICKER);
          }

          public void openFileChooser(
              ValueCallback<Uri> filePathCallback, String acceptType, String capture) {
            mFilePathCallback4 = filePathCallback;
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.addCategory(Intent.CATEGORY_OPENABLE);
            intent.setType("*/*");
            startActivityForResult(
                Intent.createChooser(intent, "File Chooser"), REQUEST_FILE_PICKER);
          }

          @Override
          public boolean onShowFileChooser(
              WebView webView,
              ValueCallback<Uri[]> filePathCallback,
              WebChromeClient.FileChooserParams fileChooserParams) {
            mFilePathCallback5 = filePathCallback;
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.addCategory(Intent.CATEGORY_OPENABLE);
            intent.setType("*/*");
            startActivityForResult(
                Intent.createChooser(intent, "File Chooser"), REQUEST_FILE_PICKER);
            return true;
          }
        });
    webView.setWebViewClient(
        new WebViewClient() {
          private boolean mSuccess = true;

          @Override
          public void onPageFinished(final WebView view, final String url) {
            runTaskCallback(
                new Runnable() {
                  public void run() {
                    if (getActivity() != null && mSuccess) {
                      showContent(
                          500); // hide progress bar with delay to show webview content smoothly
                      showActionBarProgress(false);
                    }
                  }
                });
          }

          @Override
          public void onReceivedError(
              final WebView view,
              final int errorCode,
              final String description,
              final String failingUrl) {
            runTaskCallback(
                new Runnable() {
                  public void run() {
                    if (getActivity() != null) {
                      mSuccess = false;
                      showEmpty();
                      showActionBarProgress(false);
                    }
                  }
                });
          }

          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (DownloadUtility.isDownloadableFile(url)) {
              Toast.makeText(getActivity(), R.string.fragment_main_downloading, Toast.LENGTH_LONG)
                  .show();
              DownloadUtility.downloadFile(getActivity(), url, DownloadUtility.getFileName(url));
              return true;
            } else if (url != null && (url.startsWith("http://") || url.startsWith("https://"))) {
              // determine for opening the link externally or internally
              boolean external = isLinkExternal(url);
              boolean internal = isLinkInternal(url);
              if (!external && !internal) {
                external = WebViewAppConfig.OPEN_LINKS_IN_EXTERNAL_BROWSER;
              }

              // open the link
              if (external) {
                startWebActivity(url);
                return true;
              } else {
                showActionBarProgress(true);
                return false;
              }
            } else if (url != null && url.startsWith("mailto:")) {
              MailTo mailTo = MailTo.parse(url);
              startEmailActivity(mailTo.getTo(), mailTo.getSubject(), mailTo.getBody());
              return true;
            } else if (url != null && url.startsWith("tel:")) {
              startCallActivity(url);
              return true;
            } else if (url != null && url.startsWith("sms:")) {
              startSmsActivity(url);
              return true;
            } else if (url != null && url.startsWith("geo:")) {
              startMapSearchActivity(url);
              return true;
            } else {
              return false;
            }
          }
        });
    webView.setOnKeyListener(
        new View.OnKeyListener() {
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_DOWN) {
              WebView webView = (WebView) v;

              switch (keyCode) {
                case KeyEvent.KEYCODE_BACK:
                  if (webView.canGoBack()) {
                    webView.goBack();
                    return true;
                  }
                  break;
              }
            }

            return false;
          }
        });
    webView.requestFocus(
        View
            .FOCUS_DOWN); // http://android24hours.blogspot.cz/2011/12/android-soft-keyboard-not-showing-on.html
    webView.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
              case MotionEvent.ACTION_UP:
                if (!v.hasFocus()) {
                  v.requestFocus();
                }
                break;
            }

            return false;
          }
        });

    // admob
    if (WebViewAppConfig.ADMOB && NetworkManager.isOnline(getActivity())) {
      AdRequest adRequest =
          new AdRequest.Builder()
              .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
              .addTestDevice(getString(R.string.admob_test_device_id))
              .build();
      adView.loadAd(adRequest);
      adView.setVisibility(View.VISIBLE);
    } else {
      adView.setVisibility(View.GONE);
    }
  }