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 android.graphics.Point | |
import android.os.Parcel | |
import android.os.Parcelable | |
import android.util.Size | |
import java.io.PrintWriter | |
/** | |
* Point holds two integer coordinates | |
*/ |
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 GithubSearchViewModel( | |
private val searchGithubUseCase: SearchGithubUseCase, | |
private val likeGithubUseCase: LikeGithubRepoUseCase | |
) : BaseViewModel(), EmptyObservableHost { | |
val shouldClearCurrentSearchResults = false | |
private val searchEvent: MediatorLiveData<String?> = searchQuery.map { | |
if (it.isNullOrBlank() || (restoredSearchQuery != null && restoredSearchQuery == it)) null |
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
abstract class BaseFragment<VM : BaseViewModel, DB : ViewDataBinding> : Fragment() { | |
abstract val viewModel: VM | |
@CallSuper | |
open fun bindObservables() { | |
(viewModel as? EmptyObservableHost)?.let { | |
it.getObservableLiveDataList().forEach { | |
it.observe(viewLifecycleOwner, {}) |
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
fun map(eventData: AboutData, club: ClubSupportItem, matches: LatestMatchItem?, | |
subData: EventFragmentBundleCapsule?, match: Match?, news: SearchResult<SMNews>?) |
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 android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.annotation.LayoutRes | |
import androidx.core.content.ContextCompat | |
import androidx.databinding.DataBindingUtil | |
import androidx.databinding.ViewDataBinding | |
import androidx.recyclerview.widget.DiffUtil | |
import androidx.recyclerview.widget.ListAdapter | |
import androidx.recyclerview.widget.RecyclerView |
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
private fun bindParentObservables() { | |
viewModel.snackMessageCommand.observe(viewLifecycleOwner, EventObserver { command -> | |
when (command) { | |
is SnackCommand.StringResSnackCommand -> | |
view?.showSnackBar( | |
command.message, | |
duration = command.duration | |
) | |
is SnackCommand.StringSnackCommand -> |
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
abstract class BaseAdapter<T>( | |
private var itemSimilarityPredicate: (T, T) -> Boolean, | |
private var contentSimilarityPredicate: (T, T) -> Boolean | |
) : ListAdapter<T, BaseAdapter<T>.DataBindingViewHolder>(object : DiffUtil.ItemCallback<T>() { | |
override fun areContentsTheSame( | |
oldItem: T, | |
newItem: T | |
) = contentSimilarityPredicate.invoke(oldItem, newItem) | |
override fun areItemsTheSame( |
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 CombinedLiveData<T, K, S>(source1: LiveData<T>, source2: LiveData<K>, private val combine: (data1: T?, data2: K?) -> S) : MediatorLiveData<S>() { | |
private var data1: T? = null | |
private var data2: K? = null | |
init { | |
super.addSource(source1) { | |
data1 = it | |
value = combine(data1, data2) | |
} |
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"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > | |
<item | |
android:bottom="4dp" | |
android:left="4dp" | |
android:right="4dp" | |
android:top="4dp"> | |
<shape android:shape="rectangle" > | |
<corners android:radius="11dp" /> |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/utsname.h> | |
int main(int argc, char *argv[]) { | |
struct utsname *_system_ = malloc(sizeof(struct utsname)); | |
uname(_system_); | |
if(argc==2 && | |
(strcmp(argv[1], "version")==0 | |
|| strcmp(argv[1],"VERSION" ) == 0)) |