Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrei Bacalu androuis

View GitHub Profile
@Zhuinden
Zhuinden / HiltUtils.kt
Last active Mar 19, 2021
Hilt NavGraphViewModels utils
View HiltUtils.kt
inline fun <reified T : ViewModel> Fragment.hiltNavGraphViewModels(@IdRes navGraphIdRes: Int) =
viewModels<T>(
ownerProducer = { findNavController().getBackStackEntry(navGraphIdRes) },
factoryProducer = { defaultViewModelProviderFactory } // TODO: FIX THIS. THIS ISN'T SUFFICIENT!!!
)
View Kotlin Interview Questions.md

Interview Questions

Kotlin

Q1: What is a primary constructor in Kotlin? ☆☆

Answer: The primary constructor is part of the class header. Unlike Java, you don't need to declare a constructor in the body of the class. Here's an example:

@Schadenfeude
Schadenfeude / Jenkinsfile
Last active Nov 26, 2022
Example Jenkinsfile declarative pipeline for Android projects
View Jenkinsfile
pipeline {
agent {
// Run on a build agent where we have the Android SDK installed
label 'android'
}
environment {
// Fastlane Environment Variables
PATH = "$HOME/.fastlane/bin:" +
"$HOME/.rvm/gems/ruby-2.5.3/bin:" +
"$HOME/.rvm/gems/ruby-2.5.3@global/bin:" +
@nickbutcher
nickbutcher / rainbow.xml
Last active Jan 8, 2022
Demonstrating using VectorDrawable gradients to create a rainbow effect. See https://twitter.com/crafty/status/1011922414983352320
View rainbow.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Google Inc.
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 distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.
View MainActivity.java
/*
* Copyright 2016 Google Inc.
*
* 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
@alexmiragall
alexmiragall / NestedScrollWebView.java
Last active Oct 25, 2022
NestedWebView compatible with CoordinatorLayout
View NestedScrollWebView.java
package com.tuenti.nestedwebscrollview;
import android.content.Context;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.NestedScrollingChild;
import android.support.v4.view.NestedScrollingChildHelper;
import android.support.v4.view.NestedScrollingParent;
import android.support.v4.view.VelocityTrackerCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ScrollerCompat;
View CircularProgressDrawable.java
public class CircularProgressDrawable extends Drawable
implements Animatable {
private static final Interpolator ANGLE_INTERPOLATOR = new LinearInterpolator();
private static final Interpolator SWEEP_INTERPOLATOR = new DecelerateInterpolator();
private static final int ANGLE_ANIMATOR_DURATION = 2000;
private static final int SWEEP_ANIMATOR_DURATION = 600;
private static final int MIN_SWEEP_ANGLE = 30;
private final RectF fBounds = new RectF();
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active Nov 30, 2022
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat Sheet.md

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\