forked from akexorcist/ruam-mij-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e70724
commit a1f7a4b
Showing
47 changed files
with
1,230 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
plugins { | ||
alias(libs.plugins.androidApplication) | ||
alias(libs.plugins.jetbrainsKotlinAndroid) | ||
} | ||
|
||
android { | ||
namespace = "com.akexorcist.privacychecker" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
applicationId = "com.akexorcist.privacychecker" | ||
minSdk = 23 | ||
targetSdk = 34 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
vectorDrawables { | ||
useSupportLibrary = true | ||
} | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
isCoreLibraryDesugaringEnabled = true | ||
} | ||
kotlinOptions { | ||
jvmTarget = "17" | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = "1.5.10" | ||
} | ||
packaging { | ||
resources { | ||
excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
} | ||
} | ||
} | ||
|
||
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) | ||
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) | ||
|
||
implementation(libs.androidx.navigation.compose) | ||
implementation(platform(libs.koin.bom)) | ||
implementation(libs.koin.androidx.compose) | ||
implementation(libs.koin.androidx.compose.navigation) | ||
|
||
coreLibraryDesugaring(libs.desugar) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<application | ||
android:name=".PrivacyCheckerApplication" | ||
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.PrivacyChecker" | ||
tools:targetApi="31"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true" | ||
android:label="@string/app_name" | ||
android:theme="@style/Theme.PrivacyChecker"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/akexorcist/privacychecker/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.akexorcist.privacychecker | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import com.akexorcist.privacychecker.ui.PrivacyCheckerApp | ||
import com.akexorcist.privacychecker.ui.rememberAppState | ||
import com.akexorcist.privacychecker.ui.theme.PrivacyCheckerTheme | ||
|
||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContent { | ||
PrivacyCheckerTheme { | ||
val appState = rememberAppState() | ||
PrivacyCheckerApp(appState = appState) | ||
} | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/akexorcist/privacychecker/PrivacyCheckerApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.akexorcist.privacychecker | ||
|
||
import android.app.Application | ||
import com.akexorcist.privacychecker.ui.AppModule | ||
import org.koin.core.context.startKoin | ||
|
||
class PrivacyCheckerApplication : Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
startKoin { | ||
modules(AppModule.modules) | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/akexorcist/privacychecker/ui/AppModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.akexorcist.privacychecker.ui | ||
|
||
import org.koin.dsl.module | ||
|
||
object AppModule { | ||
val modules = module { | ||
|
||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
app/src/main/java/com/akexorcist/privacychecker/ui/BottomMenu.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.akexorcist.privacychecker.ui | ||
|
||
import androidx.annotation.DrawableRes | ||
import androidx.annotation.StringRes | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.material3.NavigationBar | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.navigation.NavDestination | ||
import com.akexorcist.privacychecker.R | ||
import com.akexorcist.privacychecker.ui.aboutapp.ABOUT_APP_ROUTE | ||
import com.akexorcist.privacychecker.ui.accessibility.ACCESSIBILITY_ROUTE | ||
import com.akexorcist.privacychecker.ui.installedapp.INSTALLED_APP_ROUTE | ||
import com.akexorcist.privacychecker.ui.overview.OVERVIEW_ROUTE | ||
|
||
@Composable | ||
fun BottomMenu( | ||
destinations: List<BottomMenuDestination>, | ||
currentDestination: BottomMenuDestination, | ||
onDestinationSelected: (BottomMenuDestination) -> Unit, | ||
) { | ||
NavigationBar { | ||
destinations.forEach { | ||
BottomMenuItem( | ||
destination = it, | ||
onDestinationSelected = onDestinationSelected, | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun BottomMenuItem( | ||
destination: BottomMenuDestination, | ||
onDestinationSelected: (BottomMenuDestination) -> Unit, | ||
) { | ||
Column( | ||
modifier = Modifier.clickable { onDestinationSelected(destination) } | ||
) { | ||
Text(text = stringResource(destination.label)) | ||
} | ||
} | ||
|
||
sealed class BottomMenuDestination( | ||
@DrawableRes val selectedIcon: Int, | ||
@DrawableRes val unselectedIcon: Int, | ||
@StringRes val label: Int, | ||
) { | ||
data object Overview : BottomMenuDestination( | ||
selectedIcon = 0, | ||
unselectedIcon = 0, | ||
label = R.string.menu_overview, | ||
) | ||
|
||
data object Accessibility : BottomMenuDestination( | ||
selectedIcon = 0, | ||
unselectedIcon = 0, | ||
label = R.string.menu_accessibility, | ||
) | ||
|
||
data object InstalledApp : BottomMenuDestination( | ||
selectedIcon = 0, | ||
unselectedIcon = 0, | ||
label = R.string.menu_installed_app, | ||
) | ||
|
||
data object AboutApp : BottomMenuDestination( | ||
selectedIcon = 0, | ||
unselectedIcon = 0, | ||
label = R.string.menu_about_app, | ||
) | ||
} | ||
|
||
|
||
fun NavDestination?.toBottomMenuDestination(): BottomMenuDestination = when (this?.route) { | ||
OVERVIEW_ROUTE -> BottomMenuDestination.Overview | ||
ACCESSIBILITY_ROUTE -> BottomMenuDestination.Accessibility | ||
INSTALLED_APP_ROUTE -> BottomMenuDestination.InstalledApp | ||
ABOUT_APP_ROUTE -> BottomMenuDestination.AboutApp | ||
else -> BottomMenuDestination.Overview | ||
} |
79 changes: 79 additions & 0 deletions
79
app/src/main/java/com/akexorcist/privacychecker/ui/PrivacyCheckerApp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.akexorcist.privacychecker.ui | ||
|
||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.Stable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.navigation.NavDestination | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.compose.NavHost | ||
import androidx.navigation.compose.currentBackStackEntryAsState | ||
import androidx.navigation.compose.rememberNavController | ||
import com.akexorcist.privacychecker.ui.aboutapp.aboutAppScreen | ||
import com.akexorcist.privacychecker.ui.aboutapp.navigateToAboutApp | ||
import com.akexorcist.privacychecker.ui.accessibility.accessibilityScreen | ||
import com.akexorcist.privacychecker.ui.accessibility.navigateToAccessibility | ||
import com.akexorcist.privacychecker.ui.installedapp.installedAppScreen | ||
import com.akexorcist.privacychecker.ui.installedapp.navigateToInstalledApp | ||
import com.akexorcist.privacychecker.ui.overview.OVERVIEW_ROUTE | ||
import com.akexorcist.privacychecker.ui.overview.navigateToOverview | ||
import com.akexorcist.privacychecker.ui.overview.overviewScreen | ||
|
||
@Composable | ||
fun PrivacyCheckerApp( | ||
appState: AppState, | ||
) { | ||
val navController = appState.navController | ||
Scaffold( | ||
bottomBar = { | ||
BottomMenu( | ||
destinations = listOf( | ||
BottomMenuDestination.Overview, | ||
BottomMenuDestination.Accessibility, | ||
BottomMenuDestination.InstalledApp, | ||
BottomMenuDestination.AboutApp, | ||
), | ||
currentDestination = appState.currentDestination.toBottomMenuDestination(), | ||
onDestinationSelected = { | ||
when (it) { | ||
BottomMenuDestination.Overview -> navController.navigateToOverview() | ||
BottomMenuDestination.Accessibility -> navController.navigateToAccessibility() | ||
BottomMenuDestination.InstalledApp -> navController.navigateToInstalledApp() | ||
BottomMenuDestination.AboutApp -> navController.navigateToAboutApp() | ||
} | ||
}, | ||
) | ||
}, | ||
content = { padding -> | ||
NavHost( | ||
modifier = Modifier.padding(padding), | ||
navController = appState.navController, | ||
startDestination = OVERVIEW_ROUTE, | ||
) { | ||
overviewScreen(navController) | ||
accessibilityScreen(navController) | ||
installedAppScreen(navController) | ||
aboutAppScreen(navController) | ||
} | ||
}, | ||
) | ||
} | ||
|
||
@Stable | ||
class AppState( | ||
val navController: NavHostController, | ||
) { | ||
val currentDestination: NavDestination? | ||
@Composable get() = navController.currentBackStackEntryAsState().value?.destination | ||
} | ||
|
||
@Composable | ||
fun rememberAppState( | ||
navController: NavHostController = rememberNavController(), | ||
): AppState { | ||
return remember(navController) { | ||
AppState(navController) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/akexorcist/privacychecker/ui/aboutapp/AboutAppNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.akexorcist.privacychecker.ui.aboutapp | ||
|
||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavOptions | ||
import androidx.navigation.compose.composable | ||
|
||
const val ABOUT_APP_ROUTE = "about_app_route" | ||
|
||
fun NavController.navigateToAboutApp( | ||
navOptions: NavOptions = NavOptions.Builder().build(), | ||
) = navigate(ABOUT_APP_ROUTE, navOptions) | ||
|
||
fun NavGraphBuilder.aboutAppScreen( | ||
navController: NavController, | ||
) { | ||
composable(route = ABOUT_APP_ROUTE) { | ||
AboutAppRoute(navController = navController) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/akexorcist/privacychecker/ui/aboutapp/AboutAppScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.akexorcist.privacychecker.ui.aboutapp | ||
|
||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.navigation.NavController | ||
|
||
@Composable | ||
fun AboutAppRoute( | ||
navController: NavController, | ||
) { | ||
AboutAppScreen() | ||
} | ||
|
||
@Composable | ||
private fun AboutAppScreen() { | ||
Text(text = "About App Screen") | ||
} |
Oops, something went wrong.