Skip to content

Instantly share code, notes, and snippets.

View pranavlathigara's full-sized avatar
🤓
Learning

Pranav Lathigara pranavlathigara

🤓
Learning
View GitHub Profile
@sjthn
sjthn / RecyclerViewAdapter.kt
Last active May 7, 2018 12:52
Kotlin template for RecyclerView Adapter in Android Studio
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
#end
#parse("File Header.java")
class ${NAME}(private var items: MutableList<${ITEM_TYPE}>): RecyclerView.Adapter<${VIEWHOLDER}>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ${VIEWHOLDER} {
@SureshCS-50
SureshCS-50 / SlidingTabLayout.java
Last active May 21, 2018 19:00
SlidingTabLayout with both ImageView and TextView support.
/*
/**
* Created by Windows on 16-01-2015.
*/
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* 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
import android.app.Activity
import android.support.annotation.IdRes
import android.view.View
fun <T : View> Activity.bind(@IdRes idRes: Int): Lazy<T> {
@Suppress("UNCHECKED_CAST")
return unsafeLazy { findViewById(idRes) as T }
}
fun <T : View> View.bind(@IdRes idRes: Int): Lazy<T> {
@fuadarradhi
fuadarradhi / AesCipher.java
Created January 6, 2019 06:36 — forked from demisang/AesCipher.java
AES/CBC/PKCS5Padding encrypt/decrypt PHP and JAVA example classes
import android.support.annotation.Nullable;
import android.util.Base64;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
@mikeplate
mikeplate / SimpleDatabaseHelper.java
Created February 23, 2014 15:46
Android SQLite very simple database helper example
package se.mobileapplab.datademo;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Class that wraps the most common database operations. This example assumes you want a single table and data entity
package despotoski.nikola.appbarlayoutsamples.view;
import android.animation.IntEvaluator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorCompat;
@furkantektas
furkantektas / DatePickerFragment.java
Last active February 11, 2020 20:52
Android DatePicker without year field.
public static class DatePickerFragment extends DialogFragment
implements DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
final int year = c.get(Calendar.YEAR);
final int month = c.get(Calendar.MONTH);
final int day = c.get(Calendar.DAY_OF_MONTH);
@douo
douo / FloatingActionMenu.java
Created June 23, 2015 08:01
FloatingActionMenu build by android support FloatingActionButton
package com.diaoser.tmr.view;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
@nickbutcher
nickbutcher / 1_drawable_ic_hash_io16.xml
Last active June 16, 2020 19:28
Animated Stroke. The google I/O website this year (https://google.com/io) has some funky animated lettering. I especially liked the animated stroke around the letters and wondered how you might implement that on Android. Turns out that AnimatedVectorDrawable makes this very easy! Here's how it looks: https://twitter.com/crafty/status/71077957997…
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 Google Inc.
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
@vishhmakasana
vishhmakasana / IntroVideoView.java
Last active August 10, 2020 14:11
In Android Play mp4 video as a background intro video in your app like latest freelancer app plays it on their intro page of android app.
package com.example.videointro;
import java.io.IOException;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.os.Build;
import android.util.AttributeSet;