comparison app/src/main/java/com/five_ten_sg/connectbot/ConsoleActivity.java @ 496:f698820bffdf

add socket2 monitor protocol
author Carl Byington <carl@five-ten-sg.com>
date Sun, 05 Jun 2022 14:46:41 -0700
parents 2043bbaac86e
children
comparison
equal deleted inserted replaced
495:c7a947e291db 496:f698820bffdf
90 90
91 // Direction to shift the ViewFlipper 91 // Direction to shift the ViewFlipper
92 private static final int SHIFT_LEFT = 0; 92 private static final int SHIFT_LEFT = 0;
93 private static final int SHIFT_RIGHT = 1; 93 private static final int SHIFT_RIGHT = 1;
94 94
95 protected ViewFlipper flip = null; 95 protected ConsoleActivity activity = null;
96 protected TerminalManager bound = null; 96 protected ViewFlipper flip = null;
97 protected LayoutInflater inflater = null; 97 protected TerminalManager bound = null;
98 protected LayoutInflater inflater = null;
98 99
99 private SharedPreferences prefs = null; 100 private SharedPreferences prefs = null;
100 101
101 // determines whether or not menuitem accelerators are bound 102 // determines whether or not menuitem accelerators are bound
102 // otherwise they collide with an external keyboard's CTRL-char 103 // otherwise they collide with an external keyboard's CTRL-char
148 private ServiceConnection connection = new ServiceConnection() { 149 private ServiceConnection connection = new ServiceConnection() {
149 public void onServiceConnected(ComponentName className, IBinder service) { 150 public void onServiceConnected(ComponentName className, IBinder service) {
150 bound = ((TerminalManager.TerminalBinder) service).getService(); 151 bound = ((TerminalManager.TerminalBinder) service).getService();
151 // let manager know about our event handling services 152 // let manager know about our event handling services
152 bound.disconnectHandler = disconnectHandler; 153 bound.disconnectHandler = disconnectHandler;
154 // let manager know about this activity
155 bound.activity = activity;
153 Log.d(TAG, String.format("Connected to TerminalManager and found bridges.size=%d", bound.bridges.size())); 156 Log.d(TAG, String.format("Connected to TerminalManager and found bridges.size=%d", bound.bridges.size()));
154 bound.setResizeAllowed(true); 157 bound.setResizeAllowed(true);
155 bound.hardKeyboardHidden = (getResources().getConfiguration().hardKeyboardHidden == 158 bound.hardKeyboardHidden = (getResources().getConfiguration().hardKeyboardHidden ==
156 Configuration.HARDKEYBOARDHIDDEN_YES); 159 Configuration.HARDKEYBOARDHIDDEN_YES);
157 160
266 finish(); 269 finish();
267 } 270 }
268 } 271 }
269 } 272 }
270 273
274 public View getCurrentView() {
275 return flip.getCurrentView();
276 }
277
271 protected View findCurrentView(int id) { 278 protected View findCurrentView(int id) {
272 View view = flip.getCurrentView(); 279 View view = flip.getCurrentView();
273 280
274 if (view == null) return null; 281 if (view == null) return null;
275 282
335 } 342 }
336 } 343 }
337 @Override 344 @Override
338 public void onCreate(Bundle icicle) { 345 public void onCreate(Bundle icicle) {
339 super.onCreate(icicle); 346 super.onCreate(icicle);
347 activity = this;
340 configureStrictMode(); 348 configureStrictMode();
341 hardKeyboard = getResources().getConfiguration().keyboard == 349 hardKeyboard = getResources().getConfiguration().keyboard ==
342 Configuration.KEYBOARD_QWERTY; 350 Configuration.KEYBOARD_QWERTY;
343 this.setContentView(R.layout.act_console); 351 this.setContentView(R.layout.act_console);
344 clipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE); 352 clipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);