Search in sources :

Example 1 with TermSession

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

the class Term method updatePrefs.

private void updatePrefs() {
    mUseKeyboardShortcuts = mSettings.getUseKeyboardShortcutsFlag();
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    mViewFlipper.updatePrefs(mSettings);
    for (View v : mViewFlipper) {
        ((EmulatorView) v).setDensity(metrics);
        ((TermView) v).updatePrefs(mSettings);
    }
    if (mTermSessions != null) {
        for (TermSession session : mTermSessions) {
            ((GenericTermSession) session).updatePrefs(mSettings);
        }
    }
    {
        Window win = getWindow();
        WindowManager.LayoutParams params = win.getAttributes();
        final int FULLSCREEN = WindowManager.LayoutParams.FLAG_FULLSCREEN;
        int desiredFlag = mSettings.showStatusBar() ? 0 : FULLSCREEN;
        if (desiredFlag != (params.flags & FULLSCREEN) || (AndroidCompat.SDK >= 11 && mActionBarMode != mSettings.actionBarMode())) {
            if (mAlreadyStarted) {
                // Can't switch to/from fullscreen after
                // starting the activity.
                restart();
            } else {
                win.setFlags(desiredFlag, FULLSCREEN);
                if (mActionBarMode == TermSettings.ACTION_BAR_MODE_HIDES) {
                    if (mActionBar != null) {
                        mActionBar.hide();
                    }
                }
            }
        }
    }
    int orientation = mSettings.getScreenOrientation();
    int o = 0;
    if (orientation == 0) {
        o = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    } else if (orientation == 1) {
        o = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    } else if (orientation == 2) {
        o = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    } else {
    /* Shouldn't be happened. */
    }
    setRequestedOrientation(o);
}
Also used : Window(android.view.Window) EmulatorView(jackpal.androidterm.emulatorview.EmulatorView) TermSession(jackpal.androidterm.emulatorview.TermSession) DisplayMetrics(android.util.DisplayMetrics) View(android.view.View) TextView(android.widget.TextView) EmulatorView(jackpal.androidterm.emulatorview.EmulatorView)

Example 2 with TermSession

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

the class Term method doEmailTranscript.

private void doEmailTranscript() {
    TermSession session = getCurrentTermSession();
    if (session != null) {
        // Don't really want to supply an address, but
        // currently it's required, otherwise nobody
        // wants to handle the intent.
        String addr = "user@example.com";
        Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + addr));
        String subject = getString(R.string.email_transcript_subject);
        String title = session.getTitle();
        if (title != null) {
            subject = subject + " - " + title;
        }
        intent.putExtra(Intent.EXTRA_SUBJECT, subject);
        intent.putExtra(Intent.EXTRA_TEXT, session.getTranscriptText().trim());
        try {
            startActivity(Intent.createChooser(intent, getString(R.string.email_transcript_chooser_title)));
        } catch (ActivityNotFoundException e) {
            Toast.makeText(this, R.string.email_transcript_no_email_activity_found, Toast.LENGTH_LONG).show();
        }
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) Intent(android.content.Intent) TermSession(jackpal.androidterm.emulatorview.TermSession)

Example 3 with TermSession

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

the class SessionList method addAll.

@Override
public boolean addAll(int index, Collection<? extends TermSession> collection) {
    boolean result = super.addAll(index, collection);
    for (TermSession session : collection) {
        session.setTitleChangedListener(mTitleChangedListener);
    }
    notifyChange();
    return result;
}
Also used : TermSession(jackpal.androidterm.emulatorview.TermSession)

Example 4 with TermSession

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

the class SessionList method set.

@Override
public TermSession set(int index, TermSession object) {
    TermSession old = super.set(index, object);
    object.setTitleChangedListener(mTitleChangedListener);
    if (old != null) {
        old.setTitleChangedListener(null);
    }
    notifyChange();
    return old;
}
Also used : TermSession(jackpal.androidterm.emulatorview.TermSession)

Example 5 with TermSession

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

the class SessionList method addAll.

@Override
public boolean addAll(Collection<? extends TermSession> collection) {
    boolean result = super.addAll(collection);
    for (TermSession session : collection) {
        session.setTitleChangedListener(mTitleChangedListener);
    }
    notifyChange();
    return result;
}
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