Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mohamed Elshiekh m7mdra

🏠
Working from home
View GitHub Profile
View main.js
Parse.Cloud.beforeSave(Parse.User, function(request, response) {
Parse.Cloud.useMasterKey();
var user = request.user;
if (user.existed()) { return; }
// set ACL so only the user himself can see his own data
user.setACL(new Parse.ACL(user));
user.save();
// add user to role
var roleName = "member";
var roleQuery = new Parse.Query(Parse.Role);
View gist:a1ad1639c1787fd3fef2
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) {//لما يضغط على العنصرالاول
View gist:d476e1a20de088a903a5
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
startActivity(new Intent(MainActivity.this, UserLogin.class));
finish();
}
}, time);
}
@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
@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);
View data.json
[
{
"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",
View PrefManager.java
import android.content.Context;
import android.content.SharedPreferences;
public class PrefManager {
SharedPreferences pref;
SharedPreferences.Editor editor;
Context _context;
// shared pref mode
View TypefaceUtil.java
package m7mdra.io.services.util;
import android.content.Context;
import android.graphics.Typeface;
import java.lang.reflect.Field;
public class TypefaceUtil {
View Cache.java
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 {
@m7mdra
m7mdra / LocationUtils.java
Created Mar 28, 2017
checks gps availability and show #AlertDialg when its not
View LocationUtils.java
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;