Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: rcmiku <[email protected]>
  • Loading branch information
rcmiku committed Dec 1, 2024
0 parents commit 6b420f5
Show file tree
Hide file tree
Showing 50 changed files with 1,575 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# built application files
*.apk
*.ap_

# Mac files
.DS_Store

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# Ignore gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/
proguard-project.txt

# Eclipse files
.project
.classpath
.settings/

# Android Studio/IDEA
*.iml
.idea
.kotlin/
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Freeze Monitor

Freeze Monitor is a sample Android application process freeze monitor, built with
[Jetpack Compose](https://developer.android.com/jetpack/compose).

## Screenshot:

<img src="screenshot/screenshot.jpg" alt="Screenshot">

### Credits:

- [Accompanist](https://github.com/google/accompanist) library licensed under Apache License 2.0
- [Haze](https://github.com/chrisbanes/haze) library licensed under Apache License 2.0
- [Miuix](https://github.com/miuix-kotlin-multiplatform/miuix) library licensed under Apache License 2.0
2 changes: 2 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
/release
77 changes: 77 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
}

android {
namespace = "com.rcmiku.freeze.monitor"
compileSdk = 35

defaultConfig {
applicationId = "com.rcmiku.freeze.monitor"
minSdk = 31
targetSdk = 35
versionCode = 1
versionName = "1.0"
resourceConfigurations += listOf("en","zh-rCN")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
register("release") {
enableV1Signing = true
enableV2Signing = true
enableV3Signing = true
enableV4Signing = true
}
}

buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.findByName("release")
}
debug {
applicationIdSuffix = ".debug"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}

buildFeatures {
compose = true
buildConfig = true
}
}

dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.kmp.miuix)
implementation(libs.lifecycle.viewmodel.compose)
implementation(libs.accompanist.drawablepainter)
implementation(libs.haze)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}
24 changes: 24 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
-renamesourcefileattribute SourceFile

# Repackage classes into the top-level.
-repackageclasses
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.rcmiku.freeze.monitor

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.rcmiku.freeze.monitor.util.Shell

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.rcmiku.freeze.monitor", appContext.packageName)
}
}
30 changes: 30 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.FreezeMonitor"
>
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.FreezeMonitor">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions app/src/main/java/com/rcmiku/freeze/monitor/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.rcmiku.freeze.monitor

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.compose.foundation.isSystemInDarkTheme
import com.rcmiku.freeze.monitor.ui.FmApp
import com.rcmiku.freeze.monitor.viewModel.AppListViewModel
import top.yukonga.miuix.kmp.theme.MiuixTheme
import top.yukonga.miuix.kmp.theme.darkColorScheme
import top.yukonga.miuix.kmp.theme.lightColorScheme

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
window.isNavigationBarContrastEnforced = false
val appListViewModel:AppListViewModel by viewModels()
appListViewModel.updateInstalledApps(this)
appListViewModel.updateFilterApps(this)
setContent {
MiuixTheme(
colors = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
) {
FmApp(viewModel = appListViewModel)
}
}
}
}
13 changes: 13 additions & 0 deletions app/src/main/java/com/rcmiku/freeze/monitor/model/AppInfo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.rcmiku.freeze.monitor.model

import android.graphics.drawable.Drawable

data class AppInfo(
val appName: String,
val packageName: String,
val appIcon: Drawable,
val frozenProcess:Int,
val runningProcess:Int,
val appRes:Int,
val freezeType:String
)
Loading

0 comments on commit 6b420f5

Please sign in to comment.