2 * Copyright 2016-2017 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.fragments;
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 import com.stoutner.privacybrowser.R;
31 public class GuideTabFragment extends Fragment {
32 // `tabNumber` is used in `onCreate()` and `onCreateView()`.
33 private int tabNumber;
35 // GuideTabFragment.createTab stores the tab number in the bundle arguments so it can be referenced from onCreate().
36 public static GuideTabFragment createTab (int tab) {
37 Bundle thisTabArguments = new Bundle();
38 thisTabArguments.putInt("Tab", tab);
40 GuideTabFragment thisTab = new GuideTabFragment();
41 thisTab.setArguments(thisTabArguments);
46 public void onCreate(Bundle savedInstanceState) {
47 super.onCreate(savedInstanceState);
49 // Store the tab number in `tabNumber`.
50 tabNumber = getArguments().getInt("Tab");
54 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
55 // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container.
56 // The fragment will take care of attaching the root automatically.
57 View tabLayout = inflater.inflate(R.layout.guide_tab_webview, container, false);
58 WebView tabWebView = (WebView) tabLayout;
60 // Tab numbers start at 0.
63 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_overview.html");
67 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_javascript.html");
71 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_local_storage.html");
75 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_user_agent.html");
79 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_tor.html");
83 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_tracking_ids.html");
87 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_clear_and_exit.html");
91 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_planned_features.html");