Skip to content

Instantly share code, notes, and snippets.

View AhmadAyyaz1993's full-sized avatar
🤡

Ahmad Ayyaz AhmadAyyaz1993

🤡
  • Lahore, Pakistan
View GitHub Profile
@AhmadAyyaz1993
AhmadAyyaz1993 / Utility.java
Created April 8, 2019 13:10
Method to add dots at the end of long text in Java
public class Utility {
public static void addShowMoreDots(String targetString, TextView tvStringHolder, int charactersLimit, @Nullable final View.OnClickListener onDotsClickListener) {
if (targetString.length() > charactersLimit) {
String dotsString = " [ ... ]";
targetString = targetString.substring(0, charactersLimit).concat(dotsString);
SpannableString spannableDots = new SpannableString(targetString);
@AhmadAyyaz1993
AhmadAyyaz1993 / a- Add "Procfile"
Last active January 18, 2019 18:45 — forked from CleverProgrammer/Procfile
How to Host a Django App on Heroku
# add a Profile in the root folder of your project where manage.py exists and add the line below to your Procfile and replace
# project_name with your Project name
web: gunicorn project_name.wsgi
@AhmadAyyaz1993
AhmadAyyaz1993 / gist:046357ae218669cd5838569972dfd56b
Last active July 3, 2018 09:42
Method for generating local notifications including API level 26
private static final int NOTIFICATION_ID = 1;
private static final String NOTIFICATION_CHANNEL_ID = "joblogic_notification_channel";
...
public void showNotification( String contentTitle, String contentText ) {
int icon = R.drawable.icon;
long when = System.currentTimeMillis();
Intent notificationIntent = new Intent(this,LocalNotificationActivity.class);
@AhmadAyyaz1993
AhmadAyyaz1993 / RegularProximaTextView.java
Last active May 28, 2018 09:41
Custom TextView with custom Font
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;
public class CustomFontTextView extends TextView {
public static Typeface FONT_NAME;