A Don't Kill My App Library
The aim of dontkillmyapp.com is to create a collection of guides and information to help users and developers troubleshoot issues on their devices related to background tasks being killed unnecessarily by the Android system. This library displays relevant information from this site to the user of an affected application, and attempts to walk users through the process of solving the problem themselves, hopefully reducing the amount of time that developers have to spend providing support as a result of these issues.
Default Activity | Activity w Custom Theme | Dialog | Customized Doki View |
---|---|---|---|
For testing and experimentation purposes, a sample apk can be downloaded here.
Doki is available via JitPack, so getting it as simple as adding it as a dependency, like this:
- Add JitPack repository to your root
build.gradle
file
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
- Add the dependency in your project
build.gradle
file
dependencies {
implementation('dev.doubledot.doki:library:0.0.1@aar') {
transitive = true
}
}
The DokiActivity
provides you with a default uncustomized implementation
of the Doki API that is quick and easy to set up and use. Simply call
DokiActivity.start(...)
to open it.
Kotlin
DokiActivity.start(context = ...)
Java
DokiActivity.start(context);
Alternatively, you can use DokiActivity.newIntent(...)
to create an
Intent to open it.
DokiContentView
is the custom view that DokiActivity
is based on. Implementing
it allows for greater customization and use in more complex scenarios.
In the layout you want to include our custom view, just add it like this:
<dev.doubledot.doki.views.DokiContentView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/doki_content"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
In order to fetch content from the Don't Kill My App website,
you must call loadContent()
on the view.
Kotlin
val doki : DokiContentView? = findViewById(R.id.doki_content)
doki?.loadContent()
Java
DokiContentView doki = findViewById(R.id.doki_content);
if (doki != null) doki.loadContent();
You can pass a DokiContentCallback
instance to the loadContent
method to receive events:
Kotlin
val doki : DokiContentView? = findViewById(R.id.doki_content)
doki?.loadContent(callback = object : DokiContentCallback {
override fun onStartedToLoad() {}
override fun onLoaded() {}
override fun onFailedToLoad() {}
})
If you are using the DokiContentView
, you can customize it by setting custom attributes.
Please check this file
which implements every option available.
For custom fonts and text styles, you can override the following styles:
<style name="Doki.Custom.Headline" parent="Doki.Headline"/>
<style name="Doki.Custom.Overline" parent="Doki.Overline"/>
<style name="Doki.Custom.Button" parent="Doki.Button"/>
<style name="Doki.Custom.Body" parent="Doki.Body"/>
<style name="Doki.Custom.Header" parent="Doki.Header"/>
<style name="Doki.Custom.Subtext" parent="Doki.Subtext"/>
And add the following attributes as you wish and with the values you want:
<item name="fontFamily">sans-serif</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">bold</item>
<item name="android:textAllCaps">false</item>
<item name="android:textSize">16sp</item>
<item name="android:letterSpacing">0.1</item>
Note: don't change the parent styles, just add the attributes you want to modify
- Jahir Fiquitiva (GitHub, Twitter) 👨💻
- James Fenn (GitHub, Twitter) 👨💻
- Eduardo Pratti (Twitter) 🎨
Thank you to everyone that helped to make this project possible!
- urbandroid-team/dont-kill-my-app
- noties/Markwon
- square/retrofit
- square/okhttp
- ReactiveX/RxAndroid
- afollestad/material-dialogs
MIT License
Copyright (c) 2019 Doki Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.