Skip to content

Instantly share code, notes, and snippets.

View vkrm26's full-sized avatar
💻
Focusing

Vikram Bhati vkrm26

💻
Focusing
  • Zapr Media Labs
  • India
View GitHub Profile
@vkrm26
vkrm26 / download_artifacts_from_jcenter.py
Created April 8, 2021 10:44
Bintray JCenter is sunsetting on 1st May 2021, so it's great to download all older artifacts in the correct order and hierarchy. use below script.
import requests
import os
from bs4 import BeautifulSoup
def checkChild(parentdir, url):
r = requests.get(url)
if r.headers.get('Content-Type') != 'text/html;charset=UTF-8':
@vkrm26
vkrm26 / AdIdTest.java
Last active April 2, 2021 09:10
Robolectric test using custom shadow class
@RunWith(RobolectricTestRunner.class)
@Config(sdk = {VERSION_CODES.P}, shadows = {ShadowAdvertisingIdClient.class})
public class AdIdTest {
private Context context = ApplicationProvider.getApplicationContext();
@Test
public void test_when_context_is_not_null_then_get_advertising_id() {
AdvertisingIdClient.Info adId = new AdIdHelper(context).getAdvertisingID(context);
@vkrm26
vkrm26 / AdLoader.kt
Created May 23, 2020 18:09
Facebook Audience Network - Native Ad Integration
import android.content.Context
import com.mopub.nativeads.AdapterHelper
import com.mopub.nativeads.FacebookAdRenderer
import com.mopub.nativeads.MoPubNative
import com.mopub.nativeads.MoPubStaticNativeAdRenderer
import com.mopub.nativeads.NativeAd
import com.mopub.nativeads.NativeAd.MoPubNativeEventListener
import com.mopub.nativeads.NativeErrorCode
import com.mopub.nativeads.ViewBinder
@vkrm26
vkrm26 / CustomNetworkImageView.java
Last active December 22, 2022 09:41
Custom image view which works on TouchImageView (https://github.com/MikeOrtiz/TouchImageView) & also extends NetworkImageView (volley) functionality.
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.ViewGroup;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.ImageLoader;
/**
@vkrm26
vkrm26 / CustomCircleCumNetworkImageView.java
Created June 6, 2016 06:27
Custom image view which is circle in shape & also extends NetworkImageView (volley) functionality.
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RectF;