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 com.yjy.recyclerviewutils.adapter; | |
import android.support.annotation.NonNull; | |
import android.support.v7.widget.RecyclerView; | |
import android.util.SparseArray; | |
import android.view.ViewGroup; | |
public class ConcatAdapter extends RecyclerView.Adapter { | |
private RecyclerView.Adapter mFirstAdapter; |
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.support.v4.app.DialogFragment; | |
import android.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentManager; | |
public class FragmentUtils { | |
private FragmentUtils() {} | |
/** | |
* Use this method to prevent from creating dialog fragment more than one. |
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
-- 脚本介绍 | |
-- 功能:获取所选文件、文件夹的目录路径,支持多选 | |
-- 如果仅仅想获取文件的目录路径,可以调用 isDirectory() 过滤掉文件夹的路径 | |
tell application "Finder" to set selectedItems to selection as alias list | |
-- 没选择的话直接退出脚本 | |
if selectedItems is {} then return | |
-- 获得所选文件/文件夹的父目录。 | |
set parentPath to do shell script "dirname " & quoted form of POSIX path of (item 1 of selectedItems) | |
-- 用于拼接多个路径 |
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.annotation.SuppressLint; | |
import android.arch.lifecycle.LiveData; | |
import android.arch.lifecycle.MediatorLiveData; | |
import android.support.annotation.MainThread; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.ScheduledExecutorService; | |
import java.util.concurrent.ScheduledFuture; |
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.arch.lifecycle.LiveData; | |
import android.arch.lifecycle.MediatorLiveData; | |
import android.arch.lifecycle.Observer; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
/** | |
* | |
* 每次InputSource更新后。 | |
* <ol> |
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.arch.lifecycle.LiveData; | |
import android.arch.lifecycle.MutableLiveData; | |
import android.arch.lifecycle.Transformations; | |
/** | |
* 每当输入一个参数{@link #input(Object)},就回调{@link OnGetLiveData},生成一个LiveData | |
*/ | |
public class ActionLiveData<InputType, ResultType> { | |
private MutableLiveData<InputType> mInput = new EventMutableLiveData<>(); |
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
private static LifecycleOwner mockLifecycleOwner() { | |
LifecycleOwner owner = mock(LifecycleOwner.class); | |
LifecycleRegistry lifecycle = new LifecycleRegistry(owner); | |
lifecycle.handleLifecycleEvent(Lifecycle.Event.ON_RESUME); | |
when(owner.getLifecycle()).thenReturn(lifecycle); | |
return owner; | |
} |
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.app.Activity; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.graphics.Color; | |
import android.os.Build; | |
import android.os.Bundle; | |
import android.support.annotation.Nullable; | |
import android.support.v4.app.Fragment; | |
import android.view.Gravity; | |
import android.view.View; |
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 java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
public class TKCalculateUtils { | |
public static long hexCharAsNumber(char c) { | |
if (c >= 'a') { | |
return c - 87; | |
} else { |
OlderNewer