Skip to content

Instantly share code, notes, and snippets.

@vishalpatel1327
vishalpatel1327 / README.md
Created April 29, 2019 05:25 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

All hex value from 100% to 0% alpha:

@vishalpatel1327
vishalpatel1327 / DividerItemDecoration.java
Created July 4, 2017 12:55 — forked from zokipirlo/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@vishalpatel1327
vishalpatel1327 / SnappingRecyclerView.java
Created May 16, 2017 10:16 — forked from lauw/SnappingRecyclerView.java
Snapping RecyclerView (Horizontal)
/*
* Copyright 2015 Laurens Muller.
*
* 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
/*
* Copyright 2015 Laurens Muller.
*
* 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
@vishalpatel1327
vishalpatel1327 / MapsFragment.java
Last active February 24, 2017 11:30
Sticky Infowindows When you click on your marker, this all stuff because our map doent gives any touchlistner,clicklistner etc.
.............
.........
// this TestFragment fragment content info windows UI
private TestFragment testFragment;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.maps_fragment, container, false);
final View activityRootView = activity.getWindow().getDecorView().findViewById(android.R.id.content);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
int contentViewTop = activity.getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop();
LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(activity);
if (heightDiff > 200) { // 99% of the time the height diff will be due to a keyboard.