Preference: make it beautiful

This commit is contained in:
zt515 2017-12-06 23:58:40 +08:00
parent 5ee5ec993b
commit c127ad172d

View File

@ -114,15 +114,11 @@ object NeoPreference {
}
fun getCurrentSession(termService: NeoTermService?): TerminalSession? {
val sessionHandle = PreferenceManager.getDefaultSharedPreferences(termService!!).getString(KEY_CURRENT_SESSION, "")
var i = 0
val len = termService.sessions.size
while (i < len) {
val session = termService.sessions[i]
if (session.mHandle == sessionHandle) return session
i++
}
return null
val sessionHandle = PreferenceManager.getDefaultSharedPreferences(termService!!)
.getString(KEY_CURRENT_SESSION, "")
return termService.sessions
.singleOrNull { it.mHandle == sessionHandle }
}
fun setLoginShellName(loginProgramName: String?): Boolean {