Skip to content

Instantly share code, notes, and snippets.

View jesselima's full-sized avatar
📱
Coding for mobile...

Jesse Lima jesselima

📱
Coding for mobile...
View GitHub Profile
@Override
protected Result doInBackground(Void... params)
{
try {
InputStream inputStream = activity.getContentResolver().openInputStream(uri);
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
if (bitmap == null) {
Log.e(TAG, "uri is not a bitmap," + uri.toString());
return null;
@jesselima
jesselima / RoundedBottomSheetDialogFragment.kt
Created April 25, 2019 23:02 — forked from ArthurNagy/RoundedBottomSheetDialogFragment.kt
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
package com.your.package
import android.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom
@jesselima
jesselima / BaseDao.kt
Created April 21, 2019 01:34 — forked from florina-muntenescu/BaseDao.kt
Use Dao inheritance to reduce the amount of boilerplate code - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jesselima
jesselima / BindingConversions.java
Last active April 17, 2019 17:56
It's a sample with binding adapters. Still need improvements and more samples.
package com.udacity.popularmovies.shared;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
@jesselima
jesselima / BluetoothCallback.java
Created March 20, 2019 01:08 — forked from joinAero/BluetoothCallback.java
Android - The bluetooth listener and profile proxy.
package cc.cubone.turbo.core.bluetooth;
/**
* Interface definition for a callback to be invoked when bluetooth state changed.
*/
public interface BluetoothCallback {
/**
* Called when the bluetooth is off.
*/
@jesselima
jesselima / MyDiffUtil.java
Created March 12, 2019 19:19
Check a new list has new objects before update the old list.
package com.tetraandroid.diffutilexample.helper;
import android.support.v7.util.DiffUtil;
import com.tetraandroid.diffutilexample.http.apimodel.Result;
import java.util.List;
public class MyDiffUtil extends DiffUtil.Callback {
@jesselima
jesselima / FileReaderUtil.java
Created January 6, 2019 21:51
Read local json file and converts it to a String.
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Scanner;
/* How to use it:
1 - Create a ClassLoader instance
@jesselima
jesselima / DateUtils.java
Created December 28, 2018 02:10
Format String to String Dates
package br.com.bank.bankapp.shared;
/**
* Created by jesse on 12/28/18.
* This is a part of the project BankApp.
*/
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@jesselima
jesselima / README.md
Created December 10, 2018 10:56 — forked from CodingDoug/README.md
Example code from the video "Use async/await with TypeScript in Cloud Functions"

Example code from the video "Use async/await with TypeScript in Cloud Functions"

This is the example code from my video about using async/await with Cloud Functions. I've placed it here in a gist so it's easier to compare the "before" and "after" states for each case.

Watch the video here

The code in this project is licensed under the Apache License 2.0.

Copyright 2018 Google LLC
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software