Disable profile switching when connected

This commit is contained in:
Max Lv
2016-12-18 15:31:10 +08:00
parent e8ff469eac
commit 436119e0ab
2 changed files with 11 additions and 6 deletions
@@ -33,7 +33,7 @@ import android.view._
import android.widget.{TextView, Toast}
import com.github.shadowsocks.ShadowsocksApplication.app
import com.github.shadowsocks.database.Profile
import com.github.shadowsocks.utils.{Action, Parser, TrafficMonitor, Utils}
import com.github.shadowsocks.utils._
import com.github.shadowsocks.widget.UndoSnackbarManager
import scala.collection.mutable.ArrayBuffer
@@ -92,10 +92,12 @@ final class ProfilesFragment extends ToolbarFragment with OnMenuItemClickListene
}
def onClick(v: View) {
val old = app.profileId
app.switchProfile(item.id)
profilesAdapter.refreshId(old)
bind(item)
if (getActivity.asInstanceOf[MainActivity].state == State.STOPPED) {
val old = app.profileId
app.switchProfile(item.id)
profilesAdapter.refreshId(old)
bind(item)
}
}
}