Reverted some changes which caused big performance issues #22

This commit is contained in:
Karim Abou Zeid 2015-04-18 12:17:12 +02:00
commit 8fbcf5ffb4
4 changed files with 16 additions and 26 deletions

View file

@ -22,7 +22,6 @@ import com.kabouzeid.gramophone.App;
import com.kabouzeid.gramophone.R; import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.adapter.songadapter.AlbumSongAdapter; import com.kabouzeid.gramophone.adapter.songadapter.AlbumSongAdapter;
import com.kabouzeid.gramophone.comparator.SongTrackNumberComparator; import com.kabouzeid.gramophone.comparator.SongTrackNumberComparator;
import com.kabouzeid.gramophone.dialogs.ColorChooserDialog;
import com.kabouzeid.gramophone.helper.MusicPlayerRemote; import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
import com.kabouzeid.gramophone.interfaces.PaletteColorHolder; import com.kabouzeid.gramophone.interfaces.PaletteColorHolder;
import com.kabouzeid.gramophone.loader.AlbumLoader; import com.kabouzeid.gramophone.loader.AlbumLoader;
@ -57,6 +56,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
private Album album; private Album album;
private ObservableRecyclerView recyclerView; private ObservableRecyclerView recyclerView;
private View statusBar;
private ImageView albumArtImageView; private ImageView albumArtImageView;
private View songsBackgroundView; private View songsBackgroundView;
private TextView albumTitleView; private TextView albumTitleView;
@ -82,10 +82,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
// Change alpha of overlay // Change alpha of overlay
float alpha = Math.max(0, Math.min(1, (float) scrollY / flexibleRange)); float alpha = Math.max(0, Math.min(1, (float) scrollY / flexibleRange));
ViewUtil.setBackgroundAlpha(toolbar, alpha, toolbarColor); ViewUtil.setBackgroundAlpha(toolbar, alpha, toolbarColor);
// Status bar color is a darker shade of the toolbar color with equal opacity ViewUtil.setBackgroundAlpha(statusBar, alpha, toolbarColor);
int a = Math.min(255, Math.max(0, (int) (alpha * 255))) << 24;
int rgb = 0x00ffffff & ColorChooserDialog.shiftColorDown(toolbarColor);
setStatusBarColor(a + rgb, true);
// Translate name text // Translate name text
int maxTitleTranslationY = albumArtViewHeight; int maxTitleTranslationY = albumArtViewHeight;
@ -157,7 +154,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
recyclerView = (ObservableRecyclerView) findViewById(R.id.list); recyclerView = (ObservableRecyclerView) findViewById(R.id.list);
albumTitleView = (TextView) findViewById(R.id.album_title); albumTitleView = (TextView) findViewById(R.id.album_title);
songsBackgroundView = findViewById(R.id.list_background); songsBackgroundView = findViewById(R.id.list_background);
// statusBar = findViewById(R.id.statusBar); statusBar = findViewById(R.id.statusBar);
} }
private void setUpObservableListViewParams() { private void setUpObservableListViewParams() {

View file

@ -28,7 +28,6 @@ import com.kabouzeid.gramophone.App;
import com.kabouzeid.gramophone.R; import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.adapter.ArtistAlbumAdapter; import com.kabouzeid.gramophone.adapter.ArtistAlbumAdapter;
import com.kabouzeid.gramophone.adapter.songadapter.ArtistSongAdapter; import com.kabouzeid.gramophone.adapter.songadapter.ArtistSongAdapter;
import com.kabouzeid.gramophone.dialogs.ColorChooserDialog;
import com.kabouzeid.gramophone.helper.MusicPlayerRemote; import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
import com.kabouzeid.gramophone.interfaces.PaletteColorHolder; import com.kabouzeid.gramophone.interfaces.PaletteColorHolder;
import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistBiographyLoader; import com.kabouzeid.gramophone.lastfm.artist.LastFMArtistBiographyLoader;
@ -66,6 +65,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
private Artist artist; private Artist artist;
private ObservableListView songListView; private ObservableListView songListView;
private View statusBar;
private ImageView artistImage; private ImageView artistImage;
private View songsBackgroundView; private View songsBackgroundView;
private TextView artistNameTv; private TextView artistNameTv;
@ -95,10 +95,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
// Change alpha of overlay // Change alpha of overlay
float alpha = Math.max(0, Math.min(1, (float) scrollY / flexibleRange)); float alpha = Math.max(0, Math.min(1, (float) scrollY / flexibleRange));
ViewUtil.setBackgroundAlpha(toolbar, alpha, toolbarColor); ViewUtil.setBackgroundAlpha(toolbar, alpha, toolbarColor);
// Status bar color is a darker shade of the toolbar color with equal opacity ViewUtil.setBackgroundAlpha(statusBar, alpha, toolbarColor);
int a = Math.min(255, Math.max(0, (int) (alpha * 255))) << 24;
int rgb = 0x00ffffff & ColorChooserDialog.shiftColorDown(toolbarColor);
setStatusBarColor(a + rgb, true);
// Translate name text // Translate name text
int maxTitleTranslationY = artistImageViewHeight; int maxTitleTranslationY = artistImageViewHeight;
@ -163,7 +160,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
songListView = (ObservableListView) findViewById(R.id.list); songListView = (ObservableListView) findViewById(R.id.list);
artistNameTv = (TextView) findViewById(R.id.artist_name); artistNameTv = (TextView) findViewById(R.id.artist_name);
songsBackgroundView = findViewById(R.id.list_background); songsBackgroundView = findViewById(R.id.list_background);
// statusBar = findViewById(R.id.statusBar); statusBar = findViewById(R.id.statusBar);
songListHeader = LayoutInflater.from(this).inflate(R.layout.artist_detail_header, songListView, false); songListHeader = LayoutInflater.from(this).inflate(R.layout.artist_detail_header, songListView, false);
albumRecyclerView = (RecyclerView) songListHeader.findViewById(R.id.recycler_view); albumRecyclerView = (RecyclerView) songListHeader.findViewById(R.id.recycler_view);

View file

@ -60,17 +60,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<!--<ImageView--> <ImageView
<!--android:id="@+id/statusBar"--> android:id="@+id/statusBar"
<!--android:layout_width="match_parent"--> android:layout_width="match_parent"
<!--android:layout_height="@dimen/statusMargin"--> android:layout_height="@dimen/statusMargin"
<!--android:background="@android:color/transparent"--> android:background="@android:color/transparent" />
<!--tools:ignore="ContentDescription" />-->
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
android:layout_marginTop="@dimen/statusMargin"
android:background="@android:color/transparent" /> android:background="@android:color/transparent" />
</LinearLayout> </LinearLayout>

View file

@ -60,17 +60,15 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<!--<ImageView--> <ImageView
<!--android:id="@+id/statusBar"--> android:id="@+id/statusBar"
<!--android:layout_width="match_parent"--> android:layout_width="match_parent"
<!--android:layout_height="@dimen/statusMargin"--> android:layout_height="@dimen/statusMargin"
<!--android:background="@android:color/transparent"--> android:background="@android:color/transparent" />
<!--tools:ignore="ContentDescription" />-->
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
android:layout_marginTop="@dimen/statusMargin"
android:background="@android:color/transparent" /> android:background="@android:color/transparent" />
</LinearLayout> </LinearLayout>