Skip to content

Instantly share code, notes, and snippets.

View prashantwosti's full-sized avatar
🏠
WFH

Prashant Wosti prashantwosti

🏠
WFH
View GitHub Profile
@prashantwosti
prashantwosti / InternetConnectionCheck.kt
Last active February 17, 2023 13:10
Internet connection check using LiveData. For android version M or higher.
class InternetConnectionCheck (context: Context) : LiveData<Boolean>() {
private val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
override fun onActive() {
super.onActive()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
connectivityManager.registerDefaultNetworkCallback(getNetworkCallback())
} else {
connectivityManager.registerNetworkCallback(getNetworkRequest(), getNetworkCallback())
@prashantwosti
prashantwosti / 1MarkerAnimation.java
Created February 27, 2016 06:04 — forked from broady/1MarkerAnimation.java
Animating Markers
/* Copyright 2013 Google Inc.
Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0.html */
package com.example.latlnginterpolation;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;
@prashantwosti
prashantwosti / giffify.sh
Last active August 29, 2015 14:24 — forked from rock3r/giffify.py
#!/bin/sh
# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
# ----------------------------------------------------------------------------
#
# Based upon http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html