Skip to content

Instantly share code, notes, and snippets.

View hitesh-dhamshaniya's full-sized avatar
🎯
Focusing

Hitesh Dhamshaniya hitesh-dhamshaniya

🎯
Focusing
View GitHub Profile
@hitesh-dhamshaniya
hitesh-dhamshaniya / PhoneNumberWatcher.kt
Created April 17, 2020 09:05
Phone Number Watcher is utility class to format mobile number in android 000-000-0000, In most of application we required phone number formater, so that I created gist, so easily get whenever required. Hope it will help.
import android.text.Editable
import android.text.TextWatcher
import android.widget.EditText
/**
* @author Hitesh
* @version 1.0
* @since 14-08-2019
*/
@webianks
webianks / ScalingView.kt
Last active July 13, 2020 13:42
Achieving scale down/up and the onClick callback on CTA views with Compound Views, Gesture Detector, and ObjectAnimator in Android.
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.GestureDetector
import android.view.MotionEvent
import android.view.View
import android.widget.FrameLayout
import androidx.core.view.GestureDetectorCompat
@rahulupadhyay
rahulupadhyay / activity_scrolling.xml
Created April 22, 2016 07:20
NestedSrollView with RecyclerView inside it along with TextView.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.devdigital.rundedcardwithimagedemo.ScrollingActivity">
<android.support.design.widget.AppBarLayout
/*
* Copyright 2015 serso aka se.solovyev
*
* 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
import android.content.Context;
import android.graphics.Rect;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import com.dhl.tiktail.BuildConfig;
import java.lang.reflect.Field;
Uri imageUri = Uri.parse("/sdcard/Aa.png");
//Uri imageUri = Uri.parse("/storage/emulated/0/designapp/Aa.png");
Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
intent.setDataAndType(imageUri, "image/*");
intent.putExtra("png", "image/*");
startActivityForResult(Intent.createChooser(intent,"Set AS"), 1000);
User for Set Image as wallpaper, Contact Picture and other....
***************** Java ******************
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
public Bitmap getScreenshotFromRecyclerView(RecyclerView view) {
RecyclerView.Adapter adapter = view.getAdapter();
Bitmap bigBitmap = null;
if (adapter != null) {
int size = adapter.getItemCount();
int height = 0;
Paint paint = new Paint();
int iHeight = 0;
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
@mumer92
mumer92 / FacebookKeyHash
Last active March 21, 2017 06:25
Generate Facebook KeyHash Android Programatically
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
PackageInfo info = getPackageManager().getPackageInfo(
"com.facebook.samples.loginhowto",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");