Skip to content

Instantly share code, notes, and snippets.

View Pavneet-Sing's full-sized avatar
🎯
Focusing | Open to remote work

Pavneet Singh Pavneet-Sing

🎯
Focusing | Open to remote work
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sms_linear_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:gravity="center_horizontal"
android:orientation="vertical">
@Pavneet-Sing
Pavneet-Sing / MainActivity.java
Last active September 30, 2021 04:05
Animate a view using ObjectAnimator from left-to-right upto half of screen and inverse (right-to-left)
package com.pavneet.myapplication;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.graphics.Point;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Display;
import android.view.View;
@Pavneet-Sing
Pavneet-Sing / MainActivity.java
Last active September 20, 2016 05:29
Code will trigger an Action when ImageView is tapped three times within Specific time
package com.pavneet.myapplication;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.graphics.Point;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
package com.example.miccy.myapplication;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import java.io.InputStream;
import java.io.InputStreamReader;
public interface CountryArrayAPI {
@GET("/api/popular_destinations")
public Call<List> getCountries();
}
Retrofit retrofit = new Retrofit.Builder().baseUrl(Navigation_Url).addConverterFactory(GsonConverterFactory.create()).build();
CountryArrayAPI api = retrofit.create(CountryArrayAPI.class);
Call<List> call = api.getCountries();
call.enqueue(new Callback<List>() {
@Override
public void onResponse(Call<List> call, Response<List> response) {
Gson gson = new Gson();
try {
@Pavneet-Sing
Pavneet-Sing / 3_Espresso_Idling_Resource
Created October 13, 2017 17:22
Espresso idling resource for synchronize testing
public class EspressoTestingIdlingResource {
private static final String RESOURCE = "GLOBAL";
private static CountingIdlingResource mCountingIdlingResource =
new CountingIdlingResource(RESOURCE);
public static void increment() {
mCountingIdlingResource.increment();
}
public class AppNavigationTest {
@Rule
public ActivityTestRule<NewsActivity> activityTestRule =
new ActivityTestRule<>(NewsActivity.class);
@Before
public void registerIdlingResource() {
// let espresso know to synchronize with background tasks
IdlingRegistry.getInstance().register(EspressoTestingIdlingResource.getIdlingResource());
@Pavneet-Sing
Pavneet-Sing / Test.java
Last active November 14, 2017 08:35
Threads with lambda demo
package test.myapplication;
import static org.junit.Assert.*;
/**
* Created by Pavneet Singh on 11/14/2017.
* Email : Pavneet.edu@gmail.com
*/
public class Test {
@Pavneet-Sing
Pavneet-Sing / MaxChildHeightFragment.kt
Last active February 22, 2020 09:45
Framelayout, which will take the size of max sized child
import android.content.Context
import android.util.AttributeSet
import android.widget.FrameLayout
import kotlin.math.max
/**
* Created by Pavneet_Singh on 2020-02-19.
*/
class MaxChildHeightFrameLayout @JvmOverloads constructor(