commit 7b6b87d4766fbf7642cd967d0c37dbe0ddef8fdd Author: Matthew Finkel Matthew.Finkel@gmail.com Date: Wed May 1 22:50:54 2019 +0000
fixup! Bug 28329 - Part 4. Add new Tor Bootstrapping and configuration screens
Simplify code, making debugging easier --- .../gecko/torbootstrap/TorBootstrapPager.java | 7 +--- .../torbootstrap/TorBootstrapPagerConfig.java | 45 ++-------------------- 2 files changed, 4 insertions(+), 48 deletions(-)
diff --git a/mobile/android/base/java/org/mozilla/gecko/torbootstrap/TorBootstrapPager.java b/mobile/android/base/java/org/mozilla/gecko/torbootstrap/TorBootstrapPager.java index b780810f14ab..d9d298cb75ed 100644 --- a/mobile/android/base/java/org/mozilla/gecko/torbootstrap/TorBootstrapPager.java +++ b/mobile/android/base/java/org/mozilla/gecko/torbootstrap/TorBootstrapPager.java @@ -114,7 +114,7 @@ public class TorBootstrapPager extends FirstrunPager { if (fragment == null) { TorBootstrapPagerConfig.TorBootstrapPanelConfig panelConfig = panels.get(i); // We know the class is within the "org.mozilla.gecko.torbootstrap" package namespace - fragment = Fragment.instantiate(mActivity.getApplicationContext(), panelConfig.getClassname(), panelConfig.getArgs()); + fragment = Fragment.instantiate(mActivity.getApplicationContext(), panelConfig.getClassname()); ((TorBootstrapPanel) fragment).setPagerNavigation(pagerNavigation); ((TorBootstrapPanel) fragment).setContext(mActivity); ((TorBootstrapPanel) fragment).setBootstrapController(this); @@ -128,11 +128,6 @@ public class TorBootstrapPager extends FirstrunPager { return panels.size(); }
- @Override - public CharSequence getPageTitle(int i) { - return context.getString(panels.get(i).getTitleRes()).toUpperCase(); - } - public void startBootstrapping() { if (fragments.length == 0) { return; diff --git a/mobile/android/base/java/org/mozilla/gecko/torbootstrap/TorBootstrapPagerConfig.java b/mobile/android/base/java/org/mozilla/gecko/torbootstrap/TorBootstrapPagerConfig.java index 7eb5f77fe8ca..17454da91444 100644 --- a/mobile/android/base/java/org/mozilla/gecko/torbootstrap/TorBootstrapPagerConfig.java +++ b/mobile/android/base/java/org/mozilla/gecko/torbootstrap/TorBootstrapPagerConfig.java @@ -5,13 +5,8 @@
package org.mozilla.gecko.torbootstrap;
-import android.os.Bundle; import android.util.Log; import org.mozilla.gecko.GeckoSharedPrefs; -import org.mozilla.gecko.R; -import org.mozilla.gecko.Telemetry; -import org.mozilla.gecko.TelemetryContract; -import org.mozilla.gecko.Experiments;
import java.util.LinkedList; import java.util.List; @@ -24,13 +19,6 @@ public class TorBootstrapPagerConfig { public static final String KEY_SUBTEXT = "subtextRes"; public static final String KEY_CTATEXT = "ctatextRes";
- public static List<TorBootstrapPanelConfig> getDefaultConnectPanel() { - final List<TorBootstrapPanelConfig> panels = new LinkedList<>(); - panels.add(SimplePanelConfigs.connectPanelConfig); - - return panels; - } - public static List<TorBootstrapPanelConfig> getDefaultBootstrapPanel() { final List<TorBootstrapPanelConfig> panels = new LinkedList<>(); panels.add(SimplePanelConfigs.bootstrapPanelConfig); @@ -42,46 +30,19 @@ public class TorBootstrapPagerConfig { public static class TorBootstrapPanelConfig {
private String classname; - private int titleRes; - private Bundle args; - - public TorBootstrapPanelConfig(String resource, int titleRes) { - this(resource, titleRes, -1, -1, -1, true); - }
- public TorBootstrapPanelConfig(String classname, int titleRes, int imageRes, int textRes, int subtextRes) { - this(classname, titleRes, imageRes, textRes, subtextRes, false); - } - - private TorBootstrapPanelConfig(String classname, int titleRes, int imageRes, int textRes, int subtextRes, boolean isCustom) { + public TorBootstrapPanelConfig(String classname) { this.classname = classname; - this.titleRes = titleRes; - - if (!isCustom) { - this.args = new Bundle(); - this.args.putInt(KEY_IMAGE, imageRes); - this.args.putInt(KEY_TEXT, textRes); - this.args.putInt(KEY_SUBTEXT, subtextRes); - } }
public String getClassname() { return this.classname; } - - public int getTitleRes() { - return this.titleRes; - } - - public Bundle getArgs() { - return args; - } }
private static class SimplePanelConfigs { - public static final TorBootstrapPanelConfig connectPanelConfig = new TorBootstrapPanelConfig(TorBootstrapPanel.class.getName(), R.string.firstrun_panel_title_welcome); - public static final TorBootstrapPanelConfig bootstrapPanelConfig = new TorBootstrapPanelConfig(TorBootstrapPanel.class.getName(), R.string.firstrun_panel_title_welcome); - public static final TorBootstrapPanelConfig torLogPanelConfig = new TorBootstrapPanelConfig(TorBootstrapLogPanel.class.getName(), R.string.firstrun_panel_title_privacy); + public static final TorBootstrapPanelConfig bootstrapPanelConfig = new TorBootstrapPanelConfig(TorBootstrapPanel.class.getName()); + public static final TorBootstrapPanelConfig torLogPanelConfig = new TorBootstrapPanelConfig(TorBootstrapLogPanel.class.getName());
} }
tbb-commits@lists.torproject.org