Skip to content

Instantly share code, notes, and snippets.

@thegarlynch
thegarlynch / Cart.kt
Last active June 23, 2020 20:16
Implementation of cart
import com.myapplication.domain.model.checkout.CartItem
import com.myapplication.helper.rx.ThreadConfinedBehaviorSubject
import io.reactivex.Scheduler
import java.math.BigInteger
import javax.annotation.concurrent.ThreadSafe
import javax.inject.Inject
import javax.inject.Singleton
/**
* Beware!!
import android.content.Context
import android.view.View
import android.widget.LinearLayout
import io.reactivex.Observable
interface Input {
val mandatory : Boolean
val focusIds : Array<Int>
fun buildView(context : Context) : View
@thegarlynch
thegarlynch / LocationFinder.kt
Last active August 13, 2020 06:23
Implementasi Location Finder
package com.thegar.example.helper.location
import android.Manifest
import android.app.Activity
import android.content.IntentSender
import android.content.pm.PackageManager
import android.os.Looper
import androidx.core.app.ActivityCompat
import com.google.android.gms.common.api.ResolvableApiException
import com.google.android.gms.location.*
# Daemon config file for PipeWire version "0.3.26" #
context.properties = {
## Configure properties in the system.
#library.name.system = support/libspa-support
#context.data-loop.library.name.system = support/libspa-support
#support.dbus = true
#link.max-buffers = 64
link.max-buffers = 16 # version < 3 clients can't handle more
#mem.warn-mlock = false
<?php
class PDF extends Pdftc {
//Page header
public function Header() {
if ($this->page == 1)
{
$this->SetFont('times', '', 10);
$this->SetXY(110,8);
$this->hal='{nb}';
$this->SetX(10);
object StringUtil {
/**
* String Format :
*
* <<Regular Text>> <<Clickable Bold Text>>
*
* Don't forget this line to made clicking work,
* apply it into textView.
@thegarlynch
thegarlynch / ViewModel.kt
Created August 2, 2021 05:35
Parent Fragment ViewModel Access
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelStoreOwner
inline fun <reified VM : ViewModel> Fragment.parentViewModel() : Lazy<VM>{
return viewModels(
ownerProducer = {
parentFragmentManager as ViewModelStoreOwner
}
import android.content.Context
import android.view.View
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
private fun View.getMethodManager() : InputMethodManager {
return context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
}
@thegarlynch
thegarlynch / SlackWebHook.kt
Created September 29, 2021 09:42
SlackWebHook untuk Mengirim Remote File ke Slack
import androidx.appcompat.app.AppCompatActivity
import com.cpssoft.mobile.titan.BuildConfig
import com.cpssoft.mobile.titan.common.extentions.formatDate
import com.cpssoft.mobile.titan.common.global.App
import com.cpssoft.mobile.titan.common.view.dialog.ApproveDialog
import com.cpssoft.mobile.titan.server.RemoteModule
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import okhttp3.*
@thegarlynch
thegarlynch / appmodule.kt
Last active October 22, 2021 09:43
Manual Dependency Injection
class TitanApplication : Application(), ApplicationComponentOwner {
override lateinit var component : ApplicationComponent
fun onCreate(){
component = ApplicationComponentImpl()
}
}