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
b95bee96
Commit
b95bee96
authored
Jan 20, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use dimen instead of Utils.dpToPx
parent
99d97d1d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
8 deletions
+7
-8
mobile/src/main/res/values/dimen.xml
mobile/src/main/res/values/dimen.xml
+2
-1
mobile/src/main/scala/com/github/shadowsocks/MainActivity.scala
.../src/main/scala/com/github/shadowsocks/MainActivity.scala
+1
-1
mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
.../main/scala/com/github/shadowsocks/ProfilesFragment.scala
+2
-2
mobile/src/main/scala/com/github/shadowsocks/QRCodeDialog.scala
.../src/main/scala/com/github/shadowsocks/QRCodeDialog.scala
+2
-2
mobile/src/main/scala/com/github/shadowsocks/utils/Utils.scala
...e/src/main/scala/com/github/shadowsocks/utils/Utils.scala
+0
-2
No files found.
mobile/src/main/res/values/dimen.xml
View file @
b95bee96
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<dimen
name=
"profile_item_max_width"
>
480dp
</dimen>
<dimen
name=
"profile_item_max_width"
>
480dp
</dimen>
<dimen
name=
"icon_list_item_padding"
>
16dp
</dimen>
<dimen
name=
"qr_code_size"
>
250dp
</dimen>
<dimen
name=
"margin_small"
>
8dp
</dimen>
<!-- TODO: Remove when this issue is fixed: https://github.com/JorgeCastilloPrz/FABProgressCircle/issues/19 -->
<!-- TODO: Remove when this issue is fixed: https://github.com/JorgeCastilloPrz/FABProgressCircle/issues/19 -->
<dimen
name=
"fab_margin_top"
>
-44dp
</dimen>
<dimen
name=
"fab_margin_top"
>
-44dp
</dimen>
</resources>
</resources>
mobile/src/main/scala/com/github/shadowsocks/MainActivity.scala
View file @
b95bee96
...
@@ -309,7 +309,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
...
@@ -309,7 +309,7 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
})
})
fab
.
setOnLongClickListener
(
_
=>
{
fab
.
setOnLongClickListener
(
_
=>
{
Utils
.
positionToast
(
Toast
.
makeText
(
this
,
if
(
state
==
State
.
CONNECTED
)
R
.
string
.
stop
else
R
.
string
.
connect
,
Utils
.
positionToast
(
Toast
.
makeText
(
this
,
if
(
state
==
State
.
CONNECTED
)
R
.
string
.
stop
else
R
.
string
.
connect
,
Toast
.
LENGTH_SHORT
),
fab
,
getWindow
,
0
,
Utils
.
dpToPx
(
this
,
8
)).
show
()
Toast
.
LENGTH_SHORT
),
fab
,
getWindow
,
0
,
getResources
.
getDimensionPixelOffset
(
R
.
dimen
.
margin_small
)).
show
()
true
true
})
})
...
...
mobile/src/main/scala/com/github/shadowsocks/ProfilesFragment.scala
View file @
b95bee96
...
@@ -55,7 +55,7 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
...
@@ -55,7 +55,7 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
private
val
cardButtonLongClickListener
:
OnLongClickListener
=
view
=>
{
private
val
cardButtonLongClickListener
:
OnLongClickListener
=
view
=>
{
Utils
.
positionToast
(
Toast
.
makeText
(
getActivity
,
view
.
getContentDescription
,
Toast
.
LENGTH_SHORT
),
view
,
Utils
.
positionToast
(
Toast
.
makeText
(
getActivity
,
view
.
getContentDescription
,
Toast
.
LENGTH_SHORT
),
view
,
getActivity
.
getWindow
,
0
,
Utils
.
dpToPx
(
getActivity
,
8
)).
show
()
getActivity
.
getWindow
,
0
,
getResources
.
getDimensionPixelOffset
(
R
.
dimen
.
margin_small
)).
show
()
true
true
}
}
...
@@ -129,7 +129,7 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
...
@@ -129,7 +129,7 @@ final class ProfilesFragment extends ToolbarFragment with Toolbar.OnMenuItemClic
val
params
=
val
params
=
new
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
new
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
params
.
gravity
=
Gravity
.
CENTER_HORIZONTAL
params
.
gravity
=
Gravity
.
CENTER_HORIZONTAL
params
.
setMargins
(
0
,
Utils
.
dpToPx
(
getActivity
,
8
),
0
,
0
)
params
.
setMargins
(
0
,
getResources
.
getDimensionPixelOffset
(
R
.
dimen
.
margin_small
),
0
,
0
)
adView
=
new
NativeExpressAdView
(
getActivity
)
adView
=
new
NativeExpressAdView
(
getActivity
)
adView
.
setLayoutParams
(
params
)
adView
.
setLayoutParams
(
params
)
adView
.
setAdUnitId
(
"ca-app-pub-9097031975646651/5224027521"
)
adView
.
setAdUnitId
(
"ca-app-pub-9097031975646651/5224027521"
)
...
...
mobile/src/main/scala/com/github/shadowsocks/QRCodeDialog.scala
View file @
b95bee96
...
@@ -27,7 +27,6 @@ import android.nfc.{NdefMessage, NdefRecord, NfcAdapter}
...
@@ -27,7 +27,6 @@ import android.nfc.{NdefMessage, NdefRecord, NfcAdapter}
import
android.os.Bundle
import
android.os.Bundle
import
android.view.
{
LayoutInflater
,
View
,
ViewGroup
}
import
android.view.
{
LayoutInflater
,
View
,
ViewGroup
}
import
android.widget.
{
ImageView
,
LinearLayout
}
import
android.widget.
{
ImageView
,
LinearLayout
}
import
com.github.shadowsocks.utils.Utils
import
net.glxn.qrgen.android.QRCode
import
net.glxn.qrgen.android.QRCode
object
QRCodeDialog
{
object
QRCodeDialog
{
...
@@ -50,8 +49,9 @@ final class QRCodeDialog extends DialogFragment {
...
@@ -50,8 +49,9 @@ final class QRCodeDialog extends DialogFragment {
override
def
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
,
savedInstanceState
:
Bundle
)
:
View
=
{
override
def
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
,
savedInstanceState
:
Bundle
)
:
View
=
{
val
image
=
new
ImageView
(
getActivity
)
val
image
=
new
ImageView
(
getActivity
)
image
.
setLayoutParams
(
new
LinearLayout
.
LayoutParams
(-
1
,
-
1
))
image
.
setLayoutParams
(
new
LinearLayout
.
LayoutParams
(-
1
,
-
1
))
val
size
=
getResources
.
getDimensionPixelSize
(
R
.
dimen
.
qr_code_size
)
val
qrcode
=
QRCode
.
from
(
url
)
val
qrcode
=
QRCode
.
from
(
url
)
.
withSize
(
Utils
.
dpToPx
(
getActivity
,
250
),
Utils
.
dpToPx
(
getActivity
,
250
)
)
.
withSize
(
size
,
size
)
.
asInstanceOf
[
QRCode
].
bitmap
()
.
asInstanceOf
[
QRCode
].
bitmap
()
image
.
setImageBitmap
(
qrcode
)
image
.
setImageBitmap
(
qrcode
)
image
image
...
...
mobile/src/main/scala/com/github/shadowsocks/utils/Utils.scala
View file @
b95bee96
...
@@ -56,8 +56,6 @@ object Utils {
...
@@ -56,8 +56,6 @@ object Utils {
new
String
(
Base64
.
encode
(
mdg
.
digest
,
0
))
new
String
(
Base64
.
encode
(
mdg
.
digest
,
0
))
}
}
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
* round or floor depending on whether you are using offsets(floor) or
* widths(round)
* widths(round)
...
...
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