Search in sources :

Example 1 with TermSettings

use of jackpal.androidterm.util.TermSettings in project Android-Terminal-Emulator by jackpal.

the class RemoteInterface method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    mSettings = new TermSettings(getResources(), prefs);
    Intent TSIntent = new Intent(this, TermService.class);
    mTSIntent = TSIntent;
    startService(TSIntent);
    if (!bindService(TSIntent, mTSConnection, BIND_AUTO_CREATE)) {
        Log.e(TermDebug.LOG_TAG, "bind to service failed!");
        finish();
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) TermSettings(jackpal.androidterm.util.TermSettings) Intent(android.content.Intent)

Example 2 with TermSettings

use of jackpal.androidterm.util.TermSettings in project Android-Terminal-Emulator by jackpal.

the class Term method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Log.v(TermDebug.LOG_TAG, "onCreate");
    mPrivateAlias = new ComponentName(this, RemoteInterface.PRIVACT_ACTIVITY_ALIAS);
    if (icicle == null)
        onNewIntent(getIntent());
    final SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mSettings = new TermSettings(getResources(), mPrefs);
    mPrefs.registerOnSharedPreferenceChangeListener(this);
    Intent broadcast = new Intent(ACTION_PATH_BROADCAST);
    if (AndroidCompat.SDK >= 12) {
        broadcast.addFlags(FLAG_INCLUDE_STOPPED_PACKAGES);
    }
    mPendingPathBroadcasts++;
    sendOrderedBroadcast(broadcast, PERMISSION_PATH_BROADCAST, mPathReceiver, null, RESULT_OK, null, null);
    broadcast = new Intent(broadcast);
    broadcast.setAction(ACTION_PATH_PREPEND_BROADCAST);
    mPendingPathBroadcasts++;
    sendOrderedBroadcast(broadcast, PERMISSION_PATH_PREPEND_BROADCAST, mPathReceiver, null, RESULT_OK, null, null);
    TSIntent = new Intent(this, TermService.class);
    startService(TSIntent);
    if (AndroidCompat.SDK >= 11) {
        int actionBarMode = mSettings.actionBarMode();
        mActionBarMode = actionBarMode;
        if (AndroidCompat.V11ToV20) {
            switch(actionBarMode) {
                case TermSettings.ACTION_BAR_MODE_ALWAYS_VISIBLE:
                    setTheme(R.style.Theme_Holo);
                    break;
                case TermSettings.ACTION_BAR_MODE_HIDES:
                    setTheme(R.style.Theme_Holo_ActionBarOverlay);
                    break;
            }
        }
    } else {
        mActionBarMode = TermSettings.ACTION_BAR_MODE_ALWAYS_VISIBLE;
    }
    setContentView(R.layout.term_activity);
    mViewFlipper = (TermViewFlipper) findViewById(VIEW_FLIPPER);
    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TermDebug.LOG_TAG);
    WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    int wifiLockMode = WifiManager.WIFI_MODE_FULL;
    if (AndroidCompat.SDK >= 12) {
        wifiLockMode = WIFI_MODE_FULL_HIGH_PERF;
    }
    mWifiLock = wm.createWifiLock(wifiLockMode, TermDebug.LOG_TAG);
    ActionBarCompat actionBar = ActivityCompat.getActionBar(this);
    if (actionBar != null) {
        mActionBar = actionBar;
        actionBar.setNavigationMode(ActionBarCompat.NAVIGATION_MODE_LIST);
        actionBar.setDisplayOptions(0, ActionBarCompat.DISPLAY_SHOW_TITLE);
        if (mActionBarMode == TermSettings.ACTION_BAR_MODE_HIDES) {
            actionBar.hide();
        }
    }
    mHaveFullHwKeyboard = checkHaveFullHwKeyboard(getResources().getConfiguration());
    updatePrefs();
    mAlreadyStarted = true;
}
Also used : PowerManager(android.os.PowerManager) ActionBarCompat(jackpal.androidterm.compat.ActionBarCompat) WifiManager(android.net.wifi.WifiManager) SharedPreferences(android.content.SharedPreferences) TermSettings(jackpal.androidterm.util.TermSettings) ComponentName(android.content.ComponentName) Intent(android.content.Intent)

Example 3 with TermSettings

use of jackpal.androidterm.util.TermSettings in project Android-Terminal-Emulator by jackpal.

the class Term method createTermSession.

private TermSession createTermSession() throws IOException {
    TermSettings settings = mSettings;
    TermSession session = createTermSession(this, settings, settings.getInitialCommand());
    session.setFinishCallback(mTermService);
    return session;
}
Also used : TermSettings(jackpal.androidterm.util.TermSettings) TermSession(jackpal.androidterm.emulatorview.TermSession)

Example 4 with TermSettings

use of jackpal.androidterm.util.TermSettings in project Android-Terminal-Emulator by jackpal.

the class ShellTermSession method initializeSession.

private void initializeSession() throws IOException {
    TermSettings settings = mSettings;
    String path = System.getenv("PATH");
    if (settings.doPathExtensions()) {
        String appendPath = settings.getAppendPath();
        if (appendPath != null && appendPath.length() > 0) {
            path = path + ":" + appendPath;
        }
        if (settings.allowPathPrepend()) {
            String prependPath = settings.getPrependPath();
            if (prependPath != null && prependPath.length() > 0) {
                path = prependPath + ":" + path;
            }
        }
    }
    if (settings.verifyPath()) {
        path = checkPath(path);
    }
    String[] env = new String[3];
    env[0] = "TERM=" + settings.getTermType();
    env[1] = "PATH=" + path;
    env[2] = "HOME=" + settings.getHomePath();
    mProcId = createSubprocess(settings.getShell(), env);
}
Also used : TermSettings(jackpal.androidterm.util.TermSettings)

Aggregations

TermSettings (jackpal.androidterm.util.TermSettings)4 Intent (android.content.Intent)2 SharedPreferences (android.content.SharedPreferences)2 ComponentName (android.content.ComponentName)1 WifiManager (android.net.wifi.WifiManager)1 PowerManager (android.os.PowerManager)1 ActionBarCompat (jackpal.androidterm.compat.ActionBarCompat)1 TermSession (jackpal.androidterm.emulatorview.TermSession)1