This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity; | |
import java.lang.ref.WeakReference; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.TimeoutException; | |
import io.reactivex.Observable; | |
import io.reactivex.ObservableOperator; | |
import io.reactivex.ObservableSource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* an {@link ObservableOperator} that simulates an if-else in an RxJava Stream, it takes a {@link Map} | |
* of {@link Predicate} as key and a {@link Function} as value ... the if any emitted item passes | |
* the {@link Predicate}, this emitted item will be passed to the {@link Function} mapped to it, | |
* and this item will be invoked and it's result will continue down the stream | |
* <p> | |
* sample code : | |
* <p> | |
* {@code List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8);}<br> | |
* {@code Map<Predicate<Integer>, Function<Integer, String>> blocks = new LinkedHashMap<>(2)}<br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Bundle; | |
import android.support.annotation.CallSuper; | |
import android.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v7.app.AppCompatActivity; | |
import java.lang.reflect.Constructor; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* a {@link Maybe} that retrieves the Mac address from any of the following sources : | |
* <p> | |
* {@code Shared Preference}<br> | |
* {@code Wifi}<br> | |
* {@code Network interfaces} | |
* <p> | |
* then saves it to {@code Shared preferences} if found | |
* <p> | |
* Created by Ahmed Adel Ismail on 7/10/2017. |