diff options
author | Jeremy Klein <jlklein@google.com> | 2015-10-20 11:02:38 -0700 |
---|---|---|
committer | Jeremy Klein <jlklein@google.com> | 2015-10-20 15:27:15 -0700 |
commit | 2bda23f8f7c519ca97dca8a5df20cfa6a318d3b6 (patch) | |
tree | 9f30898d25454abd339f5559a66001e33297b6ed /app | |
parent | 04d323d8a87a3eb26bffb1b0cd9613bae854e4f8 (diff) | |
download | connectbot-2bda23f8f7c519ca97dca8a5df20cfa6a318d3b6.tar.gz connectbot-2bda23f8f7c519ca97dca8a5df20cfa6a318d3b6.tar.bz2 connectbot-2bda23f8f7c519ca97dca8a5df20cfa6a318d3b6.zip |
Scroll to the previously selected view asynchronously.
This avoids a race condition in ViewPager. See #301. Note that
this still looks a bit janky because the pager noticably scrolls
away and back to the right view. A bug has been filed with the
support library team to look into a better solution.
Also update the support library version.
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/org/connectbot/ConsoleActivity.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/src/main/java/org/connectbot/ConsoleActivity.java b/app/src/main/java/org/connectbot/ConsoleActivity.java index 3aebd41..389ddcc 100644 --- a/app/src/main/java/org/connectbot/ConsoleActivity.java +++ b/app/src/main/java/org/connectbot/ConsoleActivity.java @@ -170,10 +170,15 @@ public class ConsoleActivity extends AppCompatActivity implements BridgeDisconne // create views for all bridges on this service adapter.notifyDataSetChanged(); - int requestedIndex = bound.getBridges().indexOf(requestedBridge); + final int requestedIndex = bound.getBridges().indexOf(requestedBridge); if (requestedIndex != -1) { - setDisplayedTerminal(requestedIndex); + pager.post(new Runnable() { + @Override + public void run() { + setDisplayedTerminal(requestedIndex); + } + }); } } |