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 static void setActionDoneListener(EditText editText, final ActionDoneListener editTextActionDoneListener) { | |
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { | |
@Override | |
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { | |
if (actionId == EditorInfo.IME_ACTION_DONE) { | |
editTextActionDoneListener.onActionDone(); | |
return false; | |
} | |
return false; | |
} |
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 Observable<SomeResponse> downloadAndFilterListInResponse() { | |
return mSomeRetrofitApi.downloadSomeData() // get response from server/etc | |
// start iterating through list in response object | |
.flatMap(response -> Observable.from(response.getListWeWantToFilterOut()) | |
// NOTE: this is inner sequence, gets result from Observable.from | |
.filter(item -> item != null) // filters out items that are null | |
.toList() // all items combined into list again | |
.take(100) // take only first 100 items, rest will be ignored | |
.map(items -> { // now we need to 'map' list into response | |
response.setListWeWantToFilterOut(items); // overwrite list in object with filtered list |
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
private Bitmap defaultPin; | |
private GoogleMap googleMap; | |
private List<MapItem> items; | |
private void putItemsOnMap() { | |
for (MapItem item : items) { | |
// wrap google map marker with target, also set marker's pin with default pin bitmap, coordinates, etc, so it still be shown on map while real one is downloaded/transformed | |
MarkerTarget marker = new MarkerTarget(googleMap.addMarker(new MarkerOptions().position(new LatLng(item.getLatitude(), item.getLongitude())).title(item.getName()).icon(BitmapDescriptorFactory.fromBitmap(defaultPin)))); | |
Glide.with(this) | |
.load(item.getPinImageUrl()) |
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
// from https://plus.google.com/u/0/+LisaWrayZeitouni/posts/LTr5tX5M9mb | |
@BindingAdapter({"bind:font"}) | |
public static void setFont(TextView textView, String fontName){ | |
textView.setTypeface(Typeface.createFromAsset(textView.getContext().getAssets(), "fonts/" + fontName)); | |
} | |
<TextView | |
app:font="@{`Source-Sans-Pro-Regular.ttf`}" | |
android:layout_width="wrap_content" |
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 java.util.ArrayList; | |
import java.util.List; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.text.Layout; | |
import android.text.Layout.Alignment; | |
import android.text.StaticLayout; | |
import android.text.TextUtils.TruncateAt; | |
import android.util.AttributeSet; |
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
First, I don't know why.....but my solution at the moment | |
cd /usr/local | |
$ git remote -v | |
origin https://github.com/mxcl/homebrew.git (fetch) | |
origin https://github.com/mxcl/homebrew.git (push) | |
$ brew doctor -d | |
# hangs,stalling, no respond |
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 com.squareup.okhttp.ResponseBody; | |
import okio.BufferedSink; | |
import okio.Okio; | |
import retrofit.Response; | |
import retrofit.http.GET; | |
import retrofit.http.Query; | |
import rx.Observable; | |
interface ApiService { |
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
# Local configuration file (sdk path, etc) | |
local.properties | |
# Windows thumbnail db | |
Thumbs.db | |
# OSX files | |
.DS_Store | |
*.pydevproject |
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
Genymotion emulators are already rooted and with SU installed | |
To fix "adb server version (<server-version>) doesn't match this client (<client-version>); killing...": | |
Change SDK location https://stackoverflow.com/questions/30757191/adb-and-genymotion-error-adb-server-is-out-of-date-killing-cannot-bind-tc | |
To find current SDK location: | |
https://stackoverflow.com/questions/34532063/finding-android-sdk-on-mac-and-adding-to-path | |
System apps reside in: | |
/system/app/<AppName>/<AppName>.apk |
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
/** | |
* Custom Espresso matchers. Includes image drawable matching. | |
*/ | |
public class CustomMatchers { | |
public static Matcher<View> withBackground(final int resourceId) { | |
return new TypeSafeMatcher<View>() { | |
@Override | |
public boolean matchesSafely(View view) { | |
return sameBitmap(view.getContext(), view.getBackground(), resourceId); |
OlderNewer