Skip to content

Instantly share code, notes, and snippets.

View NinoDLC's full-sized avatar

Nino NinoDLC

  • Lyon, France
View GitHub Profile
package fr.delcey.pokedexfullflow
import android.location.Location
import androidx.lifecycle.LiveData
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import kotlin.random.Random
class AllInOneRepository {
@NinoDLC
NinoDLC / RestaurantDetailsRepository
Created August 23, 2021 20:48
Caching data in RAM
import android.util.LruCache;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import fr.delcey.go4lunch.data.restaurant_details.pojo.RestaurantDetailsResponse;
import fr.delcey.go4lunch.data.restaurant_details.pojo.RestaurantDetailsResponseWrapper;
import retrofit2.Call;
// open JaCoCo report after generation
def openReport(htmlOutDir) {
final reportPath = "$htmlOutDir\\index.html"
println "HTML Report: $reportPath"
def os = org.gradle.internal.os.OperatingSystem.current()
if (os.isWindows()) {
exec { commandLine 'cmd', '/c', "start $reportPath" }
} else if (os.isMacOsX()) {
public class NearbyRestaurantsRepository {
private static final String TYPE = "restaurant";
// Round the GPS coordinate to avoid re-querying Google for a position that would be only a few meters away
private static final int GPS_SCALE = 2;
@NonNull
private final NearbyRestaurantsApi nearbyRestaurantsApi;
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.TestCoroutineScope
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.setMain
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import androidx.test.espresso.NoMatchingViewException;
import androidx.test.espresso.ViewAssertion;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
public class RecyclerViewItemCountAssertion implements ViewAssertion {
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.TestCoroutineScope
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.setMain
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
@NinoDLC
NinoDLC / AndroidManifest.xml
Created March 3, 2021 17:17
DispatcherActivity
<activity
android:name=".view.dispatcher.DispatcherActivity"
android:theme="@style/Theme.Go4Lunch.NoActionBar.Transparent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
private void initMeetingsRecyclerView() {
final MeetingAdapter adapter = new MeetingAdapter(this);
RecyclerView recyclerView = findViewById(R.id.meeting_rv);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
viewModel.getMeetingModelsLiveData().observe(this, meetingModels -> adapter.submitList(meetingModels));
}
import androidx.annotation.NonNull;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
import java.time.Clock;
import fr.delcey.mareu.domain.MeetingRepository;
import fr.delcey.mareu.ui.create.CreateMeetingViewModel;
import fr.delcey.mareu.ui.meetings.MeetingViewModel;