Skip to content

Instantly share code, notes, and snippets.

🤖
Generating bugs

Joaquim Ley JoaquimLey

View GitHub Profile
View SingleLiveEvent.kt
import androidx.annotation.MainThread
import androidx.annotation.Nullable
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import java.util.concurrent.atomic.AtomicBoolean
/**
View BusListActivity.java
public class BusListActivity extends AppCompatActivity implements LifecycleRegistryOwner,
BusListAdapter.ClickListener {
private final LifecycleRegistry lifecycleRegistry = new LifecycleRegistry(this);
private BusListViewModel viewModel;
private BusListAdapter adapter;
private ContentLoadingProgressBar progressDialogView;
View BusRepository.java
public class BusRepository {
private static BusRepository sInstance;
private final RemoteRepository remoteRepository;
private final BusDao busDao;
public static BusRepository getInstance(RemoteRepository remoteRepository, BusDao busDao) {
if (sInstance == null) {
@JoaquimLey
JoaquimLey / IntroVideoView.java
Created Apr 12, 2017
A simple VideoView subclass that displays in full screen while keeping the aspect ration
View IntroVideoView.java
/**
* Subclass of VideoView to enable video scaling
* CustomAttribute: "scaleType": "normal", "centerCrop", "fill"
* <p>
* Add this stylable:
* <declare-styleable name="IntroVideoView">
* <attr name="scaleType" format="integer">
* <flag name="normal" value="0" />
* <flag name="centerCrop" value="1" />
* <flag name="fill" value="2" />
View BasePresenter.java
public abstract class BasePresenter<V> {
protected V mView;
public final void attachView(@NonNull V view) {
mView = view;
}
public final void detachView() {
mView = null;
@JoaquimLey
JoaquimLey / ManualChangeUser.md
Last active Nov 14, 2018
Change github user on terminal, manual way
View ManualChangeUser.md

First restart the ssh agent

  killall ssh-agent; eval `ssh-agent`

You should see something along the lines of: Agent pid 59566

Now just add your "new" user .ssh key

ssh-add ~/.ssh/id_rsa
@JoaquimLey
JoaquimLey / CircleImageTransforation.md
Created Aug 17, 2016
Transform an ImageView into circular shape, works with Picasso
View CircleImageTransforation.md

Using Picasso with a circular ImageView

With this helper class you can transform your ordinary ImageView into ciruclar shape using Picasso library.

###Include this class into your project:

package com.<YOUR-PACKAGE-NAME>
	
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
View debug_over_wifi.md

How to Debug with your device over WIFI

  1. Connect the device via USB and make sure debugging is enabled.

  2. Run adb tcpip 5555

  3. Find the IP address

MACOS: adb shell ip route

@JoaquimLey
JoaquimLey / ssh-add.sh
Last active Aug 2, 2018
Add ssh identity
View ssh-add.sh
ssh-add ~/.ssh/id_rsa
@JoaquimLey
JoaquimLey / .gitignore
Last active Aug 14, 2016
Pretty standard/complete .gitignore with focus on Android
View .gitignore
# Local files
/local.properties
/build
/captures
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
You can’t perform that action at this time.