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.content.Context; | |
import android.graphics.SurfaceTexture; | |
import android.opengl.EGL14; | |
import android.opengl.EGLExt; | |
import android.opengl.GLDebugHelper; | |
import android.opengl.GLSurfaceView; | |
import android.os.Trace; | |
import android.util.AttributeSet; | |
import android.util.Log; | |
import android.view.TextureView; |
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 SizeHelper @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : ConstraintHelper(context, attrs, defStyleAttr) { | |
private val screenHeight: Int = resources.displayMetrics.heightPixels | |
private val screenWidth: Int = resources.displayMetrics.widthPixels | |
private var layoutConstraintScreenHeightPercent = UNSPECIFIED_CONSTRAINT_SCREEN_PERCENT |
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
public class ScrollingSwipeRefreshLayoutBehavior extends AppBarLayout.ScrollingViewBehavior { | |
@Override | |
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) { | |
return super.layoutDependsOn(parent, child, dependency) || (dependency instanceof AppBarLayout); | |
} | |
@Override | |
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) { | |
boolean returnValue = super.onDependentViewChanged(parent, child, dependency); |
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
<android.support.design.widget.FloatingActionButton | |
android:id="@+id/fabButton" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="end|bottom" | |
android:layout_margin="@dimen/fab_margin" | |
android:src="@drawable/ic_favorite_outline_white_24dp" | |
app:borderWidth="0dp" | |
app:layout_behavior="pl.michalz.hideonscrollexample.ScrollingFABBehavior" /> |
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
public class ScrollingFABBehavior extends CoordinatorLayout.Behavior<FloatingActionButton> { | |
private int toolbarHeight; | |
public ScrollingFABBehavior(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
this.toolbarHeight = Utils.getToolbarHeight(context); | |
} | |
@Override | |
public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionButton fab, View dependency) { |
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
<android.support.design.widget.FloatingActionButton | |
android:id="@+id/fabButton" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="end|bottom" | |
android:layout_margin="@dimen/fab_margin" | |
android:src="@drawable/ic_favorite_outline_white_24dp" | |
app:borderWidth="0dp" /> |
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
<android.support.v7.widget.Toolbar | |
android:id="@+id/toolbar" | |
android:layout_width="match_parent" | |
android:layout_height="?attr/actionBarSize" | |
android:background="?attr/colorPrimary" | |
app:layout_scrollFlags="scroll|enterAlways" /> |
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
<android.support.v4.view.ViewPager | |
android:id="@+id/viewPager" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
app:layout_behavior="@string/appbar_scrolling_view_behavior"/> |
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 void initViewPagerAndTabs() { | |
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); | |
PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager()); | |
pagerAdapter.addFragment(PartThreeFragment.createInstance(20), getString(R.string.tab_1)); | |
pagerAdapter.addFragment(PartThreeFragment.createInstance(4), getString(R.string.tab_2)); | |
viewPager.setAdapter(pagerAdapter); | |
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout); | |
tabLayout.setupWithViewPager(viewPager); | |
} |
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"?> | |
<android.support.design.widget.CoordinatorLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/coordinatorLayout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.design.widget.AppBarLayout | |
android:id="@+id/appBarLayout" |
NewerOlder