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:
2016-02-04 19:12:53 -05:00
parent 9b00e08cd7
commit a514a8ce8f
2 changed files with 8 additions and 5 deletions

View File

@@ -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);
} }

View File

@@ -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>