Skip to content

Commit

Permalink
Convert SummaryEditTextPreference
Browse files Browse the repository at this point in the history
34/40
  • Loading branch information
HMBSbige committed Nov 4, 2019
1 parent 3d33a9d commit 33484a8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 35 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.github.shadowsocks.preferences

import android.content.*
import android.preference.*
import android.util.*

class SummaryEditTextPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int = android.R.attr.editTextPreferenceStyle) : EditTextPreference(context, attrs, defStyleAttr)
{
private val mDefaultSummary: CharSequence? = summary

override fun setText(text: String)
{
super.setText(text)
summary = text
}

override fun setSummary(summary: CharSequence)
{
if (summary.isEmpty())
{
super.setSummary(mDefaultSummary)
}
else
{
super.setSummary(summary)
}
}
}

0 comments on commit 33484a8

Please sign in to comment.