Skip to content

Instantly share code, notes, and snippets.

:electron:
Bio Robot

Ivan V nikartm

:electron:
Bio Robot
Block or report user

Report or block nikartm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nikartm
nikartm / README.md
Created May 25, 2019 — forked from lopspower/README.md
Hexadecimal color code for transparency
View README.md

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:

@nikartm
nikartm / Cache.java
Last active May 12, 2019
Android. Example how to save an image file in the App cache and get Uri for it. The Image will not be saved in a device gallery, only in an internal App cache.
View Cache.java
package com.github.example;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.core.content.FileProvider;
View FooterBarLayout.java
package ru.dasreda.dasreda;
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.widget.FrameLayout;
/**
* @author Ivan V on 06.03.2018.
* @version 1.0
@nikartm
nikartm / FooterBarBehavior.java
Last active May 12, 2019
FooterBarBehavior
View FooterBarBehavior.java
import android.content.Context;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.view.View;
/**
* @author Ivan V on 06.03.2018.
* @version 1.0
*/
@nikartm
nikartm / Java declination age method
Last active Dec 11, 2017
Склонение возраста (ru)
View Java declination age method
public static String getAgeWithDeclination(double age){
String result;
List<Double> units = Arrays.asList(2d, 3d, 4d);
List<Double> dozens = Arrays.asList(11d, 12d, 13d, 14d);
if(age != 11 && age % 10 == 1) {
result = age + " год";
} else if(age % 1 != 0d || (units.contains(age % 10) && !dozens.contains(age % 100))) {
result = age + " года";
} else {
@nikartm
nikartm / ru_cities.xml
Created Apr 29, 2017
All Russian Cities xml
View ru_cities.xml
<?xml version="1.0"?>
<string-array name="cities">
<item>Абаза, Хакасия</item>
<item>Абакан, Хакасия</item>
<item>Абдулино, Оренбургская область</item>
<item>Абинск, Краснодарский край</item>
<item>Агидель, Башкортостан</item>
<item>Агрыз, Татарстан</item>
<item>Адыгейск, Адыгея</item>
<item>Азнакаево, Татарстан</item>
@nikartm
nikartm / gitignore file
Created Apr 27, 2017
Gitignore for Android
View gitignore file
# Android Studio
.gradle
/local.properties
.DS_Store
/build
/captures
app/build/
gradle/
*.iml
.idea
@nikartm
nikartm / ImgRedactor
Created Jan 13, 2017
Get bitmap shader circle img
View ImgRedactor
// Get bitmap shader circle img
public static Bitmap getCircleMaskedBitmapShader(Bitmap source, int radius) {
if (source == null) { return null; }
int diam = radius << 1;
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
Bitmap scaledBitmap = scaleTo(source, diam);
final Shader shader = new BitmapShader(scaledBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
View Add new contact without confirmation
try {
String DisplayName = "XYZ";
String MobileNumber = "123456";
String HomeNumber = "1111";
String WorkNumber = "2222";
String emailID = "email@nomail.com";
String company = "bad";
String jobTitle = "abcd";
ArrayList<ContentProviderOperation> ops = new ArrayList < ContentProviderOperation > ();
@nikartm
nikartm / menu_hide.js
Created Feb 23, 2016
JS hide menu and open on click
View menu_hide.js
//Hide products blocks
$(document).ready(function() {
$('.btn').click(function() { //Click on button
$(".cont").not(this).slideUp().prev().removeClass("active"); //Hide all open blocks
$(this).next().find(".cont").not(":visible").slideDown().prev().addClass("active"); //Open current block
});
});
<!-- Start products menu -->
<div class="container prod_block">
You can’t perform that action at this time.