Skip to content

Instantly share code, notes, and snippets.

View mnafian's full-sized avatar
🎯
Focusing

M. Nafian Wildana mnafian

🎯
Focusing
View GitHub Profile
textWatcher(object : TextWatcher {
private val mArray_pos: IntArray = intArrayOf(3)
private var mBeforeTextChanged: CharSequence = ""
private val mAppentText: String = "-"
override fun afterTextChanged(s: Editable) {
for (i in mArray_pos.indices) {
if (mBeforeTextChanged.length - mAppentText.length * i == mArray_pos[i] - 1 && s.length - mAppentText.length * i == mArray_pos[i]) {
s.append(mAppentText)
package com.test.myapplication
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.util.Log
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
private val TAG = MainActivity::class.java.simpleName
[
{
"subno": "50050551",
"pastDue": "0.000 KD",
"deposit": "0.000 KD",
"unbilled": "47.338 KD",
"total": "47.338 KD",
"totalEx": "47.338"
},
{
@mnafian
mnafian / RxJava.md
Created November 6, 2016 07:24 — forked from cesarferreira/RxJava.md
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
public class Map2 extends AppCompatActivity implements OnMapReadyCallback {
private List<LatLng> dataLatlng = new ArrayList<>();
private double a, b;
private LatLng data;
private int incrementNext = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map2);
{
"market": "Pasar Kramat Jati",
"data": [{
"name": "Bawang merah",
"price": "75300",
"status": "down",
"unit": "kg"
}, {
"name": "Cabe keriting merah",
"price": "15300",
package dummy.protophonto.utilAndHelper;
/**
* Created on : January 20, 2016
* Author : mnafian
* Name : M. Nafian
* Email : mnafian@icloud.com
* GitHub : https://github.com/mnafian
* LinkedIn : https://id.linkedin.com/in/mnafian
* Company : Inagata Technosmith
package dummy.protophonto.utilAndHelper;
/**
* Created on : January 20, 2016
* Author : mnafian
* Name : M. Nafian
* Email : mnafian@icloud.com
* GitHub : https://github.com/mnafian
* LinkedIn : https://id.linkedin.com/in/mnafian
* Company : Inagata Technosmith
@mnafian
mnafian / Android unzip file using ZipInputStream
Created January 30, 2016 04:47 — forked from shengoo/Android unzip file using ZipInputStream
Android unzip file using ZipInputStream
public class unzip extends Activity {
/** Called when the activity is first created. */
static final int BUFFER = 2048;
TextView textView;
@Override
public void onCreate(Bundle savedInstanceState) {
textView = new TextView(this);