Skip to content

Instantly share code, notes, and snippets.

View vipinhelloindia's full-sized avatar

Vipin Sahu vipinhelloindia

View GitHub Profile
class UserOnBoardingActivity : BaseActivity() {
private val userOnBoardingViewModel: UserOnBoardingViewModel by viewModels { viewModelFactory }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
userOnBoardingViewModel.sdkEventToLiveData.observe(this, {
handleBroadcastEventAndPassActionToViewModel()
})
/* Avoid hardcoded dispatchers */
class BackgroundExecutor constructor(val contextProvider: ContextProvider) {
companion object {
private val backgroundExecutor = CoroutineScope(SupervisorJob() + Dispatchers.IO)
var executor: ExecutorService = Executors.newFixedThreadPool(5)
private val mainThreadHandler: Handler = Handler(Looper.getMainLooper())
interface BroadcastSDKEvent {
fun register()
fun unregister()
fun setDeRegisterOnInActive(shouldDeregister: Boolean)
fun getSDKEventLiveData(): LiveData<BroadcastEventModel>
}
class BroadcastEventModel(val intentData: Any) {}
@vipinhelloindia
vipinhelloindia / Scroll Issue
Created July 22, 2017 10:10
include_list_viewpager.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
@vipinhelloindia
vipinhelloindia / Api.java
Created May 9, 2017 16:59 — forked from imminent/Api.java
Call retrying with Retrofit 2.0
package com.example.api;
import java.util.Map;
import retrofit.Call;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
public interface Api {
@vipinhelloindia
vipinhelloindia / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Matthieu Harlé
*
* 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
@vipinhelloindia
vipinhelloindia / gist:724849402584d8967c8f
Last active August 29, 2015 14:15
Android Git Ignore
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
@vipinhelloindia
vipinhelloindia / Drawable
Created February 13, 2015 13:32
Line Drawable
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="1dp"
android:height="1.2dp"/>
<solid android:color="@color/divider_line_color"/>