Misc refinements

* Refine Kotlin codes;
* Support RTL;
* Use VectorDrawable for notification;
* Remove redundant resources;
* Better IDE integration.
This commit is contained in:
Mygod
2017-12-06 19:46:26 -08:00
parent f49d3cb443
commit c124e1e8ef
34 changed files with 151 additions and 132 deletions
@@ -28,13 +28,12 @@ import java.io.File
object Executable {
const val REDSOCKS = "libredsocks.so"
const val PDNSD = "libpdnsd.so"
const val SS_LOCAL = "libss-local.so"
const val SS_TUNNEL = "libss-tunnel.so"
const val TUN2SOCKS = "libtun2socks.so"
const val OVERTURE = "liboverture.so"
val EXECUTABLES = setOf(SS_LOCAL, SS_TUNNEL, PDNSD, REDSOCKS, TUN2SOCKS, OVERTURE)
val EXECUTABLES = setOf(SS_LOCAL, SS_TUNNEL, REDSOCKS, TUN2SOCKS, OVERTURE)
fun killAll() {
for (process in File("/proc").listFiles { _, name -> TextUtils.isDigitsOnly(name) }) {
@@ -69,7 +69,7 @@ class ServiceNotification(private val service: BaseService.Interface, profileNam
.setContentTitle(profileName)
.setContentIntent(PendingIntent.getActivity(service, 0, Intent(service, MainActivity::class.java)
.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), 0))
.setSmallIcon(R.drawable.ic_stat_shadowsocks)
.setSmallIcon(R.drawable.ic_start_connected)
private val style = NotificationCompat.BigTextStyle(builder)
private var isVisible = true
@@ -35,11 +35,11 @@ object TrafficMonitor {
var rxTotal = 0L
// Bytes for the last query
var txLast = 0L
var rxLast = 0L
var timestampLast = 0L
private var txLast = 0L
private var rxLast = 0L
private var timestampLast = 0L
@Volatile
var dirty = true
private var dirty = true
private val units = arrayOf("KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB", "BB", "NB", "DB", "CB")
private val numberFormat = DecimalFormat("@@@")