Skip to content

Instantly share code, notes, and snippets.

Avatar
🤒
Out sick

Rany Albeg Wein RanyAlbegWein

🤒
Out sick
View GitHub Profile
View EmailCompletionEditText.java
/**
* Created by Rany Albeg Wein on 24/01/2016.
*/
public class EmailCompletionEditText extends MultiAutoCompleteTextView {
private ContentResolver mContentResolver;
public EmailCompletionEditText(Context context) {
super(context);
init(context);
}
View LocationFetcher.java
public class LocationFetcher {
private LocationManager mLocationManager;
private LocationListener mListener;
private boolean mInProgress;
public LocationFetcher(LocationManager locationManager, OnLocationFetchedCallback callback) {
mLocationManager = Objects.requireNonNull(locationManager);
mListener = new LocationListener() {
@Override
@RanyAlbegWein
RanyAlbegWein / LinedEditText.java
Created Nov 13, 2018
An EditText with under lines.
View LinedEditText.java
public class LinedEditText extends android.support.v7.widget.AppCompatEditText {
private Rect mRect;
private Paint mPaint;
public LinedEditText(Context context, AttributeSet attrs) {
super(context, attrs);
mRect = new Rect();
mPaint = new Paint();
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
@RanyAlbegWein
RanyAlbegWein / CustomFontTextView.java
Created Nov 13, 2018
A TextView with a custom font.
View CustomFontTextView.java
/**
* @author Rany Albeg Wein
* @since 30/03/2018
* <p>
* // attrs.xml
* <declare-styleable name="CustomFontTextView">
* <attr name="customFont" format="string"/>
* </declare-styleable>
* // xml usage.
* <com.package.name.CustomFontTextView
@RanyAlbegWein
RanyAlbegWein / NiceAutoCompleteTextView.java
Last active Oct 20, 2019
A standard AutoCompleteTextView, but a bit nicer
View NiceAutoCompleteTextView.java
/**
* Created by Rany Albeg Wein on 5/12/2015.
* {@link AutoCompleteTextView} allowing us to check whether or not the user
* selected a suggested completion from the auto-complete popup.
* @see #isSelectionFromPopUp()
*/
public class NiceAutoCompleteTextView extends AppCompatAutoCompleteTextView {
{
addTextChangedListener(new TextWatcher() {
@RanyAlbegWein
RanyAlbegWein / RecyclerViewItemTouchListener.java
Last active May 18, 2020
A helper class for handling click events on a RecyclerView
View RecyclerViewItemTouchListener.java
/**
* Created by Rany Albeg Wein on 07/11/2015.
* Since we currently don't have a LongItemClick listener for the {@link RecyclerView}
* this is an implementation that uses a {@link GestureDetector} to notify us for long click events on one of
* {@link RecyclerView}'s child views. It also handles single-tap-up ( a click ) and a double-click on a child view.
*/
public class RecyclerViewItemTouchListener extends RecyclerView.SimpleOnItemTouchListener {
/**
* A listener that will be invoked on item click events.
You can’t perform that action at this time.