Skip to content

Instantly share code, notes, and snippets.

View Sottti's full-sized avatar
🏠
Remote

Pablo Costa Sottti

🏠
Remote
View GitHub Profile
@Sottti
Sottti / ApiCalls.java
Created October 18, 2015 02:43
Retrofit set up
public class ApiCalls
{
public static Call<DummyObject> getDummyObjectCall()
{
return ApiServices
.getDummyService()
.getDummyObject();
}
public static Call<List<DummyObject>> getDummyObjectListCall()
@Sottti
Sottti / MyFragment.java
Last active June 25, 2017 10:14
Allow Android Map to scroll when within an scrollable container
(...)
mSupportMapFragment = (OnScrollableContainerMapFragment) getChildFragmentManager()
.findFragmentById(R.id.fragment_map);
mSupportMapFragment
.setOnTouchListener(new OnScrollableContainerMapFragment.OnTouchListener() {
@Override
public void onStartScrollingMap() {
mScrollView.requestDisallowInterceptTouchEvent(true);
}
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.util.AttributeSet;
import android.widget.LinearLayout;
public class AdaptiveTabLayout extends TabLayout
{
private boolean mGravityAndModeSeUpNeeded = true;
data class User(val name: String, val age: Int) {
var address : String = ""
}
@Entity(tableName = "Users")
data class UserRM(
@PrimaryKey
@ColumnInfo(name = "id")
val id: Int,
@ColumnInfo(name = "name")
val name: String,
data class User(
val name: String,
val surname: String = "",
val address: String = "") {
class Builder {
private lateinit var name : String
private var surname : String = ""
private var address : String = ""
@Sottti
Sottti / Copy.kt
Last active September 22, 2018 07:56
val steveJobs= User("Steve Jobs", 56)
val steveJobsToday= steveJobs.copy(age = 63)
val steveJobs= User("Steve Jobs", 56)
fun print() {
val (name, age) = steveJobs
println("$name, $age years of age") // prints "Steve Jobs, 56 years of age"
steveJobs.component1() // name
steveJobs.component2() // age
}
@Sottti
Sottti / User.java
Last active September 22, 2018 08:02
public class User {
private String name;
private int age;
public User(String name, int age) {
this.name = name;
this.age = age;
}
@Sottti
Sottti / Private.kt
Last active November 28, 2018 07:56
Kotlin Access Modifiers: private
// Private.kt file
// Visible just inside this file
private const val numberThree = 3
// Visible just inside this file
private class User() {
// Visible just inside the user class
private val numberEight = numberThree.plus(5)
}