Skip to content

Instantly share code, notes, and snippets.

View m7mdra's full-sized avatar
💤

Mohamed Elshiekh m7mdra

💤
View GitHub Profile
@m7mdra
m7mdra / SpringAnimator.java
Last active December 19, 2017 09:44
Applies Spring animation to a given view using physics animation API
package comtas.com.zoolvibs.helper;
import android.support.animation.DynamicAnimation;
import android.support.animation.SpringAnimation;
import android.view.View;
/**
* Created by m7mdra on 08/10/17.
*/
package comtas.com.zoolvibs.helper;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.util.Log;
/**
@m7mdra
m7mdra / MainActivity.java
Last active August 13, 2017 07:15
recyclerview with clicklistener
package test.com.bttest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
package com.reqabaweb.healthcontrol.ui.activity;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.print.PrintAttributes;
import android.print.PrintDocumentAdapter;
import android.print.PrintJob;
import android.print.PrintManager;
private void createWebPrintJob(WebView webView) {
PrintManager printManager = (PrintManager) getSystemService(Context.PRINT_SERVICE);
PrintDocumentAdapter printAdapter = webView.createPrintDocumentAdapter();
String jobName = getString(R.string.app_name) + " Document";
PrintJob printJob = printManager.print(jobName, printAdapter,
new PrintAttributes.Builder().build());
@m7mdra
m7mdra / DebouncedQueryTextListener.java
Last active April 25, 2018 11:39
A debounce searchview query listener. [DO NOT USE THIS , TRY TO USE RXJAVA]
package com.reqabaweb.healthcontrol.ui;
import android.os.SystemClock;
import android.support.v7.widget.SearchView;
import android.util.Log;
public abstract class DebouncedQueryTextListener implements SearchView.OnQueryTextListener {
private static final String TAG = "DebouncedOnQueryTextLis";
@m7mdra
m7mdra / Example.java
Created June 3, 2017 22:33 — forked from RyanRamchandar/Example.java
Cancel a running or queued Call with OkHttp3
// ...
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 08:59 — forked from cbeyls/MultiChoiceHelper.java
Helper class to reproduce ListView's modal MultiChoice mode with a RecyclerView. Compatible with API 7+.
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;
@m7mdra
m7mdra / UserPreference.java
Created April 7, 2017 15:58
stores user and token
package com.reqabaweb.healthcontrol;
import android.content.Context;
import android.content.SharedPreferences;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by allaeem on 4/7/2017.
@m7mdra
m7mdra / RxVersionChecker.java
Last active June 19, 2018 11:02
checks google play for newer version using Jsoup and rxandroid
package m7mdra.io.services.util;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;