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){
|
private void toggleTabLayoutArrows(int scrollX){
|
||||||
// Hide left arrow when scrolled to the left
|
// Hide left arrow when scrolled to the left
|
||||||
View leftArrow = findViewById(R.id.left_arrow);
|
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);
|
else leftArrow.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
// TODO: hide right arrow when no need to scroll
|
|
||||||
// Hide right arrow when scrolled to the right
|
// Hide right arrow when scrolled to the right
|
||||||
View rightArrow = findViewById(R.id.right_arrow);
|
View rightArrow = findViewById(R.id.right_arrow);
|
||||||
Point size = new Point();
|
Point size = new Point();
|
||||||
getWindowManager().getDefaultDisplay().getSize(size);
|
getWindowManager().getDefaultDisplay().getSize(size);
|
||||||
if (scrollX == tabLayout.getChildAt(0).getMeasuredWidth() - size.x)
|
if (scrollX == tabLayout.getChildAt(0).getMeasuredWidth() - tabLayout.getMeasuredWidth())
|
||||||
rightArrow.setVisibility(View.GONE);
|
rightArrow.setVisibility(View.INVISIBLE);
|
||||||
else rightArrow.setVisibility(View.VISIBLE);
|
else rightArrow.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,6 +48,10 @@
|
|||||||
android:id="@+id/tabs"
|
android:id="@+id/tabs"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
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" />
|
app:tabMode="scrollable" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
@@ -65,5 +69,5 @@
|
|||||||
android:layout_gravity="end|bottom"
|
android:layout_gravity="end|bottom"
|
||||||
android:layout_margin="@dimen/fab_margin"
|
android:layout_margin="@dimen/fab_margin"
|
||||||
android:onClick="onNewTaskClick"
|
android:onClick="onNewTaskClick"
|
||||||
android:src="@android:drawable/ic_input_add" />
|
android:src="@drawable/ic_add_white_24dp" />
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
Reference in New Issue
Block a user