Fixed artist and album viewers from previous commits, need to re-add translucent status bars there for Lollipop and KitKat
This commit is contained in:
parent
3028b96634
commit
872987bfc5
4 changed files with 43 additions and 24 deletions
|
|
@ -56,15 +56,15 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
private Album album;
|
||||
|
||||
private ObservableRecyclerView recyclerView;
|
||||
private View statusBar;
|
||||
private ImageView albumArtImageView;
|
||||
private View songsBackgroundView;
|
||||
private TextView albumTitleView;
|
||||
private Toolbar toolbar;
|
||||
private int headerOffset;
|
||||
private int titleViewHeight;
|
||||
private int albumArtViewHeight;
|
||||
private int toolbarColor;
|
||||
public Toolbar toolbar;
|
||||
|
||||
private final SmallObservableScrollViewCallbacks observableScrollViewCallbacks = new SmallObservableScrollViewCallbacks() {
|
||||
@Override
|
||||
public void onScrollChanged(int scrollY, boolean b, boolean b2) {
|
||||
|
|
@ -81,6 +81,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
// Change alpha of overlay
|
||||
float alpha = Math.max(0, Math.min(1, (float) scrollY / flexibleRange));
|
||||
ViewUtil.setBackgroundAlpha(toolbar, alpha, toolbarColor);
|
||||
ViewUtil.setBackgroundAlpha(statusBar, alpha, toolbarColor);
|
||||
|
||||
// Translate name text
|
||||
int maxTitleTranslationY = albumArtViewHeight;
|
||||
|
|
@ -120,11 +121,8 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
|
||||
initViews();
|
||||
setUpObservableListViewParams();
|
||||
setUpToolBar();
|
||||
setUpViews();
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setTitle(null);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -143,11 +141,12 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
}
|
||||
|
||||
private void initViews() {
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
albumArtImageView = (ImageView) findViewById(R.id.album_art);
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
recyclerView = (ObservableRecyclerView) findViewById(R.id.list);
|
||||
albumTitleView = (TextView) findViewById(R.id.album_title);
|
||||
songsBackgroundView = findViewById(R.id.list_background);
|
||||
statusBar = findViewById(R.id.statusBar);
|
||||
}
|
||||
|
||||
private void setUpObservableListViewParams() {
|
||||
|
|
@ -156,8 +155,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
int toolbarHeight = Util.getActionBarSize(this);
|
||||
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
||||
headerOffset = toolbarHeight;
|
||||
if (Util.hasKitKatSDK() && !Util.hasLollipopSDK())
|
||||
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
||||
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
||||
}
|
||||
|
||||
private void setUpViews() {
|
||||
|
|
@ -241,6 +239,12 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
});
|
||||
}
|
||||
|
||||
private void setUpToolBar() {
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setTitle(null);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
||||
private void setUpSongsAdapter() {
|
||||
final ArrayList<Song> songs = AlbumSongLoader.getAlbumSongList(this, album.id, new SongTrackNumberComparator());
|
||||
final AlbumSongAdapter albumSongAdapter = new AlbumSongAdapter(this, songs);
|
||||
|
|
@ -317,4 +321,4 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
super.onDestroy();
|
||||
App.bus.unregister(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,14 +65,15 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
private Artist artist;
|
||||
|
||||
private ObservableListView songListView;
|
||||
private View statusBar;
|
||||
private ImageView artistImage;
|
||||
private View songsBackgroundView;
|
||||
private TextView artistNameTv;
|
||||
private Toolbar toolbar;
|
||||
private int headerOffset;
|
||||
private int titleViewHeight;
|
||||
private int artistImageViewHeight;
|
||||
private int toolbarColor;
|
||||
public Toolbar toolbar;
|
||||
|
||||
private View songListHeader;
|
||||
private RecyclerView albumRecyclerView;
|
||||
|
|
@ -94,6 +95,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
// Change alpha of overlay
|
||||
float alpha = Math.max(0, Math.min(1, (float) scrollY / flexibleRange));
|
||||
ViewUtil.setBackgroundAlpha(toolbar, alpha, toolbarColor);
|
||||
ViewUtil.setBackgroundAlpha(statusBar, alpha, toolbarColor);
|
||||
|
||||
// Translate name text
|
||||
int maxTitleTranslationY = artistImageViewHeight;
|
||||
|
|
@ -108,6 +110,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
|
@ -145,11 +148,12 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
}
|
||||
|
||||
private void initViews() {
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
artistImage = (ImageView) findViewById(R.id.artist_image);
|
||||
toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
songListView = (ObservableListView) findViewById(R.id.list);
|
||||
artistNameTv = (TextView) findViewById(R.id.artist_name);
|
||||
songsBackgroundView = findViewById(R.id.list_background);
|
||||
statusBar = findViewById(R.id.statusBar);
|
||||
|
||||
songListHeader = LayoutInflater.from(this).inflate(R.layout.artist_detail_header, songListView, false);
|
||||
albumRecyclerView = (RecyclerView) songListHeader.findViewById(R.id.recycler_view);
|
||||
|
|
@ -161,8 +165,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
int toolbarHeight = Util.getActionBarSize(this);
|
||||
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
||||
headerOffset = toolbarHeight;
|
||||
if (Util.hasKitKatSDK() && !Util.hasLollipopSDK())
|
||||
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
||||
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -429,4 +432,4 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
super.onDestroy();
|
||||
App.bus.unregister(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,9 +16,7 @@
|
|||
android:id="@+id/list_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/colorBackground"
|
||||
android:elevation="@dimen/toolbar_elevation"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
android:background="?android:attr/colorBackground" />
|
||||
|
||||
<com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView
|
||||
android:id="@+id/list"
|
||||
|
|
@ -32,7 +30,9 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:elevation="@dimen/toolbar_elevation"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/album_title"
|
||||
|
|
@ -62,6 +62,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/statusBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/statusMargin"
|
||||
android:background="@android:color/transparent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
|
|
@ -77,4 +84,4 @@
|
|||
android:layout_marginRight="16dp"
|
||||
tools:ignore="RtlHardcoded" />
|
||||
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
|
|
@ -16,9 +16,7 @@
|
|||
android:id="@+id/list_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/colorBackground"
|
||||
android:elevation="@dimen/toolbar_elevation"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
android:background="?android:attr/colorBackground" />
|
||||
|
||||
<com.github.ksoichiro.android.observablescrollview.ObservableListView
|
||||
android:id="@+id/list"
|
||||
|
|
@ -62,6 +60,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/statusBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/statusMargin"
|
||||
android:background="@android:color/transparent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
|
|
@ -77,4 +82,4 @@
|
|||
android:layout_marginRight="16dp"
|
||||
tools:ignore="RtlHardcoded" />
|
||||
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue