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

@ -24,8 +24,8 @@ android {
applicationId "com.kabouzeid.gramophone"
minSdkVersion 16
targetSdkVersion 22
versionCode 24
versionName "0.9.9.4b"
versionCode 25
versionName "0.9.10b"
}
compileOptions {

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

View file

@ -74,12 +74,18 @@
</LinearLayout>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
style="@style/PlayPauseFab"
android:layout_gravity="right|end"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
tools:ignore="RtlHardcoded" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|right|bottom"
android:fitsSystemWindows="true"
tools:ignore="RtlHardcoded">
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
style="@style/PlayPauseFab"
android:layout_margin="16dp" />
</LinearLayout>
</FrameLayout>

View file

@ -74,12 +74,18 @@
</LinearLayout>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
style="@style/PlayPauseFab"
android:layout_gravity="right|end"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
tools:ignore="RtlHardcoded" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|right|bottom"
android:fitsSystemWindows="true"
tools:ignore="RtlHardcoded">
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
style="@style/PlayPauseFab"
android:layout_margin="16dp" />
</LinearLayout>
</FrameLayout>

View file

@ -21,7 +21,7 @@
android:clipToPadding="false"
android:divider="@null"
android:dividerHeight="0px"
android:paddingBottom="@dimen/playlist_list_bottom_offset"
android:paddingBottom="@dimen/bottom_offset_fab_activity"
android:scrollbars="vertical" />
</LinearLayout>

View file

@ -48,5 +48,5 @@ http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
<dimen name="list_padding_vertical">2dp</dimen>
<dimen name="notification_albumart_size">128dp</dimen>
<dimen name="playlist_list_bottom_offset">86dp</dimen>
<dimen name="bottom_offset_fab_activity">86dp</dimen>
</resources>