Skip to content

Instantly share code, notes, and snippets.

View Sirelon's full-sized avatar
👀
Who are you?

Oleksandr Sirelon

👀
Who are you?
View GitHub Profile
@Sirelon
Sirelon / AppSignatureHelper.java
Created February 6, 2020 11:41
This is a helper class to generate your message hash to be included in your SMS message.
package com.hily.app.auth.phone;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.util.Base64;
import android.util.Log;
import java.nio.charset.StandardCharsets;
package com.sirelon
import android.content.Context
import android.graphics.Canvas
import android.graphics.Rect
import android.graphics.drawable.Drawable
import android.util.Log
import android.view.View
import android.widget.LinearLayout
import androidx.recyclerview.widget.RecyclerView
@Sirelon
Sirelon / PagedBaseAdapter.kt
Last active October 31, 2018 15:50
PagedBaseAdapter created for using BaseAdapter with android.arch.paging library. In example this can be useful, when you need to support pagination on AdapterView. For using you need to extend this class, and simply implement method getView
package com.sirelon
import android.arch.paging.PagedList
import android.arch.paging.PagedListAdapterHelper
import android.support.v7.recyclerview.extensions.ListAdapterConfig
import android.support.v7.util.ListUpdateCallback
import android.widget.BaseAdapter
/**
* Created on 2/7/18 12:35
@Sirelon
Sirelon / ReusableUCropView.java
Created April 3, 2017 10:59
The UCrop View with some trick option for reuse CropImagreView. Related issue https://github.com/Yalantis/uCrop/issues/271#issuecomment-291105984
package com.sirelon;
import android.content.Context;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import com.yalantis.ucrop.callback.CropBoundsChangeListener;
import com.yalantis.ucrop.callback.OverlayViewChangeListener;
import com.yalantis.ucrop.view.GestureCropImageView;
@Sirelon
Sirelon / FlexebleGridViewGroup.java
Last active February 21, 2017 09:55
FlexableGridViewGroup.
package com.sirelon;
import android.content.Context;
import android.support.annotation.DimenRes;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
/**
* @author sirelon
@Sirelon
Sirelon / Spannable.kt
Last active December 16, 2019 10:02 — forked from rlac/Spannable.kt
Adaptive for new Kotlin Version. A simple Kotlin builder for creating SpannableStrings. Original idea from https://gist.github.com/JakeWharton/11274467.
// Copyright 2014 Robert Carr
// Copyright 2016 Alexandr Romanishin
// 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
// distributed under the License is distributed on an "AS IS" BASIS,
@Sirelon
Sirelon / Truss.java
Created November 2, 2016 15:53 — forked from JakeWharton/Truss.java
Extremely simple wrapper around SpannableStringBuilder to make the API more logical and less awful. Apache 2 licensed.
import android.text.SpannableStringBuilder;
import java.util.ArrayDeque;
import java.util.Deque;
import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE;
/** A {@link SpannableStringBuilder} wrapper whose API doesn't make me want to stab my eyes out. */
public class Truss {
private final SpannableStringBuilder builder;
private final Deque<Span> stack;
@Sirelon
Sirelon / AppTextInputEditText.java
Created August 25, 2016 19:56
EditText, with setErrot functionality without holding TextInputLayout. Just get parent, and try to setError for parent. If parent not instance of TextInputLayout than eror have been set to itself view.
package com.sirelon;
import android.content.Context;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.text.TextUtils;
import android.util.AttributeSet;
/**
* @author romanishin
@Sirelon
Sirelon / HashtagsText.java
Last active May 31, 2016 15:34
class, which handle and show hashtags into textView.
package com.sirelon;
import android.support.annotation.ColorInt;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
@Sirelon
Sirelon / AbsModelAdapter.java
Created April 22, 2016 08:22
Parent class fot my ModelAdapter which showing progress, empty view.
package com.sirelon;
import android.content.Context;
import android.support.annotation.StringRes;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;