Skip to content

Commit

Permalink
Merge pull request #9 from judemanutd/feature/kotlin-convert
Browse files Browse the repository at this point in the history
Updated example to kotlin
  • Loading branch information
judemanutd authored Apr 7, 2019
2 parents 092be48 + 952f075 commit 6e04a73
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 37 deletions.
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Autostarter

[ ![Download](https://api.bintray.com/packages/judemanutd/Maven/autostarter/images/download.svg) ](https://bintray.com/judemanutd/Maven/autostarter/_latestVersion)
[![Download](https://api.bintray.com/packages/jude-manutd/maven/autostarter/images/download.svg) ](https://bintray.com/jude-manutd/maven/autostarter/_latestVersion)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square)](https://opensource.org/licenses/MIT)
[![API](https://img.shields.io/badge/API-14%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=14)

<img src="Logotype primary.png" width="80%" height="80%" />
<img src="Logotype primary.png" width="70%" height="70%" />

This library helps bring up the autostart permission manager of a phone to the user so they can add
an app to autostart.
Expand All @@ -29,23 +29,29 @@ of the autostart permissiong manager.

Add this to your module's `build.gradle` file:

dependencies {
```groovy
dependencies {
// ... other dependencies
implementation 'com.judemanutd:autostarter:1.0.0'
}
implementation 'com.github.judemanutd:autostarter:1.0.1'
}
```

### Maven

<dependency>
<groupId>com.judemanutd</groupId>
<artifactId>autostarter</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
```xml
<dependency>
<groupId>com.github.judemanutd</groupId>
<artifactId>autostarter</artifactId>
<version>1.0.1</version>
<type>pom</type>
</dependency>
```

Once you have integrated the library calling the following function will bring up the autostart permission manager of the phone.

```kotlin
AutoStartPermissionHelper.getInstance().getAutoStartPermission(context);
```
In order to keep the library small and simple I have not included any dialogs or pop ups, It is upto you to provide the user with a message if necessary.

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.judemanutd.autostarterexample

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.widget.Button

import com.judemanutd.autostarter.AutoStartPermissionHelper

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

val button = findViewById<Button>(R.id.button)
button.setOnClickListener { AutoStartPermissionHelper.getInstance().getAutoStartPermission(this@MainActivity) }


}
}
4 changes: 4 additions & 0 deletions autostarter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,9 @@ repositories {
mavenCentral()
}

tasks.withType(Javadoc).all {
enabled = false
}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,9 @@ class AutoStartPermissionHelper private constructor() {
}

companion object {
val obj = AutoStartPermissionHelper()

@JvmStatic
fun getInstance(): AutoStartPermissionHelper {
return obj
return AutoStartPermissionHelper()
}

}
Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ buildscript {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.

0 comments on commit 6e04a73

Please sign in to comment.