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.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 GuideTab extends Fragment {
32 private int tabNumber;
34 // GuideTab.createTab stores the tab number in the bundle arguments so it can be referenced from onCreate().
35 public static GuideTab createTab (int tab) {
36 Bundle thisTabArguments = new Bundle();
37 thisTabArguments.putInt("Tab", tab);
39 GuideTab thisTab = new GuideTab();
40 thisTab.setArguments(thisTabArguments);
45 public void onCreate(Bundle savedInstanceState) {
46 super.onCreate(savedInstanceState);
48 // Store the tab number in tabNumber.
49 tabNumber = getArguments().getInt("Tab");
53 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
54 // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container.
55 // The fragment will take care of attaching the root automatically.
56 View tabLayout = inflater.inflate(R.layout.guide_tab_webview, container, false);
57 WebView tabWebView = (WebView) tabLayout;
59 // Tab numbers start at 0.
62 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_overview.html");
66 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_javascript.html");
70 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_local_storage.html");
74 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_user_agent.html");
78 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_tor.html");
82 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_tracking_ids.html");
86 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_clear_and_exit.html");
90 tabWebView.loadUrl("file:///android_asset/" + getString(R.string.android_asset_path) + "/guide_planned_features.html");