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
91fdf73a
Commit
91fdf73a
authored
May 21, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate NFC/Android beam support
parent
072df42f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
30 deletions
+4
-30
core/src/main/res/values/strings.xml
core/src/main/res/values/strings.xml
+1
-1
mobile/src/main/AndroidManifest.xml
mobile/src/main/AndroidManifest.xml
+0
-3
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
.../src/main/java/com/github/shadowsocks/ProfilesFragment.kt
+2
-25
mobile/src/main/res/menu/profile_share_popup.xml
mobile/src/main/res/menu/profile_share_popup.xml
+1
-1
No files found.
core/src/main/res/values/strings.xml
View file @
91fdf73a
...
@@ -114,7 +114,7 @@
...
@@ -114,7 +114,7 @@
<string
name=
"profile_config"
>
Profile config
</string>
<string
name=
"profile_config"
>
Profile config
</string>
<string
name=
"delete"
>
Remove
</string>
<string
name=
"delete"
>
Remove
</string>
<string
name=
"delete_confirm_prompt"
>
Are you sure you want to remove this profile?
</string>
<string
name=
"delete_confirm_prompt"
>
Are you sure you want to remove this profile?
</string>
<string
name=
"share_qr_nfc"
>
QR code
/NFC
</string>
<string
name=
"share_qr_nfc"
>
QR code
</string>
<string
name=
"add_profile_dialog"
>
Add this Shadowsocks Profile?
</string>
<string
name=
"add_profile_dialog"
>
Add this Shadowsocks Profile?
</string>
<string
name=
"add_profile_methods_scan_qr_code"
>
Scan QR code
</string>
<string
name=
"add_profile_methods_scan_qr_code"
>
Scan QR code
</string>
<string
name=
"add_profile_methods_manual_settings"
>
Manual Settings
</string>
<string
name=
"add_profile_methods_manual_settings"
>
Manual Settings
</string>
...
...
mobile/src/main/AndroidManifest.xml
View file @
91fdf73a
...
@@ -3,13 +3,10 @@
...
@@ -3,13 +3,10 @@
package=
"com.github.shadowsocks"
package=
"com.github.shadowsocks"
tools:ignore=
"MissingLeanbackSupport"
>
tools:ignore=
"MissingLeanbackSupport"
>
<uses-permission
android:name=
"android.permission.NFC"
/>
<uses-permission-sdk-23
android:name=
"android.permission.CAMERA"
/>
<uses-permission-sdk-23
android:name=
"android.permission.CAMERA"
/>
<uses-feature
android:name=
"android.hardware.touchscreen"
<uses-feature
android:name=
"android.hardware.touchscreen"
android:required=
"false"
/>
android:required=
"false"
/>
<uses-feature
android:name=
"android.hardware.nfc"
android:required=
"false"
/>
<uses-feature
android:name=
"android.hardware.camera"
<uses-feature
android:name=
"android.hardware.camera"
android:required=
"false"
/>
android:required=
"false"
/>
...
...
mobile/src/main/java/com/github/shadowsocks/ProfilesFragment.kt
View file @
91fdf73a
...
@@ -23,9 +23,6 @@ package com.github.shadowsocks
...
@@ -23,9 +23,6 @@ package com.github.shadowsocks
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.content.*
import
android.content.*
import
android.nfc.NdefMessage
import
android.nfc.NdefRecord
import
android.nfc.NfcAdapter
import
android.os.Bundle
import
android.os.Bundle
import
android.text.format.Formatter
import
android.text.format.Formatter
import
android.util.LongSparseArray
import
android.util.LongSparseArray
...
@@ -82,33 +79,13 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
...
@@ -82,33 +79,13 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
arguments
=
bundleOf
(
Pair
(
KEY_URL
,
url
))
arguments
=
bundleOf
(
Pair
(
KEY_URL
,
url
))
}
}
private
val
url
get
()
=
arguments
?.
getString
(
KEY_URL
)
!!
private
val
nfcShareItem
by
lazy
{
url
.
toByteArray
()
}
private
var
adapter
:
NfcAdapter
?
=
null
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
val
image
=
ImageView
(
context
)
val
image
=
ImageView
(
context
)
image
.
layoutParams
=
LinearLayout
.
LayoutParams
(-
1
,
-
1
)
image
.
layoutParams
=
LinearLayout
.
LayoutParams
(-
1
,
-
1
)
val
size
=
resources
.
getDimensionPixelSize
(
R
.
dimen
.
qr_code_size
)
val
size
=
resources
.
getDimensionPixelSize
(
R
.
dimen
.
qr_code_size
)
image
.
setImageBitmap
((
QRCode
.
from
(
url
).
withSize
(
size
,
size
)
as
QRCode
).
bitmap
())
image
.
setImageBitmap
((
QRCode
.
from
(
arguments
?.
getString
(
KEY_URL
)
!!
).
withSize
(
size
,
size
)
as
QRCode
).
bitmap
())
return
image
return
image
}
}
override
fun
onAttach
(
context
:
Context
)
{
super
.
onAttach
(
context
)
val
adapter
=
NfcAdapter
.
getDefaultAdapter
(
context
)
adapter
?.
setNdefPushMessage
(
NdefMessage
(
arrayOf
(
NdefRecord
(
NdefRecord
.
TNF_ABSOLUTE_URI
,
nfcShareItem
,
byteArrayOf
(),
nfcShareItem
))),
activity
)
this
.
adapter
=
adapter
}
override
fun
onDetach
()
{
super
.
onDetach
()
val
activity
=
activity
if
(
activity
!=
null
&&
!
activity
.
isFinishing
&&
!
activity
.
isDestroyed
)
adapter
?.
setNdefPushMessage
(
null
,
activity
)
adapter
=
null
}
}
}
inner
class
ProfileViewHolder
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
),
inner
class
ProfileViewHolder
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
),
...
@@ -202,7 +179,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
...
@@ -202,7 +179,7 @@ class ProfilesFragment : ToolbarFragment(), Toolbar.OnMenuItemClickListener {
}
}
override
fun
onMenuItemClick
(
item
:
MenuItem
):
Boolean
=
when
(
item
.
itemId
)
{
override
fun
onMenuItemClick
(
item
:
MenuItem
):
Boolean
=
when
(
item
.
itemId
)
{
R
.
id
.
action_qr_code
_nfc
->
{
R
.
id
.
action_qr_code
->
{
requireFragmentManager
().
beginTransaction
().
add
(
QRCodeDialog
(
this
.
item
.
toString
()),
""
)
requireFragmentManager
().
beginTransaction
().
add
(
QRCodeDialog
(
this
.
item
.
toString
()),
""
)
.
commitAllowingStateLoss
()
.
commitAllowingStateLoss
()
true
true
...
...
mobile/src/main/res/menu/profile_share_popup.xml
View file @
91fdf73a
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@+id/action_qr_code
_nfc
"
<item
android:id=
"@+id/action_qr_code"
android:title=
"@string/share_qr_nfc"
/>
android:title=
"@string/share_qr_nfc"
/>
<item
android:id=
"@+id/action_export_clipboard"
<item
android:id=
"@+id/action_export_clipboard"
android:title=
"@string/action_export"
/>
android:title=
"@string/action_export"
/>
...
...
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