Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Uzias uziassantosferreira

🏠
Working from home
Block or report user

Report or block uziassantosferreira

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 SimpleScreenState.kt
sealed class SimpleScreenState {
object Loading : SimpleScreenState()
object GenericError : SimpleScreenState()
object NetworkError : SimpleScreenState()
object EmptyState : SimpleScreenState()
data class Content<T>(val data: T) : SimpleScreenState()
}
View ExampleViewModel.kt
internal class ExampleViewModel : ViewModel() {
private val disposables = CompositeDisposable()
val showLoading = MutableLiveData<Boolean>()
val viewState = MutableLiveData<ExampleViewState>()
val posts = MutableLiveData<List<Post>>()
@uziassantosferreira
uziassantosferreira / BindableAdapter.kt
Created Feb 5, 2019
Example use mvvm with recyclerview
View BindableAdapter.kt
interface BindableAdapter<T> {
fun setData(items: List<T>?)
}
@uziassantosferreira
uziassantosferreira / MediaRecorderHelper.java
Created Dec 12, 2016
Screen Recording in service android
View MediaRecorderHelper.java
public class MediaRecorderHelper {
private static final int SENSOR_ORIENTATION_DEFAULT_DEGREES = 90;
private static final int SENSOR_ORIENTATION_INVERSE_DEGREES = 270;
private static final SparseIntArray DEFAULT_ORIENTATIONS = new SparseIntArray();
private static final SparseIntArray INVERSE_ORIENTATIONS = new SparseIntArray();
static {
DEFAULT_ORIENTATIONS.append(Surface.ROTATION_0, 90);
DEFAULT_ORIENTATIONS.append(Surface.ROTATION_90, 0);
@uziassantosferreira
uziassantosferreira / ExampleUse.java
Created Nov 3, 2016
Example create enum in android annotation
View ExampleUse.java
//Example
User user = new User();
user.age = Numbers.ONE;
View Action.java
import java.io.Serializable;
public class Action implements Serializable {
public String label;
public String url;
public String type;
public Type getType(){
return Type.fromInt(Integer.parseInt(type));
You can’t perform that action at this time.