File tree 2 files changed +8
-13
lines changed
src/main/scala/com/github/shadowsocks
2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -295,7 +295,7 @@ final class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClic
295
295
case R .id.fab_qrcode_add =>
296
296
menu.toggle(false )
297
297
val intent = new Intent (this , classOf [ScannerActivity ])
298
- startActivityForResult (intent, REQUEST_QRCODE )
298
+ startActivity (intent)
299
299
case R .id.fab_nfc_add =>
300
300
menu.toggle(true )
301
301
val dialog = new AlertDialog .Builder (ProfileManagerActivity .this )
@@ -389,15 +389,6 @@ final class ProfileManagerActivity extends AppCompatActivity with OnMenuItemClic
389
389
super .onDestroy
390
390
}
391
391
392
- override def onActivityResult (requestCode : Int , resultCode : Int , data : Intent ) {
393
- if (requestCode == REQUEST_QRCODE && resultCode == Activity .RESULT_OK ) {
394
- val contents = data.getStringExtra(" uri" )
395
- if (! TextUtils .isEmpty(contents))
396
- Parser .findAll_ssr(contents).foreach(app.profileManager.createProfile)
397
- Parser .findAll(contents).foreach(app.profileManager.createProfile)
398
- }
399
- }
400
-
401
392
override def onBackPressed () {
402
393
if (menu.isOpened) menu.close(true ) else super .onBackPressed()
403
394
}
Original file line number Diff line number Diff line change @@ -8,8 +8,11 @@ import android.support.v4.app.ActivityCompat
8
8
import android .support .v4 .content .ContextCompat
9
9
import android .support .v7 .app .AppCompatActivity
10
10
import android .support .v7 .widget .Toolbar
11
+ import android .text .TextUtils
11
12
import android .widget .Toast
12
13
import com .google .zxing .Result
14
+ import com .github .shadowsocks .ShadowsocksApplication .app
15
+ import com .github .shadowsocks .utils .Parser
13
16
import me .dm7 .barcodescanner .zxing .ZXingScannerView
14
17
15
18
object ScannerActivity {
@@ -73,9 +76,10 @@ class ScannerActivity extends AppCompatActivity with ZXingScannerView.ResultHand
73
76
}
74
77
75
78
override def handleResult (rawResult : Result ) = {
76
- val intent = new Intent ()
77
- intent.putExtra(" uri" , rawResult.getText)
78
- setResult(Activity .RESULT_OK , intent)
79
+ val uri = rawResult.getText
80
+ if (! TextUtils .isEmpty(uri))
81
+ Parser .findAll(uri).foreach(app.profileManager.createProfile)
82
+ Parser .findAll_ssr(uri).foreach(app.profileManager.createProfile)
79
83
navigateUp()
80
84
}
81
85
}
You can’t perform that action at this time.
0 commit comments