Skip to content

Commit

Permalink
Merge pull request vx#125 from jklein24/master
Browse files Browse the repository at this point in the history
Ensure that console title overlays are shown when switching views.
  • Loading branch information
kruton committed Aug 11, 2015
2 parents 71b553c + 84e2759 commit c175466
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions app/src/main/java/org/connectbot/ConsoleActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,9 @@ public void onClick(View v) {
};

private void onEmulatedKeyClicked(View v) {
View flip = findCurrentView(R.id.console_flip);
if (flip == null)
return;
TerminalView terminal = adapter.getCurrentTerminalView();
if (terminal == null) return;

TerminalView terminal = (TerminalView) flip;
TerminalKeyListener handler = terminal.bridge.getKeyHandler();
boolean hideKeys = true;

Expand Down Expand Up @@ -274,7 +272,7 @@ private void closeBridge(final TerminalBridge bridge) {
}

protected View findCurrentView(int id) {
TerminalView view = adapter.getCurrentTerminalView();
View view = pager.findViewWithTag(adapter.getBridgeAtPosition(pager.getCurrentItem()));
if (view == null) {
return null;
}
Expand Down Expand Up @@ -1210,7 +1208,7 @@ public int getItemPosition(Object object) {
}
}

public TerminalBridge getItemAtPosition(int position) {
public TerminalBridge getBridgeAtPosition(int position) {
ArrayList<TerminalBridge> bridges = bound.getBridges();
if (position < 0 || position >= bridges.size()) {
return null;
Expand All @@ -1225,15 +1223,15 @@ public boolean isViewFromObject(View view, Object object) {

@Override
public CharSequence getPageTitle(int position) {
TerminalBridge bridge = getItemAtPosition(position);
TerminalBridge bridge = getBridgeAtPosition(position);
if (bridge == null) {
return "???";
}
return bridge.host.getNickname();
}

public TerminalView getCurrentTerminalView() {
View currentView = pager.findViewWithTag(adapter.getItemAtPosition(pager.getCurrentItem()));
View currentView = pager.findViewWithTag(getBridgeAtPosition(pager.getCurrentItem()));
if (currentView == null) return null;
return (TerminalView) currentView.findViewById(R.id.console_flip);
}
Expand Down

0 comments on commit c175466

Please sign in to comment.