Search in sources :

Example 16 with TermSession

use of jackpal.androidterm.emulatorview.TermSession in project Android-Terminal-Emulator by jackpal.

the class Term method populateViewFlipper.

private void populateViewFlipper() {
    if (mTermService != null) {
        mTermSessions = mTermService.getSessions();
        if (mTermSessions.size() == 0) {
            try {
                mTermSessions.add(createTermSession());
            } catch (IOException e) {
                Toast.makeText(this, "Failed to start terminal session", Toast.LENGTH_LONG).show();
                finish();
                return;
            }
        }
        mTermSessions.addCallback(this);
        for (TermSession session : mTermSessions) {
            EmulatorView view = createEmulatorView(session);
            mViewFlipper.addView(view);
        }
        updatePrefs();
        if (onResumeSelectWindow >= 0) {
            mViewFlipper.setDisplayedChild(onResumeSelectWindow);
            onResumeSelectWindow = -1;
        }
        mViewFlipper.onResume();
    }
}
Also used : EmulatorView(jackpal.androidterm.emulatorview.EmulatorView) IOException(java.io.IOException) TermSession(jackpal.androidterm.emulatorview.TermSession)

Example 17 with TermSession

use of jackpal.androidterm.emulatorview.TermSession in project Android-Terminal-Emulator by jackpal.

the class RemoteInterface method openNewWindow.

protected String openNewWindow(String iInitialCommand) {
    TermService service = getTermService();
    String initialCommand = mSettings.getInitialCommand();
    if (iInitialCommand != null) {
        if (initialCommand != null) {
            initialCommand += "\r" + iInitialCommand;
        } else {
            initialCommand = iInitialCommand;
        }
    }
    try {
        TermSession session = Term.createTermSession(this, mSettings, initialCommand);
        session.setFinishCallback(service);
        service.getSessions().add(session);
        String handle = UUID.randomUUID().toString();
        ((GenericTermSession) session).setHandle(handle);
        Intent intent = new Intent(PRIVACT_OPEN_NEW_WINDOW);
        intent.addCategory(Intent.CATEGORY_DEFAULT);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
        return handle;
    } catch (IOException e) {
        return null;
    }
}
Also used : Intent(android.content.Intent) IOException(java.io.IOException) TermSession(jackpal.androidterm.emulatorview.TermSession)

Example 18 with TermSession

use of jackpal.androidterm.emulatorview.TermSession in project Android-Terminal-Emulator by jackpal.

the class SessionList method clear.

@Override
public void clear() {
    for (TermSession session : this) {
        session.setTitleChangedListener(null);
    }
    super.clear();
    notifyChange();
}
Also used : TermSession(jackpal.androidterm.emulatorview.TermSession)

Aggregations

TermSession (jackpal.androidterm.emulatorview.TermSession)18 EmulatorView (jackpal.androidterm.emulatorview.EmulatorView)5 IOException (java.io.IOException)5 Intent (android.content.Intent)3 View (android.view.View)3 TextView (android.widget.TextView)3 DisplayMetrics (android.util.DisplayMetrics)2 Activity (android.app.Activity)1 ActivityNotFoundException (android.content.ActivityNotFoundException)1 Editable (android.text.Editable)1 KeyEvent (android.view.KeyEvent)1 Window (android.view.Window)1 Button (android.widget.Button)1 SessionList (jackpal.androidterm.util.SessionList)1 TermSettings (jackpal.androidterm.util.TermSettings)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 Socket (java.net.Socket)1