Skip to content

Instantly share code, notes, and snippets.

View hshahdoost's full-sized avatar
💭
I may be slow to respond.

Hossein Shahdoost hshahdoost

💭
I may be slow to respond.
View GitHub Profile
@Aesthetikx
Aesthetikx / retrofit_callback_testing.java
Last active June 24, 2022 16:55
Testing Retrofit Callback style APIs with Robolectric and CountdownLatches
// WidgetApi.java
public interface WidgetApi {
@GET("/widget/{:id}")
void getWidget(@Path("id") int id, Callback<Widget> callback);
}
// MockRetrofitClient.java
public class MockRetrofitClient implements Client {
private int statusCode = 200;
@JMPergar
JMPergar / FlipPageViewTransformer.java
Last active November 7, 2019 05:33
Flip animation for ViewPager
import android.support.v4.view.ViewPager;
import android.view.View;
public class FlipPageViewTransformer implements ViewPager.PageTransformer {
@Override
public void transformPage(View page, float position) {
float percentage = 1 - Math.abs(position);
page.setCameraDistance(12000);
setVisibility(page, position);
setTranslation(page);