Commit fbeb11a2 authored by Mygod's avatar Mygod

Refine code style

parent 10ed65c3
...@@ -50,8 +50,9 @@ class PluginConfiguration(val pluginsOptions: Map<String, PluginOptions>, val se ...@@ -50,8 +50,9 @@ class PluginConfiguration(val pluginsOptions: Map<String, PluginOptions>, val se
} else PluginOptions(line) } else PluginOptions(line)
}) })
fun getOptions(id: String): PluginOptions = if (id.isEmpty()) PluginOptions() else fun getOptions(id: String): PluginOptions = if (id.isEmpty()) PluginOptions() else {
pluginsOptions[id] ?: PluginOptions(id, PluginManager.fetchPlugins().lookup[id]?.defaultConfig) pluginsOptions[id] ?: PluginOptions(id, PluginManager.fetchPlugins().lookup[id]?.defaultConfig)
}
val selectedOptions: PluginOptions get() = getOptions(selected) val selectedOptions: PluginOptions get() = getOptions(selected)
override fun toString(): String { override fun toString(): String {
......
...@@ -30,9 +30,8 @@ import com.github.shadowsocks.plugin.PluginManager ...@@ -30,9 +30,8 @@ import com.github.shadowsocks.plugin.PluginManager
class PluginPreference(context: Context, attrs: AttributeSet? = null) : ListPreference(context, attrs) { class PluginPreference(context: Context, attrs: AttributeSet? = null) : ListPreference(context, attrs) {
companion object FallbackProvider : SummaryProvider<PluginPreference> { companion object FallbackProvider : SummaryProvider<PluginPreference> {
override fun provideSummary(preference: PluginPreference): CharSequence? { override fun provideSummary(preference: PluginPreference) =
return preference.selectedEntry?.label ?: preference.unknownValueSummary.format(preference.value) preference.selectedEntry?.label ?: preference.unknownValueSummary.format(preference.value)
}
} }
lateinit var plugins: PluginList lateinit var plugins: PluginList
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment