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();
}
}
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;
}
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;
}
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);
}
Aggregations