refine handler

This commit is contained in:
Max Lv
2014-09-07 11:44:06 +08:00
parent 3538caa80d
commit 4a4d3b11fb
3 changed files with 59 additions and 40 deletions
@@ -67,6 +67,7 @@ import net.simonvt.menudrawer.MenuDrawer
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.concurrent.ops._
import scala.ref.WeakReference
class ProfileIconDownloader(context: Context, connectTimeout: Int, readTimeout: Int)
extends BaseImageDownloader(context, connectTimeout, readTimeout) {
@@ -236,7 +237,7 @@ class Shadowsocks
private lazy val application = getApplication.asInstanceOf[ShadowsocksApplication]
val handler = new Handler()
var handler: Handler = null
def isSinglePane: Boolean = {
if (singlePane == -1) {
@@ -442,6 +443,8 @@ class Shadowsocks
super.onCreate(savedInstanceState)
handler = new Handler()
addPreferencesFromResource(R.xml.pref_all)
// Initialize the profile
@@ -797,6 +800,10 @@ class Shadowsocks
Crouton.cancelAllCroutons()
unregisterReceiver(preferenceReceiver)
new BackupManager(this).dataChanged()
if (handler != null) {
handler.removeCallbacksAndMessages(null)
handler = null
}
}
def copyToSystem() {