This file contains hidden or 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
_log("Before Observable"); | |
// Create a "cold" observable. | |
Observable<Boolean> ob = Observable | |
// The "just" convert a boolean into an Observable. | |
.just(true) | |
// Transform the items emitted by an Observable by applying a function to each item. | |
.map(new Func1<Boolean, Boolean>() { | |
@Override | |
public Boolean call(Boolean aBoolean) { |
This file contains hidden or 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
_log("Before Observable"); | |
// The publish operator makes it a HOT observable. | |
Observable<Integer> ob = Observable | |
.just(1) | |
// The operator transforms it to a hot observable. | |
.publish(); | |
// Process the observable. | |
ob.connect(); |
This file contains hidden or 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
// Copyright (c) 2016 boyw165 | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
This file contains hidden or 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
/** | |
* Insert a new {@link Whatever} instance in ascent/descent order. | |
*/ | |
public void insertByWhateverOrder(List<Whatever> whatevers, Whatever one) { | |
// The complexity is O(nlog(n)). The list needs to be already sorted in | |
// natural sorting order. Searching in an unsorted array has an undefined | |
// result. | |
int position = Collections.binarySearch(whatevers, one); | |
if (position < 0) { | |
whatevers.add(-position - 1, one); |
This file contains hidden or 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/env python | |
import httplib, urllib | |
import argparse | |
import json | |
import os | |
def analyseImages(fileStream): | |
""" |
This file contains hidden or 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
// Copyright (c) 2016-present boyw165 | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
This file contains hidden or 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
// Complete source code: | |
// https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/View.java#L10023-L10025 | |
public boolean dispatchTouchEvent(MotionEvent event) { | |
boolean result = false; | |
// Ignore ... | |
if (!result && onTouchEvent(event)) { | |
result = true; | |
} |
This file contains hidden or 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
// Complete source code: | |
// https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/ViewGroup.java#L2143-L2357 | |
public boolean dispatchTouchEvent(MotionEvent ev) { | |
boolean handled = false; | |
// Ignore ... | |
final boolean intercepted; | |
if (actionMasked == MotionEvent.ACTION_DOWN | |
|| mFirstTouchTarget != null) { |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<!-- Shadow/Invisible Activity theme --> | |
<style name="AppTheme.Invisible" parent="Theme.AppCompat.NoActionBar"> | |
<item name="android:windowIsTranslucent">true</item> | |
<item name="android:windowBackground">@android:color/transparent</item> | |
<item name="android:windowContentOverlay">@null</item> | |
<item name="android:windowIsFloating">true</item> | |
<item name="android:backgroundDimEnabled">false</item> | |
</style> |
This file contains hidden or 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 IapDelegateActivity extends AppCompatActivity { | |
/** | |
* The IAP task is successful. | |
*/ | |
public static final String ACTION_IAP_OK = "my.intent.action.IAP_OK"; | |
/** | |
* The IAP task is failed. | |
*/ | |
public static final String ACTION_IAP_CANCELED = "my.intent.action.IAP_CANCELED"; |