Skip to content

Instantly share code, notes, and snippets.

View wbinarytree's full-sized avatar

Phoenix wbinarytree

  • https://wbinarytree.github.io/
View GitHub Profile
@wbinarytree
wbinarytree / PeekingLinearLayoutManager.kt
Created March 20, 2019 10:45 — forked from bolot/PeekingLinearLayoutManager.kt
LinearLayoutManager subclass that "peeks", shows a portion of the adjacent child views.
class PeekingLinearLayoutManager : LinearLayoutManager {
@Suppress("Unused")
@JvmOverloads
constructor(context: Context?, @RecyclerView.Orientation orientation: Int = RecyclerView.VERTICAL, reverseLayout: Boolean = false) : super(context, orientation, reverseLayout)
@Suppress("Unused")
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
override fun generateDefaultLayoutParams() =
scaledLayoutParams(super.generateDefaultLayoutParams())
@wbinarytree
wbinarytree / NoScrollViewPager.kt
Created December 4, 2018 10:10
ViewPager that can disable scroll.
package fr.airweb.dood.widgets
import android.annotation.SuppressLint
import android.content.Context
import android.support.v4.view.ViewPager
import android.util.AttributeSet
import android.view.MotionEvent
class NoScrollViewPager : ViewPager {
package fr.airweb.tixipass.ui;
import org.jetbrains.annotations.Nullable;
public class Merge2List {
static class Node {
int data;
@Nullable
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
@wbinarytree
wbinarytree / build.gradle
Created August 6, 2018 12:51
remove unusable flavor for dev mod.
android.variantFilter { variant ->
def currentDevFlavor = FLAVOR_NAME
def flavorName = variant.getFlavors().get(0).name
if(currentDevFlavor && flavorName != currentDevFlavor) {
variant.setIgnore(true)
}
}
@wbinarytree
wbinarytree / build.gradle
Created August 3, 2018 14:29
force support lib version
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion support_lib_version
}
}
}
}
一篇不太一样的RxJava介绍(二):关于操作符
前言: 上篇文章介绍了Observable这个类的来历。但是操作符是RxJava又一大优势。深受大家好评,这篇文章我会介绍一下操作符相关概念。
(读完这篇文章可能会引起身体强烈不适,甚至出现你以前懂操作符,读了之后反而不懂的情况。甚至这篇文章对你开发Android App不会有很大帮助,所以这篇文章需要谨慎阅读)
我们在了解操作符之前,首先要了解几个概念: **Monad** 和 **函数式编程**。这里我会一一介绍他们,但是不会太详细,一篇文章肯定不能详细的介绍完这两个**巨大**的概念,甚至我自己都没有理解透彻这两个概念,但是这并不妨碍我们理解RxJava的操作符。
## 函数式编程
我们首先来说函数式编程,函数式编程的意义很简单。就是 用函数来编程。或者说,是用数学概念上的函数( *mathematical functions* )来编程。函数是两个集合之间的一种映射。
我们常常用 f:x -> y 这种形式来表示**函数**f是从X到Y的一种映射。
@wbinarytree
wbinarytree / FitWindowFrameLayout.kt
Last active May 25, 2018 09:48
FitsystemWindow with FrameLayout!
package com.airweb.waw.wawmusicplayer.ui.widgets
import android.content.Context
import android.support.v4.view.ViewCompat
import android.support.v4.view.WindowInsetsCompat
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
@wbinarytree
wbinarytree / AuthTranslator.kt
Created June 2, 2017 14:36
Full rx architecture.
/*
* Copyright 2017 WBinaryTree
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software

MuPdfView

Download

Base on MuPDF a custom view that simplify displaying Pdf files.

ScreenShots:

Demo1