FAB no longer attached to the album/artist footer but placed on the bottom to avoid confusion about the FABs action. Added offset to the bottom. Solves issue #26

This commit is contained in:
Karim Abou Zeid 2015-05-23 12:41:18 +02:00
commit c96e5f42b9
8 changed files with 37 additions and 29 deletions

View file

@ -67,6 +67,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
private int titleViewHeight;
private int albumArtViewHeight;
private int toolbarColor;
private int bottomOffset;
private final SmallObservableScrollViewCallbacks observableScrollViewCallbacks = new SmallObservableScrollViewCallbacks() {
@Override
@ -92,10 +93,6 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
titleTranslationY = Math.max(headerOffset, titleTranslationY);
ViewHelper.setTranslationY(albumTitleView, titleTranslationY);
// Translate FAB
int fabTranslationY = titleTranslationY + titleViewHeight - (getFab().getHeight() / 2);
ViewHelper.setTranslationY(getFab(), fabTranslationY);
}
};
@ -155,6 +152,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
}
private void setUpObservableListViewParams() {
bottomOffset = getResources().getDimensionPixelSize(R.dimen.bottom_offset_fab_activity);
albumArtViewHeight = getResources().getDimensionPixelSize(R.dimen.header_image_height);
toolbarColor = DialogUtils.resolveColor(this, R.attr.default_bar_color);
int toolbarHeight = Util.getActionBarSize(this);
@ -259,7 +257,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
private void setUpListView() {
recyclerView.setScrollViewCallbacks(observableScrollViewCallbacks);
recyclerView.setPadding(0, albumArtViewHeight + titleViewHeight, 0, 0);
recyclerView.setPadding(0, albumArtViewHeight + titleViewHeight, 0, bottomOffset);
final View contentView = getWindow().getDecorView().findViewById(android.R.id.content);
contentView.post(new Runnable() {
@Override

View file

@ -77,6 +77,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
private int titleViewHeight;
private int artistImageViewHeight;
private int toolbarColor;
private int bottomOffset;
private View songListHeader;
private RecyclerView albumRecyclerView;
@ -107,10 +108,6 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
titleTranslationY = Math.max(headerOffset, titleTranslationY);
ViewHelper.setTranslationY(artistNameTv, titleTranslationY);
// Translate FAB
int fabTranslationY = titleTranslationY + titleViewHeight - (getFab().getHeight() / 2);
ViewHelper.setTranslationY(getFab(), fabTranslationY);
}
};
@ -168,6 +165,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
}
private void setUpObservableListViewParams() {
bottomOffset = getResources().getDimensionPixelSize(R.dimen.bottom_offset_fab_activity);
artistImageViewHeight = getResources().getDimensionPixelSize(R.dimen.header_image_height);
toolbarColor = DialogUtils.resolveColor(this, R.attr.default_bar_color);
int toolbarHeight = Util.getActionBarSize(this);
@ -207,7 +205,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
private void setUpSongListView() {
songListView.setScrollViewCallbacks(observableScrollViewCallbacks);
songListView.setPadding(0, artistImageViewHeight + titleViewHeight, 0, 0);
songListView.setPadding(0, artistImageViewHeight + titleViewHeight, 0, bottomOffset);
songListView.addHeaderView(songListHeader);
final ArrayList<Song> songs = ArtistSongLoader.getArtistSongList(this, artist.id);

View file

@ -26,7 +26,7 @@ public abstract class AbsMainActivityFragment extends Fragment implements KabVie
}
protected int getBottomPadding() {
return 0;
return getResources().getDimensionPixelSize(R.dimen.bottom_offset_fab_activity);
}
@Override