mirror of
https://github.com/wismna/DoNext.git
synced 2025-10-03 15:40:14 -04:00
Tab arrows now have dedicated space
Right scrolling detection finally works correctly New task floating action button icon is now white
This commit is contained in:
@@ -218,16 +218,15 @@ public class MainActivity extends AppCompatActivity implements TasksFragment.Tas
|
||||
private void toggleTabLayoutArrows(int scrollX){
|
||||
// Hide left arrow when scrolled to the left
|
||||
View leftArrow = findViewById(R.id.left_arrow);
|
||||
if (scrollX <= 1) leftArrow.setVisibility(View.GONE);
|
||||
if (scrollX <= 1) leftArrow.setVisibility(View.INVISIBLE);
|
||||
else leftArrow.setVisibility(View.VISIBLE);
|
||||
|
||||
// TODO: hide right arrow when no need to scroll
|
||||
// Hide right arrow when scrolled to the right
|
||||
View rightArrow = findViewById(R.id.right_arrow);
|
||||
Point size = new Point();
|
||||
getWindowManager().getDefaultDisplay().getSize(size);
|
||||
if (scrollX == tabLayout.getChildAt(0).getMeasuredWidth() - size.x)
|
||||
rightArrow.setVisibility(View.GONE);
|
||||
if (scrollX == tabLayout.getChildAt(0).getMeasuredWidth() - tabLayout.getMeasuredWidth())
|
||||
rightArrow.setVisibility(View.INVISIBLE);
|
||||
else rightArrow.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
@@ -48,6 +48,10 @@
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@+id/left_arrow"
|
||||
android:layout_toEndOf="@+id/left_arrow"
|
||||
android:layout_toLeftOf="@+id/right_arrow"
|
||||
android:layout_toStartOf="@+id/right_arrow"
|
||||
app:tabMode="scrollable" />
|
||||
</RelativeLayout>
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
@@ -65,5 +69,5 @@
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:onClick="onNewTaskClick"
|
||||
android:src="@android:drawable/ic_input_add" />
|
||||
android:src="@drawable/ic_add_white_24dp" />
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
Reference in New Issue
Block a user