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.simplelisp; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
public class SimpleLisp { | |
//(+ 3 (+ 3 2) (+ 4 5)) |
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.cinemagraph; | |
import android.graphics.Matrix; | |
import android.support.v4.view.ViewPager; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.FrameLayout; | |
import android.widget.ImageView; | |
import android.widget.RelativeLayout; |
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.view.ViewPager; | |
import android.view.ViewTreeObserver; | |
/** | |
* A class that can be added to a viewTreeObserver for ViewPager's in order to determine | |
* when a smoothScroll transition is completed by viewPager.setCurrentItem(); | |
*/ | |
public class PagerScrollListener implements ViewTreeObserver.OnScrollChangedListener { | |
private int scrollX; | |
private int totalChange = 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
import android.support.v4.view.ViewPager; | |
import android.view.ViewTreeObserver; | |
/** | |
* A class that can be added to a viewTreeObserver for ViewPager's in order to determine | |
* when a smoothScroll transition is completed by viewPager.setCurrentItem(); | |
*/ | |
public class PagerScrollListener implements ViewTreeObserver.OnScrollChangedListener { | |
private int scrollX; | |
private int totalChange = 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
/** | |
* An RxJava-backed EventBus class that can support sending and receiving multiple event types. | |
* | |
* Based on https://gist.github.com/benjchristensen/04eef9ca0851f3a5d7bf | |
*/ | |
public class EventBus<T> { | |
private static EventBus<Object> INSTANCE; | |
private List<T> events; |
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
headerTrackScrollListener = new RecyclerView.OnScrollListener() { | |
@Override | |
public void onScrolled(RecyclerView recyclerView, int dx, int dy) { | |
super.onScrolled(recyclerView, dx, dy); | |
float sentinelYPos = adapter.getSentinelViewYPos(); | |
if (sentinelYPos >= Utility.getScreenHeight(getContext()) || !areAuxiliaryTouchEventsEnabled) { | |
return; | |
} | |
float topOfListScrollY = sentinelYPos - headerHeight; |
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
public interface NestedScrollingParent { | |
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes); | |
public void onNestedScrollAccepted(View child, View target, int nestedScrollAxes); | |
public void onStopNestedScroll(View target); | |
public void onNestedScroll(View target, int dxConsumed, int dyConsumed, | |
int dxUnconsumed, int dyUnconsumed); | |
public void onNestedPreScroll(View target, int dx, int dy, int[] consumed); | |
public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed); | |
public boolean onNestedPreFling(View target, float velocityX, float velocityY); | |
public int getNestedScrollAxes(); |
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
/** | |
* Need to return true here to continue hearing updates from the child | |
* for the duration of the scroll | |
*/ | |
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) { | |
return true; | |
} | |
@Override | |
public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) { |
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
/** | |
* RangeBar is a bar that allows a user to define a range of values by moving two thumbs. | |
* | |
* Normalized value refers to a number as it exists in a range from [min, max] | |
* Px value refers to a number as it exists in a range from [startX, endX] | |
*/ | |
class RangeBar : View { | |
companion object { | |
// The diameter of the circle |
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.basebeta.utility.logging.kprint | |
import kotlinx.atomicfu.atomic | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.channels.BroadcastChannel | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.flow.* | |
/** | |
* Only can use with coroutines 1.3.6-native-mt. See alternative implementation at the bottom for 1.3.5 and under. | |
* |
OlderNewer