Skip to content

Commit 0c5402c

Browse files
committed
Initial commit
0 parents  commit 0c5402c

77 files changed

Lines changed: 3079 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.name

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.MD

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Temperamon
2+
Simple floating window to show some device status controllable via Notification bar, for Android,
3+
sprinkled with my (and some of the contributors) ego.
4+
5+
## Features
6+
- **Notification Control** - fast show/hide toggle
7+
- ***Kinda accurate* SoC Temperature reading** - Gives average of all recognized thermal zone state
8+
instead of reading just one. *Well, your phone is just a fist-size slab, average value should be suffice*
9+
- **** -
10+
11+
## Why?
12+
Have you ever seen this kind of dialog?
13+
![Some annoying ad push notification confirmation dialog](readme/1.jpg)
14+
On some Phone / ROM (e.g My Nokia 6.1 Plus running Android 10), this kind of dialog cannot be
15+
responded when there is a floating window active due to some security concern. When you try to
16+
respond it, it will ask you to deactivate any floating window before you can really respond the
17+
dialog. My last app from other dev offering similar functionality will require me to open it's app
18+
to deactivate the floating window or revoke their permission from Settings, thus making it
19+
inefficient to just respond a dialog. Some app that does offer the notification-based control will
20+
asks you to buy the their "Pro" version or "Pro functionality" IAP, or the worst, The app have ads
21+
that triggered by their floating window that will fully cover the entire screen anytime and
22+
anywhere!
23+
<details>
24+
<summary><i>My complaints and cursing, but nvm.</i></summary>
25+
SHAME ON YOU, THE DEV IMPLEMENTING THE "ANYTIME AND ANYWHERE" ADS! I KNOW YOU NEED MONEY, ME TOO!
26+
JUST DON'T BE GREEDY AND ANNOY YOUR USER! MAY YOU BECAME CONSTANTLY H?RN? UNTIL YOU FIX YOUR APP!
27+
</details>
28+
29+
Well, Sometimes it's worth it to re-invent a new kind of wheel when the existing wheels needs too
30+
much energy to roll over or is designed to work by constantly trampling your toes.
31+
32+
## License
33+
Apache License 2.0, with some file is under Public Domain.

build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
plugins {
3+
id 'com.android.application' version '7.1.2' apply false
4+
id 'com.android.library' version '7.1.2' apply false
5+
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
6+
}
7+
8+
task clean(type: Delete) {
9+
delete rootProject.buildDir
10+
}

floatstat/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

floatstat/build.gradle

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
}
5+
6+
android {
7+
compileSdk 31
8+
9+
defaultConfig {
10+
applicationId "id.psw.floatstat"
11+
minSdk 19
12+
targetSdk 31
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
compileOptions {
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
29+
kotlinOptions {
30+
jvmTarget = '1.8'
31+
}
32+
}
33+
34+
dependencies {
35+
implementation 'androidx.core:core-ktx:1.7.0'
36+
implementation 'androidx.appcompat:appcompat:1.4.1'
37+
implementation project(path: ':floatstat_lib')
38+
implementation 'androidx.recyclerview:recyclerview:1.2.1'
39+
testImplementation 'junit:junit:4.13.2'
40+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
41+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
42+
}

floatstat/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package id.psw.floatstat
2+
3+
import android.util.Log
4+
import androidx.test.platform.app.InstrumentationRegistry
5+
import androidx.test.ext.junit.runners.AndroidJUnit4
6+
7+
import org.junit.Test
8+
import org.junit.runner.RunWith
9+
10+
import org.junit.Assert.*
11+
import java.io.File
12+
import java.io.RandomAccessFile
13+
import java.lang.Exception
14+
15+
/**
16+
* Instrumented test, which will execute on an Android device.
17+
*
18+
* See [testing documentation](http://d.android.com/tools/testing).
19+
*/
20+
@RunWith(AndroidJUnit4::class)
21+
class ExampleInstrumentedTest {
22+
@Test
23+
fun useAppContext() {
24+
// Context of the app under test.
25+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
26+
assertEquals("id.psw.floatstat", appContext.packageName)
27+
}
28+
29+
@Test
30+
fun readTemperatureSensor(){
31+
32+
}
33+
34+
@Test
35+
fun readTemperature(){
36+
val thermalDir = File("/sys/class/thermal")
37+
thermalDir.list { dir, _ -> dir.isDirectory }?.forEach {
38+
try{
39+
val ls = File(thermalDir, it)
40+
val typeFile = File(ls, "type")
41+
val tempFile = File(ls, "temp")
42+
if(typeFile.exists() && tempFile.exists()){
43+
val typeRac = RandomAccessFile(typeFile, "r")
44+
val tempRac = RandomAccessFile(tempFile, "r")
45+
val type = typeRac.readLine()
46+
val temp = tempRac.readLine()
47+
typeRac.close()
48+
tempRac.close()
49+
Log.d("ReadTemp","$it -> $type : $temp")
50+
}
51+
}catch(e:Exception){
52+
Log.e("ReadTemp","$it -> ${e.javaClass.name} : ${e.message}")
53+
}
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)