Skip to content

Instantly share code, notes, and snippets.

View SherifSalem's full-sized avatar

Sherif Salem SherifSalem

  • Ain Technologies
  • Cairo, Egypt
View GitHub Profile
anonymous
anonymous / build-a-tribute-page-freecodecamp.markdown
Created March 22, 2017 09:17
build a tribute page-freecodecamp
anonymous
anonymous / NumbersActivity.java
Created April 6, 2016 17:44
Miwok app: OnAudioFocusChangeListener declaration from NumberActivity
/**
* This listener gets triggered whenever the audio focus changes
* (i.e., we gain or lose audio focus because of another app or device).
*/
private AudioManager.OnAudioFocusChangeListener mOnAudioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() {
@Override
public void onAudioFocusChange(int focusChange) {
if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT ||
focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) {
// The AUDIOFOCUS_LOSS_TRANSIENT case means that we've lost audio focus for a
@udacityandroid
udacityandroid / strings.xml
Last active February 6, 2023 17:58
Android for Beginners : Spanish Localization Solution. This would be saved in the res/values-es/strings.xml file.
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Title for the application. [CHAR LIMIT=12] -->
<string name="app_name">Sólo Java</string>
<!-- Hint text display in the empty field for the user's name [CHAR LIMIT=20] -->
<string name="name">Nombre</string>
<!-- Hint text display in the empty field for the user's name [CHAR LIMIT=20] -->
<string name="toppings">Ingredientes</string>
@udacityandroid
udacityandroid / MainActivity.java
Last active December 22, 2023 08:49
Android for Beginners : Add the Chocolate Topping Checkbox Solution Java
package com.example.android.justjava;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
/**
* This app displays an order form to order coffee.
@udacityandroid
udacityandroid / TextView.java
Created June 15, 2015 18:23
Android for Beginners : Simplified TextView class
/**
* Displays text to the user.
*/
public class TextView extends View {
// String value
private String mText;
// Text color of the text
private int mTextColor;
@udacityandroid
udacityandroid / Calculate price method
Created June 9, 2015 23:49
Add to MainActivity.java
/**
* Calculates the price of the order.
*
* @param quantity is the number of cups of coffee ordered
*/
private void calculatePrice(int quantity) {
int price = quantity * 5;
}
@nickaknudson
nickaknudson / TimePreference.java
Last active May 10, 2021 04:16
TimePicker DialogPreference for Android
package com.xxx.xxx.preference;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import android.content.Context;
import android.content.res.TypedArray;