Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
1d6a0b0f
Commit
1d6a0b0f
authored
Oct 05, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use styling to fix #910
parent
abcbc98c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
19 deletions
+7
-19
src/main/res/values/styles.xml
src/main/res/values/styles.xml
+3
-0
src/main/scala/be/mygod/preference/NumberPickerPreference.scala
...in/scala/be/mygod/preference/NumberPickerPreference.scala
+3
-15
src/main/scala/com/github/shadowsocks/utils/Utils.scala
src/main/scala/com/github/shadowsocks/utils/Utils.scala
+1
-4
No files found.
src/main/res/values/styles.xml
View file @
1d6a0b0f
...
...
@@ -44,5 +44,8 @@
<item
name=
"android:fadeScrollbars"
>
true
</item>
<item
name=
"android:scrollbars"
>
vertical
</item>
</style>
<style
name=
"NumberPickerStyle"
>
<item
name=
"android:textSize"
>
14sp
</item>
</style>
</resources>
src/main/scala/be/mygod/preference/NumberPickerPreference.scala
View file @
1d6a0b0f
...
...
@@ -4,25 +4,13 @@ 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.
{
EditText
,
NumberPicker
}
import
android.view.ContextThemeWrapper
import
android.widget.NumberPicker
import
com.github.shadowsocks.R
import
com.github.shadowsocks.utils.Utils
class
MyNumberPicker
(
private
val
context
:
Context
,
attrs
:
AttributeSet
=
null
)
extends
NumberPicker
(
context
,
attrs
)
{
override
def
addView
(
child
:
View
,
index
:
Int
,
params
:
LayoutParams
)
{
super
.
addView
(
child
,
index
,
params
)
child
match
{
case
et
:
EditText
=>
et
.
setTextSize
(
Utils
.
spToPx
(
context
,
6
))
case
_
=>
}
}
}
class
NumberPickerPreference
(
private
val
context
:
Context
,
attrs
:
AttributeSet
=
null
)
extends
DialogPreference
(
context
,
attrs
)
with
SummaryPreference
{
private
[
preference
]
val
picker
=
new
MyNumberPicker
(
context
)
private
[
preference
]
val
picker
=
new
NumberPicker
(
new
ContextThemeWrapper
(
context
,
R
.
style
.
NumberPickerStyle
)
)
private
var
value
:
Int
=
_
{
...
...
src/main/scala/com/github/shadowsocks/utils/Utils.scala
View file @
1d6a0b0f
...
...
@@ -77,10 +77,7 @@ object Utils {
new
String
(
Base64
.
encode
(
mdg
.
digest
,
0
))
}
def
dpToPx
(
context
:
Context
,
dp
:
Int
)
:
Int
=
Math
.
round
(
dp
*
context
.
getResources
.
getDisplayMetrics
.
density
)
def
spToPx
(
context
:
Context
,
sp
:
Int
)
:
Int
=
Math
.
round
(
sp
*
context
.
getResources
.
getDisplayMetrics
.
scaledDensity
)
def
dpToPx
(
context
:
Context
,
dp
:
Int
)
:
Int
=
Math
.
round
(
dp
*
context
.
getResources
.
getDisplayMetrics
.
density
)
/*
* round or floor depending on whether you are using offsets(floor) or
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment