Skip to content

Instantly share code, notes, and snippets.

Generating bugs

Joaquim Ley JoaquimLey

Generating bugs
Block or report user

Report or block JoaquimLey

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 RecyclerViewExtensions.kt
fun RecyclerView.applyToolbarNavigationViewWithFabInsets() {
clipToPadding = false
View ViewExtensions.kt
* Insets Section *
* Utility methods *
fun View.applySystemBarPaddingInsets() {
this.doOnApplyWindowInsets { view, insets, padding, _ ->
View StylesNavgation.xml
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:windowLightStatusBar">true</item>
<item name="android:statusBarColor">@color/colorStatusBar</item>
<item name="android:windowBackground">@color/colorWindowBackground</item>
<item name="android:navigationBarColor">@color/colorNavigationBar</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarDividerColor">@color/colorNavigationBarDivider</item>
View RecyclerViewMarginItemDecoration.kt
open class RecyclerViewMarginItemDecoration(
private val sizeInDp: Int = 16,
private val isTop: Boolean = false
) : RecyclerView.ItemDecoration() {
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
super.getItemOffsets(outRect, view, parent, state)
if (isTop) {
if (parent.getChildAdapterPosition(view) == 0) { = sizeInDp.toPx()
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
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;
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 /
Created Apr 12, 2017
A simple VideoView subclass that displays in full screen while keeping the aspect ration
* 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" />
public abstract class BasePresenter<V> {
protected V mView;
public final void attachView(@NonNull V view) {
mView = view;
public final void detachView() {
mView = null;
JoaquimLey /
Last active Nov 14, 2018
Change github user on terminal, manual way

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
You can’t perform that action at this time.