2 * Copyright 2016 Soren Stoutner <soren@stoutner.com>.
4 * This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
6 * Privacy Browser is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * Privacy Browser is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>.
20 package com.stoutner.privacybrowser;
22 import android.os.Bundle;
23 import android.support.v4.app.Fragment;
24 import android.view.LayoutInflater;
25 import android.view.View;
26 import android.view.ViewGroup;
27 import android.webkit.WebView;
29 public class GuideTabFragment extends Fragment {
30 private int tabNumber;
32 // GuideTabFragment.createTab stores the tab number in the bundle arguments so it can be referenced from onCreate().
33 public static GuideTabFragment createTab (int tab) {
34 Bundle thisTabArguments = new Bundle();
35 thisTabArguments.putInt("Tab", tab);
37 GuideTabFragment thisTab = new GuideTabFragment();
38 thisTab.setArguments(thisTabArguments);
43 public void onCreate(Bundle savedInstanceState) {
44 super.onCreate(savedInstanceState);
46 // Store the tab number in tabNumber.
47 tabNumber = getArguments().getInt("Tab");
51 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
52 // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container.
53 // The fragment will take care of attaching the root automatically.
54 View tabLayout = inflater.inflate(R.layout.guide_tab_webview, container, false);
55 WebView tabWebView = (WebView) tabLayout;
57 // Tab numbers start at 0.
60 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_overview.html");
64 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_javascript.html");
68 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_local_storage.html");
72 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_user_agent.html");
76 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_tor.html");
80 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_tracking_ids.html");
84 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_clear_and_exit.html");
88 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_planned_features.html");