Skip to content

Instantly share code, notes, and snippets.

@li2
li2 / MyAndroidApplication.kt
Created August 20, 2023 22:46 — forked from sebaslogen/MyAndroidApplication.kt
Finish all opened activities in my Android app (also across different tasks)
class MainApplication : Application() {
private val createdActivities = mutableListOf<WeakReference<Activity>>()
override fun onCreate() {
super.onCreate()
registerActivityLifecycleCallbacks(activityLifecycleCallbacks())
}
fun closeAllActivities() {
@li2
li2 / Android Privacy Policy
Last active June 13, 2020 06:47 — forked from alphamu/Android Privacy Policy Template
Privacy policy for Android apps
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width'>
<title>Privacy Policy</title>
<style> body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; padding:1em; } </style>
</head>
<body>
<strong>Privacy Policy</strong> <p>
@li2
li2 / BluetoothCallback.java
Created October 29, 2018 02:39 — forked from joinAero/BluetoothCallback.java
Android - The bluetooth listener and profile proxy.
package cc.cubone.turbo.core.bluetooth;
/**
* Interface definition for a callback to be invoked when bluetooth state changed.
*/
public interface BluetoothCallback {
/**
* Called when the bluetooth is off.
*/
@li2
li2 / RxBroadcastReceiver.java
Created October 29, 2018 01:37 — forked from magillus/RxBroadcastReceiver.java
RxJava2.0 Broadcast Receiver for getting intent broadcasts as Observable<Intent>
/**
* RxJava based broadcast reciever that registers its local BroadcastReceiver until end of subscription.
* Listens for update and passes Intent to the Stream (Subscriber).
*
* Copyright 2016 Mateusz Perlak - http://www.apache.org/licenses/LICENSE-2.0
* Created on 11/18/16.
*/
public class RxBroadcastReceiver implements ObservableOnSubscribe<Intent> {
protected final WeakReference<Context> contextWeakReference;
@li2
li2 / iterm2-solarized.md
Last active March 20, 2018 04:40 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + Powerlevel9k - (macOS) #tags: tool

Default

Default

Powerlevel9k

Powerlevel9k

@li2
li2 / ForegroundLinearLayout.java
Last active March 20, 2018 05:22 — forked from chrisbanes/ForegroundLinearLayout.java
ForegroundLinearLayout. An layout which supports a foreground drawable. Base on this class, we can implement ripple effect on layout. #tags: android-view, android-animation
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@li2
li2 / Android Studio .gitignore
Last active March 20, 2018 11:18 — forked from iainconnor/Android Studio .gitignore
A .gitignore for use in Android Studio #tags: git
# Built application files
/*/build/
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files