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
// If you Service with threads, e.g. a Chat Service | |
// You want to show a toast such as indicating the connection is lost or stuff when your service is running foreground | |
// Get main the main thread, you are only allowed to draw UI in the main thread | |
Handler mainHandler = new Handler(getMainLooper()); | |
mainHandler.post(new Runnable() { | |
@Override | |
public void run() { | |
// Do your stuff here related to UI, e.g. show toast |
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
<!--I mostly use LinearLayout and layout_weight to give views the same width or height in a layout--> | |
<!--For example--> | |
<LinearLayout | |
android:orientation="horizontal" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<Button | |
android:layout_weight="1" |
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
/** | |
* Volley Request for passing JSON string with Jackson | |
* | |
* @TODO | |
* - Extend this class | |
* | |
* [email protected] | |
*/ | |
public class JacksonRequest<T> extends Request<T> { | |
private final Class<T> mClass; |
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
/** | |
* Loopback SoftDelete Mixins | |
* | |
* I write my own mixins because current available softdelete mixin is not working in Node.js v4.x.x, I believe it is caused by ES6 | |
* This code is forked from https://github.com/gausie/loopback-softdelete-mixin | |
* | |
* To implement, Copy this file to mixins folder, and add "SoftDelete": true in mixins on YourModel.json file | |
* | |
* To delete a row or data, don't use destroyAll etc., use YourModel.delete | |
* To find data that is considered deleted, add includeDeleted: true in where filter |