choose up to 2 bridges from default list randomly

This commit is contained in:
Nathan Freitas 2016-01-25 22:09:26 -05:00
parent 1dbe5eac55
commit 2a728140b4
2 changed files with 14 additions and 3 deletions

View File

@ -1410,15 +1410,26 @@ public class OrbotMainActivity extends AppCompatActivity
long seed = System.nanoTime();
Collections.shuffle(alBridges, new Random(seed));
//let's just pull up to 2 bridges from the defaults at time
int maxBridges = 2;
int bridgeCount = 0;
//now go through the list to find the bridges we want
for (Bridge b : alBridges)
{
if (b.type.equals(type))
{
sbConfig.append(b.type);
sbConfig.append(' ');
sbConfig.append(b.config);
sbConfig.append('\n');
bridgeCount++;
if (bridgeCount == maxBridges)
break;
else
sbConfig.append("\n");
}
}