* Refine exceptions handling when parsing per-app config string * Remove redundant profiles Preference * Move Network Traffic to title bar * Add ripple to title text * Animate using animateLayoutChanges * Hide connection test in NAT mode * Refine UI. * Change notification action button icon for hidpi device * Fix FAB ripple * Fix usability problem * Fix changes not commited when snackbar being swiped * Show import/export as action * Drop unused drawables * Move TaskerSettings * Fix action icons * Prevent switching to an invalid profile * Fix line wrap when screen width is small
59 lines
2.4 KiB
Scala
59 lines
2.4 KiB
Scala
/*
|
|
* Shadowsocks - A shadowsocks client for Android
|
|
* Copyright (C) 2014 <max.c.lv@gmail.com>
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*
|
|
* ___====-_ _-====___
|
|
* _--^^^#####// \\#####^^^--_
|
|
* _-^##########// ( ) \\##########^-_
|
|
* -############// |\^^/| \\############-
|
|
* _/############// (@::@) \\############\_
|
|
* /#############(( \\// ))#############\
|
|
* -###############\\ (oo) //###############-
|
|
* -#################\\ / VV \ //#################-
|
|
* -###################\\/ \//###################-
|
|
* _#/|##########/\######( /\ )######/\##########|\#_
|
|
* |/ |#/\#/\#/\/ \#/\##\ | | /##/\#/ \/\#/\#/\#| \|
|
|
* ` |/ V V ` V \#\| | | |/#/ V ' V V \| '
|
|
* ` ` ` ` / | | | | \ ' ' ' '
|
|
* ( | | | | )
|
|
* __\ | | | | /__
|
|
* (vvv(VVV)(VVV)vvv)
|
|
*
|
|
* HERE BE DRAGONS
|
|
*
|
|
*/
|
|
package com.github.shadowsocks
|
|
|
|
import android.content.{BroadcastReceiver, Context, Intent}
|
|
import com.github.shadowsocks.utils.{TaskerSettings, Utils}
|
|
|
|
/**
|
|
* @author CzBiX
|
|
*/
|
|
class TaskerReceiver extends BroadcastReceiver {
|
|
override def onReceive(context: Context, intent: Intent) {
|
|
val settings = TaskerSettings.fromIntent(intent)
|
|
val switched = ShadowsocksApplication.profileManager.getProfile(settings.profileId) match {
|
|
case Some(p) =>
|
|
ShadowsocksApplication.switchProfile(settings.profileId)
|
|
true
|
|
case _ => false
|
|
}
|
|
if (settings.switchOn) Utils.startSsService(context) else Utils.stopSsService(context)
|
|
}
|
|
}
|