Skip to content

Instantly share code, notes, and snippets.

View vicky7230's full-sized avatar
🎯
Focusing

Vipin Kumar vicky7230

🎯
Focusing
View GitHub Profile
override fun search(subject: PublishSubject<String>) {
compositeDisposable.add(
subject
.debounce(300, TimeUnit.MILLISECONDS)
.filter(Predicate { it: String ->
return@Predicate it.isNotEmpty()
})
.distinctUntilChanged()
.switchMap(Function<String, ObservableSource<Recipes>> { it ->
query = it
val subject = PublishSubject.create<String>()
search_edit_text.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {
subject.onNext(s.toString())
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
public class GridDividerDecoration extends RecyclerView.ItemDecoration {
private static final int[] ATTRS = {android.R.attr.listDivider};
private Drawable mDivider;
private int mInsets;
public GridDividerDecoration(Context context) {
TypedArray a = context.obtainStyledAttributes(ATTRS);
mDivider = a.getDrawable(0);
public class LocationIntentService extends IntentService {
private GoogleApiClient mGoogleApiClient;
public LocationIntentService() {
super(LocationIntentService.class.getName());
}
@Override
protected void onHandleIntent(Intent intent) {
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Timber.plant(new FileLoggingTree(getApplicationContext()));
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.yoscholar.deliveryboy"
xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:name=".application.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
public class FileLoggingTree extends Timber.DebugTree {
private static final String TAG = FileLoggingTree.class.getSimpleName();
private Context context;
public FileLoggingTree(Context context) {
this.context = context;
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val button = findViewById(R.id.button)
val editText = findViewById(R.id.editText) as EditText
button.setOnClickListener {
@vicky7230
vicky7230 / InitActivity.java
Created May 26, 2017 07:05 — forked from kosiara/InitActivity.java
Android slf4j logger with logcat + file; logging to file and logcat on Android
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class InitActivity {
public InitActivity() {
logger.debug("Activity loading....");
}
@vicky7230
vicky7230 / fcm.php
Created May 12, 2017 07:51 — forked from sab99r/fcm.php
PHP Function to Send FCM Message to Android
<?php
/*
Parameter Example
$data = array('post_id'=>'12345','post_title'=>'A Blog post');
$target = 'single tocken id or topic name';
or
$target = array('token1','token2','...'); // up to 1000 in one request
*/
public function sendMessage($data,$target){
//FCM api URL