Skip to content

Instantly share code, notes, and snippets.

View ELTEGANI's full-sized avatar
🎯
Focusing

Eltegani Mohamed ELTEGANI

🎯
Focusing
View GitHub Profile
@ELTEGANI
ELTEGANI / include_list_viewpager.xml
Created August 24, 2019 07:06 — forked from iPaulPro/include_list_viewpager.xml
CollapsingToolbarLayout with TabLayout
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2015 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
@ELTEGANI
ELTEGANI / CollapsibleToolbarActivity.java
Created August 21, 2019 06:55
Show CollapsibleToolbar title only when Toolbar is collapsed.
// From - http://stackoverflow.com/a/32724422/906577
...
final CollapsingToolbarLayout collapsingToolbar =
(CollapsingToolbarLayout) mRootView.findViewById(R.id.collapsing_toolbar);
AppBarLayout appBarLayout = (AppBarLayout) mRootView.findViewById(R.id.appbar);
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
boolean isShow = false;
int scrollRange = -1;
@ELTEGANI
ELTEGANI / HomeRepository.kt
Created August 7, 2019 03:45 — forked from coroutineDispatcher/HomeRepository.kt
Usage of the Shared Preferences in the repository
class HomeRepository @Inject constructor(
val treasureApi: TreasureApi,
val mSharedPreferences: MSharedPreferences
) {
fun makePrayerCallAsync(): Deferred<Response<PrayerTimeResponse>> {
val capitalCityName = mSharedPreferences.readString(CAPITAL_SHARED_PREFERENCES_KEY)
val countryName = mSharedPreferences.readString(COUNTRY_SHARED_PREFERENCE_KEY)
return treasureApi.getPrayerTimesTodayAsync(capitalCityName, countryName)
}
@ELTEGANI
ELTEGANI / gist:1ca726e0dd31c2a53f05359e971cc343
Created July 25, 2019 03:49 — forked from ianbarber/gist:5170508
Example Sign In activity for Google Sign-In on Android that retrieves an authorization code for use with server side authentication. See http://www.riskcompletefailure.com/2016/07/server-side-google-api-access-from.html for more background and links.
package com.example.anothersignintest;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.OptionalPendingResult;
import com.google.android.gms.common.api.ResultCallback;
@ELTEGANI
ELTEGANI / introrx.md
Created October 9, 2018 05:10 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ELTEGANI
ELTEGANI / introrx.md
Created October 9, 2018 05:10 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ELTEGANI
ELTEGANI / activity_main2.xml
Created July 13, 2018 06:40 — forked from mohamedebrahim96/activity_main2.xml
The function of the button at the center is to call an activity and the TabLayout will be place at the bottom of the screen.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.vacuum.app.cinema.MainActivity">
<!--SOME CODE FOR MY AppBarLayout-->
<!--SOME CODE FOR MY ToolBar-->
@ELTEGANI
ELTEGANI / gist:a1cd2f6356118c4862cc895b8b6de82f
Created July 2, 2018 12:49 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application android:label="@string/app_name">