Example usage for android.webkit WebView loadUrl

List of usage examples for android.webkit WebView loadUrl

Introduction

In this page you can find the example usage for android.webkit WebView loadUrl.

Prototype

public void loadUrl(String url) 

Source Link

Document

Loads the given URL.

Usage

From source file:org.ciasaboark.tacere.activity.fragment.TutorialCrashReporterFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = (ViewGroup) inflater.inflate(layout, container, false);

    TextView sampleReport = (TextView) rootView.findViewById(R.id.tutorial_report_sample_button);
    sampleReport.setOnClickListener(new View.OnClickListener() {
        @Override/*  w w w  .  java2  s .c  o m*/
        public void onClick(View v) {

            AlertDialog.Builder builder = new AlertDialog.Builder(
                    new ContextThemeWrapper(getActivity(), android.R.style.Theme_DeviceDefault_Dialog));
            builder.setTitle(R.string.tutorial_crash_report_sample_title).setPositiveButton(R.string.close,
                    new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            //nothing to do
                        }
                    });
            WebView webView = new WebView(getActivity());
            webView.loadUrl("file:///android_asset/sample_bug_report.html");
            builder.setView(webView);
            builder.show();
        }
    });

    final CheckBox sendReportsCheckbox = (CheckBox) rootView.findViewById(R.id.tutorial_crash_report_checkbox);
    final CrashReportManager crashReportManager = new CrashReportManager(getActivity());

    sendReportsCheckbox.setChecked(crashReportManager.isReportsEnabled());
    sendReportsCheckbox.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            boolean willSendReports = sendReportsCheckbox.isChecked();
            crashReportManager.setReportsEnabled(willSendReports);
        }
    });
    return rootView;
}

From source file:pl.janusz.hain.socialmediawatcher.FragmentTwitterMainMenu.java

private void displayLicensesAlertDialog() {
    WebView view = (WebView) getLayoutInflater(Bundle.EMPTY).inflate(R.layout.dialog_licenses, null);
    view.loadUrl("file:///android_asset/licenses.html");
    new AlertDialog.Builder(getActivity()).setView(view).setPositiveButton(android.R.string.ok, null).show();
}

From source file:com.example.myapplicationtranslator.ui.OpenSourceLicenseActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_open_source_licenses);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    WebView webView = (WebView) findViewById(R.id.web_view);

    webView.getSettings().setBuiltInZoomControls(false);
    webView.loadUrl("file:///android_asset/open_source_licenses.html");
}

From source file:com.pennapps.labs.pennmobile.AboutFragment.java

@OnClick(R.id.licenses)
public void displayLicensesAlertDialog() {
    WebView view = (WebView) LayoutInflater.from(getActivity()).inflate(R.layout.dialog_licenses, null);
    view.loadUrl("file:///android_asset/open_source_licenses.html");
    mAlertDialog = new AlertDialog.Builder(getActivity(), R.style.Theme_AppCompat_Light_Dialog_Alert)
            .setTitle(getString(R.string.action_licenses)).setView(view)
            .setPositiveButton(android.R.string.ok, null).show();
}

From source file:com.pdi.hybridge.HybridgeBroadcaster.java

public void runJsInWebView(WebView view, final String js) {
    view.loadUrl("javascript:(function(){" + js + "})()");
}

From source file:com.microsoft.azure.engagement.fragment.AboutFragment.java

@Nullable
@Override//from   w  w w .  ja  v a2s. co  m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_about, container, false);

    final WebView webView = (WebView) view.findViewById(R.id.webView);
    webView.loadUrl("file:///android_asset/html/about.html");
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {

            final String eventName;

            switch (url) {
            case "file:///android_asset/html/smartnsoft":
                eventName = null;
                url = getString(R.string.smartnsoft_url);
                break;
            case "file:///android_asset/html/github":
                eventName = "click_source_link";
                url = getString(R.string.github_url);
                break;
            case "file:///android_asset/html/application_license":
                eventName = "click_application_license_link";
                url = getString(R.string.application_license_url);
                break;
            case "file:///android_asset/html/third_party_notices":
                eventName = "click_3rd_party_notices_link";
                url = getString(R.string.third_party_notices_url);
                break;
            default:
                eventName = null;
                break;
            }

            Log.d(AboutFragment.TAG, "String url clicked on: " + url);

            CustomTabActivityHelper.openCustomTab(getActivity(), Uri.parse(url), eventName, null, null);

            return true;
        }
    });

    AzmeTracker.startActivity(getActivity(), "about");

    return view;
}

From source file:com.radiusnetworks.museumguide.IntroFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.intro_screen, container, false);

    View controlView = rootView.findViewById(R.id.introFinishControls);

    /*//from ww w.  j  ava  2s.  com
     If we are on the last page of the intro, we show a special controlView that lets the user
     select if they ever want to see this again, and continue on to the main part of the app.
     */
    if (item == IntroActivity.NUM_INTRO_PAGES) {
        controlView.setVisibility(View.VISIBLE);
        rootView.findViewById(R.id.checkBox).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dontShowAgainTapped();
            }
        });

        // This button lets the user move on to the main part of the app
        Button button = (Button) rootView.findViewById(R.id.continueButton);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ((IntroActivity) getActivity()).continueTapped(dontShowAgain);
            }
        });
    } else {
        controlView.setVisibility(View.INVISIBLE);
    }

    WebView webview = (WebView) rootView.findViewById(R.id.webView);
    webview.loadUrl("file:///android_asset/intro" + item + ".html");
    Log.d(TAG, "Loaded intro page URL: " + webview.getUrl());

    return rootView;
}

From source file:shehan.com.migrainetrigger.view.fragment.main.AboutFragment.java

private void displayLicensesAlertDialog() {
    @SuppressLint("InflateParams")
    WebView webView = (WebView) LayoutInflater.from(getContext()).inflate(R.layout.dialog_licenses, null);
    webView.loadUrl("file:///android_asset/open_source_licenses.html");
    new MaterialDialog.Builder(getContext()).title("Open source licenses").customView(webView, true)
            .positiveText("Ok").show();
}

From source file:ca.rmen.android.networkmonitor.app.speedtest.SpeedTestAboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.v(TAG, "onCreateView");
    View rootView = inflater.inflate(R.layout.fragment_speed_test_about, container, false);
    WebView wv = (WebView) rootView.findViewById(R.id.webview);
    wv.setBackgroundColor(0);/*from  w w  w  . ja  v  a2  s.c  o m*/
    wv.getSettings().setDefaultFontSize(14);
    wv.loadUrl(getString(R.string.speed_test_about_file));
    return rootView;
}

From source file:com.money.manager.ex.about.WebChangelogFragment.java

private void loadChangelog(View view) {
    // check if there is network access
    NetworkUtils utils = new NetworkUtils(getActivity());
    if (!utils.isOnline()) {
        new Core(getActivity()).alert(R.string.no_network);
        return;// ww  w .ja  v a 2s. c  om
    }

    // Set up the URL.

    //        String url = "https://github.com/moneymanagerex/android-money-manager-ex/issues?q=milestone%3A";
    //        Core core = new Core(getActivity());
    //        String version = core.getFullAppVersion(); // "2016.01.21.763";
    //        url += version;

    // Show all the versions
    String url = "https://github.com/moneymanagerex/android-money-manager-ex/milestones?direction=desc&sort=due_date&state=closed";

    WebView webView = (WebView) view.findViewById(R.id.webView);
    if (webView != null) {
        webView.loadUrl(url);
    }
}