This file contains 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
using System; | |
using System.Collections.Generic; | |
namespace GenericFactoryPatternExample | |
{ | |
public class MainClass | |
{ | |
// Example of using a service locator to get the correct factory for | |
// a given object type. | |
public static void Main() |
This file contains 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
object GeneralBindingAdapters { | |
/** | |
* To allow binding image resource Int in addition to Drawable. | |
* Saves you from depending on Resouces in the ViewModel, | |
*/ | |
@JvmStatic | |
@BindingAdapter("android:src") | |
fun setImageResource(imageView: ImageView, resource: Int) { | |
imageView.setImageResource(resource) |
This file contains 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"?> | |
<!-- REMEMBER TO UPDATE BOTH LANDSCAPE AND PORTRAIT FILES --> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:grid="http://schemas.android.com/apk/res-auto" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent"> | |
<!-- Setting up GridLayout support library in IntelliJ: http://stackoverflow.com/questions/12468606/intellij-and-android-support-v7-widget-gridlayout --> | |
<android.support.v7.widget.GridLayout | |
android:layout_width="match_parent" |
This file contains 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
buildscript { | |
repositories { | |
mavenCentral() | |
jcenter() | |
} | |
} | |
plugins { | |
id 'org.jetbrains.kotlin.jvm' version '1.5.10' | |
id 'org.jetbrains.intellij' version '1.0' |
This file contains 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
@BindingConversion | |
@JvmStatic | |
fun konverto1(action: (() -> Unit)?) : View.OnClickListener? { | |
return View.OnClickListener { action?.invoke() } | |
} |
This file contains 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 android.databinding.BaseObservable; | |
import android.databinding.BindingAdapter; | |
import android.databinding.BindingConversion; | |
import android.text.Editable; | |
import android.text.TextWatcher; | |
import android.widget.EditText; | |
import java.io.Serializable; |
This file contains 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
/** | |
* Overrides the HTTP Header Content-Type for POST, PATCH and PUT calls to the given [contentType] | |
*/ | |
class ContentTypeInterceptor(private val contentType: String) : Interceptor { | |
override fun intercept(chain: Interceptor.Chain): Response { | |
val request = chain.request() | |
val chainBuilder = request.newBuilder() | |
request.body()?.let { | |
val newBody = ForwardingRequestbody(it, contentType) | |
when (request.method()) { |
This file contains 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
package no.ruter.sales.utils | |
import org.hamcrest.MatcherAssert.assertThat | |
import org.hamcrest.core.IsInstanceOf | |
import org.junit.Test | |
import toothpick.Scope | |
import toothpick.Toothpick | |
import toothpick.config.Module | |
import toothpick.ktp.binding.bind | |
import toothpick.ktp.binding.module |
This file contains 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 com.myapp.shared.databinding.FragmentSaleProductBindingImpl; | |
^ | |
symbol: class FragmentSaleProductBindingImpl | |
^ | |
warning Binding adapter AK(android.widget.ImageView, com.myapp.shared.model.viewmodel.overview.ConnectivityState) already exists for connectivityState! Overriding com.myapp.shared.bindingadapters.ValidatorBindingAdapter.Companion#setIdleCardImage with com.myapp.shared.bindingadapters.ValidatorBindingAdapter#setIdleCardImage | |
warning Binding adapter AK(android.widget.ImageView, com.myapp.shared.model.viewmodel.overview.ConnectivityState) already exists for connectivityState! Overriding com.myapp.shared.bindingadapters.ValidatorBindingAdapter.Companion#setIdleCardImage with com.myapp.shared.bindingadapters.ValidatorBindingAdapter#setIdleCardImage | |
warning Binding adapter AK(android.widget.TextView, com.myapp.shared.model.viewmodel.overview.ConnectivityState) already exists for connectivityState! Overriding com.myapp.shared.bindingadapters.ValidatorBin |
NewerOlder