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
Encrypting plaintext with key in 128-bit mode. | |
The Expanded Key: | |
00000000 62626262 9BF99BF9 9069F20B EE87757E 7FF88DF3 EC14996A 2135ACC6 0E3B9751 B18A1D4C B43E236F | |
00000000 63636363 98FB98FB 976CF40F 066A9E91 2E44DA4B 6125FFB4 7550AF1B F9A9061D D47D7B66 EF92E98F | |
00000000 63636363 98FB98FB 34CF57AC DA1542EE 2B3E7C92 4B75099B 17626BF0 03610AFA D8B9B349 5BE25118 | |
00000000 63636363 C9AAC9AA 50FA3399 7B81B22B 8809BB90 858C37A7 870B3C9B 3338049F E2DADE41 CB11CF8E | |
After addRoundKey(0): | |
00000000000000000000000000000000 |
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
public class DataStore { | |
public static Observable<Something> getSomethingObservable() { | |
Something cachedSomething = MyCache.getCachedSomething(); | |
if (cachedSomething != null) { | |
return Observable.just(cachedSomething); // still on same thread so returned to subscriber synchronously | |
} | |
return myRestService.getSomething(); // on separate Retrofit worker thread so returned to subscriber asynchronously |
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
ConnectableObservable<Foo> connectableFooObservable = fooObservable.share(); | |
Observable | |
.combineLatest(connectableFooObservable, obsA, (foo, a) -> { // do something }) | |
.subscribe(); | |
Observable | |
.combineLatest(connectableFooObservable, obsB, (foo, b) -> { // do something }) | |
.subscribe(); |
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
#!/usr/bin/expect -f | |
# Usage example: | |
# ./accept-licenses "android update sdk --no-ui --all --filter build-tools" "android-sdk-license-bcbbd656|intel-android-sysimage-license-1ea702d1" | |
set timeout 1800 | |
set cmd [lindex $argv 0] | |
set licenses [lindex $argv 1] | |
spawn {*}$cmd |
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.annotation.TargetApi; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Point; | |
import android.graphics.Rect; | |
import android.os.Build; | |
import android.util.AttributeSet; | |
import android.util.Log; | |
import android.view.ViewTreeObserver; | |
import android.widget.FrameLayout; |
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
public class EventView { | |
public interface EventViewListener<ViewType extends View> { | |
/** | |
* @param onScreen When the view enters/exits the viewport. Not to be confused with {@link View#VISIBLE}. | |
*/ | |
void onVisibleOnScreenStateChanged(boolean onScreen); | |
/** | |
* Verbose method that is called every time the view hierarchy has the potential to | |
* move this view in/out of the viewport. Useful for debugging, but will be called |
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
public class ViewUtil { | |
static boolean isVisibleOnScreen(View view, Rect rect, Point globalOffset) { | |
if (view == null) { | |
throw new IllegalArgumentException("view must not be null"); | |
} | |
boolean isVisibleOnScreen = view.getGlobalVisibleRect(rect, globalOffset); | |
return isVisibleOnScreen; | |
} |
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.content.Context; | |
import android.content.Intent; | |
import android.os.Build; | |
import android.provider.Settings; | |
public class SystemWindowUtil { | |
private final Context appContext; | |
public SystemWindowUtil(Context appContext) { | |
this.appContext = appContext; |
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
public class SerialDelayUtil { | |
private final SerialDelayHandler serialDelayHandler; | |
public SerialDelayUtil() { | |
this.serialDelayHandler = new SerialDelayHandler(Looper.getMainLooper()); | |
} | |
/** | |
* <p> | |
* Runs the runnable after millisDelay, but every time this function is called |
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
// TODO: Actually convert the below to Kotlin | |
/** | |
* Reads file and returns a String. | |
* | |
* @param file the file to read | |
* @return the string with file content or null | |
*/ | |
@Nullable | |
public static String tryReadFile(@NonNull final File file) { |
OlderNewer