Skip to content

Instantly share code, notes, and snippets.

View sabiou's full-sized avatar
📿
La hawla wa la quwwata illa Billah

Farouk Sabiou sabiou

📿
La hawla wa la quwwata illa Billah
View GitHub Profile
@sabiou
sabiou / RecyclerViewAdapter.java
Last active November 23, 2018 00:17
RecyclerViewAdapter template code
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
#parse("File Header.java")
@sabiou
sabiou / AsyncTaskActivity.java
Created January 23, 2019 01:42 — forked from cesarferreira/AsyncTaskActivity.java
Advanced Android AsyncTask Callback example
package com.cesarferreira.asynctaskcallback;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
@sabiou
sabiou / gist:9b4db3c17f493a404320584996e68455
Created February 1, 2019 22:01 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@sabiou
sabiou / Data.kt
Created February 1, 2019 23:38 — forked from florina-muntenescu/Data.kt
Using RoomDatabase#Callback to pre-populate the database - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 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
@sabiou
sabiou / IfElse.kt
Created March 5, 2019 02:58 — forked from ragdroid/IfElse.kt
Simplified if-else
infix fun <T>Boolean.then(action : () -> T): T? {
return if (this)
action.invoke()
else null
}
infix fun <T>T?.elze(action: () -> T): T {
return if (this == null)
action.invoke()
package com.be.homsi.adapter;
import android.Manifest;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
@sabiou
sabiou / Inter.java
Last active April 4, 2019 09:58 — forked from tchiks1/Inter
public class Inter extends Fragment implements MainView {
List<InterpretationModel> passages;
List<InterpretationModel> interlists;
Menu test; AudioAdapter adapters;
public RecyclerView mRecyclerView,recycleraudio;
public Recycleradapter mAdapter;
boolean serviceBound = false;
TextView textView;
public class MediaPlayerService extends Service implements MediaPlayer.OnCompletionListener,
MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener, MediaPlayer.OnSeekCompleteListener,
MediaPlayer.OnInfoListener, MediaPlayer.OnBufferingUpdateListener,
AudioManager.OnAudioFocusChangeListener {
public static final String ACTION_PLAY = "com.be.homsi.ACTION_PLAY";
public static final String ACTION_PAUSE = "com.be.homsi.ACTION_PAUSE";
public static final String ACTION_PREVIOUS = "com.be.homsi.ACTION_PREVIOUS";
public static final String ACTION_NEXT = "com.be.homsi.ACTION_NEXT";
@sabiou
sabiou / ShowbizView.kt
Created May 4, 2019 03:20 — forked from nickbutcher/ShowbizView.kt
A prototype of an animation I helped out on, see: https://twitter.com/crafty/status/1073612862139064332
/*
* Copyright 2018 Google Inc.
*
* 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 distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@sabiou
sabiou / addADTSToPacket.java
Created June 18, 2019 11:19
MPEG 2 TS ISOMEDIA
private void addADTStoPacket(byte[] packet, int packetLen) {
int profile = 2; //AAC LC //39=MediaCodecInfo.CodecProfileLevel.AACObjectELD;
int freqIdx = 4; //44.1KHz
int chanCfg = 2; //CPE
// fill in ADTS data
packet[0] = (byte)0xFF; // conversion hexadecimal a decimal - il y a seize unités de 0 à F, on parle donc d'hexadécimal.
packet[1] = (byte)0xF1; // installe l'entete ADTS dans MPEG-2 (0xF1) au lieu de MPEG-4 (0xF9)
packet[2] = (byte)(((profile-1)<<6) + (freqIdx<<2) +(chanCfg>>2));
packet[3] = (byte)(((chanCfg&3)<<6) + (packetLen>>11));