Skip to content

Instantly share code, notes, and snippets.

View HashUtils.kt
package com.isscroberto.onebreath.utils
import java.security.MessageDigest
enum class Algorithm(val code: String) {
SHA1("SHA-1"), SHA256("SHA-256"), SHA512("SHA-512")
}
fun String.hash (algorithm: Algorithm): String {
val hexArray = "0123456789ABCDEF"
View YourClass.cs
using System.Diagnostics.CodeAnalysis;
namespace YourNamespace
{
[ExcludeFromCodeCoverage]
public class YourClass
{
...
}
}
View .travis.yml
os:
- linux
language: generic
sudo: false
addons:
apt:
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
sources:
- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
packages:
View AndroidManifest.xml
<service android:name=".util.AlarmService"/>
View MainActivity.kt
// Stop alarm.
context!!.stopService(Intent(context!!, AlarmService::class.java))
View TimerExpiredReceiver.kt
package com.isscroberto.powernap
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.isscroberto.powernap.data.NapState
import com.isscroberto.powernap.util.NotificationUtil
import com.isscroberto.powernap.util.PrefUtil
import com.isscroberto.powernap.util.AlarmService
View AlarmService.kt
package com.isscroberto.powernap.util
import android.app.Service
import android.content.Context
import android.content.Intent
import android.media.Ringtone
import android.media.RingtoneManager
import android.os.IBinder
class AlarmService : Service() {
View SplashActivity.kt
package com.isscroberto.powernap.splash
import android.animation.Animator
import android.animation.ValueAnimator
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import com.isscroberto.powernap.R
import com.isscroberto.powernap.start.StartActivity
import android.view.animation.BounceInterpolator
View activity_splash.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
View SplashActivity.kt
package com.isscroberto.onebreath.splash
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import com.crashlytics.android.Crashlytics
import com.isscroberto.onebreath.main.BreatheActivity
class SplashActivity : AppCompatActivity() {