Skip to content

Instantly share code, notes, and snippets.

View xuhaibahmad's full-sized avatar
💭
¯\_(ツ)_/¯

Zuhaib Ahmad xuhaibahmad

💭
¯\_(ツ)_/¯
View GitHub Profile
@xuhaibahmad
xuhaibahmad / proguard-rules.pro
Last active January 29, 2017 10:39
Proguard rules for commonly used libraries
# Add this global rule
-keepattributes Signature
# This rule will properly ProGuard all the model classes in
# the package com.yourcompany.models. Modify to fit the structure
# of your app.
# -keepclassmembers class com.mypackagename.myapplication.** {
# *;
# }
@xuhaibahmad
xuhaibahmad / StaticViewPager.java
Last active June 21, 2017 17:27
A fragment less View Pager
package com.zuhaibahmad.upworkevaluationproject.utils;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
/**
@xuhaibahmad
xuhaibahmad / .gitlab-ci.yml
Created January 29, 2017 10:34
Gitlab CI config file
image: jangrewe/gitlab-ci-android
stages:
- build
- test
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
@xuhaibahmad
xuhaibahmad / .gitignore
Last active March 19, 2017 14:54
Generic gitignore file for Android
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
@xuhaibahmad
xuhaibahmad / IntegerValueFormatter.java
Last active June 21, 2017 17:24
Value formatter for MP Android Charts library to display integer values instead of floating point
package com.zuhaibahmad.cricketer.utils;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.formatter.ValueFormatter;
import com.github.mikephil.charting.utils.ViewPortHandler;
/**
* Created by Zuhaib Ahmad on 1/9/2017.
*
* Value formatter for MP Android Charts library to display integer values instead of floating point
@xuhaibahmad
xuhaibahmad / DropDownEditText.java
Created May 2, 2017 10:29
Variation of AutoCompleteTextView that displays suggestions even in absence of any text input. Often used in conjunction with a handle view to mimic a custom drop down behavior
package com.android.tresmark.utils;
import android.content.Context;
import android.support.v7.widget.AppCompatAutoCompleteTextView;
import android.util.AttributeSet;
/**
* Created by Zuhaib on 5/2/2017.
* <p>
* Variation of {@link android.widget.AutoCompleteTextView} that displays suggestions even in
@xuhaibahmad
xuhaibahmad / DecimalPlacesFilter.java
Created September 18, 2017 12:08
Text Input Filter to limit the number of decimal places
package com.mindscollide.baycho.utils;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.method.DigitsKeyListener;
/**
* Created by Zuhaib on 5/11/2017.
* <p>
* Text {@link android.text.InputFilter} to limit the number of decimal places
package com.zuhaibahmad.template.utils
import android.content.Context
import android.graphics.Bitmap
import android.media.MediaScannerConnection
import android.os.Environment
import android.util.Log
import android.view.View
import com.itextpdf.text.Document
import com.itextpdf.text.DocumentException
@xuhaibahmad
xuhaibahmad / BaseRecyclerView.kt
Last active July 13, 2018 06:03
A simple RecyclerView subclass that supports providing an empty view which is displayed when the adapter has no data and hidden otherwise
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.util.AttributeSet
import android.view.View
/**
* Created by zuhaib.ahmad on 2/22/2018.
*
* Simple RecyclerView subclass that supports providing an empty view (which
* is displayed when the adapter has no data and hidden otherwise).
@xuhaibahmad
xuhaibahmad / NonSwipeableViewPager
Created July 30, 2018 07:38
A View pager that can only be swiped programmatically
import android.annotation.SuppressLint
import android.content.Context
import android.support.v4.view.ViewPager
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.animation.DecelerateInterpolator
import android.widget.Scroller
/**
* Created by Zuhaib Ahmad on 30/7/2018.