Commit 108b740c authored by Mygod's avatar Mygod

Remove delay when scanning QR code

parent 63bc4a57
...@@ -39,11 +39,11 @@ ...@@ -39,11 +39,11 @@
package com.github.shadowsocks package com.github.shadowsocks
import android.app.{Activity, AlertDialog, ProgressDialog} import android.app.{Activity, AlertDialog}
import android.content.DialogInterface import android.content.DialogInterface
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
import android.os.{Bundle, Handler, Message} import android.os.Bundle
import android.preference.PreferenceManager import android.preference.PreferenceManager
import android.view.WindowManager import android.view.WindowManager
import com.github.shadowsocks.database.{Profile, ProfileManager} import com.github.shadowsocks.database.{Profile, ProfileManager}
...@@ -84,27 +84,11 @@ class ParserActivity extends Activity { ...@@ -84,27 +84,11 @@ class ParserActivity extends Activity {
} }
def addProfile(profile: Profile) { def addProfile(profile: Profile) {
val profileManager =
val h = showProgress(getString(R.string.loading)) new ProfileManager(PreferenceManager.getDefaultSharedPreferences(getBaseContext),
ShadowsocksApplication.dbHelper)
h.postDelayed(() => { profileManager.createOrUpdateProfile(profile)
val profileManager = profileManager.reload(profile.id)
new ProfileManager(PreferenceManager.getDefaultSharedPreferences(getBaseContext),
ShadowsocksApplication.dbHelper)
profileManager.createOrUpdateProfile(profile)
profileManager.reload(profile.id)
h.sendEmptyMessage(0)
}, 600)
}
private def showProgress(msg: String): Handler = {
val progressDialog = ProgressDialog.show(this, "", msg, true, false)
new Handler {
override def handleMessage(msg: Message) {
progressDialog.dismiss()
finish()
}
}
} }
} }
...@@ -526,10 +526,6 @@ class Shadowsocks ...@@ -526,10 +526,6 @@ class Shadowsocks
} }
} }
override def onStart() {
super.onStart()
}
override def onStop() { override def onStop() {
super.onStop() super.onStop()
clearDialog() clearDialog()
......
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