Skip to content

Instantly share code, notes, and snippets.

View tolmachevroman's full-sized avatar

Roman Tolmachev tolmachevroman

  • Santiago, Chile
View GitHub Profile
@tolmachevroman
tolmachevroman / BadRequestException.java
Created February 6, 2015 19:19
Custom Error Handler for Retrofit
public class BadRequestException extends Exception {
public BadRequestException() { super(); }
public BadRequestException(String message) { super(message); }
public BadRequestException(String message, Throwable cause) { super(message, cause); }
public BadRequestException(Throwable cause) { super(cause); }
}
@tolmachevroman
tolmachevroman / Manifest.xml
Created February 5, 2015 13:02
Open Url using custom Scheme
<!-- http://development.server.com/confirmations/eMkVMRppXUbV5F8Xd17W from browser address bar -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="development.server.com"
android:scheme="http" />
@tolmachevroman
tolmachevroman / Snippet.java
Last active August 29, 2015 14:14
Fit all the markers on the map
LatLngBounds.Builder builder = new LatLngBounds.Builder();
//mMarkers is a List<Marker> with your markers
for (Marker marker : mMarkers) {
builder.include(marker.getPosition());
}
LatLngBounds bounds = builder.build();
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(bounds, PADDING); //padding between screen borders and extreme right/left markers
@tolmachevroman
tolmachevroman / TestActivity.java
Last active August 29, 2015 14:14
Resumable file upload to Nginx powered server
public class TestActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample);
if(!isUploading) {
// EditText view with file path