Skip to content

Instantly share code, notes, and snippets.

Avatar
🚁
Focusing

Shifar theapache64

🚁
Focusing
View GitHub Profile
View MainActivityTest.kt
package com.theapache64.mockitosample
import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.MockitoAnnotations
View ParameterizedTest.kt
object Calculator {
fun divide(a: Int, b: Int): Int {
return a / b
}
}
@RunWith(Parameterized::class)
class ParameterizedTest(
private val num1: Int,
private val num2: Int,
View DonutView.kt
import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.view.View
class DonutView(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
private val icingPathEffect = ComposePathEffect(
CornerPathEffect(50f),
DiscretePathEffect(80f, 50f)
@theapache64
theapache64 / Main.kt
Created Feb 15, 2019
Delegation Pattern `by` Kotlin
View Main.kt
interface Car {
fun carMethod();
}
interface Bus {
fun busMethod();
}
class Leyland : Bus {
override fun busMethod() {
View AnyExtensions.kt
package com.tp.theah64.orchid.utils.extensions
import android.util.Log
fun Any.debug(message: String) {
Log.d(getTag(this), message)
}
fun Any.info(message: String) {
Log.i(getTag(this), message)
View SplashActivity.java
public class SplashActivity extends BaseAppCompatActivity implements SplashActivityNavigator {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
final SplashActivityViewModel viewModel = ViewModelProviders
.of(this,
View SplashActivityNavigator.java
public interface SplashActivityNavigator {
void openMainActivity();
void openLogInActivity();
}
View SplashActivityViewModel.java
public class SplashActivityViewModel extends BaseViewModel<SplashActivityNavigator> {
private static final int SPLASH_DURATION_IN_MILLIS = 1500;
public SplashActivityViewModel(@NonNull Application application, SplashActivityNavigator navigator) {
super(application, navigator);
}
void startWorking() {
View LargeListSample.tsx
/*
*
* Created by Stone
* Email: bolan999999@gmail.com
* Date: 2017/12/2
*
*/
import React from 'react';
import {LargeList} from 'react-native-largelist';
View ReactCloneElementSample
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default class App extends React.Component {
getGreenText = () => {
return (<ColorText text="Default text" color="green"/>);
}
You can’t perform that action at this time.