Search in sources :

Example 1 with EmulatorView

use of jackpal.androidterm.emulatorview.EmulatorView 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 EmulatorView

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

the class Term method onConfigurationChanged.

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    mHaveFullHwKeyboard = checkHaveFullHwKeyboard(newConfig);
    EmulatorView v = (EmulatorView) mViewFlipper.getCurrentView();
    if (v != null) {
        v.updateSize(false);
    }
    if (mWinListAdapter != null) {
        // Force Android to redraw the label in the navigation dropdown
        mWinListAdapter.notifyDataSetChanged();
    }
}
Also used : EmulatorView(jackpal.androidterm.emulatorview.EmulatorView)

Example 3 with EmulatorView

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

the class TermViewFlipper method showTitle.

private void showTitle() {
    if (getChildCount() == 0) {
        return;
    }
    EmulatorView view = (EmulatorView) getCurrentView();
    if (view == null) {
        return;
    }
    TermSession session = view.getTermSession();
    if (session == null) {
        return;
    }
    String title = context.getString(R.string.window_title, getDisplayedChild() + 1);
    if (session instanceof GenericTermSession) {
        title = ((GenericTermSession) session).getTitle(title);
    }
    if (mToast == null) {
        mToast = Toast.makeText(context, title, Toast.LENGTH_SHORT);
        mToast.setGravity(Gravity.CENTER, 0, 0);
    } else {
        mToast.setText(title);
    }
    mToast.show();
}
Also used : EmulatorView(jackpal.androidterm.emulatorview.EmulatorView) TermSession(jackpal.androidterm.emulatorview.TermSession)

Example 4 with EmulatorView

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

the class TermViewFlipper method pauseCurrentView.

public void pauseCurrentView() {
    EmulatorView view = (EmulatorView) getCurrentView();
    if (view == null) {
        return;
    }
    view.onPause();
}
Also used : EmulatorView(jackpal.androidterm.emulatorview.EmulatorView)

Example 5 with EmulatorView

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

the class Term method doCloseWindow.

private void doCloseWindow() {
    if (mTermSessions == null) {
        return;
    }
    EmulatorView view = getCurrentEmulatorView();
    if (view == null) {
        return;
    }
    TermSession session = mTermSessions.remove(mViewFlipper.getDisplayedChild());
    view.onPause();
    session.finish();
    mViewFlipper.removeView(view);
    if (mTermSessions.size() != 0) {
        mViewFlipper.showNext();
    }
}
Also used : EmulatorView(jackpal.androidterm.emulatorview.EmulatorView) TermSession(jackpal.androidterm.emulatorview.TermSession)

Aggregations

EmulatorView (jackpal.androidterm.emulatorview.EmulatorView)10 TermSession (jackpal.androidterm.emulatorview.TermSession)5 View (android.view.View)3 DisplayMetrics (android.util.DisplayMetrics)2 TextView (android.widget.TextView)2 Intent (android.content.Intent)1 Rect (android.graphics.Rect)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 IOException (java.io.IOException)1