Skip to content

Instantly share code, notes, and snippets.

View mankum93's full-sized avatar

Manish Kumar Sharma mankum93

View GitHub Profile
@mankum93
mankum93 / IMyAidlInterface.java
Created September 2, 2022 14:58
IMyAidlInterface.java
/*
* This file is auto-generated. DO NOT MODIFY.
*/
package com.example.aidlsimpleexample;
// Declare any non-default types here with import statements
public interface IMyAidlInterface extends android.os.IInterface
{
/** Default implementation for IMyAidlInterface. */
public static class Default implements com.example.aidlsimpleexample.IMyAidlInterface
@mankum93
mankum93 / response.html
Created November 30, 2021 07:58
404 response OIC
<HTML>
<HEAD>
<TITLE>Error 404 -- Not Found.NOT FOUND. Please check the request URI [/ic/api/integration/v1/flows/rest/BOD_LOGIN_VALIDATI_SERVICE/1.0/login1]. This request URI should end like... [/login] </TITLE>
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5>
<TR>
@mankum93
mankum93 / drawable_attrs.xml
Last active September 26, 2021 16:29
Drawable Attributes
<?xml version="1.0"?>
<!-- Set of framework-provided states that may be specified on a Drawable. Actual usage of
states may vary between view implementations, as documented on the individual state
attributes. -->
<declare-styleable name="DrawableStates">
<!-- State value for {@link android.graphics.drawable.StateListDrawable StateListDrawable},
set when a view has input focus. -->
<attr name="state_focused" format="boolean" />
<!-- State value for {@link android.graphics.drawable.StateListDrawable StateListDrawable},
set when a view's window has input focus. -->
@mankum93
mankum93 / gist.java
Last active June 22, 2021 02:01
Builder pattern snippet from Effective Java
// Builder pattern for class hierarchies
public abstract class Pizza {
public enum Topping {
HAM,
MUSHROOM,
ONION,
PEPPER,
SAUSAGE
}
final Set < Topping > toppings;
// Java program to multiply two polynomials
class GFG
{
// A[] represents coefficients
// of first polynomial
// B[] represents coefficients
// of second polynomial
// m and n are sizes of A[] and B[] respectively
static int[] multiply(int A[], int B[],
@mankum93
mankum93 / UriUtils.java
Last active July 13, 2020 18:34
Uri: Extract the required file name and size from the "content"
package com.androiduriutils;
import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
import androidx.annotation.NonNull;
@mankum93
mankum93 / NetworkingClient.java
Created August 15, 2019 16:54
We enable filtering the request/response params for Retrofit using a HttpLoggingInterceptor
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public final class NetworkingClient {
private static final String TAG = NetworkingClient.class.getSimpleName();
/**
* This Behavior corrects the bug in RecyclerView that doesn't report scroll consumption
* properly by plugging in a scroll listener to RecyclerView that properly reports the
* same(on reaching the top)
*
* This is courtesy of @mak-sing on SO:(top rated answer is FLAWED!)
* https://stackoverflow.com/questions/30923889/flinging-with-recyclerview-appbarlayout
*/
public final class CorrectiveAppBarLayoutFlingBehavior extends AppBarLayout.Behavior {
private Map<RecyclerView, RecyclerViewScrollListener> scrollListenerMap = new HashMap<>(); //keep scroll listener map, the custom scroll listener also keep the current scroll Y position.