Skip to content

Instantly share code, notes, and snippets.

View ShabanKamell's full-sized avatar
🏠
Working from home

Shaban Kamel ShabanKamell

🏠
Working from home
View GitHub Profile
class Test {
fun isAnagram(str1: CharArray, str2: CharArray): Boolean {
val n1 = str1.size
val n2 = str2.size
if (n1 != n2) return false
str1.sort()
str2.sort()
// show Base64 image in iOS
import UIKit
extension UIImageView {
func setImage(
base64: String?,
placeholder: UIImage? = nil
){
import android.text.TextUtils;
import java.util.Locale;
public class DigitUtil {
public static String toEn(String value){
if (!TextUtils.isDigitsOnly(value))
return value;
return String.format(Locale.US, "%d", Long.valueOf(value));
@ShabanKamell
ShabanKamell / DottedLine.java
Created September 20, 2017 15:20 — forked from mlagerberg/DottedLine.java
[Vertical dotted line view] #android
package com.pixplicity.gist.ui.views;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathDashPathEffect;
import android.util.AttributeSet;
@ShabanKamell
ShabanKamell / gist:01eb00a8a16b4f1702f2ea03e1252fd4
Created August 11, 2017 23:56 — forked from yqritc/gist:ccca77dc42f2364777e1
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@ShabanKamell
ShabanKamell / gist:a9bf165cf4e2aee47b7cb39dab1b4a75
Created August 11, 2017 23:56 — forked from yqritc/gist:ccca77dc42f2364777e1
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@ShabanKamell
ShabanKamell / AndroidManifest.xml
Created June 20, 2017 09:39 — forked from bjoernQ/AndroidManifest.xml
Creating a System Overlay (Always on Top over all Apps) in Android
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.mobilej.overlay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application android:label="SystemOverlay" >
<activity
@ShabanKamell
ShabanKamell / ApiService.java
Created June 1, 2017 13:25 — forked from dustin-graham/ApiService.java
Infinite Scrolling Android RecyclerView with RxJava
public static Observable<List<String>> paginatedThings(final Observable<Void> onNextObservable) {
return Observable.create(new Observable.OnSubscribe<List<String>>() {
@Override
public void call(final Subscriber<? super List<String>> subscriber) {
onNextObservable.subscribe(new Observer<Void>() {
int latestPage = -1;
@Override
public void onCompleted() {
subscriber.onCompleted();
@ShabanKamell
ShabanKamell / Example.java
Created June 1, 2017 13:25 — forked from nightscape/Example.java
Simple RxJava-based adapter for an Android RecyclerView
public class ReactiveTextViewHolder<T> extends ReactiveViewHolder<T> {
private TextView label;
private T currentItem;
public ReactiveTextViewHolder(View itemView) {
super(itemView);
label = (TextView) itemView.findViewById(android.R.id.text1);
}