Skip to content

Instantly share code, notes, and snippets.

View mainul-hossain's full-sized avatar
🏠
Working from home

Mainul Hossain mainul-hossain

🏠
Working from home
View GitHub Profile
@keithics
keithics / startDropMarkerAnimation.kt
Last active April 17, 2024 01:56
Animated Drop Marker Kotlin
private fun startDropMarkerAnimation(marker: Marker) {
val target = marker.position
val handler = Handler()
val start = SystemClock.uptimeMillis()
val proj = mMap!!.projection
val targetPoint = proj.toScreenLocation(target)
val duration = (200 + targetPoint.y * 0.6) as Double
val startPoint = proj.toScreenLocation(marker.position)
startPoint.y = 0
val startLatLng = proj.fromScreenLocation(startPoint)
@mainul-hossain
mainul-hossain / shadow.xml
Created April 19, 2017 07:56 — forked from lecho/shadow.xml
Android shadow drawable xml.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
@riggaroo
riggaroo / MainActivity.java
Last active July 15, 2020 12:30
Online Presence with Firebase and Android based off article https://firebase.googleblog.com/2013/06/how-to-build-presence-system.html . Read the article as it explains the whole .onDisconnect().removeValue() nicely.
private void initialiseOnlinePresence() {
final DatabaseReference onlineRef = databaseReference.child(".info/connected");
final DatabaseReference currentUserRef = databaseReference.child("/presence/" + userId);
onlineRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(final DataSnapshot dataSnapshot) {
Log.d(TAG, "DataSnapshot:" + dataSnapshot);
if (dataSnapshot.getValue(Boolean.class)){
currentUserRef.onDisconnect().removeValue();
currentUserRef.setValue(true);
@lecho
lecho / shadow.xml
Created September 7, 2013 07:01
Android shadow drawable xml.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"