Skip to content

Instantly share code, notes, and snippets.

View ClaudeHangui's full-sized avatar

Claude Hangui ClaudeHangui

  • Deimos Cloud Ltd
  • Dakar, Senegal
View GitHub Profile
@ClaudeHangui
ClaudeHangui / pre-merge.yml
Created May 23, 2021 13:11
Github actions for pre merge
# Github actions to run detekt, klint & jacoco on all modules of the project, then build and test the artifacts
name: Pre Merge Checks
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
@ClaudeHangui
ClaudeHangui / pre-merge.yml
Created May 23, 2021 13:08
Github actions to run detekt, klint & jacoco on all modules of the project, then build and test the artifacts
Github actions to run detekt, klint & jacoco on all modules of the project, then build and test the artifacts
@ClaudeHangui
ClaudeHangui / SendTransactionsFragmentTest.kt
Created May 23, 2021 12:42
Sample demo of an Integration test
package com.changui.penguinpay
import android.os.SystemClock.sleep
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.test.espresso.Espresso.onData
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.IdlingRegistry
import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
@ClaudeHangui
ClaudeHangui / PaymentMethodRepositoryImplTest.java
Created May 23, 2021 12:37
Unit test for repository which provides payment methods
package com.changui.payoneerhomeexercise;
import com.changui.payoneerhomeexercise.data.ApiService;
import com.changui.payoneerhomeexercise.data.GetPaymentMethodsMapper;
import com.changui.payoneerhomeexercise.data.PaymentMethodRepositoryImpl;
import com.changui.payoneerhomeexercise.data.apiresponse.PaymentMethodsApiResponse;
import com.changui.payoneerhomeexercise.domain.PaymentMethodUIModel;
import com.changui.payoneerhomeexercise.domain.SchedulersFacade;
import org.junit.jupiter.api.BeforeEach;
@ClaudeHangui
ClaudeHangui / PaymentMethodRepositoryImpl.java
Created May 23, 2021 12:37
Repository which provides the various payment methods used by financial service companies
package com.changui.payoneerhomeexercise.data;
import com.changui.payoneerhomeexercise.domain.PaymentMethodUIModel;
import com.changui.payoneerhomeexercise.domain.PaymentMethodRepository;
import com.changui.payoneerhomeexercise.domain.SchedulersFacade;
import java.util.List;
import javax.inject.Inject;
import io.reactivex.Single;
@ClaudeHangui
ClaudeHangui / ExchangeRateRepository.kt
Created May 23, 2021 12:25
Repository which provides the latest currency exchange rates for every country. The USD is the base currency
package com.changui.penguinpay
import android.content.Context
import android.net.ConnectivityManager
interface ExchangeRateRepoInt {
suspend fun getExchangeRates(): ExchangeRates?
}
@ClaudeHangui
ClaudeHangui / ExchangeRateRepoImplTest.kt
Created May 23, 2021 12:23
Unit test for the repostory. When fetching data from the APi the repository should return some result
package com.changui.penguinpay
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import kotlinx.coroutines.ExperimentalCoroutinesApi
import org.junit.Assert.assertNotNull
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.rules.ExpectedException
import org.junit.rules.TestRule
@ClaudeHangui
ClaudeHangui / BitmapFileLoader.java
Created September 12, 2017 18:44 — forked from esoxjem/BitmapFileLoader.java
Scaling a bitmap in android
import android.graphics.*;
import android.net.Uri;
public class BitmapFileLoader
{
public static Bitmap loadFromUri(Uri fileUri, float maxWidth, float maxHeight)
{
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(fileUri.getPath(), options);
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<RelativeLayout
@ClaudeHangui
ClaudeHangui / ProjectInformationDialogFragment.java
Created March 10, 2016 18:16
Boite de dialogue pour l'information sur un projet
package fr.koonda.koonda.ui.fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;