Feature: Install missing login program when selected
This commit is contained in:
parent
7d828d63df
commit
3e208feae7
@ -167,7 +167,7 @@ object NeoPreference {
|
||||
}
|
||||
}
|
||||
|
||||
private fun findLoginProgram(loginProgramName: String): String? {
|
||||
fun findLoginProgram(loginProgramName: String): String? {
|
||||
val file = File("${NeoTermPath.USR_PATH}/bin", loginProgramName)
|
||||
return if (file.canExecute()) file.absolutePath else null
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package io.neoterm.ui.settings
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import io.neoterm.R
|
||||
import io.neoterm.frontend.preference.NeoPreference
|
||||
|
||||
/**
|
||||
* @author kiva
|
||||
@ -14,6 +15,24 @@ class GeneralSettingsActivity : BasePreferenceActivity() {
|
||||
supportActionBar?.title = getString(R.string.general_settings)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
addPreferencesFromResource(R.xml.setting_general)
|
||||
findPreference(getString(R.string.key_general_shell)).setOnPreferenceChangeListener { _, value ->
|
||||
val shellName = value.toString()
|
||||
val newShell = NeoPreference.findLoginProgram(shellName)
|
||||
if (newShell == null) {
|
||||
requestInstallShell(shellName)
|
||||
} else {
|
||||
postChangeShell(shellName)
|
||||
}
|
||||
return@setOnPreferenceChangeListener true
|
||||
}
|
||||
}
|
||||
|
||||
private fun postChangeShell(shellName: String) {
|
||||
NeoPreference.store(R.string.key_general_shell, shellName)
|
||||
}
|
||||
|
||||
private fun requestInstallShell(shellName: String) {
|
||||
|
||||
}
|
||||
|
||||
override fun onBuildHeaders(target: MutableList<Header>?) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user