Commit b6d0af1e authored by Max Lv's avatar Max Lv

Fix #910

parent f58301b8
......@@ -4,12 +4,37 @@ import android.content.Context
import android.content.res.TypedArray
import android.support.v7.preference.DialogPreference
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup.LayoutParams
import android.widget.NumberPicker
import android.widget.EditText
import com.github.shadowsocks.R
class MyNumberPicker(private val context: Context, attrs: AttributeSet = null)
extends NumberPicker(context, attrs) {
override def addView(child: View) {
super.addView(child)
updateView(child)
}
override def addView(child: View, params: LayoutParams) {
super.addView(child, params)
updateView(child)
}
override def addView(child: View, index: Int, params: LayoutParams) {
super.addView(child, index, params)
updateView(child)
}
def updateView(child: View) {
if (child.isInstanceOf[EditText]) {
child.asInstanceOf[EditText].setTextSize(dp2px(6))
}
}
def dp2px(dp: Float): Int = (dp*getResources().getDisplayMetrics().density).toInt
}
class NumberPickerPreference(private val context: Context, attrs: AttributeSet = null)
extends DialogPreference(context, attrs) with SummaryPreference {
private[preference] val picker = new NumberPicker(context)
private[preference] val picker = new MyNumberPicker(context)
private var value: Int = _
{
......
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