public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {
private int mItemOffset;
public ItemOffsetDecoration(int itemOffset) {
mItemOffset = itemOffset;
}
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 PopupWindow popTrainMenu() { | |
LayoutInflater inflater = LayoutInflater.from(this); | |
View view = inflater.inflate(R.layout.train_popwindow_menu, null); | |
Display display = getWindowManager().getDefaultDisplay(); | |
Point size = new Point(); | |
display.getSize(size); | |
int width = size.x; | |
int height = size.y; | |
Log.v("zxy", "width=" + width + ",height=" + height); | |
PopupWindow popWindow = new PopupWindow(view, 2 * width / 5, ViewGroup.LayoutParams.WRAP_CONTENT, true); |
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
int X_MAX = 412; | |
int Y_MAX = 50; | |
int x, y; | |
x = random.nextInt(X_MAX); | |
y = random.nextInt(Y_MAX); | |
// String htmlEventJs = "var ev = document.createEvent(\"HTMLEvents\"); " + | |
// "var el = document.elementFromPoint(%d,%d); " + | |
// "ev.initEvent('click',true,true);" + | |
// " el.dispatchEvent(ev);"; |
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
feedbackEditText.setOnTouchListener((v, event) -> { | |
if (v.getId() == R.id.feedbackEditText) { | |
ViewParent parent = v.getParent(); | |
while (!(parent instanceof ScrollView)) { | |
parent = parent.getParent(); | |
} | |
parent.requestDisallowInterceptTouchEvent(true); | |
switch (event.getAction() & MotionEvent.ACTION_MASK) { | |
case MotionEvent.ACTION_UP: |
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
/* | |
* Copyright 2014 Google Inc. All rights reserved. | |
*/*from w ww . jav a2s . c om*/ | |
* 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 |
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<String> doAmazingThingObservable(int param) { | |
return Observable.create(new Observable.OnSubscribe<String>() { | |
@Override | |
public void call(Subscriber<? super String> subscriber) { | |
doAmazingThing(param, new CallBack() { | |
@Override | |
public void onGotResult(String result) { | |
if (result == null) { |
Problem
Error:(29, 37) error: cannot find symbol method subscribeOn(Scheduler)
This happens compiling this code borrowed from http://blog.danlew.net/2015/03/02/dont-break-the-chain/#comment-2388677116
final Observable.Transformer schedulersTransformer =
observable -> observable.subscribeOn(Schedulers.io())
@Override public void startActivityForResult(final Intent _intent, final int _requestCode) { final FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
final Fragment f = new Fragment() {
@Override
public void onAttach(Context context) {
super.onAttach(context);
startActivityForResult(_intent, _requestCode);
}