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
@Override | |
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { | |
super.onCreateOptionsMenu(menu, inflater); | |
// the first way to show menu | |
// Inflate the menu; this adds items to the action bar if it is present. | |
inflater.inflate(R.menu.main, menu); | |
// the second way to show menu | |
MenuItem item = menu.add(R.string.new_item).setIcon(android.R.drawable.ic_input_add) |
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
apply plugin: 'com.android.application' | |
apply plugin: 'com.neenbedankt.android-apt' | |
android { | |
dataBinding { | |
enabled true | |
} | |
compileSdkVersion rootProject.ext.compileSdkVersion | |
buildToolsVersion rootProject.ext.buildToolsVersion |
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 class MyData{ | |
public int code; | |
public String name; | |
public MyData(int code, String name) { | |
this.code = code; | |
this.name = name; | |
} |
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
//希望返回:[1A, 2B, 3A]。但实际返回[1A, 2B, 3B]。怎么搞? | |
public Observable<List<String>> test_onErrorResumeNext() { | |
final List<Integer> codeList = new ArrayList<>(); | |
for (int i = 1; i <= 3; i++) { | |
codeList.add(i); | |
} | |
return Observable.create(new Observable.OnSubscribe<String>() { | |
@Override | |
public void call(Subscriber<? super String> subscriber) { |
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
\w+Activity\w* XXXActivity或XXXActivtyXXX | |
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
/** | |
* entity可用性常规则检查 | |
*/ | |
@SuppressWarnings("unchecked") | |
public static <T> Observable.Transformer<BaseEntity<T>, T> check() { | |
return new Observable.Transformer<BaseEntity<T>, T>() { | |
@Override | |
public Observable<T> call(Observable<BaseEntity<T>> observable) { | |
return observable.flatMap(new Func1<BaseEntity<T>, Observable<T>>() { | |
@Override |
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
#!/bin/bash | |
# Sync Homebrew installations between Macs via Dropbox | |
# | |
BREW="/usr/local/bin/brew" | |
# first get local settings | |
echo "Reading local settings ..." | |
rm -f /tmp/brew-sync.* |
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
Snackbar.make(getView(), "Replace with your own action", Snackbar.LENGTH_LONG) | |
.setAction("Action", new View.OnClickListener(){ | |
@Override | |
public void onClick(View v) { | |
} | |
}).show(); |
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
$.ajax({ | |
url: "../routeProgressReport/dataItem", //请求的url地址 | |
type: "POST", //请求方式 | |
data: {warehouseId: warehouseId}, //参数值为@RequestBody或@RequestParam | |
dataType: "json", //返回格式为json | |
beforeSend: function () { | |
//请求前的处理 | |
}, | |
success: function (data) { | |
// |
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
//通过key去重 | |
Map<String, OrderItem> orderItemMap = orderItemList.stream() | |
.collect(Collectors.toMap(item -> item.getSkuId() + "_" + item.getDeliveryDate() + "_" + item.getWarehouseId(), item -> item, (a, b) -> a)); | |
orderItemList = orderItemMap.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList()); |
OlderNewer