Skip to content

Instantly share code, notes, and snippets.

View gzeinnumer's full-sized avatar
🏠
Work from home

M. Fadli Zein gzeinnumer

🏠
Work from home
  • Indonesia
View GitHub Profile
@gzeinnumer
gzeinnumer / AndroidDeviceInfo.java
Created June 26, 2021 06:10
Generate ICCID, IMSI, IMEI Android > 9
package com.mlpt.siemo.mobilebanking.riau.utils;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.provider.Settings;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
public class MainActivity extends AppCompatActivity {
public static final String TAG = "Main_Activity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
public class MainActivity extends AppCompatActivity {
public static final String TAG = "Main_Activity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//check NFC
AdapterCreator<MyModel> adapter = new AdapterBuilder<MyModel>(R.layout.rv_item)
.onBind( ... )
.onFilter(new FilterCallBack<MyModel>() {
@Override
public List<MyModel> performFiltering(CharSequence constraint, List<MyModel> listFilter) {
List<MyModel> fildteredList = new ArrayList<>();
if (constraint != null || constraint.length() != 0) {
String filterPattern = constraint.toString().toLowerCase().trim();
for (MyModel item : listFilter) {
//filter by id
....
AdapterCreatorMultiType<MyModel> adapter = new AdapterBuilderMultiType<MyModel>()
.setList(list)
.onBind(new BindViewHolderMultiType<MyModel>() {
//your constant type
private final int TYPE_GENAP = 1;
private final int TYPE_GANJIL = 0;
@Override
//setup data
List<MyModel> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
list.add(new MyModel(i,"Data Ke "+ (i + 1)));
}
//setup adapter
AdapterCreator<MyModel> adapter = new AdapterBuilder<MyModel>(R.layout.rv_item)
.setList(list)
.onBind(new BindViewHolder<MyModel>() {
EditText editText = findViewById(R.id.ed);
editText.addTextChangedListener(new SimpleTextWatcher(new AfterTextChanged() {
@Override
public void afterTextChanged(Editable s) {
//do something
}
}));
editText.addTextChangedListener(new SimpleTextWatcher(new BeforeTextChanged() {
@gzeinnumer
gzeinnumer / MyLibSimpleTextWatcher.gradle
Created January 2, 2021 11:04
MyLibSimpleTextWatcher setting
// build.gradle project
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
// build.gradle app/module
dependencies {
EditText editText = findViewById(R.id.ed);
editText.addTextChangedListener(new SimpleTextWatcher(new AfterTextChanged() {
@Override
public void afterTextChanged(Editable s) {
//do something
}
}));
@gzeinnumer
gzeinnumer / edittext_textwatcher.java
Last active January 2, 2021 10:57
Sample EditText With TextWatcher
EditText editText = findViewById(R.id.ed);
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {