Skip to content

Commit

Permalink
Convert sample to kotlin (#133)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Alexander-Bown <scottyab@users.noreply.github.com>
  • Loading branch information
scottyab and scottyab committed May 8, 2021
1 parent 95821ec commit 3163211
Show file tree
Hide file tree
Showing 58 changed files with 628 additions and 818 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
build:
docker:
# https://circleci.com/docs/2.0/circleci-images/#android
- image: circleci/android:api-29
- image: circleci/android:api-30
environment:
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
steps:
Expand Down
24 changes: 19 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'


android {
compileSdkVersion compileSdkVer
Expand All @@ -10,6 +13,7 @@ android {
targetSdkVersion targetSdkVer
versionCode 9
versionName "0.8.1"
vectorDrawables.useSupportLibrary = true
}

//check if the keystore details are defined in gradle.properties (this is so the key is not in github)
Expand Down Expand Up @@ -43,9 +47,19 @@ android {

dependencies {
implementation project(':rootbeerlib')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.2.0-alpha04'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'uk.co.barbuzz:beerprogressview:0.0.6'

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"

implementation "androidx.core:core-ktx:$corektxVersion"

implementation "androidx.appcompat:appcompat:$appcompatVersion"
implementation "androidx.constraintlayout:constraintlayout:$constraintlayoutVersion"
implementation "com.google.android.material:material:$materialDesignVersion"

implementation "com.nineoldandroids:library:$nineoldandroidsVersion"
implementation "uk.co.barbuzz:beerprogressview:$beerProgressViewVersion"

implementation "com.jakewharton.timber:timber:$timberVersion"
}
39 changes: 20 additions & 19 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.scottyab.rootbeer.sample"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.scottyab.rootbeer.sample">

<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="unspecified"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<application
android:name=".RootSampleApp"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="unspecified">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.scottyab.rootbeer.sample

import android.content.Context
import com.scottyab.rootbeer.RootBeer
import com.scottyab.rootbeer.util.Utils

class CheckForRootWorker(context: Context) {

private val rootBeer = RootBeer(context)

suspend operator fun invoke(): List<RootItemResult> = getRootResults()

private fun getRootResults() = listOf(
RootItemResult("Root Management Apps", rootBeer.detectRootManagementApps()),
RootItemResult("Potentially Dangerous Apps", rootBeer.detectPotentiallyDangerousApps()),
RootItemResult("Root Cloaking Apps", rootBeer.detectRootCloakingApps()),
RootItemResult("TestKeys", rootBeer.detectTestKeys()),
RootItemResult("BusyBoxBinary", rootBeer.checkForBusyBoxBinary()),
RootItemResult("SU Binary", rootBeer.checkForSuBinary()),
RootItemResult("2nd SU Binary check", rootBeer.checkSuExists()),
RootItemResult("For RW Paths", rootBeer.checkForRWPaths()),
RootItemResult("Dangerous Props", rootBeer.checkForDangerousProps()),
RootItemResult("Root via native check", rootBeer.checkForRootNative()),
RootItemResult("SE linux Flag Is Enabled", Utils.isSelinuxFlagInEnabled()),
RootItemResult("Magisk specific checks", rootBeer.checkForMagiskBinary())
)
}

141 changes: 0 additions & 141 deletions app/src/main/java/com/scottyab/rootbeer/sample/CheckRootTask.java

This file was deleted.

Loading

0 comments on commit 3163211

Please sign in to comment.