X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FAboutActivity.java;h=3508b7521f3de43efec13ac42c3ca111abaabaa8;hp=c20452151e9f5c010795593bdd577fdb07384eba;hb=84989e138cb593d5a2f70be848db4889aaa8da88;hpb=74857298f431569df1849e8ef91387cb25274095 diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.java index c2045215..3508b752 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2017 Soren Stoutner . + * Copyright © 2016-2019 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -20,14 +20,17 @@ package com.stoutner.privacybrowser.activities; import android.os.Bundle; -import android.support.design.widget.TabLayout; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.view.ViewPager; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; +import android.view.WindowManager; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.ViewPager; + +import com.google.android.material.tabs.TabLayout; import com.stoutner.privacybrowser.fragments.AboutTabFragment; import com.stoutner.privacybrowser.R; @@ -35,6 +38,11 @@ import com.stoutner.privacybrowser.R; public class AboutActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { + // Disable screenshots if not allowed. + if (!MainWebViewActivity.allowScreenshots) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); + } + // Set the theme. if (MainWebViewActivity.darkTheme) { setTheme(R.style.PrivacyBrowserDark_SecondaryActivity); @@ -48,27 +56,34 @@ public class AboutActivity extends AppCompatActivity { // Set the content view. setContentView(R.layout.about_coordinatorlayout); - // We need to use the SupportActionBar from android.support.v7.app.ActionBar until the minimum API is >= 21. - Toolbar aboutAppBar = (Toolbar) findViewById(R.id.about_toolbar); - setSupportActionBar(aboutAppBar); + // Get handles for the views. + Toolbar toolbar = findViewById(R.id.about_toolbar); + TabLayout aboutTabLayout = findViewById(R.id.about_tablayout); + ViewPager aboutViewPager = findViewById(R.id.about_viewpager); + + // Set the action bar. `SupportActionBar` must be used until the minimum API is >= 21. + setSupportActionBar(toolbar); + + // Get a handle for the action bar. + final ActionBar actionBar = getSupportActionBar(); + + // Remove the incorrect lint warning that the action bar might be null. + assert actionBar != null; // - // Display the home arrow on supportAppBar. - final ActionBar appBar = getSupportActionBar(); - assert appBar != null;// This assert removes the incorrect warning in Android Studio on the following line that appBar might be null. - appBar.setDisplayHomeAsUpEnabled(true); + // Display the home arrow on action bar. + actionBar.setDisplayHomeAsUpEnabled(true); // Setup the ViewPager. - ViewPager aboutViewPager = (ViewPager) findViewById(R.id.about_viewpager); - aboutViewPager.setAdapter(new aboutPagerAdapter(getSupportFragmentManager())); + aboutViewPager.setAdapter(new AboutPagerAdapter(getSupportFragmentManager())); - // Setup the TabLayout and connect it to the ViewPager. - TabLayout aboutTabLayout = (TabLayout) findViewById(R.id.about_tablayout); + // Connect the tab layout to the view pager. aboutTabLayout.setupWithViewPager(aboutViewPager); } - private class aboutPagerAdapter extends FragmentPagerAdapter { - private aboutPagerAdapter(FragmentManager fm) { - super(fm); + private class AboutPagerAdapter extends FragmentPagerAdapter { + private AboutPagerAdapter(FragmentManager fragmentManager) { + // Run the default commands. + super(fragmentManager); } @Override