From: Soren Stoutner Date: Wed, 5 Oct 2016 20:14:58 +0000 (-0700) Subject: Enable printing. X-Git-Tag: v1.11~6 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=9a1be859899abe1eb75637c1ea6b817afee723b1;p=PrivacyBrowserAndroid.git Enable printing. --- diff --git a/app/build.gradle b/app/build.gradle index 8e28fdd4..3f2a08d4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,7 +21,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 24 - buildToolsVersion "24.0.2" + buildToolsVersion "24.0.3" defaultConfig { minSdkVersion 19 targetSdkVersion 24 diff --git a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java index 104522b6..a27dddb2 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/MainWebViewActivity.java @@ -23,6 +23,7 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.app.DialogFragment; import android.app.DownloadManager; +import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -35,6 +36,8 @@ import android.net.http.SslError; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; +import android.print.PrintDocumentAdapter; +import android.print.PrintManager; import android.support.annotation.NonNull; import android.support.design.widget.NavigationView; import android.support.design.widget.Snackbar; @@ -745,6 +748,17 @@ public class MainWebViewActivity extends AppCompatActivity implements Navigation //Everything else will be handled by `CreateHomeScreenShortcut` and the associated listener below. return true; + case R.id.print: + // Get a `PrintManager` instance. + PrintManager printManager = (PrintManager) getSystemService(Context.PRINT_SERVICE); + + // Convert `mainWebView` to `printDocumentAdapter`. + PrintDocumentAdapter printDocumentAdapter = mainWebView.createPrintDocumentAdapter(); + + // Print the document. The print attributes are `null`. + printManager.print(getResources().getString(R.string.privacy_browser_web_page), printDocumentAdapter, null); + return true; + case R.id.refresh: mainWebView.reload(); return true; diff --git a/app/src/main/res/drawable-xxxhdpi/folder_blue_bitmap.png b/app/src/main/res/drawable-xxxhdpi/folder_blue_bitmap.png new file mode 100644 index 00000000..225a2179 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/folder_blue_bitmap.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/folder_grey_bitmap.png b/app/src/main/res/drawable-xxxhdpi/folder_grey_bitmap.png new file mode 100644 index 00000000..00e682e1 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/folder_grey_bitmap.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/world.png b/app/src/main/res/drawable-xxxhdpi/world.png new file mode 100644 index 00000000..5b213935 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/world.png differ diff --git a/app/src/main/res/layout/navigation_header.xml b/app/src/main/res/layout/navigation_header.xml index 0f6c443a..13d390b3 100644 --- a/app/src/main/res/layout/navigation_header.xml +++ b/app/src/main/res/layout/navigation_header.xml @@ -18,7 +18,6 @@ You should have received a copy of the GNU General Public License along with Privacy Browser. If not, see . --> - - + android:textColor="@color/white" /> \ No newline at end of file diff --git a/app/src/main/res/menu/webview_options_menu.xml b/app/src/main/res/menu/webview_options_menu.xml index 0d1f9093..89f1bfbd 100644 --- a/app/src/main/res/menu/webview_options_menu.xml +++ b/app/src/main/res/menu/webview_options_menu.xml @@ -141,6 +141,12 @@ android:orderInCategory="110" app:showAsAction="never" /> + + 200% Share Add to Home Screen + Print + Privacy Browser Web Page Refresh