This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LocationIntentService extends IntentService { | |
| private GoogleApiClient mGoogleApiClient; | |
| public LocationIntentService() { | |
| super(LocationIntentService.class.getName()); | |
| } | |
| @Override | |
| protected void onHandleIntent(Intent intent) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyApplication extends Application { | |
| @Override | |
| public void onCreate() { | |
| super.onCreate(); | |
| Timber.plant(new FileLoggingTree(getApplicationContext())); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FileLoggingTree extends Timber.DebugTree { | |
| private static final String TAG = FileLoggingTree.class.getSimpleName(); | |
| private Context context; | |
| public FileLoggingTree(Context context) { | |
| this.context = context; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| public class InitActivity { | |
| public InitActivity() { | |
| logger.debug("Activity loading...."); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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 |