X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2FAboutDialog.java;fp=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2FAboutDialog.java;h=ea87318fb65796d6299cd4d34936f55b24804181;hb=a7e15f550848e50703320e8811d24a7cf0d8d189;hp=0000000000000000000000000000000000000000;hpb=b72fd06c1e378ca01c1cccd83ed0c7ae5297b8f4;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/AboutDialog.java b/app/src/main/java/com/stoutner/privacybrowser/AboutDialog.java new file mode 100644 index 00000000..ea87318f --- /dev/null +++ b/app/src/main/java/com/stoutner/privacybrowser/AboutDialog.java @@ -0,0 +1,57 @@ +/** + * Copyright 2015 Soren Stoutner + * + * This file is part of Privacy Browser . + * + * Privacy Browser is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser. If not, see . + */ + +package com.stoutner.privacybrowser; + +import android.app.Dialog; +import android.content.DialogInterface; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v7.app.AlertDialog; +import android.support.v7.app.AppCompatDialogFragment; +import android.webkit.WebView; + +public class AboutDialog extends AppCompatDialogFragment { + // onCreateDialog requires @NonNull. + @Override + @NonNull + public Dialog onCreateDialog(Bundle savedInstanceState) { + // Create a WebView to display about_text.html + final WebView aboutDialogWebView = new WebView(getContext()); + aboutDialogWebView.loadUrl("file:///android_asset/about_text.html"); + + // Use AlertDialog.Builder to create the AlertDialog + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); + alertDialogBuilder.setTitle(R.string.about_privacy_browser); + alertDialogBuilder.setView(aboutDialogWebView); + alertDialogBuilder.setPositiveButton(R.string.dismiss, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // Do nothing. The dialog will automatically be dismissed. + } + }); + + // Assign alertDialogBuilder to an AlertDialog and show it on the screen. + final AlertDialog alertDialog = alertDialogBuilder.create(); + alertDialog.show(); + + // onCreateDialog requires the return of an AlertDialog. + return alertDialog; + } +}