Skip to content

Commit

Permalink
🥥
Browse files Browse the repository at this point in the history
  • Loading branch information
yunowo committed Mar 13, 2018
1 parent 205c9cd commit a3b4d0a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 22 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@

BJUT Wi-Fi client for Android.

Warning: This is an experimental app.
**Warning:** This is an experimental app.

## Install
See [Releases](https://github.com/yunv/BJUTWiFi/releases). For a more stable app, go to [BJUTLoginApp](https://github.com/ZeroGoYoosee/BJUTLoginApp/).
See [Releases](https://github.com/yunv/BJUTWiFi/releases).

Only Android 8.1 and later is supported. If you are using older versions, go to [BJUTLoginApp](https://github.com/ZeroGoYoosee/BJUTLoginApp/).

## Screenshot
<img src="https://github.com/yunv/BJUTWiFi/blob/master/art/0.png" width="540px">
24 changes: 7 additions & 17 deletions app/src/main/kotlin/com/android/settings/graph/UsageGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,8 @@ class UsageGraph(context: Context, attrs: AttributeSet?) : View(context, attrs)

private fun addPathAndUpdate(points: SparseIntArray, paths: SparseIntArray,
localPaths: SparseIntArray) {
var i = 0
val size = points.size()
while (i < size) {
for (i in 0 until points.size()) {
paths.put(points.keyAt(i), points.valueAt(i))
i++
}
// Add a delimiting value immediately after the last point.
paths.put(points.keyAt(points.size() - 1) + 1, PATH_DELIM)
Expand Down Expand Up @@ -185,26 +182,19 @@ class UsageGraph(context: Context, attrs: AttributeSet?) : View(context, attrs)
}
}

private fun hasDiff(x1: Int, x2: Int): Boolean {
return Math.abs(x2 - x1) >= mCornerRadius
}
private fun hasDiff(x1: Int, x2: Int) = Math.abs(x2 - x1) >= mCornerRadius

private fun getX(x: Float): Int {
return (x / mMaxX * width).toInt()
}
private fun getX(x: Float) = (x / mMaxX * width).toInt()

private fun getY(y: Float): Int {
return (height * (1 - y / mMaxY)).toInt()
}
private fun getY(y: Float) = (height * (1 - y / mMaxY)).toInt()

private fun updateGradient() {
mFillPaint.shader = LinearGradient(0f, 0f, 0f, height.toFloat(),
getColor(mAccentColor, .2f), 0, TileMode.CLAMP)
}

private fun getColor(color: Int, alphaScale: Float): Int {
return color and ((0xff * alphaScale).toInt() shl 24 or 0xffffff)
}
private fun getColor(color: Int, alphaScale: Float) =
color and ((0xff * alphaScale).toInt() shl 24 or 0xffffff)

override fun onDraw(canvas: Canvas) {
// Draw lines across the top, middle, and bottom.
Expand Down Expand Up @@ -280,6 +270,6 @@ class UsageGraph(context: Context, attrs: AttributeSet?) : View(context, attrs)
}

companion object {
private val PATH_DELIM = -1
private const val PATH_DELIM = -1
}
}
2 changes: 1 addition & 1 deletion app/src/main/kotlin/me/liuyun/bjutlgn/ui/StatusCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class StatusCard(private val cv: FrameLayout, private val graphCard: GraphCard?,
cv.progress_ring.progressValue = percent
startSpringAnimation(cv.progress_ring)

if (stats.isOnline) {
if (stats.isOnline && stats.flow != 0 && !app.prefs.getBoolean("debug", false)) {
app.appDatabase.flowDao().insert(Flow(0, System.currentTimeMillis() / 1000L, stats.flow))
graphCard?.show()

Expand Down
Binary file added art/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.21'
ext.kotlin_version = '1.2.30'
ext.anko_version = '0.10.4'
ext.support_lib_version = '27.0.2'
ext.lifecycle_version = '1.1.0'
Expand All @@ -11,7 +11,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-beta4'
classpath 'com.android.tools.build:gradle:3.1.0-rc02'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down

0 comments on commit a3b4d0a

Please sign in to comment.