Starting new fragments with Kotlin is easy
Example
val user = User(id = "id", name = "Ruby")
val userFragment: UserFragment = newFragment<User, UserFragment>(user)
val user = User(id = "id", name = "Ruby")
val userFragment: UserFragment = newFragment<User, UserFragment>(user)
class LifeCycle { | |
open class BaseActivity : Activity(), CoroutineScope { | |
private val job = SupervisorJob() | |
override val coroutineContext: CoroutineContext | |
get() = job + Dispatchers.Main | |
override fun onDestroy() { | |
super.onDestroy() | |
job.cancel() |
package com.saber.customstickyheader; | |
import android.graphics.Color; | |
import android.support.annotation.NonNull; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.TextView; |
import android.util.Log; | |
import java.text.MessageFormat; | |
/* | |
* Copyright 2015 Dor Sakal | |
* | |
* 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 |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
private int previousTotal = 0; // The total number of items in the dataset after the last load | |
private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
int firstVisibleItem, visibleItemCount, totalItemCount; |
/* | |
* Copyright (c) 2017 Emil Davtyan | |
* | |
* 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 furnished to do so, subject to | |
* the following conditions: |