Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mohamed Elshiekh m7mdra

🏠
Working from home
View GitHub Profile
@m7mdra
m7mdra / Example.kt
Last active Aug 18, 2021 — forked from radoyankov/Example.kt
Easy Spannable on Kotlin
View Example.kt
val spanned = spannable{ bold("some") + italic(" formatted") + color(Color.RED, " text") }
val nested = spannable { italic(underline(bold(size(2f, color(Color.RED, "Red Bold Color"))))) }
val noWrapping = bold("no ") + sub("wrapping ) + sup("also ") + "works"
text_view.text = spanned + nested + noWrapping
@m7mdra
m7mdra / Example.java
Created Jun 3, 2017 — forked from RyanRamchandar/Example.java
Cancel a running or queued Call with OkHttp3
View Example.java
// ...
Request request = new Request.Builder()
.url(url)
.tag(TAG)
.build();
// Cancel previous call(s) if they are running or queued
OkHttpUtils.cancelCallWithTag(client, TAG);
// New call
@m7mdra
m7mdra / MultiChoiceHelper.java
Created May 8, 2017 — forked from cbeyls/MultiChoiceHelper.java
Helper class to reproduce ListView's modal MultiChoice mode with a RecyclerView. Compatible with API 7+.
View MultiChoiceHelper.java
package be.digitalia.common.widgets;
import android.content.Context;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.v4.util.LongSparseArray;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.view.ActionMode;
View AndroidManifest.xml
<service
android:name="com.example.AuthenticatorService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data
android:name="android.accounts.AccountAuthenticator"
@m7mdra
m7mdra / README.md
Created Sep 9, 2016 — forked from claudijo/README.md
An Android view for typewriting-like animations
View README.md

TypewriterView

An Android view that can be used to sequentially animate typing and deleting one character at a time. Pausing and enqueuing arbitrary Runnables is also possible. Inspired by Devunwired @ Stackoverflow (see http://stackoverflow.com/questions/6700374/android-character-by-character-display-text-animation).

An EditText view has been used as base to get a blinking cursor. This has the drawback that the user could edit the text while it is animating. Minimum changes to the code are required to instead use a TextView as base if that is an issue.

Example

TypewriterView typewriterView = (TypewriterView) view.findViewById(R.id.typewriter);
@m7mdra
m7mdra / Connectivity.java
Created Aug 24, 2016 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
View Connectivity.java
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil