Skip to content

Instantly share code, notes, and snippets.

View francisnnumbi's full-sized avatar
😀
Learn and share

Francis Nduba Numbi francisnnumbi

😀
Learn and share
View GitHub Profile
@francisnnumbi
francisnnumbi / LineNumberedEditText
Created May 16, 2017 08:32
implementing an EditText with line number on the left. What is new is: - get/set line number margin gap - set line number visible - set line number color Everything is done in the overridden onDraw() method.
import android.widget.*;
import android.util.*;
import android.content.*;
import android.graphics.*;
/**
* the simple implementation of an EditText where each line is numbered on the left
*/
public class LineNumberedEditText extends EditText {
@francisnnumbi
francisnnumbi / MyEditText.java
Created May 16, 2017 00:40 — forked from lifeparticle/LICENSE
Custom Edittext with Line Number
package rupantor.cusedittext;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.EditText;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.Random;
@francisnnumbi
francisnnumbi / AppInfo.java
Created January 12, 2017 15:26
Android helper class. This is the way to get the version name and the version code of your application.
package fnn.smirl.rdc.constitution.info;
import android.content.Context;
import android.content.pm.PackageInfo;
/** by Francis Nduba Numbi */
public final class AppInfo
{
private static String vn= ""; // version name
private static int vc = 0; // version code
private static final AppInfo INSTANCE = new AppInfo();
@metaphore
metaphore / ResizeTexture.java
Last active March 22, 2023 07:04
[LibGDX] Resize texture on load
Pixmap pixmap200 = new Pixmap(Gdx.files.internal("200x200.png"));
Pixmap pixmap100 = new Pixmap(100, 100, pixmap200.getFormat());
pixmap100.drawPixmap(pixmap200,
0, 0, pixmap200.getWidth(), pixmap200.getHeight(),
0, 0, pixmap100.getWidth(), pixmap100.getHeight()
);
Texture texture = new Texture(pixmap100);
pixmap200.dispose();
pixmap100.dispose();
@lifeparticle
lifeparticle / LICENSE
Last active February 9, 2023 11:22
Custom Edittext with Line Number
MIT License
Copyright (c) 2023 Mahbub Zaman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@arcao
arcao / build.gradle
Last active August 23, 2017 08:38
Run JarJar task to repackage Gson library in Android Gradle build script
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.0'
}
}
apply plugin: 'com.android.application'