Skip to content

Instantly share code, notes, and snippets.

View m7mdra's full-sized avatar
💤

Mohamed Elshiekh m7mdra

💤
View GitHub Profile
<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 / LocationUtils.java
Created March 28, 2017 08:44
checks gps availability and show #AlertDialg when its not
package util;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.provider.Settings;
import android.text.TextUtils;
@m7mdra
m7mdra / Cache.java
Created March 28, 2017 08:43
LruCache
package util;
import com.jakewharton.disklrucache.DiskLruCache;
import java.io.File;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
public class Cache {
package m7mdra.io.services.util;
import android.content.Context;
import android.graphics.Typeface;
import java.lang.reflect.Field;
public class TypefaceUtil {
import android.content.Context;
import android.content.SharedPreferences;
public class PrefManager {
SharedPreferences pref;
SharedPreferences.Editor editor;
Context _context;
// shared pref mode
@m7mdra
m7mdra / data.json
Last active November 3, 2016 12:38
[
{
"id": 1,
"username": "pcarroll0",
"email": "pcarroll0@mapy.cz",
"birth_date": "10/04/1967",
"first_name": "Pamela",
"last_name": "Carroll",
"phone_number": "380-(533)243-2031",
@m7mdra
m7mdra / README.md
Created September 9, 2016 18:34 — forked from claudijo/README.md
An Android view for typewriting-like animations

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 August 24, 2016 20:00 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
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
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
startActivity(new Intent(MainActivity.this, UserLogin.class));
finish();
}
}, time);
}
String[] data = {"index0","index1","index2"}; // البيانات العايز تضيفها للـلسته
ListView list = (ListView) findViewById(R.id.list);
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getBaseContext(), ,android.R.layout.activity_list_item, data);
spinner.setAdapter(arrayAdapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (parent.getSelectedItemPosition() == 0) {//لما يضغط على العنصرالاول