Skip to content

Instantly share code, notes, and snippets.

:octocat:
Coding

Pablo Costa Sottti

:octocat:
Coding
Block or report user

Report or block Sottti

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ApiCalls.java
public class ApiCalls
{
public static Call<DummyObject> getDummyObjectCall()
{
return ApiServices
.getDummyService()
.getDummyObject();
}
public static Call<List<DummyObject>> getDummyObjectListCall()
@Sottti
Sottti / MyFragment.java
Last active Jun 25, 2017
Allow Android Map to scroll when within an scrollable container
View MyFragment.java
(...)
mSupportMapFragment = (OnScrollableContainerMapFragment) getChildFragmentManager()
.findFragmentById(R.id.fragment_map);
mSupportMapFragment
.setOnTouchListener(new OnScrollableContainerMapFragment.OnTouchListener() {
@Override
public void onStartScrollingMap() {
mScrollView.requestDisallowInterceptTouchEvent(true);
}
View AdaptiveTabLayout.java
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;
@Sottti
Sottti / MyActivity.java
Last active May 22, 2018
Handles clicks on a EditText right drawable
View MyActivity.java
[...]
mEditText.setOnTouchListener(
new OnEditTextRightDrawableTouchListener(mEditText) {
@Override
public void OnDrawableClick() {
// The right drawable was clicked. Your action goes here.
}
});
[...]
View UserWithBodyPropery.kt
data class User(val name: String, val age: Int) {
var address : String = ""
}
View UserRM.kt
@Entity(tableName = "Users")
data class UserRM(
@PrimaryKey
@ColumnInfo(name = "id")
val id: Int,
@ColumnInfo(name = "name")
val name: String,
View UserBuilder.kt
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 = ""
View Copy.kt
val steveJobs= User("Steve Jobs", 56)
val steveJobsToday= steveJobs.copy(age = 63)
View UserDestructuring.kt
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
}
View User.java
public class User {
private String name;
private int age;
public User(String name, int age) {
this.name = name;
this.age = age;
}
You can’t perform that action at this time.