Skip to content

Instantly share code, notes, and snippets.

🚀
Hard work

Uzias uziassantosferreira

🚀
Hard work
View GitHub Profile
@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));
@uziassantosferreira
uziassantosferreira / BindableAdapter.kt
Created Feb 5, 2019
Example use mvvm with recyclerview
View BindableAdapter.kt
interface BindableAdapter<T> {
fun setData(items: List<T>?)
}
View ExampleViewModel.kt
internal class ExampleViewModel : ViewModel() {
private val disposables = CompositeDisposable()
val showLoading = MutableLiveData<Boolean>()
val viewState = MutableLiveData<ExampleViewState>()
val posts = MutableLiveData<List<Post>>()
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()
}
@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);
You can’t perform that action at this time.