Skip to content

Instantly share code, notes, and snippets.

View MuhamedFathy's full-sized avatar
🎯
Focusing

Mohamed Fathy MuhamedFathy

🎯
Focusing
  • La3eb
  • Egypt
View GitHub Profile
/*
* Copyright (C) 2006 The Android Open Source Project
*
* 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
@MuhamedFathy
MuhamedFathy / udemy-youtube-dl.py
Created March 26, 2016 05:58 — forked from melkopisi/udemy-youtube-dl.py
Download udemy lectures using youtube-dl script (by : @luiz-rocha)
#!/usr/bin/env python3
#by luiz-rocha
#You can now download udemy lectures by this script which uses youtube-dl script :))
import getpass
import subprocess
try:
url = input('Course URL: ')
@MuhamedFathy
MuhamedFathy / Foreground.java
Created May 15, 2016 14:43 — forked from steveliles/Foreground.java
Class for detecting and eventing whether an Android app is currently foreground or background (requires API level 14+)
package com.sjl.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import java.util.List;
@MuhamedFathy
MuhamedFathy / Coloring.java
Last active May 31, 2021 13:43 — forked from milosmns/Coloring.java
Android: Coloring (Helper Class)
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
@MuhamedFathy
MuhamedFathy / SwipeRefreshLayoutWithEmpty.java
Created January 29, 2017 19:39 — forked from grennis/SwipeRefreshLayoutWithEmpty.java
This class allows easy use of SwipeRefreshLayout with RecyclerView (or ListView) and an "empty" view that can still be pulled to refresh
package com.innodroid.sample;
import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
//
@MuhamedFathy
MuhamedFathy / ResizeAnimation.java
Created February 11, 2017 14:02 — forked from rafali/ResizeAnimation.java
Resize animation on Android
public class ResizeAnimation extends Animation {
final int startWidth;
final int targetWidth;
View view;
public ResizeAnimation(View view, int targetWidth) {
this.view = view;
this.targetWidth = targetWidth;
startWidth = view.getWidth();
}
@MuhamedFathy
MuhamedFathy / ActivityA.java
Created March 14, 2017 12:41
Stackoverflow answer, "Singleton in Android"
package com.example.testSingleton;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class ActivityA extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
/* Copyright 2013 Google Inc.
Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0.html */
package com.example.latlnginterpolation;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;
public class Animator implements Runnable {
private static final int ANIMATE_SPEEED = 800;
private static final int ANIMATE_SPEEED_TURN = 1000;
private static final int BEARING_OFFSET = 20;
private final Interpolator interpolator = new LinearInterpolator();
int currentIndex = 0;
import android.graphics.Color;
import android.location.Location;
import android.os.Handler;
import android.os.SystemClock;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;