Skip to content

Instantly share code, notes, and snippets.

View hardikamal's full-sized avatar
🖥️

Hardik Amal hardikamal

🖥️
View GitHub Profile
@NikolaDespotoski
NikolaDespotoski / BottomNavigationBehavior.java
Last active December 19, 2022 06:14
Bottom Navigation behavior
/*
* BottomNavigationLayout library for Android
* Copyright (c) 2016. Nikola Despotoski (http://github.com/NikolaDespotoski).
* 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
@01taylop
01taylop / DateTimeAgo.swift
Last active April 7, 2018 11:33
A very simple date time ago file in swift inspired from kevinlawler's "NSDate-TimeAgo".
//
// DateTimeAgo.swift
//
// Created by Patrick Taylor on 30/01/2016.
// Copyright © 2016 Patrick Taylor. All rights reserved.
//
import Foundation
import Darwin
@eneim
eneim / BadgeTabLayout.java
Last active June 10, 2022 11:27
A custom TabLayout with badge support for Tabs
package im.ene.lab.android.widgets;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.util.AttributeSet;
@billwang1990
billwang1990 / ObjectMapper+Alamofire+RxSwift
Created October 30, 2015 06:24
ObjectMapper+Alamofire+RxSwift
//
// RxAlamofireObjMapper.swift
// RXDemo
//
// Created by Yaqing Wang on 10/30/15.
// Copyright © 2015 billwang1990.github.io. All rights reserved.
//
import Foundation
import Alamofire
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by benny on 15/10/15.
*/
public abstract class HeaderFooterAdapter<T extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public static final int FOOTER = 8769;
@TWiStErRob
TWiStErRob / SquareFrameLayout.java
Created September 30, 2015 23:33
Make GridView or GridLayoutManager items square.
package net.twisterrob.android.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;
public class SquareFrameLayout extends FrameLayout {
public SquareFrameLayout(Context context) {
super(context);
}
@willthink
willthink / contact.m
Last active March 6, 2023 20:05
Using CNContactStore in Objective C to query contacts info
#import <Contacts/Contacts.h>
@implementation ContactsScan
- (void) contactScan
{
if ([CNContactStore class]) {
//ios9 or later
CNEntityType entityType = CNEntityTypeContacts;
if( [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusNotDetermined)
@FireZenk
FireZenk / SnackbarAnimation.java
Last active August 11, 2020 13:06
With this class you can clone the {Snackbar} animation to move the {ViewGroup} above of the Snackbar when it is visible and avoid view overlapping (clone of fab animation)
package com.your.package;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.view.ViewGroup;
import com.daimajia.easing.BaseEasingMethod;
import com.daimajia.easing.Glider;
import com.daimajia.easing.Skill;
import com.nineoldandroids.animation.AnimatorSet;
@ftvs
ftvs / PhonecallReceiver.java
Last active October 11, 2023 10:05
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: Gabe Sechan http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {