[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser/tor-browser-60.6.1esr-8.5-1] fixup! Bug 28329 - Part 4. Add new Tor Bootstrapping and configuration screens
commit 2665a59cc56b12e27ac050e31b2db65b66cd1878
Author: Matthew Finkel <Matthew.Finkel@xxxxxxxxx>
Date: Wed May 1 22:56:42 2019 +0000
fixup! Bug 28329 - Part 4. Add new Tor Bootstrapping and configuration screens
Move Fragment creation into ViewPagerAdapter constructor.
---
.../gecko/torbootstrap/TorBootstrapPager.java | 25 ++++++++++++----------
1 file changed, 14 insertions(+), 11 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 d9d298cb75ed..67cfe73d465a 100644
--- a/mobile/android/base/java/org/mozilla/gecko/torbootstrap/TorBootstrapPager.java
+++ b/mobile/android/base/java/org/mozilla/gecko/torbootstrap/TorBootstrapPager.java
@@ -105,22 +105,25 @@ public class TorBootstrapPager extends FirstrunPager {
public ViewPagerAdapter(FragmentManager fm, List<TorBootstrapPagerConfig.TorBootstrapPanelConfig> panels) {
super(fm);
this.panels = panels;
- this.fragments = new Fragment[panels.size()];
+ this.fragments = getPagerPanels();
}
- @Override
- public Fragment getItem(int i) {
- Fragment fragment = fragments[i];
- if (fragment == null) {
+ private Fragment[] getPagerPanels() {
+ Fragment[] fragments = new Fragment[panels.size()];
+ for (int i = 0; i < fragments.length; i++) {
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());
- ((TorBootstrapPanel) fragment).setPagerNavigation(pagerNavigation);
- ((TorBootstrapPanel) fragment).setContext(mActivity);
- ((TorBootstrapPanel) fragment).setBootstrapController(this);
- fragments[i] = fragment;
+ fragments[i] = Fragment.instantiate(mActivity.getApplicationContext(), panelConfig.getClassname());
+ ((TorBootstrapPanel) fragments[i]).setPagerNavigation(pagerNavigation);
+ ((TorBootstrapPanel) fragments[i]).setContext(mActivity);
+ ((TorBootstrapPanel) fragments[i]).setBootstrapController(this);
}
- return fragment;
+ return fragments;
+ }
+
+ @Override
+ public Fragment getItem(int i) {
+ return fragments[i];
}
@Override
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits