Skip to content

Instantly share code, notes, and snippets.

class AppModule(val application: Application) : Module() {
init {
val context = application.applicationContext
bind(Application::class.java).toInstance(application)
bind(Context::class.java).toInstance(context)
bind(AppConfigManager::class.java).toInstance(AppConfigManager())
}
}
class App : Application() {
val appConfigManager: AppConfigManager by inject()
override fun onCreate() {
super.onCreate()
KTP.openRootScope()
.openSubScope(APPSCOPE)
.installModules(AppModule(this))
@markchristopherng
markchristopherng / equals.kt
Created August 19, 2019 00:22
Equals method
override fun equals(other: Any?): Boolean {
// same type
if (other == null || other !is Consignment) {
return false
}
// null id
return if (id == null) {
other.id == null
apply plugin: 'com.android.application'
apply plugin: 'com.github.triplet.play'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "au.com.auspost.app"
minSdkVersion 28
#!/bin/bash
# Script which handles starting the UI build container, then building the UI inside of it.
# This expects to be run from a bamboo task, hence the $bamboo_X variables. Set these locally if you want to run it locally.
# Call it with no args to start the container
# Call it with 'build' to run the build, test, and upload process
set -euo pipefail
echo "Starting build now"
class NonEqualWrapper<T>(var content: T?) {
override fun hashCode(): Int {
return content.hashCode()
}
override fun equals(other: Any?): Boolean {
return false
}
}
notificationBuilder = new NotificationCompat.Builder(context, channelId)
.setSmallIcon(icon)
.setContentTitle(title)
.setContentText(message)
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
.setAutoCancel(autoCancel)
.setSound(defaultSoundUri)
.setContentIntent(contentAction.actionIntent);
@TargetApi(Build.VERSION_CODES.O)
private void createNotificationChannels(AppConfig config) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
config.getChannelGroups()!= null) {
for (AppConfig.ChannelGroup cg: config.getChannelGroups()) {
NotificationChannelGroup ncg =
new NotificationChannelGroup(cg.groupId, cg.groupName);
notificationManager.createNotificationChannelGroup(ncg);
for (AppConfig.Channel channel : cg.channels) {
"pushNotificationSettings":[
{
"groupId":"Deliveries",
"groupName":"Deliveries",
"channels":[
{
"channelId":"1_ON_MATCH_PUSH",
"templateName":"ON_MATCH_PUSH",
"channelName":"Added to track list",
"importance":3
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/primary"/>
<foreground android:drawable="@drawable/ic_icon_foreground"/>
</adaptive-icon>