main
h4h13 2018-08-08 13:33:38 +05:30
parent 3d2adc1ca2
commit c648dcb378
84 changed files with 6018 additions and 5405 deletions

View File

@ -133,6 +133,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-libraries" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkNormalDebugClasspath" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
@ -141,18 +142,14 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_main_apk_resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_split_apk_resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/linked_res_for_bundle" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint_jar" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged-not-compiled-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/module_bundle" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-rules" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />

View File

@ -11,8 +11,8 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 207
versionName '1.7.10'
versionCode 209
versionName '1.7.100'
multiDexEnabled true
@ -86,7 +86,7 @@ static def getProperty(Properties properties, String name) {
}
static def getDate() {
new Date().format('yyyyMMdd')
new Date().format('MMdd')
}
ext {

View File

@ -26,7 +26,7 @@
</style>
</head>
<body style="padding: 1.0rem 0.5rem 2.5rem 0.5rem;">
<body style="padding: 1.0rem 0.5rem 1.0rem 0.5rem;">
<p><b><a href="https://github.com/kabouzeid/Phonograph" title="Phonograph"> Phonograph</a></b> by Karim Abou Zeid</p>
<p><b><a href="https://github.com/ReactiveX/RxAndroid" title="RxAndroid"> RxAndroid</a></b> by RxAndroid authors</p>
<p><b><a href="https://github.com/ReactiveX/RxAndroid" title="RxJava"> RxJava</a></b> by RxJava authors</p>

View File

@ -1 +1 @@
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: #{link-color}; } a:active { color: #{link-color-active}; } ol { list-style-position: inside; padding-left: 0; padding-right: 0; } li { padding-top: 8px; } </style> </head> <body> <p>You can view the changelog dialog again at any time from the <i>about</i> section.</p> <h3>Version 1.7.50</h3> <ol> <li><b>Fix:</b> Playlist renaming</li> <li><b>Improvement:</b> Version naming</li> <li><b>Added:</b> Changelog dialog</li> <li><b>Added:</b> Home banner toggle.</li> <li><b>Improvement:</b> Grammatical mistakes</li> </ol> </body>
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: #{link-color}; } a:active { color: #{link-color-active}; } ol { list-style-position: inside; padding-left: 0; padding-right: 0; } li { padding-top: 8px; } </style> </head> <body> <p>You can view the changelog dialog again at any time from the <i>about</i> section.</p> <h3>Version 1.7.100</h3> <ol> <li><b>Fix:</b> same theme follows entire app </li> <li><b>Added:</b> Volume toggle for lock screen to support small screen </li> <li><b>Added:</b> Volume toggle for lock screen to support small screen </li> </ol> <h3>Version 1.7.50</h3> <ol> <li><b>Fix:</b> Playlist renaming</li> <li><b>Improvement:</b> Version naming</li> <li><b>Added:</b> Changelog dialog</li> <li><b>Added:</b> Home banner toggle.</li> <li><b>Improvement:</b> Grammatical mistakes</li> </ol> </body>

View File

@ -110,7 +110,8 @@ public class HomeOptionDialog extends RoundedBottomSheetDialogFragment {
if (mainActivity == null) {
return;
}
mainActivity.setCurrentFragment(FoldersFragment.newInstance(getContext()), true);
mainActivity.setCurrentFragment(FoldersFragment.newInstance(getContext()), true,
FoldersFragment.TAG);
break;
case R.id.action_settings:
NavigationUtil.goToSettings(getActivity());

View File

@ -1,60 +1,63 @@
package code.name.monkey.retromusic.loaders;
import android.content.Context;
import android.support.annotation.NonNull;
import java.util.ArrayList;
import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist;
import code.name.monkey.retromusic.model.smartplaylist.HistoryPlaylist;
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist;
import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist;
import io.reactivex.Observable;
import java.util.ArrayList;
public class HomeLoader {
public static Observable<ArrayList<AbsSmartPlaylist>> getRecentAndTopThings(
@NonNull Context context) {
ArrayList<AbsSmartPlaylist> objects = new ArrayList<>();
return Observable.create(e -> {
public static Observable<ArrayList<AbsSmartPlaylist>> getRecentAndTopThings(
@NonNull Context context) {
ArrayList<AbsSmartPlaylist> objects = new ArrayList<>();
return Observable.create(e -> {
new HistoryPlaylist(context).getSongs(context).subscribe(songs -> {
if (!songs.isEmpty()) {
objects.add(new HistoryPlaylist(context));
}
});
new LastAddedPlaylist(context).getSongs(context).subscribe(songs -> {
if (!songs.isEmpty()) {
objects.add(new LastAddedPlaylist(context));
}
});
new MyTopTracksPlaylist(context).getSongs(context).subscribe(songs -> {
if (!songs.isEmpty()) {
objects.add(new MyTopTracksPlaylist(context));
}
});
new HistoryPlaylist(context).getSongs(context).subscribe(songs -> {
if (!songs.isEmpty()) {
objects.add(new HistoryPlaylist(context));
}
});
new LastAddedPlaylist(context).getSongs(context).subscribe(songs -> {
if (!songs.isEmpty()) {
objects.add(new LastAddedPlaylist(context));
}
});
new MyTopTracksPlaylist(context).getSongs(context).subscribe(songs -> {
if (!songs.isEmpty()) {
objects.add(new MyTopTracksPlaylist(context));
}
});
e.onNext(objects);
e.onComplete();
});
}
public static Observable<ArrayList<Playlist>> getHomeLoader(@NonNull Context context) {
ArrayList<Playlist> playlists = new ArrayList<>();
PlaylistLoader.getAllPlaylists(context)
.subscribe(playlists1 -> {
if (playlists1.size() > 0) {
for (Playlist playlist : playlists1) {
PlaylistSongsLoader.getPlaylistSongList(context, playlist)
.subscribe(songs -> {
if (songs.size() > 0) {
playlists.add(playlist);
}
});
}
}
e.onNext(objects);
e.onComplete();
});
return Observable.just(playlists);
}
}
public static Observable<ArrayList<Playlist>> getHomeLoader(@NonNull Context context) {
ArrayList<Playlist> playlists = new ArrayList<>();
PlaylistLoader.getAllPlaylists(context)
.subscribe(playlists1 -> {
if (playlists1.size() > 0) {
for (Playlist playlist : playlists1) {
PlaylistSongsLoader.getPlaylistSongList(context, playlist)
.subscribe(songs -> {
if (songs.size() > 0) {
playlists.add(playlist);
}
});
}
}
});
return Observable.just(playlists);
}
}

View File

@ -1,6 +1,6 @@
package code.name.monkey.retromusic.model;
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist;
import android.support.annotation.StringRes;
import java.util.ArrayList;
@ -10,41 +10,20 @@ import java.util.ArrayList;
*/
public class Home {
public String sectionTitle;
public ArrayList<Object> list;
public AbsSmartPlaylist playlist;
public Home(String sectionTitle, AbsSmartPlaylist playlist) {
this.sectionTitle = sectionTitle;
this.playlist = playlist;
}
private int sectionTitle;
private ArrayList list;
public Home(String sectionTitle, ArrayList<Object> list) {
public Home(@StringRes int sectionTitle, ArrayList list) {
this.sectionTitle = sectionTitle;
this.list = list;
}
public Home(AbsSmartPlaylist playlist) {
this.playlist = playlist;
}
public AbsSmartPlaylist getPlaylist() {
return playlist;
}
@Override
public String toString() {
return "Home{" +
"sectionTitle='" + sectionTitle + '\'' +
", songs=" + list +
'}';
}
public String getSectionTitle() {
public int getSectionTitle() {
return sectionTitle;
}
public ArrayList<Object> getList() {
public ArrayList getList() {
return list;
}
}

View File

@ -1,15 +1,14 @@
package code.name.monkey.retromusic.mvp.contract;
import java.util.ArrayList;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.model.Artist;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist;
import code.name.monkey.retromusic.mvp.BasePresenter;
import code.name.monkey.retromusic.mvp.BaseView;
import java.util.ArrayList;
public interface HomeContract {
interface HomeView extends BaseView<ArrayList<Object>> {
@ -41,4 +40,4 @@ public interface HomeContract {
void loadGenres();
}
}
}

View File

@ -2,12 +2,11 @@ package code.name.monkey.retromusic.providers;
import android.content.Context;
import code.name.monkey.retromusic.RetroApplication;
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist;
import java.io.File;
import java.util.ArrayList;
import code.name.monkey.retromusic.Injection;
import code.name.monkey.retromusic.RetroApplication;
import code.name.monkey.retromusic.loaders.AlbumLoader;
import code.name.monkey.retromusic.loaders.ArtistLoader;
import code.name.monkey.retromusic.loaders.GenreLoader;
@ -23,6 +22,7 @@ import code.name.monkey.retromusic.model.Artist;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist;
import code.name.monkey.retromusic.providers.interfaces.Repository;
import code.name.monkey.retromusic.rest.model.KuGouRawLyric;
import code.name.monkey.retromusic.rest.model.KuGouSearchLyricResult;
@ -39,7 +39,7 @@ public class RepositoryImpl implements Repository {
this.context = context;
}
public static synchronized RepositoryImpl getInstance( ) {
public static synchronized RepositoryImpl getInstance() {
if (INSTANCE == null) {
INSTANCE = new RepositoryImpl(RetroApplication.getInstance());
}

View File

@ -16,45 +16,45 @@ import java.util.ArrayList;
public interface Repository {
Observable<ArrayList<Song>> getAllSongs();
Observable<ArrayList<Song>> getAllSongs();
Observable<ArrayList<AbsSmartPlaylist>> getSuggestionSongs();
Observable<ArrayList<AbsSmartPlaylist>> getSuggestionSongs();
Observable<Song> getSong(int id);
Observable<Song> getSong(int id);
Observable<ArrayList<Album>> getAllAlbums();
Observable<ArrayList<Album>> getAllAlbums();
Observable<ArrayList<Album>> getRecentAlbums();
Observable<ArrayList<Album>> getRecentAlbums();
Observable<ArrayList<Album>> getTopAlbums();
Observable<ArrayList<Album>> getTopAlbums();
Observable<Album> getAlbum(int albumId);
Observable<Album> getAlbum(int albumId);
Observable<ArrayList<Artist>> getAllArtists();
Observable<ArrayList<Artist>> getAllArtists();
Observable<ArrayList<Artist>> getRecentArtists();
Observable<ArrayList<Artist>> getRecentArtists();
Observable<ArrayList<Artist>> getTopArtists();
Observable<ArrayList<Artist>> getTopArtists();
Observable<Artist> getArtistById(long artistId);
Observable<Artist> getArtistById(long artistId);
Observable<ArrayList<Playlist>> getAllPlaylists();
Observable<ArrayList<Playlist>> getAllPlaylists();
Observable<ArrayList<Song>> getFavoriteSongs();
Observable<ArrayList<Song>> getFavoriteSongs();
Observable<ArrayList<Object>> search(String query);
Observable<ArrayList<Object>> search(String query);
Observable<ArrayList<Song>> getPlaylistSongs(Playlist playlist);
Observable<ArrayList<Song>> getPlaylistSongs(Playlist playlist);
Observable<ArrayList<Playlist>> getHomeList();
Observable<ArrayList<Playlist>> getHomeList();
Observable<ArrayList<AbsSmartPlaylist>> getAllThings();
Observable<ArrayList<AbsSmartPlaylist>> getAllThings();
Observable<ArrayList<Genre>> getAllGenres();
Observable<ArrayList<Genre>> getAllGenres();
Observable<ArrayList<Song>> getGenre(int genreId);
Observable<ArrayList<Song>> getGenre(int genreId);
Observable<File> downloadLrcFile(final String title, final String artist, final long duration);
Observable<File> downloadLrcFile(final String title, final String artist, final long duration);
}
}

View File

@ -5,7 +5,6 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ShareCompat;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
@ -40,11 +39,16 @@ public class AboutActivity extends AbsBaseActivity {
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
View background;
@BindView(R.id.app_version)
TextView appVersion;
@BindView(R.id.title)
TextView title;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -62,7 +66,7 @@ public class AboutActivity extends AbsBaseActivity {
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
@ -71,13 +75,13 @@ public class AboutActivity extends AbsBaseActivity {
}
private void setUpToolbar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
int primaryColor = ThemeStore.primaryColor(this);
toolbar.setBackgroundColor(primaryColor);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
toolbar.setNavigationOnClickListener(v -> onBackPressed());
setTitle(null);
setSupportActionBar(toolbar);
//noinspection ConstantConditions
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@ -91,7 +95,7 @@ public class AboutActivity extends AbsBaseActivity {
@OnClick({R.id.app_github, R.id.faq_link, R.id.app_google_plus, R.id.app_translation,
R.id.app_rate, R.id.app_share, R.id.instagram_link, R.id.twitter_link, R.id.changelog,
R.id.open_source, R.id.discord_link, R.id.telegram_link})
R.id.open_source, R.id.discord_link, R.id.telegram_link, R.id.donate_link})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.faq_link:

View File

@ -86,9 +86,6 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
@BindView(R.id.app_bar)
@Nullable
AppBarLayout appBarLayout;
@BindView(R.id.image_container)
@Nullable
View imageContainer;
@BindView(R.id.content)
View contentContainer;
@BindView(R.id.toolbar)

View File

@ -25,6 +25,12 @@ import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@ -54,372 +60,370 @@ import code.name.monkey.retromusic.util.DensityUtil;
import code.name.monkey.retromusic.util.MusicUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroUtil;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.Locale;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implements
ArtistDetailContract.ArtistsDetailsView {
ArtistDetailContract.ArtistsDetailsView {
public static final String EXTRA_ARTIST_ID = "extra_artist_id";
private static final int REQUEST_CODE_SELECT_IMAGE = 9003;
@BindView(R.id.image)
ImageView image;
@BindView(R.id.biography)
TextView biographyTextView;
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
@BindView(R.id.album_recycler_view)
RecyclerView albumRecyclerView;
@BindView(R.id.album_title)
AppCompatTextView albumTitle;
@BindView(R.id.song_title)
AppCompatTextView songTitle;
@BindView(R.id.biography_title)
AppCompatTextView biographyTitle;
@BindView(R.id.title)
TextView title;
@BindView(R.id.text)
TextView text;
@BindView(R.id.action_shuffle_all)
FloatingActionButton shuffleButton;
@BindView(R.id.collapsing_toolbar)
@Nullable
CollapsingToolbarLayout collapsingToolbarLayout;
@BindView(R.id.app_bar)
@Nullable
AppBarLayout appBarLayout;
@BindView(R.id.gradient_background)
@Nullable
View background;
@BindView(R.id.image_container)
@Nullable
View imageContainer;
@BindView(R.id.content)
View contentContainer;
@BindView(R.id.toolbar)
Toolbar toolbar;
@Nullable
private Spanned biography;
private Artist artist;
private LastFMRestClient lastFMRestClient;
private ArtistDetailsPresenter artistDetailsPresenter;
private SimpleSongAdapter songAdapter;
private AlbumAdapter albumAdapter;
private boolean forceDownload;
public static final String EXTRA_ARTIST_ID = "extra_artist_id";
private static final int REQUEST_CODE_SELECT_IMAGE = 9003;
@BindView(R.id.app_bar)
@Nullable
AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar)
@Nullable
CollapsingToolbarLayout collapsingToolbarLayout;
@Override
protected View createContentView() {
return wrapSlidingMusicPanel(R.layout.activity_artist_details);
}
@BindView(R.id.image)
ImageView image;
@BindView(R.id.biography)
TextView biographyTextView;
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
@BindView(R.id.album_recycler_view)
RecyclerView albumRecyclerView;
@BindView(R.id.album_title)
AppCompatTextView albumTitle;
@BindView(R.id.song_title)
AppCompatTextView songTitle;
@BindView(R.id.biography_title)
AppCompatTextView biographyTitle;
@BindView(R.id.title)
TextView title;
@BindView(R.id.text)
TextView text;
@BindView(R.id.action_shuffle_all)
FloatingActionButton shuffleButton;
@BindView(R.id.gradient_background)
@Nullable
View background;
@BindView(R.id.image_container)
@Nullable
View imageContainer;
@BindView(R.id.content)
View contentContainer;
@BindView(R.id.toolbar)
Toolbar toolbar;
@Nullable
private Spanned biography;
private Artist artist;
private LastFMRestClient lastFMRestClient;
private ArtistDetailsPresenter artistDetailsPresenter;
private SimpleSongAdapter songAdapter;
private AlbumAdapter albumAdapter;
private boolean forceDownload;
@Override
protected void onCreate(Bundle bundle) {
setDrawUnderStatusBar(true);
super.onCreate(bundle);
ButterKnife.bind(this);
supportPostponeEnterTransition();
setBottomBarVisibility(View.GONE);
setNavigationbarColorAuto();
setLightNavigationBar(true);
lastFMRestClient = new LastFMRestClient(this);
setUpViews();
int artistID = getIntent().getIntExtra(EXTRA_ARTIST_ID, -1);
artistDetailsPresenter = new ArtistDetailsPresenter(this, artistID);
}
private void setUpViews() {
setupRecyclerView();
setupToolbar();
setupContainerHeight();
}
private void setupContainerHeight() {
if (imageContainer != null) {
LayoutParams params = imageContainer.getLayoutParams();
params.width = DensityUtil.getScreenHeight(this) / 2;
imageContainer.setLayoutParams(params);
}
}
private void setupToolbar() {
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
setSupportActionBar(toolbar);
//noinspection ConstantConditions
getSupportActionBar().setTitle(null);
if (toolbar != null && !PreferenceUtil.getInstance(this).getFullScreenMode()) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar
.getLayoutParams();
params.topMargin = RetroUtil.getStatusBarHeight(this);
toolbar.setLayoutParams(params);
@Override
protected View createContentView() {
return wrapSlidingMusicPanel(R.layout.activity_artist_details);
}
int primaryColor = ThemeStore.primaryColor(this);
TintHelper.setTintAuto(contentContainer, primaryColor, true);
@Override
protected void onCreate(Bundle bundle) {
setDrawUnderStatusBar(true);
super.onCreate(bundle);
ButterKnife.bind(this);
if (appBarLayout != null) {
appBarLayout.setBackgroundColor(primaryColor);
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout,
AppBarStateChangeListener.State state) {
int color;
switch (state) {
case COLLAPSED:
setLightStatusbar(!ATHUtil.isWindowBackgroundDark(ArtistDetailActivity.this));
color = ATHUtil.resolveColor(ArtistDetailActivity.this, R.attr.iconColor);
break;
supportPostponeEnterTransition();
setBottomBarVisibility(View.GONE);
setNavigationbarColorAuto();
setLightNavigationBar(true);
lastFMRestClient = new LastFMRestClient(this);
setUpViews();
int artistID = getIntent().getIntExtra(EXTRA_ARTIST_ID, -1);
artistDetailsPresenter = new ArtistDetailsPresenter(this, artistID);
}
private void setUpViews() {
setupRecyclerView();
setupToolbar();
setupContainerHeight();
}
private void setupContainerHeight() {
if (imageContainer != null) {
LayoutParams params = imageContainer.getLayoutParams();
params.width = DensityUtil.getScreenHeight(this) / 2;
imageContainer.setLayoutParams(params);
}
}
private void setupToolbar() {
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
setSupportActionBar(toolbar);
//noinspection ConstantConditions
getSupportActionBar().setTitle(null);
if (toolbar != null && !PreferenceUtil.getInstance(this).getFullScreenMode()) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar
.getLayoutParams();
params.topMargin = RetroUtil.getStatusBarHeight(this);
toolbar.setLayoutParams(params);
}
int primaryColor = ThemeStore.primaryColor(this);
TintHelper.setTintAuto(contentContainer, primaryColor, true);
if (appBarLayout != null) {
appBarLayout.setBackgroundColor(primaryColor);
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout,
AppBarStateChangeListener.State state) {
int color;
switch (state) {
case COLLAPSED:
setLightStatusbar(!ATHUtil.isWindowBackgroundDark(ArtistDetailActivity.this));
color = ATHUtil.resolveColor(ArtistDetailActivity.this, R.attr.iconColor);
break;
default:
case EXPANDED:
case IDLE:
setLightStatusbar(false);
color = ContextCompat.getColor(ArtistDetailActivity.this, R.color.md_white_1000);
break;
}
ToolbarContentTintHelper.colorizeToolbar(toolbar, color, ArtistDetailActivity.this);
}
});
}
if (collapsingToolbarLayout != null) {
collapsingToolbarLayout.setContentScrimColor(primaryColor);
collapsingToolbarLayout.setStatusBarScrimColor(ColorUtil.darkenColor(primaryColor));
}
}
private void setupRecyclerView() {
albumAdapter = new HorizontalAlbumAdapter(this, new ArrayList<>(), false, null);
albumRecyclerView.setItemAnimator(new DefaultItemAnimator());
albumRecyclerView
.setLayoutManager(new GridLayoutManager(this, 1, GridLayoutManager.HORIZONTAL, false));
albumRecyclerView.setAdapter(albumAdapter);
songAdapter = new SimpleSongAdapter(this, new ArrayList<>(), R.layout.item_song);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(songAdapter);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_CODE_SELECT_IMAGE:
if (resultCode == RESULT_OK) {
CustomArtistImageUtil.getInstance(this).setCustomArtistImage(artist, data.getData());
}
break;
default:
case EXPANDED:
case IDLE:
setLightStatusbar(false);
color = ContextCompat.getColor(ArtistDetailActivity.this, R.color.md_white_1000);
break;
}
ToolbarContentTintHelper.colorizeToolbar(toolbar, color, ArtistDetailActivity.this);
if (resultCode == RESULT_OK) {
reload();
}
break;
}
});
}
if (collapsingToolbarLayout != null) {
collapsingToolbarLayout.setContentScrimColor(primaryColor);
collapsingToolbarLayout.setStatusBarScrimColor(ColorUtil.darkenColor(primaryColor));
@Override
protected void onResume() {
super.onResume();
artistDetailsPresenter.subscribe();
}
}
private void setupRecyclerView() {
albumAdapter = new HorizontalAlbumAdapter(this, new ArrayList<>(), false, null);
albumRecyclerView.setItemAnimator(new DefaultItemAnimator());
albumRecyclerView
.setLayoutManager(new GridLayoutManager(this, 1, GridLayoutManager.HORIZONTAL, false));
albumRecyclerView.setAdapter(albumAdapter);
@Override
protected void onPause() {
super.onPause();
artistDetailsPresenter.unsubscribe();
}
songAdapter = new SimpleSongAdapter(this, new ArrayList<>(), R.layout.item_song);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(songAdapter);
}
@Override
public void loading() {
}
@Override
public void showEmptyView() {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_CODE_SELECT_IMAGE:
if (resultCode == RESULT_OK) {
CustomArtistImageUtil.getInstance(this).setCustomArtistImage(artist, data.getData());
}
@Override
public void completed() {
supportStartPostponedEnterTransition();
}
@Override
public void showData(Artist artist) {
setArtist(artist);
}
private Artist getArtist() {
if (artist == null) {
artist = new Artist();
}
break;
default:
if (resultCode == RESULT_OK) {
reload();
return artist;
}
private void setArtist(Artist artist) {
if (artist.getSongCount() <= 0) {
finish();
}
break;
this.artist = artist;
loadArtistImage();
if (RetroUtil.isAllowedToDownloadMetadata(this)) {
loadBiography();
}
title.setText(artist.getName());
text.setText(String.format("%s • %s", MusicUtil.getArtistInfoString(this, artist), MusicUtil
.getReadableDurationString(MusicUtil.getTotalDuration(this, artist.getSongs()))));
songAdapter.swapDataSet(artist.getSongs());
albumAdapter.swapDataSet(artist.albums);
}
}
@Override
protected void onResume() {
super.onResume();
artistDetailsPresenter.subscribe();
}
@Override
protected void onPause() {
super.onPause();
artistDetailsPresenter.unsubscribe();
}
@Override
public void loading() {
}
@Override
public void showEmptyView() {
}
@Override
public void completed() {
supportStartPostponedEnterTransition();
}
@Override
public void showData(Artist artist) {
setArtist(artist);
}
private Artist getArtist() {
if (artist == null) {
artist = new Artist();
private void loadBiography() {
loadBiography(Locale.getDefault().getLanguage());
}
return artist;
}
private void setArtist(Artist artist) {
if (artist.getSongCount() <= 0) {
finish();
private void loadBiography(@Nullable final String lang) {
biography = null;
lastFMRestClient.getApiService()
.getArtistInfo(getArtist().getName(), lang, null)
.enqueue(new Callback<LastFmArtist>() {
@Override
public void onResponse(@NonNull Call<LastFmArtist> call,
@NonNull Response<LastFmArtist> response) {
final LastFmArtist lastFmArtist = response.body();
if (lastFmArtist != null && lastFmArtist.getArtist() != null) {
final String bioContent = lastFmArtist.getArtist().getBio().getContent();
if (bioContent != null && !bioContent.trim().isEmpty()) {
//TransitionManager.beginDelayedTransition(titleContainer);
biographyTextView.setVisibility(View.VISIBLE);
biographyTitle.setVisibility(View.VISIBLE);
biography = Html.fromHtml(bioContent);
biographyTextView.setText(biography);
}
}
// If the "lang" parameter is set and no biography is given, retry with default language
if (biography == null && lang != null) {
loadBiography(null);
}
}
@Override
public void onFailure(@NonNull Call<LastFmArtist> call, @NonNull Throwable t) {
t.printStackTrace();
biography = null;
}
});
}
this.artist = artist;
loadArtistImage();
if (RetroUtil.isAllowedToDownloadMetadata(this)) {
loadBiography();
@OnClick(R.id.biography)
void toggleArtistBiography() {
if (biographyTextView.getMaxLines() == 4) {
biographyTextView.setMaxLines(Integer.MAX_VALUE);
} else {
biographyTextView.setMaxLines(4);
}
}
title.setText(artist.getName());
text.setText(String.format("%s • %s", MusicUtil.getArtistInfoString(this, artist), MusicUtil
.getReadableDurationString(MusicUtil.getTotalDuration(this, artist.getSongs()))));
songAdapter.swapDataSet(artist.getSongs());
albumAdapter.swapDataSet(artist.albums);
}
private void loadBiography() {
loadBiography(Locale.getDefault().getLanguage());
}
private void loadBiography(@Nullable final String lang) {
biography = null;
lastFMRestClient.getApiService()
.getArtistInfo(getArtist().getName(), lang, null)
.enqueue(new Callback<LastFmArtist>() {
@Override
public void onResponse(@NonNull Call<LastFmArtist> call,
@NonNull Response<LastFmArtist> response) {
final LastFmArtist lastFmArtist = response.body();
if (lastFmArtist != null && lastFmArtist.getArtist() != null) {
final String bioContent = lastFmArtist.getArtist().getBio().getContent();
if (bioContent != null && !bioContent.trim().isEmpty()) {
//TransitionManager.beginDelayedTransition(titleContainer);
biographyTextView.setVisibility(View.VISIBLE);
biographyTitle.setVisibility(View.VISIBLE);
biography = Html.fromHtml(bioContent);
biographyTextView.setText(biography);
}
}
// If the "lang" parameter is set and no biography is given, retry with default language
if (biography == null && lang != null) {
loadBiography(null);
}
}
@Override
public void onFailure(@NonNull Call<LastFmArtist> call, @NonNull Throwable t) {
t.printStackTrace();
biography = null;
}
});
}
@OnClick(R.id.biography)
void toggleArtistBiography() {
if (biographyTextView.getMaxLines() == 4) {
biographyTextView.setMaxLines(Integer.MAX_VALUE);
} else {
biographyTextView.setMaxLines(4);
private void loadArtistImage() {
ArtistGlideRequest.Builder.from(Glide.with(this), artist)
.forceDownload(forceDownload)
.generatePalette(this).build()
.dontAnimate()
.into(new RetroMusicColoredTarget(image) {
@Override
public void onColorReady(int color) {
setColors(color);
}
});
forceDownload = false;
}
}
private void loadArtistImage() {
ArtistGlideRequest.Builder.from(Glide.with(this), artist)
.forceDownload(forceDownload)
.generatePalette(this).build()
.dontAnimate()
.into(new RetroMusicColoredTarget(image) {
@Override
public void onColorReady(int color) {
setColors(color);
}
});
forceDownload = false;
}
private void setColors(int color) {
private void setColors(int color) {
int textColor =
PreferenceUtil.getInstance(this).getAdaptiveColor() ? color : ThemeStore.accentColor(this);
int textColor =
PreferenceUtil.getInstance(this).getAdaptiveColor() ? color : ThemeStore.accentColor(this);
albumTitle.setTextColor(textColor);
songTitle.setTextColor(textColor);
biographyTitle.setTextColor(textColor);
albumTitle.setTextColor(textColor);
songTitle.setTextColor(textColor);
biographyTitle.setTextColor(textColor);
TintHelper.setTintAuto(shuffleButton, textColor, true);
TintHelper.setTintAuto(shuffleButton, textColor, true);
if (background != null) {
background.setBackgroundTintList(ColorStateList.valueOf(color));
if (background != null) {
background.setBackgroundTintList(ColorStateList.valueOf(color));
}
findViewById(R.id.root).setBackgroundColor(ThemeStore.primaryColor(this));
}
findViewById(R.id.root).setBackgroundColor(ThemeStore.primaryColor(this));
}
@OnClick({R.id.action_shuffle_all})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.action_shuffle_all:
MusicPlayerRemote.openAndShuffleQueue(getArtist().getSongs(), true);
break;
@OnClick({R.id.action_shuffle_all})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.action_shuffle_all:
MusicPlayerRemote.openAndShuffleQueue(getArtist().getSongs(), true);
break;
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return handleSortOrderMenuItem(item);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return handleSortOrderMenuItem(item);
}
private boolean handleSortOrderMenuItem(@NonNull MenuItem item) {
final ArrayList<Song> songs = getArtist().getSongs();
switch (item.getItemId()) {
case android.R.id.home:
super.onBackPressed();
return true;
case R.id.action_play_next:
MusicPlayerRemote.playNext(songs);
return true;
case R.id.action_add_to_current_playing:
MusicPlayerRemote.enqueue(songs);
return true;
case R.id.action_add_to_playlist:
AddToPlaylistDialog.create(songs).show(getSupportFragmentManager(), "ADD_PLAYLIST");
return true;
case R.id.action_set_artist_image:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(
Intent.createChooser(intent, getString(R.string.pick_from_local_storage)),
REQUEST_CODE_SELECT_IMAGE);
return true;
case R.id.action_reset_artist_image:
Toast.makeText(ArtistDetailActivity.this, getResources().getString(R.string.updating),
Toast.LENGTH_SHORT).show();
CustomArtistImageUtil.getInstance(ArtistDetailActivity.this).resetCustomArtistImage(artist);
forceDownload = true;
private boolean handleSortOrderMenuItem(@NonNull MenuItem item) {
final ArrayList<Song> songs = getArtist().getSongs();
switch (item.getItemId()) {
case android.R.id.home:
super.onBackPressed();
return true;
case R.id.action_play_next:
MusicPlayerRemote.playNext(songs);
return true;
case R.id.action_add_to_current_playing:
MusicPlayerRemote.enqueue(songs);
return true;
case R.id.action_add_to_playlist:
AddToPlaylistDialog.create(songs).show(getSupportFragmentManager(), "ADD_PLAYLIST");
return true;
case R.id.action_set_artist_image:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(
Intent.createChooser(intent, getString(R.string.pick_from_local_storage)),
REQUEST_CODE_SELECT_IMAGE);
return true;
case R.id.action_reset_artist_image:
Toast.makeText(ArtistDetailActivity.this, getResources().getString(R.string.updating),
Toast.LENGTH_SHORT).show();
CustomArtistImageUtil.getInstance(ArtistDetailActivity.this).resetCustomArtistImage(artist);
forceDownload = true;
return true;
}
return true;
}
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_artist_detail, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_artist_detail, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public void onMediaStoreChanged() {
super.onMediaStoreChanged();
reload();
}
@Override
public void onMediaStoreChanged() {
super.onMediaStoreChanged();
reload();
}
private void reload() {
artistDetailsPresenter.unsubscribe();
artistDetailsPresenter.subscribe();
}
private void reload() {
artistDetailsPresenter.unsubscribe();
artistDetailsPresenter.subscribe();
}
}

View File

@ -15,6 +15,7 @@ import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
@ -27,197 +28,205 @@ import code.name.monkey.retromusic.ui.activities.base.AbsMusicServiceActivity;
*/
public class EqualizerActivity extends AbsMusicServiceActivity implements
AdapterView.OnItemSelectedListener {
AdapterView.OnItemSelectedListener {
@BindView(R.id.equalizer)
SwitchCompat mEnable;
@BindView(R.id.content)
LinearLayout mContent;
@BindView(R.id.bands)
LinearLayout mLinearLayout;
@BindView(R.id.equalizer)
SwitchCompat mEnable;
@BindView(R.id.bass_boost_strength)
SeekBar mBassBoostStrength;
@BindView(R.id.virtualizer_strength)
SeekBar mVirtualizerStrength;
@BindView(R.id.content)
LinearLayout mContent;
@BindView(R.id.bass_boost)
TextView mBassBoost;
@BindView(R.id.virtualizer)
TextView mVirtualizer;
@BindView(R.id.bands)
LinearLayout mLinearLayout;
@BindView(R.id.toolbar)
Toolbar mToolbar;
@BindView(R.id.app_bar)
AppBarLayout mAppBar;
@BindView(R.id.presets)
Spinner mPresets;
@BindView(R.id.bass_boost_strength)
SeekBar mBassBoostStrength;
private CompoundButton.OnCheckedChangeListener mListener = (buttonView, isChecked) -> {
switch (buttonView.getId()) {
case R.id.equalizer:
EqualizerHelper.getInstance().getEqualizer().setEnabled(isChecked);
TransitionManager.beginDelayedTransition(mContent);
mContent.setVisibility(isChecked ? View.VISIBLE : View.GONE);
break;
}
};
private SeekBar.OnSeekBarChangeListener mSeekBarChangeListener = new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
if (seekBar == mBassBoostStrength) {
mBassBoost.setEnabled(progress > 0);
EqualizerHelper.getInstance().setBassBoostStrength(progress);
EqualizerHelper.getInstance().setBassBoostEnabled(progress > 0);
} else if (seekBar == mVirtualizerStrength) {
mVirtualizer.setEnabled(progress > 0);
EqualizerHelper.getInstance().setVirtualizerEnabled(progress > 0);
EqualizerHelper.getInstance().setVirtualizerStrength(progress);
@BindView(R.id.virtualizer_strength)
SeekBar mVirtualizerStrength;
@BindView(R.id.bass_boost)
TextView mBassBoost;
@BindView(R.id.virtualizer)
TextView mVirtualizer;
@BindView(R.id.toolbar)
Toolbar mToolbar;
@BindView(R.id.app_bar)
AppBarLayout mAppBar;
@BindView(R.id.presets)
Spinner mPresets;
@BindView(R.id.title)
TextView mTitle;
private CompoundButton.OnCheckedChangeListener mListener = (buttonView, isChecked) -> {
switch (buttonView.getId()) {
case R.id.equalizer:
EqualizerHelper.getInstance().getEqualizer().setEnabled(isChecked);
TransitionManager.beginDelayedTransition(mContent);
mContent.setVisibility(isChecked ? View.VISIBLE : View.GONE);
break;
}
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
};
private ArrayAdapter<String> mPresetsNamesAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_equalizer);
ButterKnife.bind(this);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
int primaryColor = ThemeStore.primaryColor(this);
mToolbar.setBackgroundColor(primaryColor);
mAppBar.setBackgroundColor(primaryColor);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
mToolbar.setTitle(R.string.equalizer);
setSupportActionBar(mToolbar);
//noinspection ConstantConditions
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mEnable.setChecked(EqualizerHelper.getInstance().getEqualizer().getEnabled());
mEnable.setOnCheckedChangeListener(mListener);
mPresetsNamesAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
mPresets.setAdapter(mPresetsNamesAdapter);
mPresets.setOnItemSelectedListener(this);
mBassBoostStrength.setProgress(EqualizerHelper.getInstance().getBassBoostStrength());
mBassBoostStrength.setOnSeekBarChangeListener(mSeekBarChangeListener);
mVirtualizerStrength.setProgress(EqualizerHelper.getInstance().getVirtualizerStrength());
mVirtualizerStrength.setOnSeekBarChangeListener(mSeekBarChangeListener);
setupUI();
addPresets();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
}
return super.onOptionsItemSelected(item);
}
private void addPresets() {
mPresetsNamesAdapter.clear();
mPresetsNamesAdapter.add("Custom");
for (int j = 0; j < EqualizerHelper.getInstance().getEqualizer().getNumberOfPresets(); j++) {
mPresetsNamesAdapter
.add(EqualizerHelper.getInstance().getEqualizer().getPresetName((short) j));
mPresetsNamesAdapter.notifyDataSetChanged();
}
mPresets
.setSelection((int) EqualizerHelper.getInstance().getEqualizer().getCurrentPreset() + 1);
}
private void setupUI() {
mLinearLayout.removeAllViews();
short bands;
try {
// get number of supported bands
bands = (short) EqualizerHelper.getInstance().getNumberOfBands();
// for each of the supported bands, we will set up a slider from -10dB to 10dB boost/attenuation,
// as well as text labels to assist the user
for (short i = 0; i < bands; i++) {
final short band = i;
View view = LayoutInflater.from(this).inflate(R.layout.retro_seekbar, mLinearLayout, false);
TextView freqTextView = view.findViewById(R.id.hurtz);
freqTextView.setText(
String.format("%d Hz", EqualizerHelper.getInstance().getCenterFreq((int) band) / 1000));
TextView minDbTextView = view.findViewById(R.id.minus_db);
minDbTextView
.setText(String.format("%d dB", EqualizerHelper.getInstance().getBandLevelLow() / 100));
TextView maxDbTextView = view.findViewById(R.id.plus_db);
maxDbTextView.setText(
String.format("%d dB", EqualizerHelper.getInstance().getBandLevelHigh() / 100));
SeekBar bar = view.findViewById(R.id.seekbar);
bar.setMax(EqualizerHelper.getInstance().getBandLevelHigh() - EqualizerHelper.getInstance()
.getBandLevelLow());
bar.setProgress(
EqualizerHelper.getInstance().getBandLevel((int) band) - EqualizerHelper.getInstance()
.getBandLevelLow());
bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
EqualizerHelper.getInstance().setBandLevel((int) band,
(int) (progress + EqualizerHelper.getInstance().getBandLevelLow()));
};
private SeekBar.OnSeekBarChangeListener mSeekBarChangeListener = new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
mPresets.setSelection(0);
if (seekBar == mBassBoostStrength) {
mBassBoost.setEnabled(progress > 0);
EqualizerHelper.getInstance().setBassBoostStrength(progress);
EqualizerHelper.getInstance().setBassBoostEnabled(progress > 0);
} else if (seekBar == mVirtualizerStrength) {
mVirtualizer.setEnabled(progress > 0);
EqualizerHelper.getInstance().setVirtualizerEnabled(progress > 0);
EqualizerHelper.getInstance().setVirtualizerStrength(progress);
}
}
}
}
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
mLinearLayout.addView(view);
}
} catch (Exception e) {
e.printStackTrace();
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
};
private ArrayAdapter<String> mPresetsNamesAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_equalizer);
ButterKnife.bind(this);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
setupToolbar();
mEnable.setChecked(EqualizerHelper.getInstance().getEqualizer().getEnabled());
mEnable.setOnCheckedChangeListener(mListener);
mPresetsNamesAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
mPresets.setAdapter(mPresetsNamesAdapter);
mPresets.setOnItemSelectedListener(this);
mBassBoostStrength.setProgress(EqualizerHelper.getInstance().getBassBoostStrength());
mBassBoostStrength.setOnSeekBarChangeListener(mSeekBarChangeListener);
mVirtualizerStrength.setProgress(EqualizerHelper.getInstance().getVirtualizerStrength());
mVirtualizerStrength.setOnSeekBarChangeListener(mSeekBarChangeListener);
setupUI();
addPresets();
}
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
return;
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
EqualizerHelper.getInstance().getEqualizer().usePreset((short) (position - 1));
setupUI();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
private void setupToolbar() {
mTitle.setTextColor(ThemeStore.textColorPrimary(this));
int primaryColor = ThemeStore.primaryColor(this);
mToolbar.setBackgroundColor(primaryColor);
mAppBar.setBackgroundColor(primaryColor);
mToolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
mToolbar.setNavigationOnClickListener(v -> onBackPressed());
setSupportActionBar(mToolbar);
setTitle(null);
}
}
private void addPresets() {
mPresetsNamesAdapter.clear();
mPresetsNamesAdapter.add("Custom");
for (int j = 0; j < EqualizerHelper.getInstance().getEqualizer().getNumberOfPresets(); j++) {
mPresetsNamesAdapter
.add(EqualizerHelper.getInstance().getEqualizer().getPresetName((short) j));
mPresetsNamesAdapter.notifyDataSetChanged();
}
mPresets
.setSelection((int) EqualizerHelper.getInstance().getEqualizer().getCurrentPreset() + 1);
}
private void setupUI() {
mLinearLayout.removeAllViews();
short bands;
try {
// get number of supported bands
bands = (short) EqualizerHelper.getInstance().getNumberOfBands();
// for each of the supported bands, we will set up a slider from -10dB to 10dB boost/attenuation,
// as well as text labels to assist the user
for (short i = 0; i < bands; i++) {
final short band = i;
View view = LayoutInflater.from(this).inflate(R.layout.retro_seekbar, mLinearLayout, false);
TextView freqTextView = view.findViewById(R.id.hurtz);
freqTextView.setText(
String.format("%d Hz", EqualizerHelper.getInstance().getCenterFreq((int) band) / 1000));
TextView minDbTextView = view.findViewById(R.id.minus_db);
minDbTextView
.setText(String.format("%d dB", EqualizerHelper.getInstance().getBandLevelLow() / 100));
TextView maxDbTextView = view.findViewById(R.id.plus_db);
maxDbTextView.setText(
String.format("%d dB", EqualizerHelper.getInstance().getBandLevelHigh() / 100));
SeekBar bar = view.findViewById(R.id.seekbar);
bar.setMax(EqualizerHelper.getInstance().getBandLevelHigh() - EqualizerHelper.getInstance()
.getBandLevelLow());
bar.setProgress(
EqualizerHelper.getInstance().getBandLevel((int) band) - EqualizerHelper.getInstance()
.getBandLevelLow());
bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
EqualizerHelper.getInstance().setBandLevel((int) band,
(int) (progress + EqualizerHelper.getInstance().getBandLevelLow()));
if (fromUser) {
mPresets.setSelection(0);
}
}
public void onStartTrackingTouch(SeekBar seekBar) {
}
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
mLinearLayout.addView(view);
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
return;
}
EqualizerHelper.getInstance().getEqualizer().usePreset((short) (position - 1));
setupUI();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
}

View File

@ -3,7 +3,6 @@ package code.name.monkey.retromusic.ui.activities;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
@ -18,7 +17,6 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import com.afollestad.materialcab.MaterialCab;
import code.name.monkey.retromusic.ui.activities.base.AbsSlidingMusicPanelActivity;
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
import java.util.ArrayList;
@ -39,6 +37,7 @@ import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.mvp.contract.GenreDetailsContract;
import code.name.monkey.retromusic.mvp.presenter.GenreDetailsPresenter;
import code.name.monkey.retromusic.ui.activities.base.AbsSlidingMusicPanelActivity;
import code.name.monkey.retromusic.ui.adapter.song.SongAdapter;
import code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.RetroUtil;
@ -72,8 +71,8 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
@BindView(R.id.app_bar)
AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar)
CollapsingToolbarLayout toolbarLayout;
@BindView(R.id.title)
TextView title;
private Genre genre;
private GenreDetailsPresenter presenter;
@ -99,8 +98,7 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
setBottomBarVisibility(View.GONE);
RetroUtil.statusBarHeight(statusBar);
RetroUtil.statusBarHeight(statusBar);
genre = getIntent().getParcelableExtra(EXTRA_GENRE_ID);
presenter = new GenreDetailsPresenter(this, genre.id);
@ -119,14 +117,14 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
}
private void setUpToolBar() {
title.setText(genre.name);
title.setTextColor(ThemeStore.textColorPrimary(this));
int primaryColor = ThemeStore.primaryColor(this);
toolbar.setBackgroundColor(primaryColor);
appBarLayout.setBackgroundColor(primaryColor);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
setTitle(null);
setSupportActionBar(toolbar);
//noinspection ConstantConditions
getSupportActionBar().setTitle(genre.name);
setTitle(R.string.app_name);
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
@ -140,7 +138,6 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
color = ATHUtil.resolveColor(GenreDetailsActivity.this, android.R.attr.textColorPrimary);
break;
}
toolbarLayout.setExpandedTitleColor(color);
ToolbarContentTintHelper.colorizeToolbar(toolbar, color, GenreDetailsActivity.this);
}
});
@ -267,6 +264,4 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
super.onMediaStoreChanged();
presenter.subscribe();
}
}

View File

@ -6,6 +6,8 @@ import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.webkit.WebView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
@ -13,40 +15,46 @@ import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
public class LicenseActivity extends AbsBaseActivity {
@BindView(R.id.license)
WebView mLicense;
@BindView(R.id.toolbar)
Toolbar mToolbar;
@BindView(R.id.appbar)
AppBarLayout mAppbar;
@BindView(R.id.license)
WebView mLicense;
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
@BindView(R.id.toolbar)
Toolbar mToolbar;
@BindView(R.id.app_bar)
AppBarLayout mAppbar;
@BindView(R.id.title)
TextView title;
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_license);
ButterKnife.bind(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_license);
ButterKnife.bind(this);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
mLicense.loadUrl("file:///android_asset/index.html");
mLicense.loadUrl("file:///android_asset/index.html");
mToolbar.setTitle(R.string.licenses);
mToolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
mToolbar.setNavigationOnClickListener(view -> onBackPressed());
mToolbar.setBackgroundColor(ThemeStore.primaryColor(this));
mAppbar.setBackgroundColor(ThemeStore.primaryColor(this));
setSupportActionBar(mToolbar);
}
title.setTextColor(ThemeStore.textColorPrimary(this));
mToolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
mToolbar.setNavigationOnClickListener(view -> onBackPressed());
mToolbar.setBackgroundColor(ThemeStore.primaryColor(this));
mAppbar.setBackgroundColor(ThemeStore.primaryColor(this));
setTitle(null);
setSupportActionBar(mToolbar);
}
}

View File

@ -155,14 +155,16 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this);
}
public void setCurrentFragment(@Nullable Fragment fragment, boolean isStackAdd) {
public void setCurrentFragment(@Nullable Fragment fragment, boolean isStackAdd, String tag) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, fragment, TAG);
fragmentTransaction.replace(R.id.fragment_container, fragment, tag);
if (isStackAdd) {
fragmentTransaction.addToBackStack(TAG);
fragmentTransaction.addToBackStack(tag);
}
fragmentTransaction.commit();
currentFragment = (MainActivityFragmentCallbacks) fragment;
}
@ -186,13 +188,13 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
case R.id.action_album:
case R.id.action_artist:
case R.id.action_playlist:
setCurrentFragment(LibraryFragment.newInstance(menuItem), false);
setCurrentFragment(LibraryFragment.newInstance(menuItem), false, LibraryFragment.TAG);
break;
default:
case R.id.action_home:
setCurrentFragment(PreferenceUtil.getInstance(this).toggleHomeBanner() ? BannerHomeFragment
.newInstance() : HomeFragment.newInstance(),
false);
setCurrentFragment(PreferenceUtil.getInstance(this).toggleHomeBanner() ?
BannerHomeFragment.newInstance() : HomeFragment.newInstance(), false,
HomeFragment.TAG);
break;
}
}

View File

@ -5,6 +5,7 @@ import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.Toolbar;
import android.widget.TextView;
import butterknife.BindDrawable;
import butterknife.BindString;
import butterknife.BindView;
@ -19,50 +20,56 @@ import code.name.monkey.retromusic.util.MusicUtil;
public class PlayingQueueActivity extends AbsMusicServiceActivity {
@BindView(R.id.toolbar)
Toolbar mToolbar;
@BindDrawable(R.drawable.ic_close_white_24dp)
Drawable mClose;
@BindView(R.id.player_queue_sub_header)
TextView mPlayerQueueSubHeader;
@BindString(R.string.queue)
String queue;
@BindView(R.id.app_bar)
AppBarLayout mAppBarLayout;
@BindView(R.id.toolbar)
Toolbar mToolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_playing_queue);
ButterKnife.bind(this);
@BindDrawable(R.drawable.ic_keyboard_backspace_black_24dp)
Drawable mClose;
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
@BindView(R.id.player_queue_sub_header)
TextView mPlayerQueueSubHeader;
setupToolbar();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container, new PlayingQueueFragment())
.commit();
@BindString(R.string.queue)
String queue;
@BindView(R.id.app_bar)
AppBarLayout mAppBarLayout;
@BindView(R.id.title)
TextView title;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_playing_queue);
ButterKnife.bind(this);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
setupToolbar();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container, new PlayingQueueFragment())
.commit();
}
}
}
protected String getUpNextAndQueueTime() {
return getResources().getString(R.string.up_next) + " • " + MusicUtil
.getReadableDurationString(
MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.getPosition()));
}
protected String getUpNextAndQueueTime() {
return getResources().getString(R.string.up_next) + " • " + MusicUtil.getReadableDurationString(MusicPlayerRemote.getQueueDurationMillis(MusicPlayerRemote.getPosition()));
}
private void setupToolbar() {
mPlayerQueueSubHeader.setText(getUpNextAndQueueTime());
mPlayerQueueSubHeader.setTextColor(ThemeStore.accentColor(this));
mAppBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
mToolbar.setBackgroundColor(ThemeStore.primaryColor(this));
mToolbar.setNavigationIcon(mClose);
setSupportActionBar(mToolbar);
setTitle(queue);
mToolbar.setNavigationOnClickListener(v -> onBackPressed());
}
private void setupToolbar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
mPlayerQueueSubHeader.setText(getUpNextAndQueueTime());
mPlayerQueueSubHeader.setTextColor(ThemeStore.accentColor(this));
mAppBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
mToolbar.setBackgroundColor(ThemeStore.primaryColor(this));
mToolbar.setNavigationIcon(mClose);
setSupportActionBar(mToolbar);
setTitle(null);
mToolbar.setNavigationOnClickListener(v -> onBackPressed());
}
}

View File

@ -3,7 +3,6 @@ package code.name.monkey.retromusic.ui.activities;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
@ -29,13 +28,11 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.menu.PlaylistMenuHelper;
import code.name.monkey.retromusic.interfaces.CabHolder;
import code.name.monkey.retromusic.loaders.PlaylistLoader;
import code.name.monkey.retromusic.misc.AppBarStateChangeListener;
import code.name.monkey.retromusic.model.AbsCustomPlaylist;
import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.model.PlaylistSong;
@ -72,8 +69,8 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
@BindView(R.id.app_bar)
AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar)
CollapsingToolbarLayout toolbarLayout;
@BindView(R.id.title)
TextView title;
@BindView(R.id.status_bar)
View statusBar;
@ -182,33 +179,17 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
}
private void setUpToolBar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
TintHelper.setTintAuto(shuffleButton, ThemeStore.accentColor(this), true);
int primaryColor = ThemeStore.primaryColor(this);
toolbar.setBackgroundColor(primaryColor);
appBarLayout.setBackgroundColor(primaryColor);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
title.setText(playlist.name);
setTitle(null);
setSupportActionBar(toolbar);
//noinspection ConstantConditions
getSupportActionBar().setTitle(playlist.name);
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state) {
int color;
switch (state) {
default:
case COLLAPSED:
case EXPANDED:
case IDLE:
color = ThemeStore.textColorPrimary(PlaylistDetailActivity.this);
break;
}
toolbarLayout.setExpandedTitleColor(color);
ToolbarContentTintHelper.colorizeToolbar(toolbar, color, PlaylistDetailActivity.this);
}
});
TintHelper.setTintAuto(shuffleButton, ThemeStore.accentColor(this), true);
}
@Override

View File

@ -44,28 +44,38 @@ public class SearchActivity extends AbsMusicServiceActivity implements OnQueryTe
public static final String TAG = SearchActivity.class.getSimpleName();
public static final String QUERY = "query";
private static final int REQ_CODE_SPEECH_INPUT = 9002;
@BindView(R.id.voice_search)
View micIcon;
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(android.R.id.empty)
TextView empty;
@BindView(R.id.title)
TextView title;
@BindView(R.id.search_view)
EditText searchView;
@BindView(R.id.root)
CoordinatorLayout container;
@BindView(R.id.appbar)
@BindView(R.id.app_bar)
AppBarLayout appbar;
@BindView(R.id.status_bar)
View statusBar;
private SearchPresenter searchPresenter;
private SearchAdapter adapter;
private String query;
private boolean isMicSearch = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
setDrawUnderStatusBar(true);
@ -94,7 +104,7 @@ public class SearchActivity extends AbsMusicServiceActivity implements OnQueryTe
if (getIntent().getBooleanExtra("mic_search", false)) {
startMicSearch();
isMicSearch = true;
boolean isMicSearch = true;
}
}
@ -145,12 +155,13 @@ public class SearchActivity extends AbsMusicServiceActivity implements OnQueryTe
}
private void setUpToolBar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
int primaryColor = ThemeStore.primaryColor(this);
toolbar.setBackgroundColor(primaryColor);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
appbar.setBackgroundColor(primaryColor);
setSupportActionBar(toolbar);
//noinspection ConstantConditions
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setTitle(null);
}
@Override

View File

@ -5,6 +5,7 @@ import android.os.Bundle;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.design.widget.AppBarLayout;
import android.support.transition.TransitionManager;
import android.support.v4.app.Fragment;
@ -12,142 +13,131 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.afollestad.materialdialogs.color.ColorChooserDialog;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager;
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
import code.name.monkey.retromusic.ui.fragments.settings.MainSettingsFragment;
import code.name.monkey.retromusic.util.PreferenceUtil;
import com.afollestad.materialdialogs.color.ColorChooserDialog;
public class SettingsActivity extends AbsBaseActivity implements ColorChooserDialog.ColorCallback {
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
AppBarLayout appBarLayout;
@BindView(R.id.detail_content_frame)
@Nullable
FrameLayout detailsFrame;
private FragmentManager fragmentManager = getSupportFragmentManager();
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
AppBarLayout appBarLayout;
@BindView(R.id.title)
TextView title;
@BindView(R.id.detail_content_frame)
@Nullable
FrameLayout detailsFrame;
private FragmentManager fragmentManager = getSupportFragmentManager();
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
switch (dialog.getTitle()) {
case R.string.primary_color:
int theme = ColorUtil.isColorLight(selectedColor) ?
PreferenceUtil.getThemeResFromPrefValue("light") :
PreferenceUtil.getThemeResFromPrefValue("dark");
@Override
public void onColorSelection(@NonNull ColorChooserDialog dialog, @ColorInt int selectedColor) {
switch (dialog.getTitle()) {
case R.string.primary_color:
int theme = ColorUtil.isColorLight(selectedColor) ?
PreferenceUtil.getThemeResFromPrefValue("light") :
PreferenceUtil.getThemeResFromPrefValue("dark");
ThemeStore.editTheme(this).activityTheme(theme).primaryColor(selectedColor).commit();
break;
case R.string.accent_color:
ThemeStore.editTheme(this).accentColor(selectedColor).commit();
break;
ThemeStore.editTheme(this).activityTheme(theme).primaryColor(selectedColor).commit();
break;
case R.string.accent_color:
ThemeStore.editTheme(this).accentColor(selectedColor).commit();
break;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
new DynamicShortcutManager(this).updateDynamicShortcuts();
}
recreate();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
new DynamicShortcutManager(this).updateDynamicShortcuts();
}
recreate();
}
@Override
public void onColorChooserDismissed(@NonNull ColorChooserDialog dialog) {
@Override
public void onColorChooserDismissed(@NonNull ColorChooserDialog dialog) {
}
@Override
protected void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_settings);
ButterKnife.bind(this);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
setupToolbar();
if (bundle == null) {
fragmentManager.beginTransaction().replace(R.id.content_frame, new MainSettingsFragment())
.commit();
} else {
restoreFragment();
}
}
private void setupToolbar() {
int primaryColor = ThemeStore.primaryColor(this);
appBarLayout.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(primaryColor);
toolbar.setNavigationOnClickListener(v -> onBackPressed());
setTitle(R.string.app_name);
setSupportActionBar(toolbar);
}
private void restoreFragment() {
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
if (fragmentManager.getBackStackEntryCount() > 0) {
appBarLayout.setExpanded(false, true);
} else {
appBarLayout.setExpanded(true, true);
}
setupToolbar();
}
public void setupFragment(Fragment fragment) {
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction()
.setCustomAnimations(R.animator.slide_up, 0, 0, R.animator.slide_down);
if (detailsFrame == null) {
fragmentTransaction.replace(R.id.content_frame, fragment, fragment.getTag());
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
} else {
fragmentTransaction.replace(R.id.detail_content_frame, fragment, fragment.getTag());
fragmentTransaction.commit();
}
fragmentManager.addOnBackStackChangedListener(() -> {
if (fragmentManager.getBackStackEntryCount() > 0) {
appBarLayout.setExpanded(false, true);
} else {
appBarLayout.setExpanded(true, true);
}
setupToolbar();
});
}
@Override
protected void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_settings);
ButterKnife.bind(this);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
@Override
public void onBackPressed() {
if (fragmentManager.getBackStackEntryCount() == 0) {
super.onBackPressed();
} else {
fragmentManager.popBackStack();
setupToolbar();
if (bundle == null) {
fragmentManager.beginTransaction().replace(R.id.content_frame, new MainSettingsFragment())
.commit();
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
private void setupToolbar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
int primaryColor = ThemeStore.primaryColor(this);
appBarLayout.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(primaryColor);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
toolbar.setNavigationOnClickListener(v -> onBackPressed());
setTitle(null);
setSupportActionBar(toolbar);
}
return super.onOptionsItemSelected(item);
}
public void addAppbarLayoutElevation(float v) {
TransitionManager.beginDelayedTransition(appBarLayout);
appBarLayout.setElevation(v);
}
public void setupFragment(Fragment fragment, @StringRes int titleName) {
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction()
.setCustomAnimations(R.animator.slide_up, 0, 0, R.animator.slide_down);
title.setText(titleName);
if (detailsFrame == null) {
fragmentTransaction.replace(R.id.content_frame, fragment, fragment.getTag());
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
} else {
fragmentTransaction.replace(R.id.detail_content_frame, fragment, fragment.getTag());
fragmentTransaction.commit();
}
}
@Override
public void onBackPressed() {
if (fragmentManager.getBackStackEntryCount() == 0) {
super.onBackPressed();
} else {
title.setText(R.string.action_settings);
fragmentManager.popBackStack();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
public void addAppbarLayoutElevation(float v) {
TransitionManager.beginDelayedTransition(appBarLayout);
appBarLayout.setElevation(v);
}
}

View File

@ -14,6 +14,7 @@ import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
@ -53,18 +54,27 @@ import static code.name.monkey.retromusic.Constants.PAYPAL_ME_URL;
public class SupportDevelopmentActivity extends AbsBaseActivity implements BillingProcessor.IBillingHandler {
public static final String TAG = SupportDevelopmentActivity.class.getSimpleName();
private static final int DONATION_PRODUCT_IDS = R.array.donation_ids;
@BindView(R.id.progress)
ProgressBar mProgressBar;
@BindView(R.id.progress_container)
View mProgressContainer;
@BindView(R.id.list)
RecyclerView mListView;
@BindView(R.id.toolbar)
Toolbar mToolbar;
@BindView(R.id.app_bar)
AppBarLayout mAppBarLayout;
@BindView(R.id.root)
ViewGroup mViewGroup;
@BindView(R.id.title)
TextView title;
private BillingProcessor mBillingProcessor;
private AsyncTask skuDetailsLoadAsyncTask;
@ -86,6 +96,15 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
return skuDetails;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
private void donate(int i) {
final String[] ids = getResources().getStringArray(DONATION_PRODUCT_IDS);
mBillingProcessor.purchase(this, ids[i]);
@ -107,13 +126,8 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
int primaryColor = ThemeStore.primaryColor(this);
mAppBarLayout.setBackgroundColor(primaryColor);
mToolbar.setBackgroundColor(primaryColor);
setSupportActionBar(mToolbar);
//noinspection ConstantConditions
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(view -> onBackPressed());
setupToolbar();
mBillingProcessor
= new BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSE_KEY, this);
@ -122,6 +136,17 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
((TextView) findViewById(R.id.donation)).setTextColor(ThemeStore.accentColor(this));
}
private void setupToolbar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
int primaryColor = ThemeStore.primaryColor(this);
mAppBarLayout.setBackgroundColor(primaryColor);
mToolbar.setBackgroundColor(primaryColor);
mToolbar.setNavigationOnClickListener(view -> onBackPressed());
mToolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
setSupportActionBar(mToolbar);
setTitle(null);
}
@Override
public void onBillingInitialized() {
loadSkuDetails();
@ -173,7 +198,7 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
private static class SkuDetailsLoadAsyncTask extends AsyncTask<Void, Void, List<SkuDetails>> {
private final WeakReference<SupportDevelopmentActivity> donationDialogWeakReference;
public SkuDetailsLoadAsyncTask(SupportDevelopmentActivity donationsDialog) {
SkuDetailsLoadAsyncTask(SupportDevelopmentActivity donationsDialog) {
this.donationDialogWeakReference = new WeakReference<>(donationsDialog);
}
@ -205,8 +230,6 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
if (dialog == null) return;
if (skuDetails == null || skuDetails.isEmpty()) {
//Toast.makeText(dialog, "Error loading items", Toast.LENGTH_SHORT).show();
//dialog.finish();
dialog.mProgressContainer.setVisibility(View.GONE);
return;
}
@ -229,7 +252,7 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
SupportDevelopmentActivity donationsDialog;
List<SkuDetails> skuDetailsList = new ArrayList<>();
public SkuDetailsAdapter(@NonNull SupportDevelopmentActivity donationsDialog, @NonNull List<SkuDetails> objects) {
SkuDetailsAdapter(@NonNull SupportDevelopmentActivity donationsDialog, @NonNull List<SkuDetails> objects) {
this.donationsDialog = donationsDialog;
skuDetailsList = objects;
}
@ -260,14 +283,15 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
}
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
return new ViewHolder(LayoutInflater.from(donationsDialog)
.inflate(LAYOUT_RES_ID, viewGroup, false));
}
@Override
public void onBindViewHolder(ViewHolder viewHolder, int i) {
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
SkuDetails skuDetails = skuDetailsList.get(i);
if (skuDetails != null) {
viewHolder.title.setText(skuDetails.title.replace("(Retro Music Player)", "").trim());

View File

@ -1,96 +1,92 @@
package code.name.monkey.retromusic.ui.adapter;
import android.app.Activity;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindViews;
import butterknife.ButterKnife;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.glide.SongGlideRequest;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.ui.adapter.CollageSongAdapter.CollageSongViewHolder;
import code.name.monkey.retromusic.ui.adapter.base.MediaEntryViewHolder;
import code.name.monkey.retromusic.util.NavigationUtil;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
/**
* @author Hemanth S (h4h13).
*/
public class CollageSongAdapter extends RecyclerView.Adapter<CollageSongViewHolder> {
private AppCompatActivity activity;
private ArrayList<Album> dataSet;
private int itemLayoutRes;
private Activity activity;
private ArrayList<Song> dataSet;
public CollageSongAdapter(AppCompatActivity activity, ArrayList<Album> dataSet,
int itemLayoutRes) {
this.activity = activity;
this.dataSet = dataSet;
this.itemLayoutRes = itemLayoutRes;
}
@Override
public void onBindViewHolder(@NonNull CollageSongViewHolder holder, int position) {
ArrayList<Album> albums = dataSet;
holder.bindSongs(albums);
if (albums.size() > 9) {
for (int i = 0; i < albums.subList(0, 9).size(); i++) {
if (holder.imageViews != null) {
SongGlideRequest.Builder.from(Glide.with(activity), albums.get(i).safeGetFirstSong())
.checkIgnoreMediaStore(activity).build().into(holder.imageViews.get(i));
}
}
}
}
@Override
public int getItemCount() {
return 1;
}
@NonNull
@Override
public CollageSongViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new CollageSongViewHolder(
LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false));
}
class CollageSongViewHolder extends MediaEntryViewHolder {
@BindViews({R.id.image_1, R.id.image_2, R.id.image_3, R.id.image_4, R.id.image_5, R.id.image_6,
R.id.image_7, R.id.image_8, R.id.image_9})
@Nullable
List<ImageView> imageViews;
CollageSongViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
public CollageSongAdapter(Activity activity, ArrayList<Song> dataSet) {
this.activity = activity;
this.dataSet = dataSet;
}
@Override
public void onClick(View v) {
super.onClick(v);
NavigationUtil.goToAlbum(activity, dataSet.get(getAdapterPosition() + 1).getId());
public void onBindViewHolder(@NonNull CollageSongViewHolder holder, int position) {
holder.bindSongs();
if (dataSet.size() > 9) {
for (int i = 0; i < dataSet.subList(0, 9).size(); i++) {
if (holder.imageViews != null) {
SongGlideRequest.Builder.from(Glide.with(activity), dataSet.get(i))
.checkIgnoreMediaStore(activity)
.build()
.into(holder.imageViews.get(i));
}
}
}
}
void bindSongs(ArrayList<Album> albums) {
if (imageViews != null) {
for (int i = 0; i < imageViews.size(); i++) {
final int startPosition = i;
ImageView imageView = imageViews.get(i);
imageView.setOnClickListener(
v -> NavigationUtil.goToAlbum(activity, albums.get(startPosition).getId()));
}
}
@Override
public int getItemCount() {
return 1;
}
@NonNull
@Override
public CollageSongViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new CollageSongViewHolder(
LayoutInflater.from(activity).inflate(R.layout.item_collage, parent, false));
}
class CollageSongViewHolder extends MediaEntryViewHolder {
@BindViews({R.id.image_1, R.id.image_2, R.id.image_3, R.id.image_4, R.id.image_5, R.id.image_6,
R.id.image_7, R.id.image_8, R.id.image_9})
@Nullable
List<ImageView> imageViews;
CollageSongViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
void bindSongs() {
if (imageViews != null) {
for (int i = 0; i < imageViews.size(); i++) {
final int startPosition = i;
ImageView imageView = imageViews.get(i);
imageView.setOnClickListener(view -> {
});
}
}
}
}
}
}

View File

@ -60,8 +60,11 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
this.usePalette = usePalette;
setHasStableIds(true);
this.textColor = ThemeStore.textColorPrimary(activity);
Typeface mTypeface = Typeface
.createFromAsset(activity.getAssets(), activity.getString(R.string.sans_regular));
}
public AlbumAdapter(@NonNull AppCompatActivity activity, ArrayList<Album> dataSet,
@LayoutRes int itemLayoutRes) {
this(activity, dataSet, itemLayoutRes, false, null);
}
public void useItemLayout(int itemLayoutRes) {

View File

@ -25,6 +25,12 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget;
import code.name.monkey.retromusic.glide.SongGlideRequest;
@ -32,116 +38,114 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.views.MetalRecyclerViewPager;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
public class AlbumFullWithAdapter extends
MetalRecyclerViewPager.MetalAdapter<AlbumFullWithAdapter.FullMetalViewHolder> {
MetalRecyclerViewPager.MetalAdapter<AlbumFullWithAdapter.FullMetalViewHolder> {
private Activity activity;
private List<Album> dataSet = new ArrayList<>();
private Activity activity;
private List<Album> dataSet = new ArrayList<>();
public AlbumFullWithAdapter(@NonNull Activity activity,
@NonNull DisplayMetrics metrics) {
super(metrics);
this.activity = activity;
}
public void swapData(ArrayList<Album> list) {
dataSet = list;
notifyDataSetChanged();
}
@Override
public FullMetalViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View viewItem = LayoutInflater.from(parent.getContext())
.inflate(R.layout.pager_item, parent, false);
return new FullMetalViewHolder(viewItem);
}
private Bitmap combineImageIntoOne(ArrayList<Bitmap> bitmap) {
int w = 0, h = 0;
for (int i = 0; i < bitmap.size(); i++) {
if (i < bitmap.size() - 1) {
h = bitmap.get(i).getWidth() > bitmap.get(i + 1).getWidth() ? bitmap.get(i).getWidth()
: bitmap.get(i + 1).getWidth();
}
w += bitmap.get(i).getHeight();
public AlbumFullWithAdapter(@NonNull Activity activity,
@NonNull DisplayMetrics metrics) {
super(metrics);
this.activity = activity;
}
Bitmap temp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(temp);
int top = 0, left = 0;
for (int i = 0; i < bitmap.size(); i++) {
Log.d("HTML", "Combine: " + i + "/" + bitmap.size() + 1);
top = (i == 0 ? 0 : top + bitmap.get(i).getHeight());
left = (i == 0 ? 0 : top + bitmap.get(i).getWidth());
canvas.drawBitmap(bitmap.get(i), left, 0f, null);
}
return temp;
}
@Override
public void onBindViewHolder(FullMetalViewHolder holder, int position) {
// don't forget about calling supper.onBindViewHolder!
super.onBindViewHolder(holder, position);
final Album album = dataSet.get(position);
if (holder.title != null) {
holder.title.setText(getAlbumTitle(album));
}
if (holder.text != null) {
holder.text.setText(getAlbumText(album));
}
if (holder.playSongs != null) {
holder.playSongs.setOnClickListener(v -> MusicPlayerRemote.openQueue(album.songs, 0, true));
}
loadAlbumCover(album, holder);
}
private String getAlbumTitle(Album album) {
return album.getTitle();
}
private String getAlbumText(Album album) {
return album.getArtistName();
}
private void loadAlbumCover(Album album, FullMetalViewHolder holder) {
if (holder.image == null) {
return;
public void swapData(ArrayList<Album> list) {
dataSet = list;
notifyDataSetChanged();
}
SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
.checkIgnoreMediaStore(activity)
.generatePalette(activity).build()
.into(new RetroMusicColoredTarget(holder.image) {
@Override
public void onColorReady(int color) {
@NonNull
@Override
public FullMetalViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View viewItem = LayoutInflater.from(parent.getContext())
.inflate(R.layout.pager_item, parent, false);
return new FullMetalViewHolder(viewItem);
}
}
});
}
private Bitmap combineImageIntoOne(ArrayList<Bitmap> bitmap) {
int w = 0, h = 0;
for (int i = 0; i < bitmap.size(); i++) {
if (i < bitmap.size() - 1) {
h = bitmap.get(i).getWidth() > bitmap.get(i + 1).getWidth() ? bitmap.get(i).getWidth()
: bitmap.get(i + 1).getWidth();
}
w += bitmap.get(i).getHeight();
}
@Override
public int getItemCount() {
return dataSet.size();
}
Bitmap temp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(temp);
int top = 0, left = 0;
for (int i = 0; i < bitmap.size(); i++) {
Log.d("HTML", "Combine: " + i + "/" + bitmap.size() + 1);
class FullMetalViewHolder extends MetalRecyclerViewPager.MetalViewHolder {
FullMetalViewHolder(View itemView) {
super(itemView);
top = (i == 0 ? 0 : top + bitmap.get(i).getHeight());
left = (i == 0 ? 0 : top + bitmap.get(i).getWidth());
canvas.drawBitmap(bitmap.get(i), left, 0f, null);
}
return temp;
}
@Override
public void onClick(View v) {
Pair[] albumPairs = new Pair[]{
Pair.create(image, activity.getResources().getString(R.string.transition_album_art))};
NavigationUtil.goToAlbum(activity, dataSet.get(getAdapterPosition()).getId(), albumPairs);
public void onBindViewHolder(@NonNull FullMetalViewHolder holder, int position) {
// don't forget about calling supper.onBindViewHolder!
super.onBindViewHolder(holder, position);
final Album album = dataSet.get(position);
if (holder.title != null) {
holder.title.setText(getAlbumTitle(album));
}
if (holder.text != null) {
holder.text.setText(getAlbumText(album));
}
if (holder.playSongs != null) {
holder.playSongs.setOnClickListener(v -> MusicPlayerRemote.openQueue(album.songs, 0, true));
}
loadAlbumCover(album, holder);
}
private String getAlbumTitle(Album album) {
return album.getTitle();
}
private String getAlbumText(Album album) {
return album.getArtistName();
}
private void loadAlbumCover(Album album, FullMetalViewHolder holder) {
if (holder.image == null) {
return;
}
SongGlideRequest.Builder.from(Glide.with(activity), album.safeGetFirstSong())
.checkIgnoreMediaStore(activity)
.generatePalette(activity).build()
.into(new RetroMusicColoredTarget(holder.image) {
@Override
public void onColorReady(int color) {
}
});
}
@Override
public int getItemCount() {
return dataSet.size();
}
class FullMetalViewHolder extends MetalRecyclerViewPager.MetalViewHolder {
FullMetalViewHolder(View itemView) {
super(itemView);
}
@Override
public void onClick(View v) {
Pair[] albumPairs = new Pair[]{
Pair.create(image, activity.getResources().getString(R.string.transition_album_art))};
NavigationUtil.goToAlbum(activity, dataSet.get(getAdapterPosition()).getId(), albumPairs);
}
}
}
}

View File

@ -9,6 +9,13 @@ import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.bumptech.glide.Glide;
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
import java.util.ArrayList;
import java.util.List;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
import code.name.monkey.retromusic.R;
@ -22,167 +29,171 @@ import code.name.monkey.retromusic.ui.adapter.base.AbsMultiSelectAdapter;
import code.name.monkey.retromusic.ui.adapter.base.MediaEntryViewHolder;
import code.name.monkey.retromusic.util.MusicUtil;
import code.name.monkey.retromusic.util.NavigationUtil;
import com.bumptech.glide.Glide;
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
import java.util.ArrayList;
import java.util.List;
public class ArtistAdapter extends
AbsMultiSelectAdapter<ArtistAdapter.ViewHolder, Artist> implements
FastScrollRecyclerView.SectionedAdapter {
AbsMultiSelectAdapter<ArtistAdapter.ViewHolder, Artist> implements
FastScrollRecyclerView.SectionedAdapter {
protected final AppCompatActivity activity;
protected ArrayList<Artist> dataSet;
protected final AppCompatActivity activity;
protected ArrayList<Artist> dataSet;
protected int itemLayoutRes;
protected int itemLayoutRes;
protected boolean usePalette = false;
protected boolean usePalette = false;
public ArtistAdapter(@NonNull AppCompatActivity activity, ArrayList<Artist> dataSet,
@LayoutRes int itemLayoutRes, boolean usePalette, @Nullable CabHolder cabHolder) {
super(activity, cabHolder, R.menu.menu_media_selection);
this.activity = activity;
this.dataSet = dataSet;
this.itemLayoutRes = itemLayoutRes;
this.usePalette = usePalette;
//setHasStableIds(true);
}
public void swapDataSet(ArrayList<Artist> dataSet) {
this.dataSet = dataSet;
notifyDataSetChanged();
}
public ArrayList<Artist> getDataSet() {
return dataSet;
}
public void usePalette(boolean usePalette) {
this.usePalette = usePalette;
notifyDataSetChanged();
}
@Override
public long getItemId(int position) {
return dataSet.get(position).getId();
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false);
return createViewHolder(view);
}
protected ViewHolder createViewHolder(View view) {
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
final Artist artist = dataSet.get(position);
boolean isChecked = isChecked(artist);
holder.itemView.setActivated(isChecked);
if (holder.title != null) {
holder.title.setText(artist.getName());
public ArtistAdapter(@NonNull AppCompatActivity activity, ArrayList<Artist> dataSet,
@LayoutRes int itemLayoutRes, boolean usePalette, @Nullable CabHolder cabHolder) {
super(activity, cabHolder, R.menu.menu_media_selection);
this.activity = activity;
this.dataSet = dataSet;
this.itemLayoutRes = itemLayoutRes;
this.usePalette = usePalette;
//setHasStableIds(true);
}
if (holder.text != null) {
holder.text.setVisibility(View.GONE);
public ArtistAdapter(@NonNull AppCompatActivity activity, ArrayList<Artist> dataSet,
@LayoutRes int itemLayoutRes ) {
super(activity, null, R.menu.menu_media_selection);
this.activity = activity;
this.dataSet = dataSet;
this.itemLayoutRes = itemLayoutRes;
}
if (holder.shortSeparator != null) {
holder.shortSeparator.setVisibility(View.VISIBLE);
public void swapDataSet(ArrayList<Artist> dataSet) {
this.dataSet = dataSet;
notifyDataSetChanged();
}
loadArtistImage(artist, holder);
}
protected void setColors(int color, ViewHolder holder) {
if (holder.paletteColorContainer != null) {
holder.paletteColorContainer.setBackgroundColor(color);
if (holder.title != null) {
holder.title.setTextColor(
MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
}
public ArrayList<Artist> getDataSet() {
return dataSet;
}
}
private void loadArtistImage(Artist artist, final ViewHolder holder) {
if (holder.image == null) {
return;
}
ArtistGlideRequest.Builder.from(Glide.with(activity), artist)
.generatePalette(activity).build()
.into(new RetroMusicColoredTarget(holder.image) {
@Override
public void onColorReady(int color) {
setColors(color, holder);
}
});
}
@Override
public int getItemCount() {
return dataSet.size();
}
@Override
protected Artist getIdentifier(int position) {
return dataSet.get(position);
}
@Override
protected String getName(Artist artist) {
return artist.getName();
}
@Override
protected void onMultipleItemAction(@NonNull MenuItem menuItem,
@NonNull ArrayList<Artist> selection) {
SongsMenuHelper.handleMenuClick(activity, getSongList(selection), menuItem.getItemId());
}
@NonNull
private ArrayList<Song> getSongList(@NonNull List<Artist> artists) {
final ArrayList<Song> songs = new ArrayList<>();
for (Artist artist : artists) {
songs.addAll(artist.getSongs()); // maybe async in future?
}
return songs;
}
@NonNull
@Override
public String getSectionName(int position) {
return MusicUtil.getSectionName(dataSet.get(position).getName());
}
public class ViewHolder extends MediaEntryViewHolder {
public ViewHolder(@NonNull View itemView) {
super(itemView);
setImageTransitionName(activity.getString(R.string.transition_artist_image));
if (menu != null) {
menu.setVisibility(View.GONE);
}
public void usePalette(boolean usePalette) {
this.usePalette = usePalette;
notifyDataSetChanged();
}
@Override
public void onClick(View v) {
if (isInQuickSelectMode()) {
toggleChecked(getAdapterPosition());
} else {
Pair[] artistPairs = new Pair[]{Pair.create(image,
activity.getResources().getString(R.string.transition_artist_image))};
NavigationUtil.goToArtist(activity, dataSet.get(getAdapterPosition()).getId(), artistPairs);
}
public long getItemId(int position) {
return dataSet.get(position).getId();
}
@Override
public boolean onLongClick(View view) {
toggleChecked(getAdapterPosition());
return true;
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false);
return createViewHolder(view);
}
protected ViewHolder createViewHolder(View view) {
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
final Artist artist = dataSet.get(position);
boolean isChecked = isChecked(artist);
holder.itemView.setActivated(isChecked);
if (holder.title != null) {
holder.title.setText(artist.getName());
}
if (holder.text != null) {
holder.text.setVisibility(View.GONE);
}
if (holder.shortSeparator != null) {
holder.shortSeparator.setVisibility(View.VISIBLE);
}
loadArtistImage(artist, holder);
}
protected void setColors(int color, ViewHolder holder) {
if (holder.paletteColorContainer != null) {
holder.paletteColorContainer.setBackgroundColor(color);
if (holder.title != null) {
holder.title.setTextColor(
MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
}
}
}
private void loadArtistImage(Artist artist, final ViewHolder holder) {
if (holder.image == null) {
return;
}
ArtistGlideRequest.Builder.from(Glide.with(activity), artist)
.generatePalette(activity).build()
.into(new RetroMusicColoredTarget(holder.image) {
@Override
public void onColorReady(int color) {
setColors(color, holder);
}
});
}
@Override
public int getItemCount() {
return dataSet.size();
}
@Override
protected Artist getIdentifier(int position) {
return dataSet.get(position);
}
@Override
protected String getName(Artist artist) {
return artist.getName();
}
@Override
protected void onMultipleItemAction(@NonNull MenuItem menuItem,
@NonNull ArrayList<Artist> selection) {
SongsMenuHelper.handleMenuClick(activity, getSongList(selection), menuItem.getItemId());
}
@NonNull
private ArrayList<Song> getSongList(@NonNull List<Artist> artists) {
final ArrayList<Song> songs = new ArrayList<>();
for (Artist artist : artists) {
songs.addAll(artist.getSongs()); // maybe async in future?
}
return songs;
}
@NonNull
@Override
public String getSectionName(int position) {
return MusicUtil.getSectionName(dataSet.get(position).getName());
}
public class ViewHolder extends MediaEntryViewHolder {
public ViewHolder(@NonNull View itemView) {
super(itemView);
setImageTransitionName(activity.getString(R.string.transition_artist_image));
if (menu != null) {
menu.setVisibility(View.GONE);
}
}
@Override
public void onClick(View v) {
if (isInQuickSelectMode()) {
toggleChecked(getAdapterPosition());
} else {
Pair[] artistPairs = new Pair[]{Pair.create(image,
activity.getResources().getString(R.string.transition_artist_image))};
NavigationUtil.goToArtist(activity, dataSet.get(getAdapterPosition()).getId(), artistPairs);
}
}
@Override
public boolean onLongClick(View view) {
toggleChecked(getAdapterPosition());
return true;
}
}
}
}

View File

@ -10,6 +10,7 @@ import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
@ -17,82 +18,82 @@ import code.name.monkey.retromusic.R;
public class MediaEntryViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener, View.OnLongClickListener {
implements View.OnClickListener, View.OnLongClickListener {
@Nullable
@BindView(R.id.image)
public ImageView image;
@Nullable
@BindView(R.id.image_text)
public TextView imageText;
@Nullable
@BindView(R.id.title)
public TextView title;
@Nullable
@BindView(R.id.text)
public TextView text;
@Nullable
@BindView(R.id.image_container)
public ViewGroup imageContainer;
@Nullable
@BindView(R.id.image_container_card)
public CardView imageContainerCard;
@Nullable
@BindView(R.id.menu)
public View menu;
@Nullable
@BindView(R.id.separator)
public View separator;
@Nullable
@BindView(R.id.short_separator)
public View shortSeparator;
@Nullable
@BindView(R.id.drag_view)
public View dragView;
@Nullable
@BindView(R.id.palette_color_container)
public View paletteColorContainer;
@BindView(R.id.time)
@Nullable
public TextView time;
@BindView(R.id.recycler_view)
@Nullable
public RecyclerView recyclerView;
@BindView(R.id.play_songs)
@Nullable
public ImageButton playSongs;
@BindView(R.id.image_text_container)
@Nullable
public CardView imageTextContainer;
@Nullable
@BindView(R.id.image)
public ImageView image;
@Nullable
@BindView(R.id.image_text)
public TextView imageText;
@Nullable
@BindView(R.id.title)
public TextView title;
@Nullable
@BindView(R.id.text)
public TextView text;
@Nullable
@BindView(R.id.image_container)
public ViewGroup imageContainer;
@Nullable
@BindView(R.id.image_container_card)
public CardView imageContainerCard;
@Nullable
@BindView(R.id.menu)
public View menu;
@Nullable
@BindView(R.id.separator)
public View separator;
@Nullable
@BindView(R.id.short_separator)
public View shortSeparator;
@Nullable
@BindView(R.id.drag_view)
public View dragView;
@Nullable
@BindView(R.id.palette_color_container)
public View paletteColorContainer;
@BindView(R.id.time)
@Nullable
public TextView time;
@BindView(R.id.recycler_view)
@Nullable
public RecyclerView recyclerView;
@BindView(R.id.play_songs)
@Nullable
public ImageButton playSongs;
@BindView(R.id.image_text_container)
@Nullable
public CardView imageTextContainer;
public MediaEntryViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
public MediaEntryViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
if (imageTextContainer != null) {
imageTextContainer.setCardBackgroundColor(ThemeStore.primaryColor(itemView.getContext()));
if (imageTextContainer != null) {
imageTextContainer.setCardBackgroundColor(ThemeStore.primaryColor(itemView.getContext()));
}
if (imageContainerCard != null) {
imageContainerCard.setCardBackgroundColor(ThemeStore.primaryColor(itemView.getContext()));
}
}
if (imageContainerCard != null) {
imageContainerCard.setCardBackgroundColor(ThemeStore.primaryColor(itemView.getContext()));
protected void setImageTransitionName(@NonNull String transitionName) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && image != null) {
image.setTransitionName(transitionName);
}
}
}
protected void setImageTransitionName(@NonNull String transitionName) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && image != null) {
image.setTransitionName(transitionName);
@Override
public boolean onLongClick(View v) {
return false;
}
}
@Override
public boolean onLongClick(View v) {
return false;
}
@Override
public void onClick(View v) {
}
@Override
public void onClick(View v) {
}
}

View File

@ -1,169 +1,128 @@
package code.name.monkey.retromusic.ui.adapter.home;
import android.app.Activity;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.BindView;
import java.util.ArrayList;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.loaders.SongLoader;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.model.Artist;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Home;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.model.smartplaylist.HistoryPlaylist;
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist;
import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist;
import code.name.monkey.retromusic.ui.adapter.CollageSongAdapter;
import code.name.monkey.retromusic.ui.adapter.GenreAdapter;
import code.name.monkey.retromusic.ui.adapter.album.AlbumAdapter;
import code.name.monkey.retromusic.ui.adapter.artist.ArtistAdapter;
import code.name.monkey.retromusic.ui.adapter.base.MediaEntryViewHolder;
import code.name.monkey.retromusic.ui.adapter.song.SongAdapter;
import code.name.monkey.retromusic.util.NavigationUtil;
import java.util.ArrayList;
public class HomeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.ViewHolder> {
private static final int SUB_HEADER = 0;
private static final int ABS_PLAYLITS = 1;
private static final int DATA = 2;
private ArrayList<Object> dataSet = new ArrayList<>();
private AppCompatActivity activity;
private static final int ALBUMS = 0;
private static final int ARTISTS = 1;
private static final int GENERS = 2;
private static final int SUGGESTIONS = 3;
private Activity activity;
private ArrayList<Home> sections = new ArrayList<>();
public HomeAdapter(@NonNull AppCompatActivity activity) {
this.activity = activity;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
switch (i) {
case ABS_PLAYLITS:
return new ViewHolder(LayoutInflater.from(activity)
.inflate(R.layout.abs_playlists, viewGroup, false));
default:
case DATA:
return new ViewHolder(LayoutInflater.from(activity)
.inflate(R.layout.recycler_view_sec, viewGroup, false));
case SUB_HEADER:
return new ViewHolder(LayoutInflater.from(activity)
.inflate(R.layout.sub_header, viewGroup, false));
public HomeAdapter(Activity activity) {
this.activity = activity;
}
}
@Override
public int getItemViewType(int position) {
if (dataSet.get(position) instanceof String) {
return SUB_HEADER;
} else if (dataSet.get(position) instanceof Integer) {
return ABS_PLAYLITS;
} else if (dataSet.get(position) instanceof ArrayList) {
return DATA;
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
Context context = parent.getContext();
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.home_section_recycler_view,
parent, false));
}
return super.getItemViewType(position);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int i) {
ViewHolder viewholder = (ViewHolder) holder;
switch (getItemViewType(i)) {
case ABS_PLAYLITS:
bindAbsActions(viewholder);
break;
case SUB_HEADER:
String title = (String) dataSet.get(i);
if (viewholder.title != null) {
viewholder.title.setText(title);
@Override
public int getItemViewType(int position) {
Home home = sections.get(position);
ArrayList arrayList = home.getList();
if (arrayList.get(0) instanceof Album) {
return ALBUMS;
} else if (arrayList.get(0) instanceof Artist) {
return ARTISTS;
} else if (arrayList.get(0) instanceof Genre) {
return GENERS;
} else {
return SUGGESTIONS;
}
break;
case DATA:
parseAllSections(i, viewholder);
break;
}
}
private void bindAbsActions(ViewHolder viewholder) {
if (viewholder.shuffle != null) {
viewholder.shuffle.setOnClickListener(view -> MusicPlayerRemote
.openAndShuffleQueue(SongLoader.getAllSongs(activity).blockingFirst(), true));
private DisplayMetrics getDisplayMetrics() {
Display display = activity.getWindowManager().getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
return metrics;
}
/*if (viewholder.search != null) {
viewholder.search.setBackgroundTintList(ColorStateList.valueOf(ColorUtil.withAlpha(ThemeStore.textColorPrimary(activity), 0.2f)));
viewholder.search.setOnClickListener(view -> {
activity.startActivity(new Intent(activity, SearchActivity.class));
});
}*/
}
@SuppressWarnings("unchecked")
private void parseAllSections(int i, ViewHolder viewholder) {
if (viewholder.recyclerView != null) {
ArrayList arrayList = (ArrayList) dataSet.get(i);
if (arrayList.isEmpty()) {
return;
}
Object something = arrayList.get(0);
if (something instanceof Artist) {
layoutManager(viewholder);
viewholder.recyclerView.setAdapter(
new ArtistAdapter(activity, (ArrayList<Artist>) arrayList, R.layout.item_artist, false,
null));
} else if (something instanceof Album) {
layoutManager(viewholder);
viewholder.recyclerView.setItemAnimator(new DefaultItemAnimator());
viewholder.recyclerView.setAdapter(
new AlbumAdapter(activity, (ArrayList<Album>) arrayList, R.layout.item_image, false,
null));
} else if (something instanceof Song) {
GridLayoutManager layoutManager = new GridLayoutManager(activity, 1,
LinearLayoutManager.HORIZONTAL, false);
viewholder.recyclerView.setLayoutManager(layoutManager);
viewholder.recyclerView.setAdapter(
new SongAdapter(activity, (ArrayList<Song>) arrayList, R.layout.item_image, false,
null));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
Home home = sections.get(position);
if (holder.title != null) {
holder.title.setText(home.getSectionTitle());
}
ArrayList arrayList = home.getList();
if (arrayList.get(0) instanceof Album) {
AlbumAdapter albumAdapter = new AlbumAdapter((AppCompatActivity) activity,
(ArrayList<Album>) arrayList, R.layout.item_image);
if (holder.recyclerView != null) {
holder.recyclerView.setLayoutManager(new GridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false));
holder.recyclerView.setAdapter(albumAdapter);
}
} else if (arrayList.get(0) instanceof Artist) {
ArtistAdapter artistAdapter = new ArtistAdapter((AppCompatActivity) activity, (ArrayList<Artist>) arrayList, R.layout.item_artist);
GridLayoutManager layoutManager = new GridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false);
if (holder.recyclerView != null) {
holder.recyclerView.setLayoutManager(layoutManager);
holder.recyclerView.setAdapter(artistAdapter);
}
} else if (arrayList.get(0) instanceof Genre) {
GenreAdapter genreAdapter = new GenreAdapter(activity, (ArrayList<Genre>) arrayList, R.layout.item_list);
if (holder.recyclerView != null) {
holder.recyclerView.setLayoutManager(new LinearLayoutManager(activity));
holder.recyclerView.setAdapter(genreAdapter);
}
} else if (arrayList.get(0) instanceof Song) {
CollageSongAdapter collageSongAdapter = new CollageSongAdapter(activity, (ArrayList<Song>) arrayList);
if (holder.recyclerView != null) {
holder.recyclerView.setLayoutManager(new LinearLayoutManager(activity));
holder.recyclerView.setAdapter(collageSongAdapter);
}
}
}
}
private void layoutManager(ViewHolder viewholder) {
if (viewholder.recyclerView != null) {
viewholder.recyclerView.setLayoutManager(
new GridLayoutManager(activity, 1, GridLayoutManager.HORIZONTAL, false));
viewholder.recyclerView.setItemAnimator(new DefaultItemAnimator());
@Override
public int getItemCount() {
return sections.size();
}
}
@Override
public int getItemCount() {
return dataSet.size();
}
public void swapDataSet(@NonNull ArrayList<Object> data) {
dataSet = data;
notifyDataSetChanged();
}
public ArrayList<Object> getDataset() {
return dataSet;
}
public class ViewHolder extends MediaEntryViewHolder {
@BindView(R.id.action_shuffle)
@Nullable
View shuffle;
public ViewHolder(View itemView) {
super(itemView);
public void swapData(ArrayList<Home> sections) {
this.sections = sections;
notifyDataSetChanged();
}
public class ViewHolder extends MediaEntryViewHolder {
public ViewHolder(View itemView) {
super(itemView);
}
}
}
}

View File

@ -35,11 +35,11 @@ public abstract class AbsMainActivityFragment extends AbsMusicServiceFragment {
final View statusBar = view.findViewById(R.id.status_bar);
if (statusBar != null) {
RetroUtil.statusBarHeight(statusBar);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
statusBar.setBackgroundColor(ColorUtil.darkenColor(color));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
statusBar.setBackgroundColor(color);
getMainActivity().setLightStatusbarAuto(color);
} else {
statusBar.setBackgroundColor(color);
statusBar.setBackgroundColor(ColorUtil.darkenColor(color));
}
}
}
@ -47,6 +47,7 @@ public abstract class AbsMainActivityFragment extends AbsMusicServiceFragment {
public void setStatusbarColorAuto(View view) {
// we don't want to use statusbar color because we are doing the color darkening on our own to support KitKat
//noinspection ConstantConditions
setStatusbarColor(view, ThemeStore.primaryColor(getContext()));
}
}

View File

@ -4,6 +4,9 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import java.util.ArrayList;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.mvp.contract.AlbumContract;
@ -11,156 +14,166 @@ import code.name.monkey.retromusic.mvp.presenter.AlbumPresenter;
import code.name.monkey.retromusic.ui.adapter.album.AlbumAdapter;
import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
import code.name.monkey.retromusic.util.PreferenceUtil;
import java.util.ArrayList;
public class AlbumsFragment extends
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager> implements
AlbumContract.AlbumView {
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager> implements
AlbumContract.AlbumView {
public static final String TAG = AlbumsFragment.class.getSimpleName();
public static final String TAG = AlbumsFragment.class.getSimpleName();
private AlbumPresenter presenter;
private AlbumPresenter presenter;
public static AlbumsFragment newInstance() {
Bundle args = new Bundle();
AlbumsFragment fragment = new AlbumsFragment();
fragment.setArguments(args);
return fragment;
}
@Override
protected GridLayoutManager createLayoutManager() {
return new GridLayoutManager(getActivity(), getGridSize());
}
@NonNull
@Override
protected AlbumAdapter createAdapter() {
int itemLayoutRes = getItemLayoutRes();
notifyLayoutResChanged(itemLayoutRes);
if (itemLayoutRes != R.layout.item_list) {
itemLayoutRes = PreferenceUtil.getInstance(getContext()).getAlbumGridStyle(getContext());
public static AlbumsFragment newInstance() {
Bundle args = new Bundle();
AlbumsFragment fragment = new AlbumsFragment();
fragment.setArguments(args);
return fragment;
}
ArrayList<Album> dataSet =
getAdapter() == null ? new ArrayList<>() : getAdapter().getDataSet();
return new AlbumAdapter(getLibraryFragment().getMainActivity(), dataSet, itemLayoutRes,
loadUsePalette(), getLibraryFragment());
}
@Override
protected int getEmptyMessage() {
return R.string.no_albums;
}
@Override
public boolean loadUsePalette() {
return PreferenceUtil.getInstance(getActivity()).albumColoredFooters();
}
@Override
protected void setUsePalette(boolean usePalette) {
getAdapter().usePalette(usePalette);
}
@Override
protected void setGridSize(int gridSize) {
getLayoutManager().setSpanCount(gridSize);
getAdapter().notifyDataSetChanged();
}
@Override
protected void setSortOrder(String sortOrder) {
presenter.loadAlbums();
}
@Override
protected String loadSortOrder() {
return PreferenceUtil.getInstance(getActivity()).getAlbumSortOrder();
}
@Override
protected void saveSortOrder(String sortOrder) {
PreferenceUtil.getInstance(getActivity()).setAlbumSortOrder(sortOrder);
}
@Override
protected int loadGridSize() {
return PreferenceUtil.getInstance(getActivity()).getAlbumGridSize(getActivity());
}
@Override
protected void saveGridSize(int gridSize) {
PreferenceUtil.getInstance(getActivity()).setAlbumGridSize(gridSize);
}
@Override
protected int loadGridSizeLand() {
return PreferenceUtil.getInstance(getActivity()).getAlbumGridSizeLand(getActivity());
}
@Override
protected void saveGridSizeLand(int gridSize) {
PreferenceUtil.getInstance(getActivity()).setAlbumGridSizeLand(gridSize);
}
@Override
protected void saveUsePalette(boolean usePalette) {
PreferenceUtil.getInstance(getActivity()).setAlbumColoredFooters(usePalette);
}
@Override
public void onMediaStoreChanged() {
presenter.loadAlbums();
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
presenter = new AlbumPresenter(this);
}
@Override
public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible);
if (menuVisible) {
getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library
: R.string.albums);
@Override
protected GridLayoutManager createLayoutManager() {
return new GridLayoutManager(getActivity(), getGridSize());
}
}
@Override
public void onResume() {
super.onResume();
getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.albums);
if (getAdapter().getDataSet().isEmpty()) {
presenter.subscribe();
@NonNull
@Override
protected AlbumAdapter createAdapter() {
int itemLayoutRes = getItemLayoutRes();
notifyLayoutResChanged(itemLayoutRes);
if (itemLayoutRes != R.layout.item_list) {
//noinspection ConstantConditions
itemLayoutRes = PreferenceUtil.getInstance(getContext()).getAlbumGridStyle(getContext());
}
ArrayList<Album> dataSet =
getAdapter() == null ? new ArrayList<>() : getAdapter().getDataSet();
return new AlbumAdapter(getLibraryFragment().getMainActivity(), dataSet, itemLayoutRes,
loadUsePalette(), getLibraryFragment());
}
}
@Override
public void onDestroy() {
super.onDestroy();
presenter.unsubscribe();
}
@Override
protected int getEmptyMessage() {
return R.string.no_albums;
}
@Override
public void loading() {
}
@Override
public boolean loadUsePalette() {
//noinspection ConstantConditions
return PreferenceUtil.getInstance(getActivity()).albumColoredFooters();
}
@Override
public void showEmptyView() {
getAdapter().swapDataSet(new ArrayList<>());
}
@Override
protected void setUsePalette(boolean usePalette) {
getAdapter().usePalette(usePalette);
}
@Override
public void completed() {
}
@Override
protected void setGridSize(int gridSize) {
getLayoutManager().setSpanCount(gridSize);
getAdapter().notifyDataSetChanged();
}
@Override
public void showData(ArrayList<Album> albums) {
getAdapter().swapDataSet(albums);
}
@Override
protected void setSortOrder(String sortOrder) {
presenter.loadAlbums();
}
@Override
protected String loadSortOrder() {
//noinspection ConstantConditions
return PreferenceUtil.getInstance(getActivity()).getAlbumSortOrder();
}
@Override
protected void saveSortOrder(String sortOrder) {
//noinspection ConstantConditions
PreferenceUtil.getInstance(getActivity()).setAlbumSortOrder(sortOrder);
}
@Override
protected int loadGridSize() {
//noinspection ConstantConditions
return PreferenceUtil.getInstance(getActivity()).getAlbumGridSize(getActivity());
}
@Override
protected void saveGridSize(int gridSize) {
//noinspection ConstantConditions
PreferenceUtil.getInstance(getActivity()).setAlbumGridSize(gridSize);
}
@Override
protected int loadGridSizeLand() {
//noinspection ConstantConditions
return PreferenceUtil.getInstance(getActivity()).getAlbumGridSizeLand(getActivity());
}
@Override
protected void saveGridSizeLand(int gridSize) {
//noinspection ConstantConditions
PreferenceUtil.getInstance(getActivity()).setAlbumGridSizeLand(gridSize);
}
@Override
protected void saveUsePalette(boolean usePalette) {
//noinspection ConstantConditions
PreferenceUtil.getInstance(getActivity()).setAlbumColoredFooters(usePalette);
}
@Override
public void onMediaStoreChanged() {
presenter.loadAlbums();
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
presenter = new AlbumPresenter(this);
}
@Override
public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible);
if (menuVisible) {
//noinspection ConstantConditions
getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library
: R.string.albums);
}
}
@Override
public void onResume() {
super.onResume();
//noinspection ConstantConditions
getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.albums);
if (getAdapter().getDataSet().isEmpty()) {
presenter.subscribe();
}
}
@Override
public void onDestroy() {
super.onDestroy();
presenter.unsubscribe();
}
@Override
public void loading() {
}
@Override
public void showEmptyView() {
getAdapter().swapDataSet(new ArrayList<>());
}
@Override
public void completed() {
}
@Override
public void showData(ArrayList<Album> albums) {
getAdapter().swapDataSet(albums);
}
}

View File

@ -7,7 +7,6 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
@ -19,12 +18,18 @@ import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.afollestad.materialcab.MaterialCab;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.common.ATHToolbarActivity;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.CreatePlaylistDialog;
@ -40,416 +45,424 @@ import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.RetroUtil;
import com.afollestad.materialcab.MaterialCab;
import code.name.monkey.retromusic.views.IconImageView;
public class LibraryFragment extends AbsMainActivityFragment implements CabHolder,
MainActivityFragmentCallbacks {
MainActivityFragmentCallbacks {
private static final String TAG = "LibraryFragment";
private static final String CURRENT_TAB_ID = "current_tab_id";
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
AppBarLayout appbar;
@BindView(R.id.collapsing_toolbar)
CollapsingToolbarLayout collapsingToolbarLayout;
public static final String TAG = "LibraryFragment";
private static final String CURRENT_TAB_ID = "current_tab_id";
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
AppBarLayout appbar;
@BindView(R.id.title)
TextView title;
@BindView(R.id.search)
IconImageView search;
private Unbinder unBinder;
private MaterialCab cab;
private FragmentManager fragmentManager;
private Unbinder unBinder;
private MaterialCab cab;
private FragmentManager fragmentManager;
public static Fragment newInstance(int tab) {
Bundle args = new Bundle();
args.putInt(CURRENT_TAB_ID, tab);
LibraryFragment fragment = new LibraryFragment();
fragment.setArguments(args);
return fragment;
}
public void setTitle(@StringRes int name) {
collapsingToolbarLayout.setTitle(getString(name));
}
public void addOnAppBarOffsetChangedListener(
AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
appbar.addOnOffsetChangedListener(onOffsetChangedListener);
}
public void removeOnAppBarOffsetChangedListener(
AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
appbar.removeOnOffsetChangedListener(onOffsetChangedListener);
}
public int getTotalAppBarScrollingRange() {
return appbar.getTotalScrollRange();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_library, container, false);
unBinder = ButterKnife.bind(this, view);
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setStatusbarColorAuto(view);
getMainActivity().setBottomBarVisibility(View.VISIBLE);
setupToolbar();
inflateFragment();
}
private void inflateFragment() {
if (getArguments() == null) {
selectedFragment(SongsFragment.newInstance());
return;
}
switch (getArguments().getInt(CURRENT_TAB_ID)) {
default:
case R.id.action_song:
selectedFragment(SongsFragment.newInstance());
break;
case R.id.action_album:
selectedFragment(AlbumsFragment.newInstance());
break;
case R.id.action_artist:
selectedFragment(ArtistsFragment.newInstance());
break;
case R.id.action_playlist:
selectedFragment(PlaylistsFragment.newInstance());
break;
}
}
@SuppressWarnings("ConstantConditions")
private void setupToolbar() {
int primaryColor = ThemeStore.primaryColor(getContext());
appbar.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(primaryColor);
appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
getMainActivity().setTitle(R.string.app_name);
getMainActivity().setSupportActionBar(toolbar);
}
public Fragment getCurrentFragment() {
if (fragmentManager == null) {
return SongsFragment.newInstance();
}
return fragmentManager.findFragmentByTag(LibraryFragment.TAG);
}
@Override
public void onDestroyView() {
super.onDestroyView();
unBinder.unbind();
}
@Override
public boolean handleBackPress() {
if (cab != null && cab.isActive()) {
cab.finish();
return true;
}
return false;
}
public void selectedFragment(Fragment fragment) {
fragmentManager = getChildFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction
.replace(R.id.fragment_container, fragment, TAG)
.commit();
}
@NonNull
@Override
public MaterialCab openCab(int menuRes, MaterialCab.Callback callback) {
if (cab != null && cab.isActive()) {
cab.finish();
}
//noinspection ConstantConditions
cab = new MaterialCab(getMainActivity(), R.id.cab_stub)
.setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
.setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.primaryColor(getActivity())))
.start(callback);
return cab;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_main, menu);
Fragment currentFragment = getCurrentFragment();
if (currentFragment instanceof AbsLibraryPagerRecyclerViewCustomGridSizeFragment
&& currentFragment.isAdded()) {
AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment = (AbsLibraryPagerRecyclerViewCustomGridSizeFragment) currentFragment;
MenuItem gridSizeItem = menu.findItem(R.id.action_grid_size);
if (RetroUtil.isLandscape(getResources())) {
gridSizeItem.setTitle(R.string.action_grid_size_land);
}
setUpGridSizeMenu(fragment, gridSizeItem.getSubMenu());
setUpSortOrderMenu(fragment, menu.findItem(R.id.action_sort_order).getSubMenu());
} else {
menu.add(0, R.id.action_new_playlist, 0, R.string.new_playlist_title);
menu.removeItem(R.id.action_grid_size);
}
Activity activity = getActivity();
if (activity == null) {
return;
}
ToolbarContentTintHelper.handleOnCreateOptionsMenu(getActivity(), toolbar, menu,
ATHToolbarActivity.getToolbarBackgroundColor(toolbar));
}
private void setUpSortOrderMenu(
@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment,
@NonNull SubMenu sortOrderMenu) {
String currentSortOrder = fragment.getSortOrder();
sortOrderMenu.clear();
if (fragment instanceof AlbumsFragment) {
sortOrderMenu.add(0, R.id.action_album_sort_order_asc, 0, R.string.sort_order_a_z)
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_A_Z));
sortOrderMenu.add(0, R.id.action_album_sort_order_desc, 1, R.string.sort_order_z_a)
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_Z_A));
sortOrderMenu.add(0, R.id.action_album_sort_order_artist, 2, R.string.sort_order_artist)
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_ARTIST));
sortOrderMenu.add(0, R.id.action_album_sort_order_year, 3, R.string.sort_order_year)
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_YEAR));
} else if (fragment instanceof ArtistsFragment) {
sortOrderMenu.add(0, R.id.action_artist_sort_order_asc, 0, R.string.sort_order_a_z)
.setChecked(currentSortOrder.equals(SortOrder.ArtistSortOrder.ARTIST_A_Z));
sortOrderMenu.add(0, R.id.action_artist_sort_order_desc, 1, R.string.sort_order_z_a)
.setChecked(currentSortOrder.equals(SortOrder.ArtistSortOrder.ARTIST_Z_A));
} else if (fragment instanceof SongsFragment) {
sortOrderMenu.add(0, R.id.action_song_sort_order_asc, 0, R.string.sort_order_a_z)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_A_Z));
sortOrderMenu.add(0, R.id.action_song_sort_order_desc, 1, R.string.sort_order_z_a)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_Z_A));
sortOrderMenu.add(0, R.id.action_song_sort_order_artist, 2, R.string.sort_order_artist)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_ARTIST));
sortOrderMenu.add(0, R.id.action_song_sort_order_album, 3, R.string.sort_order_album)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_ALBUM));
sortOrderMenu.add(0, R.id.action_song_sort_order_year, 4, R.string.sort_order_year)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_YEAR));
sortOrderMenu.add(0, R.id.action_song_sort_order_date, 4, R.string.sort_order_date)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_DATE));
public static Fragment newInstance(int tab) {
Bundle args = new Bundle();
args.putInt(CURRENT_TAB_ID, tab);
LibraryFragment fragment = new LibraryFragment();
fragment.setArguments(args);
return fragment;
}
sortOrderMenu.setGroupCheckable(0, true, true);
}
private boolean handleSortOrderMenuItem(
@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment, @NonNull MenuItem item) {
String sortOrder = null;
if (fragment instanceof AlbumsFragment) {
switch (item.getItemId()) {
case R.id.action_album_sort_order_asc:
sortOrder = SortOrder.AlbumSortOrder.ALBUM_A_Z;
break;
case R.id.action_album_sort_order_desc:
sortOrder = SortOrder.AlbumSortOrder.ALBUM_Z_A;
break;
case R.id.action_album_sort_order_artist:
sortOrder = SortOrder.AlbumSortOrder.ALBUM_ARTIST;
break;
case R.id.action_album_sort_order_year:
sortOrder = SortOrder.AlbumSortOrder.ALBUM_YEAR;
break;
}
} else if (fragment instanceof ArtistsFragment) {
switch (item.getItemId()) {
case R.id.action_artist_sort_order_asc:
sortOrder = SortOrder.ArtistSortOrder.ARTIST_A_Z;
break;
case R.id.action_artist_sort_order_desc:
sortOrder = SortOrder.ArtistSortOrder.ARTIST_Z_A;
break;
}
} else if (fragment instanceof SongsFragment) {
switch (item.getItemId()) {
case R.id.action_song_sort_order_asc:
sortOrder = SortOrder.SongSortOrder.SONG_A_Z;
break;
case R.id.action_song_sort_order_desc:
sortOrder = SortOrder.SongSortOrder.SONG_Z_A;
break;
case R.id.action_song_sort_order_artist:
sortOrder = SortOrder.SongSortOrder.SONG_ARTIST;
break;
case R.id.action_song_sort_order_album:
sortOrder = SortOrder.SongSortOrder.SONG_ALBUM;
break;
case R.id.action_song_sort_order_year:
sortOrder = SortOrder.SongSortOrder.SONG_YEAR;
break;
case R.id.action_song_sort_order_date:
sortOrder = SortOrder.SongSortOrder.SONG_DATE;
break;
}
public void setTitle(@StringRes int name) {
title.setText(getString(name));
}
if (sortOrder != null) {
item.setChecked(true);
fragment.setAndSaveSortOrder(sortOrder);
return true;
public void addOnAppBarOffsetChangedListener(
AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
appbar.addOnOffsetChangedListener(onOffsetChangedListener);
}
return false;
}
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
Activity activity = getActivity();
if (activity == null) {
return;
public void removeOnAppBarOffsetChangedListener(
AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
appbar.removeOnOffsetChangedListener(onOffsetChangedListener);
}
ToolbarContentTintHelper.handleOnPrepareOptionsMenu(activity, toolbar);
}
@SuppressWarnings("ConstantConditions")
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
//if (pager == null) return false;
Fragment currentFragment = getCurrentFragment();
if (currentFragment instanceof AbsLibraryPagerRecyclerViewCustomGridSizeFragment) {
AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment = (AbsLibraryPagerRecyclerViewCustomGridSizeFragment) currentFragment;
if (handleGridSizeMenuItem(fragment, item)) {
return true;
}
if (handleSortOrderMenuItem(fragment, item)) {
return true;
}
public int getTotalAppBarScrollingRange() {
return appbar.getTotalScrollRange();
}
int id = item.getItemId();
switch (id) {
case R.id.action_new_playlist:
CreatePlaylistDialog.create().show(getChildFragmentManager(), "CREATE_PLAYLIST");
return true;
case R.id.action_shuffle_all:
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(getContext())
.blockingFirst(), true);
return true;
case R.id.action_search:
NavigationUtil.goToSearch(getMainActivity());
break;
case R.id.action_equalizer:
NavigationUtil.openEqualizer(getActivity());
return true;
case R.id.action_sleep_timer:
if (getFragmentManager() != null) {
new SleepTimerDialog().show(getFragmentManager(), TAG);
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_library, container, false);
unBinder = ButterKnife.bind(this, view);
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setStatusbarColorAuto(view);
getMainActivity().setBottomBarVisibility(View.VISIBLE);
setupToolbar();
inflateFragment();
}
private void inflateFragment() {
if (getArguments() == null) {
selectedFragment(SongsFragment.newInstance());
return;
}
switch (getArguments().getInt(CURRENT_TAB_ID)) {
default:
case R.id.action_song:
selectedFragment(SongsFragment.newInstance());
break;
case R.id.action_album:
selectedFragment(AlbumsFragment.newInstance());
break;
case R.id.action_artist:
selectedFragment(ArtistsFragment.newInstance());
break;
case R.id.action_playlist:
selectedFragment(PlaylistsFragment.newInstance());
break;
}
return true;
case R.id.action_settings:
startActivity(new Intent(getContext(), SettingsActivity.class));
break;
}
return super.onOptionsItemSelected(item);
}
private void setUpGridSizeMenu(
@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment,
@NonNull SubMenu gridSizeMenu) {
switch (fragment.getGridSize()) {
case 1:
gridSizeMenu.findItem(R.id.action_grid_size_1).setChecked(true);
break;
case 2:
gridSizeMenu.findItem(R.id.action_grid_size_2).setChecked(true);
break;
case 3:
gridSizeMenu.findItem(R.id.action_grid_size_3).setChecked(true);
break;
case 4:
gridSizeMenu.findItem(R.id.action_grid_size_4).setChecked(true);
break;
case 5:
gridSizeMenu.findItem(R.id.action_grid_size_5).setChecked(true);
break;
case 6:
gridSizeMenu.findItem(R.id.action_grid_size_6).setChecked(true);
break;
case 7:
gridSizeMenu.findItem(R.id.action_grid_size_7).setChecked(true);
break;
case 8:
gridSizeMenu.findItem(R.id.action_grid_size_8).setChecked(true);
break;
}
int maxGridSize = fragment.getMaxGridSize();
if (maxGridSize < 8) {
gridSizeMenu.findItem(R.id.action_grid_size_8).setVisible(false);
}
if (maxGridSize < 7) {
gridSizeMenu.findItem(R.id.action_grid_size_7).setVisible(false);
}
if (maxGridSize < 6) {
gridSizeMenu.findItem(R.id.action_grid_size_6).setVisible(false);
}
if (maxGridSize < 5) {
gridSizeMenu.findItem(R.id.action_grid_size_5).setVisible(false);
}
if (maxGridSize < 4) {
gridSizeMenu.findItem(R.id.action_grid_size_4).setVisible(false);
}
if (maxGridSize < 3) {
gridSizeMenu.findItem(R.id.action_grid_size_3).setVisible(false);
}
}
private boolean handleGridSizeMenuItem(
@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment, @NonNull MenuItem item) {
int gridSize = 0;
switch (item.getItemId()) {
case R.id.action_grid_size_1:
gridSize = 1;
break;
case R.id.action_grid_size_2:
gridSize = 2;
break;
case R.id.action_grid_size_3:
gridSize = 3;
break;
case R.id.action_grid_size_4:
gridSize = 4;
break;
case R.id.action_grid_size_5:
gridSize = 5;
break;
case R.id.action_grid_size_6:
gridSize = 6;
break;
case R.id.action_grid_size_7:
gridSize = 7;
break;
case R.id.action_grid_size_8:
gridSize = 8;
break;
}
if (gridSize > 0) {
item.setChecked(true);
fragment.setAndSaveGridSize(gridSize);
return true;
@SuppressWarnings("ConstantConditions")
private void setupToolbar() {
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
TintHelper.setTintAuto(search, ThemeStore.textColorSecondary(getContext()), false);
int primaryColor = ThemeStore.primaryColor(getContext());
appbar.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(primaryColor);
appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
getMainActivity().setTitle(null);
getMainActivity().setSupportActionBar(toolbar);
}
public Fragment getCurrentFragment() {
if (fragmentManager == null) {
return SongsFragment.newInstance();
}
return fragmentManager.findFragmentByTag(LibraryFragment.TAG);
}
@Override
public void onDestroyView() {
super.onDestroyView();
unBinder.unbind();
}
@Override
public boolean handleBackPress() {
if (cab != null && cab.isActive()) {
cab.finish();
return true;
}
return false;
}
public void selectedFragment(Fragment fragment) {
fragmentManager = getChildFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction
.replace(R.id.fragment_container, fragment, TAG)
.commit();
}
@NonNull
@Override
public MaterialCab openCab(int menuRes, MaterialCab.Callback callback) {
if (cab != null && cab.isActive()) {
cab.finish();
}
//noinspection ConstantConditions
cab = new MaterialCab(getMainActivity(), R.id.cab_stub)
.setMenu(menuRes)
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
.setBackgroundColor(
RetroColorUtil.shiftBackgroundColorForLightText(ThemeStore.primaryColor(getActivity())))
.start(callback);
return cab;
}
@OnClick(R.id.search)
void search() {
NavigationUtil.goToSearch(getActivity());
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_main, menu);
Fragment currentFragment = getCurrentFragment();
if (currentFragment instanceof AbsLibraryPagerRecyclerViewCustomGridSizeFragment
&& currentFragment.isAdded()) {
AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment = (AbsLibraryPagerRecyclerViewCustomGridSizeFragment) currentFragment;
MenuItem gridSizeItem = menu.findItem(R.id.action_grid_size);
if (RetroUtil.isLandscape(getResources())) {
gridSizeItem.setTitle(R.string.action_grid_size_land);
}
setUpGridSizeMenu(fragment, gridSizeItem.getSubMenu());
setUpSortOrderMenu(fragment, menu.findItem(R.id.action_sort_order).getSubMenu());
} else {
menu.add(0, R.id.action_new_playlist, 0, R.string.new_playlist_title);
menu.removeItem(R.id.action_grid_size);
}
Activity activity = getActivity();
if (activity == null) {
return;
}
ToolbarContentTintHelper.handleOnCreateOptionsMenu(getActivity(), toolbar, menu,
ATHToolbarActivity.getToolbarBackgroundColor(toolbar));
}
private void setUpSortOrderMenu(
@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment,
@NonNull SubMenu sortOrderMenu) {
String currentSortOrder = fragment.getSortOrder();
sortOrderMenu.clear();
if (fragment instanceof AlbumsFragment) {
sortOrderMenu.add(0, R.id.action_album_sort_order_asc, 0, R.string.sort_order_a_z)
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_A_Z));
sortOrderMenu.add(0, R.id.action_album_sort_order_desc, 1, R.string.sort_order_z_a)
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_Z_A));
sortOrderMenu.add(0, R.id.action_album_sort_order_artist, 2, R.string.sort_order_artist)
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_ARTIST));
sortOrderMenu.add(0, R.id.action_album_sort_order_year, 3, R.string.sort_order_year)
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_YEAR));
} else if (fragment instanceof ArtistsFragment) {
sortOrderMenu.add(0, R.id.action_artist_sort_order_asc, 0, R.string.sort_order_a_z)
.setChecked(currentSortOrder.equals(SortOrder.ArtistSortOrder.ARTIST_A_Z));
sortOrderMenu.add(0, R.id.action_artist_sort_order_desc, 1, R.string.sort_order_z_a)
.setChecked(currentSortOrder.equals(SortOrder.ArtistSortOrder.ARTIST_Z_A));
} else if (fragment instanceof SongsFragment) {
sortOrderMenu.add(0, R.id.action_song_sort_order_asc, 0, R.string.sort_order_a_z)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_A_Z));
sortOrderMenu.add(0, R.id.action_song_sort_order_desc, 1, R.string.sort_order_z_a)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_Z_A));
sortOrderMenu.add(0, R.id.action_song_sort_order_artist, 2, R.string.sort_order_artist)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_ARTIST));
sortOrderMenu.add(0, R.id.action_song_sort_order_album, 3, R.string.sort_order_album)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_ALBUM));
sortOrderMenu.add(0, R.id.action_song_sort_order_year, 4, R.string.sort_order_year)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_YEAR));
sortOrderMenu.add(0, R.id.action_song_sort_order_date, 4, R.string.sort_order_date)
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_DATE));
}
sortOrderMenu.setGroupCheckable(0, true, true);
}
private boolean handleSortOrderMenuItem(
@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment, @NonNull MenuItem item) {
String sortOrder = null;
if (fragment instanceof AlbumsFragment) {
switch (item.getItemId()) {
case R.id.action_album_sort_order_asc:
sortOrder = SortOrder.AlbumSortOrder.ALBUM_A_Z;
break;
case R.id.action_album_sort_order_desc:
sortOrder = SortOrder.AlbumSortOrder.ALBUM_Z_A;
break;
case R.id.action_album_sort_order_artist:
sortOrder = SortOrder.AlbumSortOrder.ALBUM_ARTIST;
break;
case R.id.action_album_sort_order_year:
sortOrder = SortOrder.AlbumSortOrder.ALBUM_YEAR;
break;
}
} else if (fragment instanceof ArtistsFragment) {
switch (item.getItemId()) {
case R.id.action_artist_sort_order_asc:
sortOrder = SortOrder.ArtistSortOrder.ARTIST_A_Z;
break;
case R.id.action_artist_sort_order_desc:
sortOrder = SortOrder.ArtistSortOrder.ARTIST_Z_A;
break;
}
} else if (fragment instanceof SongsFragment) {
switch (item.getItemId()) {
case R.id.action_song_sort_order_asc:
sortOrder = SortOrder.SongSortOrder.SONG_A_Z;
break;
case R.id.action_song_sort_order_desc:
sortOrder = SortOrder.SongSortOrder.SONG_Z_A;
break;
case R.id.action_song_sort_order_artist:
sortOrder = SortOrder.SongSortOrder.SONG_ARTIST;
break;
case R.id.action_song_sort_order_album:
sortOrder = SortOrder.SongSortOrder.SONG_ALBUM;
break;
case R.id.action_song_sort_order_year:
sortOrder = SortOrder.SongSortOrder.SONG_YEAR;
break;
case R.id.action_song_sort_order_date:
sortOrder = SortOrder.SongSortOrder.SONG_DATE;
break;
}
}
if (sortOrder != null) {
item.setChecked(true);
fragment.setAndSaveSortOrder(sortOrder);
return true;
}
return false;
}
@Override
public void onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
Activity activity = getActivity();
if (activity == null) {
return;
}
ToolbarContentTintHelper.handleOnPrepareOptionsMenu(activity, toolbar);
}
@SuppressWarnings("ConstantConditions")
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
//if (pager == null) return false;
Fragment currentFragment = getCurrentFragment();
if (currentFragment instanceof AbsLibraryPagerRecyclerViewCustomGridSizeFragment) {
AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment = (AbsLibraryPagerRecyclerViewCustomGridSizeFragment) currentFragment;
if (handleGridSizeMenuItem(fragment, item)) {
return true;
}
if (handleSortOrderMenuItem(fragment, item)) {
return true;
}
}
int id = item.getItemId();
switch (id) {
case R.id.action_new_playlist:
CreatePlaylistDialog.create().show(getChildFragmentManager(), "CREATE_PLAYLIST");
return true;
case R.id.action_shuffle_all:
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(getContext())
.blockingFirst(), true);
return true;
case R.id.action_search:
NavigationUtil.goToSearch(getMainActivity());
break;
case R.id.action_equalizer:
NavigationUtil.openEqualizer(getActivity());
return true;
case R.id.action_sleep_timer:
if (getFragmentManager() != null) {
new SleepTimerDialog().show(getFragmentManager(), TAG);
}
return true;
case R.id.action_settings:
startActivity(new Intent(getContext(), SettingsActivity.class));
break;
}
return super.onOptionsItemSelected(item);
}
private void setUpGridSizeMenu(
@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment,
@NonNull SubMenu gridSizeMenu) {
switch (fragment.getGridSize()) {
case 1:
gridSizeMenu.findItem(R.id.action_grid_size_1).setChecked(true);
break;
case 2:
gridSizeMenu.findItem(R.id.action_grid_size_2).setChecked(true);
break;
case 3:
gridSizeMenu.findItem(R.id.action_grid_size_3).setChecked(true);
break;
case 4:
gridSizeMenu.findItem(R.id.action_grid_size_4).setChecked(true);
break;
case 5:
gridSizeMenu.findItem(R.id.action_grid_size_5).setChecked(true);
break;
case 6:
gridSizeMenu.findItem(R.id.action_grid_size_6).setChecked(true);
break;
case 7:
gridSizeMenu.findItem(R.id.action_grid_size_7).setChecked(true);
break;
case 8:
gridSizeMenu.findItem(R.id.action_grid_size_8).setChecked(true);
break;
}
int maxGridSize = fragment.getMaxGridSize();
if (maxGridSize < 8) {
gridSizeMenu.findItem(R.id.action_grid_size_8).setVisible(false);
}
if (maxGridSize < 7) {
gridSizeMenu.findItem(R.id.action_grid_size_7).setVisible(false);
}
if (maxGridSize < 6) {
gridSizeMenu.findItem(R.id.action_grid_size_6).setVisible(false);
}
if (maxGridSize < 5) {
gridSizeMenu.findItem(R.id.action_grid_size_5).setVisible(false);
}
if (maxGridSize < 4) {
gridSizeMenu.findItem(R.id.action_grid_size_4).setVisible(false);
}
if (maxGridSize < 3) {
gridSizeMenu.findItem(R.id.action_grid_size_3).setVisible(false);
}
}
private boolean handleGridSizeMenuItem(
@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment, @NonNull MenuItem item) {
int gridSize = 0;
switch (item.getItemId()) {
case R.id.action_grid_size_1:
gridSize = 1;
break;
case R.id.action_grid_size_2:
gridSize = 2;
break;
case R.id.action_grid_size_3:
gridSize = 3;
break;
case R.id.action_grid_size_4:
gridSize = 4;
break;
case R.id.action_grid_size_5:
gridSize = 5;
break;
case R.id.action_grid_size_6:
gridSize = 6;
break;
case R.id.action_grid_size_7:
gridSize = 7;
break;
case R.id.action_grid_size_8:
gridSize = 8;
break;
}
if (gridSize > 0) {
item.setChecked(true);
fragment.setAndSaveGridSize(gridSize);
return true;
}
return false;
}
return false;
}
}

View File

@ -1,14 +1,11 @@
package code.name.monkey.retromusic.ui.fragments.mainactivity.home;
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
@ -22,13 +19,16 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.io.File;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.HomeOptionDialog;
@ -56,276 +56,276 @@ import code.name.monkey.retromusic.views.MetalRecyclerViewPager;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import java.io.File;
import java.util.ArrayList;
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
public class BannerHomeFragment extends AbsMainActivityFragment implements
MainActivityFragmentCallbacks,
HomeContract.HomeView {
MainActivityFragmentCallbacks,
HomeContract.HomeView {
private static final String TAG = "HomeFragment";
Unbinder unbinder;
@BindView(R.id.home_toolbar)
Toolbar toolbar;
@BindView(R.id.appbar)
AppBarLayout appbar;
@BindView(R.id.user_image)
CircularImageView userImage;
@BindView(R.id.recycler_view)
RecyclerView recentArtistRV;
@BindView(R.id.recent_album)
RecyclerView recentAlbumRV;
@BindView(R.id.top_artist)
RecyclerView topArtistRV;
@BindView(R.id.top_album)
MetalRecyclerViewPager topAlbumRV;
@BindView(R.id.recent_artist_container)
View recentArtistContainer;
@BindView(R.id.recent_albums_container)
View recentAlbumsContainer;
@BindView(R.id.top_artist_container)
View topArtistContainer;
@BindView(R.id.top_albums_container)
View topAlbumContainer;
@BindView(R.id.genres)
RecyclerView genresRecyclerView;
@BindView(R.id.genre_container)
LinearLayout genreContainer;
@BindView(R.id.container)
View container;
@BindView(R.id.title)
TextView title;
@BindView(R.id.search)
ImageView search;
private static final String TAG = "HomeFragment";
Unbinder unbinder;
@BindView(R.id.home_toolbar)
Toolbar toolbar;
@BindView(R.id.appbar)
AppBarLayout appbar;
@BindView(R.id.user_image)
CircularImageView userImage;
@BindView(R.id.recycler_view)
RecyclerView recentArtistRV;
@BindView(R.id.recent_album)
RecyclerView recentAlbumRV;
@BindView(R.id.top_artist)
RecyclerView topArtistRV;
@BindView(R.id.top_album)
MetalRecyclerViewPager topAlbumRV;
@BindView(R.id.recent_artist_container)
View recentArtistContainer;
@BindView(R.id.recent_albums_container)
View recentAlbumsContainer;
@BindView(R.id.top_artist_container)
View topArtistContainer;
@BindView(R.id.top_albums_container)
View topAlbumContainer;
@BindView(R.id.genres)
RecyclerView genresRecyclerView;
@BindView(R.id.genre_container)
LinearLayout genreContainer;
@BindView(R.id.container)
View container;
@BindView(R.id.title)
TextView title;
@BindView(R.id.search)
ImageView search;
private HomePresenter homePresenter;
private CompositeDisposable disposable;
private HomePresenter homePresenter;
private CompositeDisposable disposable;
public static BannerHomeFragment newInstance() {
Bundle args = new Bundle();
BannerHomeFragment fragment = new BannerHomeFragment();
fragment.setArguments(args);
return fragment;
}
private void loadImageFromStorage(ImageView imageView) {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance(getContext()).getProfileImage(), USER_PROFILE))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(imageView::setImageBitmap,
throwable -> imageView.setImageDrawable(ContextCompat
.getDrawable(getContext(), R.drawable.ic_person_flat))));
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
disposable = new CompositeDisposable();
//noinspection ConstantConditions
homePresenter = new HomePresenter(this);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_banner_home, container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setStatusbarColorAuto(view);
getMainActivity().getSlidingUpPanelLayout().setShadowHeight(8);
getMainActivity().setBottomBarVisibility(View.VISIBLE);
setupToolbar();
loadImageFromStorage(userImage);
homePresenter.subscribe();
checkPadding();
}
@SuppressWarnings("ConstantConditions")
private void setupToolbar() {
//noinspection ConstantConditions
int primaryColor = ThemeStore.primaryColor(getContext());
appbar.setBackgroundColor(ColorUtil.darkenColor(primaryColor));
toolbar.setBackgroundColor(ColorUtil.darkenColor(primaryColor));
appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
getActivity().setTitle(R.string.app_name);
getMainActivity().setSupportActionBar(toolbar);
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
TintHelper.setTintAuto(search, ThemeStore.textColorPrimary(getContext()), false);
TintHelper.setTintAuto(container, primaryColor, true);
}
@Override
public boolean handleBackPress() {
return false;
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
disposable.clear();
homePresenter.unsubscribe();
}
@Override
public void loading() {
}
@Override
public void showEmptyView() {
}
@Override
public void completed() {
}
@Override
public void showData(ArrayList<Object> homes) {
//homeAdapter.swapDataSet(homes);
}
@Override
public void onMediaStoreChanged() {
super.onMediaStoreChanged();
homePresenter.subscribe();
}
@Override
public void onServiceConnected() {
super.onServiceConnected();
checkPadding();
}
@Override
public void onQueueChanged() {
super.onQueueChanged();
checkPadding();
}
private void checkPadding() {
int height = getResources().getDimensionPixelSize(R.dimen.mini_player_height);
container.setPadding(0, 0, 0, MusicPlayerRemote.getPlayingQueue().isEmpty() ? height * 2 : 0);
}
@Override
public void recentArtist(ArrayList<Artist> artists) {
recentArtistContainer.setVisibility(View.VISIBLE);
recentArtistRV.setLayoutManager(new GridLayoutManager(getMainActivity(),
1, GridLayoutManager.HORIZONTAL, false));
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists,
R.layout.item_artist, false, null);
recentArtistRV.setAdapter(artistAdapter);
}
@Override
public void recentAlbum(ArrayList<Album> albums) {
recentAlbumsContainer.setVisibility(View.VISIBLE);
AlbumFullWithAdapter artistAdapter = new AlbumFullWithAdapter(getMainActivity(),
getDisplayMetrics());
artistAdapter.swapData(albums);
recentAlbumRV.setAdapter(artistAdapter);
}
@Override
public void topArtists(ArrayList<Artist> artists) {
topArtistContainer.setVisibility(View.VISIBLE);
topArtistRV.setLayoutManager(new GridLayoutManager(getMainActivity(),
1, GridLayoutManager.HORIZONTAL, false));
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists,
R.layout.item_artist, false, null);
topArtistRV.setAdapter(artistAdapter);
}
@Override
public void topAlbums(ArrayList<Album> albums) {
topAlbumContainer.setVisibility(View.VISIBLE);
AlbumFullWithAdapter artistAdapter = new AlbumFullWithAdapter(getMainActivity(),
getDisplayMetrics());
artistAdapter.swapData(albums);
topAlbumRV.setAdapter(artistAdapter);
}
private DisplayMetrics getDisplayMetrics() {
Display display = getMainActivity().getWindowManager().getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
return metrics;
}
@Override
public void suggestions(ArrayList<Playlist> playlists) {
}
@Override
public void geners(ArrayList<Genre> genres) {
genreContainer.setVisibility(View.VISIBLE);
genresRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
//noinspection ConstantConditions
GenreAdapter genreAdapter = new GenreAdapter(getActivity(), genres, R.layout.item_list);
genresRecyclerView.setAdapter(genreAdapter);
}
@OnClick({R.id.last_added, R.id.top_played, R.id.action_shuffle, R.id.history,
R.id.user_image, R.id.search})
void startUserInfo(View view) {
Activity activity = getActivity();
if (activity != null) {
switch (view.getId()) {
case R.id.action_shuffle:
MusicPlayerRemote
.openAndShuffleQueue(SongLoader.getAllSongs(activity).blockingFirst(), true);
break;
case R.id.last_added:
NavigationUtil.goToPlaylistNew(activity, new LastAddedPlaylist(activity));
break;
case R.id.top_played:
NavigationUtil.goToPlaylistNew(activity, new MyTopTracksPlaylist(activity));
break;
case R.id.history:
NavigationUtil.goToPlaylistNew(activity, new HistoryPlaylist(activity));
break;
case R.id.search:
NavigationUtil.goToSearch(activity);
break;
case R.id.user_image:
new HomeOptionDialog().show(getFragmentManager(), TAG);
break;
}
public static BannerHomeFragment newInstance() {
Bundle args = new Bundle();
BannerHomeFragment fragment = new BannerHomeFragment();
fragment.setArguments(args);
return fragment;
}
}
@Override
public void onPlayingMetaChanged() {
super.onPlayingMetaChanged();
homePresenter.loadRecentArtists();
homePresenter.loadRecentAlbums();
}
private void loadImageFromStorage(ImageView imageView) {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance(getContext()).getProfileImage(), USER_PROFILE))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(imageView::setImageBitmap,
throwable -> imageView.setImageDrawable(ContextCompat
.getDrawable(getContext(), R.drawable.ic_person_flat))));
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
disposable = new CompositeDisposable();
//noinspection ConstantConditions
homePresenter = new HomePresenter(this);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_banner_home, container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setStatusbarColorAuto(view);
getMainActivity().getSlidingUpPanelLayout().setShadowHeight(8);
getMainActivity().setBottomBarVisibility(View.VISIBLE);
setupToolbar();
loadImageFromStorage(userImage);
homePresenter.subscribe();
checkPadding();
}
@SuppressWarnings("ConstantConditions")
private void setupToolbar() {
//noinspection ConstantConditions
int primaryColor = ThemeStore.primaryColor(getContext());
appbar.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(primaryColor);
appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
getActivity().setTitle(R.string.app_name);
getMainActivity().setSupportActionBar(toolbar);
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
TintHelper.setTintAuto(search, ThemeStore.textColorPrimary(getContext()), false);
TintHelper.setTintAuto(container, primaryColor, true);
}
@Override
public boolean handleBackPress() {
return false;
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
disposable.clear();
homePresenter.unsubscribe();
}
@Override
public void loading() {
}
@Override
public void showEmptyView() {
}
@Override
public void completed() {
}
@Override
public void showData(ArrayList<Object> homes) {
//homeAdapter.swapDataSet(homes);
}
@Override
public void onMediaStoreChanged() {
super.onMediaStoreChanged();
homePresenter.subscribe();
}
@Override
public void onServiceConnected() {
super.onServiceConnected();
checkPadding();
}
@Override
public void onQueueChanged() {
super.onQueueChanged();
checkPadding();
}
private void checkPadding() {
int height = getResources().getDimensionPixelSize(R.dimen.mini_player_height);
container.setPadding(0, 0, 0, MusicPlayerRemote.getPlayingQueue().isEmpty() ? height * 2 : 0);
}
@Override
public void recentArtist(ArrayList<Artist> artists) {
recentArtistContainer.setVisibility(View.VISIBLE);
recentArtistRV.setLayoutManager(new GridLayoutManager(getMainActivity(),
1, GridLayoutManager.HORIZONTAL, false));
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists,
R.layout.item_artist, false, null);
recentArtistRV.setAdapter(artistAdapter);
}
@Override
public void recentAlbum(ArrayList<Album> albums) {
recentAlbumsContainer.setVisibility(View.VISIBLE);
AlbumFullWithAdapter artistAdapter = new AlbumFullWithAdapter(getMainActivity(),
getDisplayMetrics());
artistAdapter.swapData(albums);
recentAlbumRV.setAdapter(artistAdapter);
}
@Override
public void topArtists(ArrayList<Artist> artists) {
topArtistContainer.setVisibility(View.VISIBLE);
topArtistRV.setLayoutManager(new GridLayoutManager(getMainActivity(),
1, GridLayoutManager.HORIZONTAL, false));
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists,
R.layout.item_artist, false, null);
topArtistRV.setAdapter(artistAdapter);
}
@Override
public void topAlbums(ArrayList<Album> albums) {
topAlbumContainer.setVisibility(View.VISIBLE);
AlbumFullWithAdapter artistAdapter = new AlbumFullWithAdapter(getMainActivity(),
getDisplayMetrics());
artistAdapter.swapData(albums);
topAlbumRV.setAdapter(artistAdapter);
}
private DisplayMetrics getDisplayMetrics() {
Display display = getMainActivity().getWindowManager().getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
return metrics;
}
@Override
public void suggestions(ArrayList<Playlist> playlists) {
}
@Override
public void geners(ArrayList<Genre> genres) {
genreContainer.setVisibility(View.VISIBLE);
genresRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
//noinspection ConstantConditions
GenreAdapter genreAdapter = new GenreAdapter(getActivity(), genres, R.layout.item_list);
genresRecyclerView.setAdapter(genreAdapter);
}
@OnClick({R.id.last_added, R.id.top_played, R.id.action_shuffle, R.id.history,
R.id.user_image, R.id.search})
void startUserInfo(View view) {
Activity activity = getActivity();
if (activity != null) {
switch (view.getId()) {
case R.id.action_shuffle:
MusicPlayerRemote
.openAndShuffleQueue(SongLoader.getAllSongs(activity).blockingFirst(), true);
break;
case R.id.last_added:
NavigationUtil.goToPlaylistNew(activity, new LastAddedPlaylist(activity));
break;
case R.id.top_played:
NavigationUtil.goToPlaylistNew(activity, new MyTopTracksPlaylist(activity));
break;
case R.id.history:
NavigationUtil.goToPlaylistNew(activity, new HistoryPlaylist(activity));
break;
case R.id.search:
NavigationUtil.goToSearch(activity);
break;
case R.id.user_image:
new HomeOptionDialog().show(getFragmentManager(), TAG);
break;
}
}
}
@Override
public void onPlayingMetaChanged() {
super.onPlayingMetaChanged();
homePresenter.loadRecentArtists();
homePresenter.loadRecentAlbums();
}
}

View File

@ -71,7 +71,7 @@ import static code.name.monkey.retromusic.Constants.USER_PROFILE;
public class HomeFragment extends AbsMainActivityFragment implements MainActivityFragmentCallbacks,
HomeContract.HomeView {
private static final String TAG = "HomeFragment";
public static final String TAG = "HomeFragment";
Unbinder unbinder;
@BindView(R.id.home_toolbar)
Toolbar toolbar;
@ -411,4 +411,413 @@ public class HomeFragment extends AbsMainActivityFragment implements MainActivit
homePresenter.loadRecentArtists();
homePresenter.loadRecentAlbums();
}
}
}
/*
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Random;
import butterknife.BindView;
import butterknife.BindViews;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.HomeOptionDialog;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
import code.name.monkey.retromusic.loaders.SongLoader;
import code.name.monkey.retromusic.misc.AppBarStateChangeListener;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.model.Artist;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Home;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.model.smartplaylist.HistoryPlaylist;
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist;
import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist;
import code.name.monkey.retromusic.mvp.contract.HomeContract;
import code.name.monkey.retromusic.mvp.presenter.HomePresenter;
import code.name.monkey.retromusic.ui.adapter.CollageSongAdapter;
import code.name.monkey.retromusic.ui.adapter.GenreAdapter;
import code.name.monkey.retromusic.ui.adapter.album.AlbumFullWithAdapter;
import code.name.monkey.retromusic.ui.adapter.artist.ArtistAdapter;
import code.name.monkey.retromusic.ui.adapter.home.HomeAdapter;
import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment;
import code.name.monkey.retromusic.util.Compressor;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroUtil;
import code.name.monkey.retromusic.views.CircularImageView;
import code.name.monkey.retromusic.views.MetalRecyclerViewPager;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import static code.name.monkey.retromusic.Constants.USER_BANNER;
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
public class HomeFragment extends AbsMainActivityFragment implements MainActivityFragmentCallbacks,
HomeContract.HomeView {
public static final String TAG = "HomeFragment";
Unbinder unbinder;
@BindView(R.id.home_toolbar)
Toolbar toolbar;
@BindView(R.id.appbar)
AppBarLayout appbar;
@BindView(R.id.image)
ImageView imageView;
@BindView(R.id.user_image)
CircularImageView userImage;
@BindView(R.id.collapsing_toolbar)
CollapsingToolbarLayout toolbarLayout;
@BindView(R.id.container)
View container;
@BindView(R.id.title)
TextView title;
@BindView(R.id.search)
ImageView search;
@BindViews({R.id.recent_artist_container, R.id.recent_albums_container,
R.id.top_artist_container, R.id.top_albums_container,
R.id.genre_container})
List<View> sectionContainers;
@BindViews({R.id.recent_artist_recycler_view, R.id.top_artist_recycler_view,
R.id.genres_recycler_view})
List<RecyclerView> sectionRecyclerViews;
@BindViews({R.id.recent_albums_recycler_view, R.id.top_album_recycler_view})
List<MetalRecyclerViewPager> metalRecyclerViewPagers;
private HomePresenter homePresenter;
private CompositeDisposable disposable;
public static HomeFragment newInstance() {
Bundle args = new Bundle();
HomeFragment fragment = new HomeFragment();
fragment.setArguments(args);
return fragment;
}
private void getTimeOfTheDay() {
Calendar c = Calendar.getInstance();
int timeOfDay = c.get(Calendar.HOUR_OF_DAY);
String[] images = new String[]{};
if (timeOfDay >= 0 && timeOfDay < 6) {
images = getResources().getStringArray(R.array.night);
} else if (timeOfDay >= 6 && timeOfDay < 12) {
images = getResources().getStringArray(R.array.morning);
} else if (timeOfDay >= 12 && timeOfDay < 16) {
images = getResources().getStringArray(R.array.after_noon);
} else if (timeOfDay >= 16 && timeOfDay < 20) {
images = getResources().getStringArray(R.array.evening);
} else if (timeOfDay >= 20 && timeOfDay < 24) {
images = getResources().getStringArray(R.array.night);
}
String day = images[new Random().nextInt(images.length)];
loadTimeImage(day);
}
private void loadTimeImage(String day) {
//noinspection ConstantConditions
if (PreferenceUtil.getInstance(getActivity()).getBannerImage().isEmpty()) {
if (imageView != null) {
Glide.with(getActivity()).load(day)
.asBitmap()
.placeholder(R.drawable.material_design_default)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(imageView);
}
} else {
loadBannerFromStorage();
}
}
private void loadBannerFromStorage() {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
.setQuality(100)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance(getContext()).getBannerImage(), USER_BANNER))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(imageView::setImageBitmap));
}
private void loadImageFromStorage(ImageView imageView) {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance(getContext()).getProfileImage(), USER_PROFILE))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(imageView::setImageBitmap,
throwable -> imageView.setImageDrawable(ContextCompat
.getDrawable(getContext(), R.drawable.ic_person_flat))));
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
disposable = new CompositeDisposable();
homePresenter = new HomePresenter(this);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
unbinder = ButterKnife.bind(this, view);
setRetainInstance(true);
return view;
}
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getMainActivity().getSlidingUpPanelLayout().setShadowHeight(8);
getMainActivity().setBottomBarVisibility(View.VISIBLE);
setupToolbar();
loadImageFromStorage(userImage);
homePresenter.subscribe();
checkPadding();
getTimeOfTheDay();
}
@SuppressWarnings("ConstantConditions")
private void setupToolbar() {
if (!PreferenceUtil.getInstance(getContext()).getFullScreenMode()) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar
.getLayoutParams();
params.topMargin = RetroUtil.getStatusBarHeight(getContext());
toolbar.setLayoutParams(params);
}
appbar.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout, State state) {
int color;
switch (state) {
case COLLAPSED:
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext()));
color = ThemeStore.textColorPrimary(getContext());
break;
default:
case EXPANDED:
case IDLE:
getMainActivity().setLightStatusbar(false);
color = Color.WHITE;
break;
}
TintHelper.setTintAuto(search, color, false);
title.setTextColor(color);
}
});
int primaryColor = ThemeStore.primaryColor(getContext());
TintHelper.setTintAuto(container, primaryColor, true);
toolbarLayout.setStatusBarScrimColor(primaryColor);
toolbarLayout.setContentScrimColor(primaryColor);
toolbar.setTitle(R.string.home);
getMainActivity().setSupportActionBar(toolbar);
}
@Override
public boolean handleBackPress() {
return false;
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
disposable.clear();
homePresenter.unsubscribe();
}
@Override
public void loading() {
}
@Override
public void showEmptyView() {
}
@Override
public void completed() {
}
@Override
public void showData(ArrayList<Home> homes) {
HomeAdapter homeAdapter = new HomeAdapter(getMainActivity());
homeAdapter.swapData(homes);
}
@Override
public void onServiceConnected() {
super.onServiceConnected();
checkPadding();
}
@Override
public void onQueueChanged() {
super.onQueueChanged();
checkPadding();
}
private void checkPadding() {
int height = getResources().getDimensionPixelSize(R.dimen.mini_player_height);
container.setPadding(0, 0, 0, MusicPlayerRemote.getPlayingQueue().isEmpty() ? height * 2 : 0);
}
private DisplayMetrics getDisplayMetrics() {
Display display = getMainActivity().getWindowManager().getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
return metrics;
}
@OnClick({R.id.last_added, R.id.top_played, R.id.action_shuffle,
R.id.history, R.id.user_image, R.id.search})
void startUserInfo(View view) {
Activity activity = getActivity();
if (activity != null) {
switch (view.getId()) {
case R.id.action_shuffle:
MusicPlayerRemote
.openAndShuffleQueue(SongLoader.getAllSongs(activity).blockingFirst(), true);
break;
case R.id.last_added:
NavigationUtil.goToPlaylistNew(activity, new LastAddedPlaylist(activity));
break;
case R.id.top_played:
NavigationUtil.goToPlaylistNew(activity, new MyTopTracksPlaylist(activity));
break;
case R.id.history:
NavigationUtil.goToPlaylistNew(activity, new HistoryPlaylist(activity));
break;
case R.id.search:
NavigationUtil.goToSearch(activity);
break;
case R.id.user_image:
//noinspection ConstantConditions
new HomeOptionDialog().show(getFragmentManager(), TAG);
break;
}
}
}
@Override
public void showRecentAlbums(ArrayList<Album> albums) {
sectionContainers.get(1).setVisibility(View.VISIBLE);
AlbumFullWithAdapter albumFullWithAdapter = new AlbumFullWithAdapter(getMainActivity(),
getDisplayMetrics());
albumFullWithAdapter.swapData(albums);
MetalRecyclerViewPager recyclerView = metalRecyclerViewPagers.get(0);
recyclerView.setAdapter(albumFullWithAdapter);
}
@Override
public void showTopAlbums(ArrayList<Album> albums) {
sectionContainers.get(3).setVisibility(View.VISIBLE);
AlbumFullWithAdapter albumFullWithAdapter = new AlbumFullWithAdapter(getMainActivity(),
getDisplayMetrics());
albumFullWithAdapter.swapData(albums);
MetalRecyclerViewPager recyclerView = metalRecyclerViewPagers.get(1);
recyclerView.setAdapter(albumFullWithAdapter);
}
@Override
public void showRecentArtist(ArrayList<Artist> artists) {
sectionContainers.get(0).setVisibility(View.VISIBLE);
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 1,
GridLayoutManager.HORIZONTAL, false);
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists, R.layout.item_artist);
RecyclerView recyclerView = sectionRecyclerViews.get(0);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(artistAdapter);
}
@Override
public void showTopArtist(ArrayList<Artist> artists) {
sectionContainers.get(2).setVisibility(View.VISIBLE);
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 1,
GridLayoutManager.HORIZONTAL, false);
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists, R.layout.item_artist);
RecyclerView recyclerView = sectionRecyclerViews.get(1);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(artistAdapter);
}
@Override
public void showGenres(ArrayList<Genre> genres) {
sectionContainers.get(4).setVisibility(View.VISIBLE);
RecyclerView recyclerView = sectionRecyclerViews.get(2);
recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(new GenreAdapter(getMainActivity(), genres, R.layout.item_list));
}
}*/

View File

@ -31,9 +31,9 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper;
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.ui.fragments.VolumeFragment;
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment;
import code.name.monkey.retromusic.util.MusicUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
/**
* @author Hemanth S (h4h13).
@ -41,21 +41,31 @@ import code.name.monkey.retromusic.util.MusicUtil;
public class LockScreenPlayerControlsFragment extends AbsPlayerControlsFragment {
@BindView(R.id.player_play_pause_button)
AppCompatImageButton playPauseFab;
@BindView(R.id.player_prev_button)
ImageButton prevButton;
@BindView(R.id.player_next_button)
ImageButton nextButton;
@BindView(R.id.player_progress_slider)
AppCompatSeekBar progressSlider;
@BindView(R.id.player_song_total_time)
TextView songTotalTime;
@BindView(R.id.player_song_current_progress)
TextView songCurrentProgress;
@BindView(R.id.title)
AppCompatTextView title;
@BindView(R.id.text)
AppCompatTextView text;
@BindView(R.id.volume_fragment_container)
View volumeContainer;
private Unbinder unbinder;
private MusicProgressViewUpdateHelper progressViewUpdateHelper;
private int lastPlaybackControlsColor;
@ -82,7 +92,9 @@ public class LockScreenPlayerControlsFragment extends AbsPlayerControlsFragment
super.onViewCreated(view, savedInstanceState);
setUpMusicControllers();
VolumeFragment volumeFragment = (VolumeFragment) getChildFragmentManager().findFragmentById(R.id.volume_fragment);
//noinspection ConstantConditions
volumeContainer.setVisibility(PreferenceUtil.getInstance(getContext()).getVolumeToggle()
? View.VISIBLE : View.GONE);
}

View File

@ -2,8 +2,6 @@ package code.name.monkey.retromusic.ui.fragments.player.plain;
import android.animation.ObjectAnimator;
import android.graphics.PorterDuff;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@ -16,6 +14,7 @@ import android.view.animation.LinearInterpolator;
import android.widget.ImageButton;
import android.widget.SeekBar;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@ -41,296 +40,288 @@ import code.name.monkey.retromusic.views.PlayPauseDrawable;
public class PlainPlaybackControlsFragment extends AbsPlayerControlsFragment {
@BindView(R.id.player_play_pause_button)
ImageButton playPauseFab;
@BindView(R.id.player_prev_button)
ImageButton prevButton;
@BindView(R.id.player_next_button)
ImageButton nextButton;
@BindView(R.id.player_repeat_button)
ImageButton repeatButton;
@BindView(R.id.player_shuffle_button)
ImageButton shuffleButton;
@BindView(R.id.player_progress_slider)
SeekBar progressSlider;
@BindView(R.id.player_song_total_time)
TextView songTotalTime;
@BindView(R.id.player_song_current_progress)
TextView songCurrentProgress;
@BindView(R.id.volume_fragment_container)
View volumeContainer;
private Unbinder unbinder;
private PlayPauseDrawable playerFabPlayPauseDrawable;
private int lastPlaybackControlsColor;
private int lastDisabledPlaybackControlsColor;
private MusicProgressViewUpdateHelper progressViewUpdateHelper;
@BindView(R.id.player_play_pause_button)
ImageButton playPauseFab;
@BindView(R.id.player_prev_button)
ImageButton prevButton;
@BindView(R.id.player_next_button)
ImageButton nextButton;
@BindView(R.id.player_repeat_button)
ImageButton repeatButton;
@BindView(R.id.player_shuffle_button)
ImageButton shuffleButton;
@BindView(R.id.player_progress_slider)
SeekBar progressSlider;
@BindView(R.id.player_song_total_time)
TextView songTotalTime;
@BindView(R.id.player_song_current_progress)
TextView songCurrentProgress;
@BindView(R.id.volume_fragment_container)
View volumeContainer;
@Override
public void onPlayStateChanged() {
updatePlayPauseDrawableState(true);
}
private Unbinder unbinder;
private PlayPauseDrawable playerFabPlayPauseDrawable;
private int lastPlaybackControlsColor;
private int lastDisabledPlaybackControlsColor;
private MusicProgressViewUpdateHelper progressViewUpdateHelper;
@Override
public void onRepeatModeChanged() {
updateRepeatState();
}
@Override
public void onShuffleModeChanged() {
updateShuffleState();
}
@Override
public void onServiceConnected() {
updatePlayPauseDrawableState(false);
updateRepeatState();
updateShuffleState();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
progressViewUpdateHelper = new MusicProgressViewUpdateHelper(this);
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_plain_controls_fragment, container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
@Override
public void onResume() {
super.onResume();
progressViewUpdateHelper.start();
}
@Override
public void onPause() {
super.onPause();
progressViewUpdateHelper.stop();
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setUpMusicControllers();
if (PreferenceUtil.getInstance(getContext()).getVolumeToggle()) {
volumeContainer.setVisibility(View.VISIBLE);
} else {
volumeContainer.setVisibility(View.GONE);
@Override
public void onPlayStateChanged() {
updatePlayPauseDrawableState(true);
}
}
private void setUpMusicControllers() {
setUpPlayPauseFab();
setUpPrevNext();
setUpRepeatButton();
setUpShuffleButton();
setUpProgressSlider();
}
private void setUpPrevNext() {
updatePrevNextColor();
nextButton.setOnClickListener(v -> MusicPlayerRemote.playNextSong());
prevButton.setOnClickListener(v -> MusicPlayerRemote.back());
}
private void updatePrevNextColor() {
nextButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
prevButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
}
private void setUpShuffleButton() {
shuffleButton.setOnClickListener(v -> MusicPlayerRemote.toggleShuffleMode());
}
@Override
protected void updateShuffleState() {
switch (MusicPlayerRemote.getShuffleMode()) {
case MusicService.SHUFFLE_MODE_SHUFFLE:
shuffleButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
break;
default:
shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
break;
@Override
public void onRepeatModeChanged() {
updateRepeatState();
}
}
private void setUpRepeatButton() {
repeatButton.setOnClickListener(v -> MusicPlayerRemote.cycleRepeatMode());
}
@Override
protected void updateRepeatState() {
switch (MusicPlayerRemote.getRepeatMode()) {
case MusicService.REPEAT_MODE_NONE:
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp);
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
break;
case MusicService.REPEAT_MODE_ALL:
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp);
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
break;
case MusicService.REPEAT_MODE_THIS:
repeatButton.setImageResource(R.drawable.ic_repeat_one_white_24dp);
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
break;
@Override
public void onShuffleModeChanged() {
updateShuffleState();
}
}
@Override
protected void show() {
playPauseFab.animate()
.scaleX(1f)
.scaleY(1f)
.rotation(360f)
.setInterpolator(new DecelerateInterpolator())
.start();
}
@Override
protected void hide() {
if (playPauseFab != null) {
playPauseFab.setScaleX(0f);
playPauseFab.setScaleY(0f);
playPauseFab.setRotation(0f);
@Override
public void onServiceConnected() {
updatePlayPauseDrawableState(false);
updateRepeatState();
updateShuffleState();
}
}
@Override
protected void setUpProgressSlider() {
progressSlider.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
MusicPlayerRemote.seekTo(progress);
onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(),
MusicPlayerRemote.getSongDurationMillis());
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
progressViewUpdateHelper = new MusicProgressViewUpdateHelper(this);
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_plain_controls_fragment, container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
@Override
public void onResume() {
super.onResume();
progressViewUpdateHelper.start();
}
@Override
public void onPause() {
super.onPause();
progressViewUpdateHelper.stop();
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setUpMusicControllers();
if (PreferenceUtil.getInstance(getContext()).getVolumeToggle()) {
volumeContainer.setVisibility(View.VISIBLE);
} else {
volumeContainer.setVisibility(View.GONE);
}
}
});
}
public void showBouceAnimation() {
playPauseFab.clearAnimation();
playPauseFab.setScaleX(0.9f);
playPauseFab.setScaleY(0.9f);
playPauseFab.setVisibility(View.VISIBLE);
playPauseFab.setPivotX(playPauseFab.getWidth() / 2);
playPauseFab.setPivotY(playPauseFab.getHeight() / 2);
playPauseFab.animate()
.setDuration(200)
.setInterpolator(new DecelerateInterpolator())
.scaleX(1.1f)
.scaleY(1.1f)
.withEndAction(() -> playPauseFab.animate()
.setDuration(200)
.setInterpolator(new AccelerateInterpolator())
.scaleX(1f)
.scaleY(1f)
.alpha(1f)
.start())
.start();
}
@OnClick(R.id.player_play_pause_button)
void showAnimation() {
if (MusicPlayerRemote.isPlaying()) {
MusicPlayerRemote.pauseSong();
} else {
MusicPlayerRemote.resumePlaying();
}
showBouceAnimation();
}
@Override
public void onUpdateProgressViews(int progress, int total) {
progressSlider.setMax(total);
ObjectAnimator animator = ObjectAnimator.ofInt(progressSlider, "progress", progress);
animator.setDuration(1500);
animator.setInterpolator(new LinearInterpolator());
animator.start();
songTotalTime.setText(MusicUtil.getReadableDurationString(total));
songCurrentProgress.setText(MusicUtil.getReadableDurationString(progress));
}
@Override
public void setDark(int dark) {
int color = ATHUtil.resolveColor(getActivity(), android.R.attr.colorBackground);
if (ColorUtil.isColorLight(color)) {
lastPlaybackControlsColor =
MaterialValueHelper.getSecondaryTextColor(getActivity(), true);
lastDisabledPlaybackControlsColor =
MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true);
} else {
lastPlaybackControlsColor =
MaterialValueHelper.getPrimaryTextColor(getActivity(), false);
lastDisabledPlaybackControlsColor =
MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
}
if (PreferenceUtil.getInstance(getContext()).getAdaptiveColor()) {
TintHelper.setTintAuto(playPauseFab,
MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(dark)),
false);
TintHelper.setTintAuto(playPauseFab, dark, true);
setProgressBarColor(dark);
} else {
int accentColor = ThemeStore.accentColor(getContext());
setProgressBarColor(accentColor);
TintHelper.setTintAuto(playPauseFab,
MaterialValueHelper
.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(accentColor)),
false);
TintHelper.setTintAuto(playPauseFab, accentColor, true);
private void setUpMusicControllers() {
setUpPlayPauseFab();
setUpPrevNext();
setUpRepeatButton();
setUpShuffleButton();
setUpProgressSlider();
}
updateRepeatState();
updateShuffleState();
updatePrevNextColor();
}
public void setProgressBarColor(int newColor) {
LayerDrawable ld = (LayerDrawable) progressSlider.getProgressDrawable();
ClipDrawable clipDrawable = (ClipDrawable) ld.findDrawableByLayerId(android.R.id.progress);
clipDrawable.setColorFilter(newColor, PorterDuff.Mode.SRC_IN);
}
private void setUpPrevNext() {
updatePrevNextColor();
nextButton.setOnClickListener(v -> MusicPlayerRemote.playNextSong());
prevButton.setOnClickListener(v -> MusicPlayerRemote.back());
}
private void setUpPlayPauseFab() {
playerFabPlayPauseDrawable = new PlayPauseDrawable(getActivity());
private void updatePrevNextColor() {
nextButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
prevButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
}
playPauseFab.setImageDrawable(
playerFabPlayPauseDrawable); // Note: set the drawable AFTER TintHelper.setTintAuto() was called
//playPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN);
//playPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler());
playPauseFab.post(() -> {
if (playPauseFab != null) {
private void setUpShuffleButton() {
shuffleButton.setOnClickListener(v -> MusicPlayerRemote.toggleShuffleMode());
}
@Override
protected void updateShuffleState() {
switch (MusicPlayerRemote.getShuffleMode()) {
case MusicService.SHUFFLE_MODE_SHUFFLE:
shuffleButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
break;
default:
shuffleButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
break;
}
}
private void setUpRepeatButton() {
repeatButton.setOnClickListener(v -> MusicPlayerRemote.cycleRepeatMode());
}
@Override
protected void updateRepeatState() {
switch (MusicPlayerRemote.getRepeatMode()) {
case MusicService.REPEAT_MODE_NONE:
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp);
repeatButton.setColorFilter(lastDisabledPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
break;
case MusicService.REPEAT_MODE_ALL:
repeatButton.setImageResource(R.drawable.ic_repeat_white_24dp);
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
break;
case MusicService.REPEAT_MODE_THIS:
repeatButton.setImageResource(R.drawable.ic_repeat_one_white_24dp);
repeatButton.setColorFilter(lastPlaybackControlsColor, PorterDuff.Mode.SRC_IN);
break;
}
}
@Override
protected void show() {
playPauseFab.animate()
.scaleX(1f)
.scaleY(1f)
.rotation(360f)
.setInterpolator(new DecelerateInterpolator())
.start();
}
@Override
protected void hide() {
if (playPauseFab != null) {
playPauseFab.setScaleX(0f);
playPauseFab.setScaleY(0f);
playPauseFab.setRotation(0f);
}
}
@Override
protected void setUpProgressSlider() {
progressSlider.setOnSeekBarChangeListener(new SimpleOnSeekbarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
MusicPlayerRemote.seekTo(progress);
onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(),
MusicPlayerRemote.getSongDurationMillis());
}
}
});
}
public void showBouceAnimation() {
playPauseFab.clearAnimation();
playPauseFab.setScaleX(0.9f);
playPauseFab.setScaleY(0.9f);
playPauseFab.setVisibility(View.VISIBLE);
playPauseFab.setPivotX(playPauseFab.getWidth() / 2);
playPauseFab.setPivotY(playPauseFab.getHeight() / 2);
}
});
}
protected void updatePlayPauseDrawableState(boolean animate) {
if (MusicPlayerRemote.isPlaying()) {
playerFabPlayPauseDrawable.setPause(animate);
} else {
playerFabPlayPauseDrawable.setPlay(animate);
playPauseFab.animate()
.setDuration(200)
.setInterpolator(new DecelerateInterpolator())
.scaleX(1.1f)
.scaleY(1.1f)
.withEndAction(() -> playPauseFab.animate()
.setDuration(200)
.setInterpolator(new AccelerateInterpolator())
.scaleX(1f)
.scaleY(1f)
.alpha(1f)
.start())
.start();
}
@OnClick(R.id.player_play_pause_button)
void showAnimation() {
if (MusicPlayerRemote.isPlaying()) {
MusicPlayerRemote.pauseSong();
} else {
MusicPlayerRemote.resumePlaying();
}
showBouceAnimation();
}
@Override
public void onUpdateProgressViews(int progress, int total) {
progressSlider.setMax(total);
ObjectAnimator animator = ObjectAnimator.ofInt(progressSlider, "progress", progress);
animator.setDuration(1500);
animator.setInterpolator(new LinearInterpolator());
animator.start();
songTotalTime.setText(MusicUtil.getReadableDurationString(total));
songCurrentProgress.setText(MusicUtil.getReadableDurationString(progress));
}
@Override
public void setDark(int dark) {
int color = ATHUtil.resolveColor(getActivity(), android.R.attr.colorBackground);
if (ColorUtil.isColorLight(color)) {
lastPlaybackControlsColor =
MaterialValueHelper.getSecondaryTextColor(getActivity(), true);
lastDisabledPlaybackControlsColor =
MaterialValueHelper.getSecondaryDisabledTextColor(getActivity(), true);
} else {
lastPlaybackControlsColor =
MaterialValueHelper.getPrimaryTextColor(getActivity(), false);
lastDisabledPlaybackControlsColor =
MaterialValueHelper.getPrimaryDisabledTextColor(getActivity(), false);
}
int finalColor = PreferenceUtil.getInstance(getContext()).getAdaptiveColor()
? dark : ThemeStore.accentColor(getContext());
setProgressBarColor(dark);
TintHelper.setTintAuto(playPauseFab, MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(finalColor)), false);
TintHelper.setTintAuto(playPauseFab, finalColor, true);
updateRepeatState();
updateShuffleState();
updatePrevNextColor();
}
public void setProgressBarColor(int newColor) {
TintHelper.setTintAuto(progressSlider, newColor, false);
}
private void setUpPlayPauseFab() {
playerFabPlayPauseDrawable = new PlayPauseDrawable(getActivity());
playPauseFab.setImageDrawable(
playerFabPlayPauseDrawable); // Note: set the drawable AFTER TintHelper.setTintAuto() was called
//playPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN);
//playPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler());
playPauseFab.post(() -> {
if (playPauseFab != null) {
playPauseFab.setPivotX(playPauseFab.getWidth() / 2);
playPauseFab.setPivotY(playPauseFab.getHeight() / 2);
}
});
}
protected void updatePlayPauseDrawableState(boolean animate) {
if (MusicPlayerRemote.isPlaying()) {
playerFabPlayPauseDrawable.setPause(animate);
} else {
playerFabPlayPauseDrawable.setPlay(animate);
}
}
}
}

View File

@ -59,18 +59,17 @@ public abstract class AbsSettingsFragment extends ATEPreferenceFragmentCompat {
setDividerHeight(0);
setDivider(new ColorDrawable(Color.TRANSPARENT));
//noinspection ConstantConditions
getListView().setPadding(DensityUtil.dip2px(getContext(), 0), 0, 0, 0);
getListView().addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (getActivity() != null) {
((SettingsActivity) getActivity())
.addAppbarLayoutElevation(recyclerView.canScrollVertically(RecyclerView.NO_POSITION) ? 8f : 0f);
((SettingsActivity) getActivity()).addAppbarLayoutElevation(recyclerView.canScrollVertically(RecyclerView.NO_POSITION) ? 8f : 0f);
}
}
});
//noinspection ConstantConditions
getListView().setBackgroundColor(ThemeStore.primaryColor(getContext()));
getListView().setOverScrollMode(View.OVER_SCROLL_NEVER);
invalidateSettings();

View File

@ -4,6 +4,7 @@ import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
@ -57,29 +58,29 @@ public class MainSettingsFragment extends Fragment {
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.general_settings:
inflateFragment(new ThemeSettingsFragment());
inflateFragment(new ThemeSettingsFragment(), R.string.general_settings_title);
break;
case R.id.audio_settings:
inflateFragment(new AudioSettings());
inflateFragment(new AudioSettings(), R.string.pref_header_audio);
break;
case R.id.now_playing_settings:
inflateFragment(new NowPlayingSettingsFragment());
inflateFragment(new NowPlayingSettingsFragment(), R.string.personalize);
break;
case R.id.image_settings:
inflateFragment(new ImageSettingFragment());
inflateFragment(new ImageSettingFragment(), R.string.pref_header_images);
break;
case R.id.notification_settings:
inflateFragment(new NotificationSettingsFragment());
inflateFragment(new NotificationSettingsFragment(), R.string.notification);
break;
case R.id.other_settings:
inflateFragment(new OtherSettingsFragment());
inflateFragment(new OtherSettingsFragment(), R.string.others);
break;
}
}
private void inflateFragment(Fragment fragment) {
private void inflateFragment(Fragment fragment, @StringRes int title) {
if (getActivity() != null) {
((SettingsActivity) getActivity()).setupFragment(fragment);
((SettingsActivity) getActivity()).setupFragment(fragment, title);
}
}
}

View File

@ -1,7 +1,5 @@
package code.name.monkey.retromusic.util;
import static code.name.monkey.retromusic.ui.activities.GenreDetailsActivity.EXTRA_GENRE_ID;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
@ -12,6 +10,7 @@ import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.util.Pair;
import android.widget.Toast;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.model.Genre;
@ -31,100 +30,108 @@ import code.name.monkey.retromusic.ui.activities.SettingsActivity;
import code.name.monkey.retromusic.ui.activities.SupportDevelopmentActivity;
import code.name.monkey.retromusic.ui.activities.UserInfoActivity;
import static code.name.monkey.retromusic.Constants.RATE_ON_GOOGLE_PLAY;
import static code.name.monkey.retromusic.ui.activities.GenreDetailsActivity.EXTRA_GENRE_ID;
import static code.name.monkey.retromusic.util.RetroUtil.openUrl;
public class NavigationUtil {
public static void goToAlbum(@NonNull Activity activity, int i,
@Nullable Pair... sharedElements) {
Intent intent = new Intent(activity, AlbumDetailsActivity.class);
intent.putExtra(AlbumDetailsActivity.EXTRA_ALBUM_ID, i);
//noinspection unchecked
ActivityCompat.startActivity(activity, intent,
ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements).toBundle());
}
public static void goToArtist(@NonNull Activity activity, int i,
@Nullable Pair... sharedElements) {
Intent intent = new Intent(activity, ArtistDetailActivity.class);
intent.putExtra(ArtistDetailActivity.EXTRA_ARTIST_ID, i);
//noinspection unchecked
ActivityCompat.startActivity(activity, intent,
ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements).toBundle());
}
public static void goToPlaylistNew(@NonNull Activity activity, Playlist playlist) {
Intent intent = new Intent(activity, PlaylistDetailActivity.class);
intent.putExtra(PlaylistDetailActivity.EXTRA_PLAYLIST, playlist);
ActivityCompat.startActivity(activity, intent, null);
}
public static void openEqualizer(@NonNull final Activity activity) {
if (PreferenceUtil.getInstance(activity).getSelectedEqualizer().equals("system")) {
stockEqalizer(activity);
} else {
ActivityCompat.startActivity(activity, new Intent(activity, EqualizerActivity.class), null);
public static void goToAlbum(@NonNull Activity activity, int i,
@Nullable Pair... sharedElements) {
Intent intent = new Intent(activity, AlbumDetailsActivity.class);
intent.putExtra(AlbumDetailsActivity.EXTRA_ALBUM_ID, i);
//noinspection unchecked
ActivityCompat.startActivity(activity, intent,
ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements).toBundle());
}
}
private static void stockEqalizer(@NonNull Activity activity) {
final int sessionId = MusicPlayerRemote.getAudioSessionId();
if (sessionId == AudioEffect.ERROR_BAD_VALUE) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_audio_ID),
Toast.LENGTH_LONG).show();
} else {
try {
final Intent effects = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
effects.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, sessionId);
effects.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
activity.startActivityForResult(effects, 0);
} catch (@NonNull final ActivityNotFoundException notFound) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_equalizer),
Toast.LENGTH_SHORT).show();
}
public static void goToArtist(@NonNull Activity activity, int i,
@Nullable Pair... sharedElements) {
Intent intent = new Intent(activity, ArtistDetailActivity.class);
intent.putExtra(ArtistDetailActivity.EXTRA_ARTIST_ID, i);
//noinspection unchecked
ActivityCompat.startActivity(activity, intent,
ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements).toBundle());
}
}
public static void goToPlayingQueue(@NonNull Activity activity) {
Intent intent = new Intent(activity, PlayingQueueActivity.class);
ActivityCompat.startActivity(activity, intent, null);
}
public static void goToPlaylistNew(@NonNull Activity activity, Playlist playlist) {
Intent intent = new Intent(activity, PlaylistDetailActivity.class);
intent.putExtra(PlaylistDetailActivity.EXTRA_PLAYLIST, playlist);
ActivityCompat.startActivity(activity, intent, null);
}
public static void goToLyrics(@NonNull Activity activity) {
Intent intent = new Intent(activity, LyricsActivity.class);
ActivityCompat.startActivity(activity, intent, null);
}
public static void openEqualizer(@NonNull final Activity activity) {
if (PreferenceUtil.getInstance(activity).getSelectedEqualizer().equals("system")) {
stockEqalizer(activity);
} else {
ActivityCompat.startActivity(activity, new Intent(activity, EqualizerActivity.class), null);
}
}
public static void goToGenre(@NonNull Activity activity, @NonNull Genre genre) {
Intent intent = new Intent(activity, GenreDetailsActivity.class);
intent.putExtra(EXTRA_GENRE_ID, genre);
ActivityCompat.startActivity(activity, intent, null);
}
private static void stockEqalizer(@NonNull Activity activity) {
final int sessionId = MusicPlayerRemote.getAudioSessionId();
if (sessionId == AudioEffect.ERROR_BAD_VALUE) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_audio_ID),
Toast.LENGTH_LONG).show();
} else {
try {
final Intent effects = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
effects.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, sessionId);
effects.putExtra(AudioEffect.EXTRA_CONTENT_TYPE, AudioEffect.CONTENT_TYPE_MUSIC);
activity.startActivityForResult(effects, 0);
} catch (@NonNull final ActivityNotFoundException notFound) {
Toast.makeText(activity, activity.getResources().getString(R.string.no_equalizer),
Toast.LENGTH_SHORT).show();
}
}
}
public static void goToProVersion(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, ProVersionActivity.class), null);
}
public static void goToPlayingQueue(@NonNull Activity activity) {
Intent intent = new Intent(activity, PlayingQueueActivity.class);
ActivityCompat.startActivity(activity, intent, null);
}
public static void goToSettings(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, SettingsActivity.class), null);
}
public static void goToLyrics(@NonNull Activity activity) {
Intent intent = new Intent(activity, LyricsActivity.class);
ActivityCompat.startActivity(activity, intent, null);
}
public static void goToAbout(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, AboutActivity.class), null);
}
public static void goToGenre(@NonNull Activity activity, @NonNull Genre genre) {
Intent intent = new Intent(activity, GenreDetailsActivity.class);
intent.putExtra(EXTRA_GENRE_ID, genre);
ActivityCompat.startActivity(activity, intent, null);
}
public static void goToUserInfo(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, UserInfoActivity.class), null);
}
public static void goToProVersion(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, ProVersionActivity.class), null);
}
public static void goToOpenSource(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, LicenseActivity.class), null);
}
public static void goToSettings(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, SettingsActivity.class), null);
}
public static void goToSearch(Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, SearchActivity.class), null);
}
public static void goToAbout(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, AboutActivity.class), null);
}
public static void goToSupportDevelopment(Activity activity) {
ActivityCompat
.startActivity(activity, new Intent(activity, SupportDevelopmentActivity.class), null);
}
public static void goToUserInfo(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, UserInfoActivity.class), null);
}
public static void goToOpenSource(@NonNull Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, LicenseActivity.class), null);
}
public static void goToSearch(Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, SearchActivity.class), null);
}
public static void goToSupportDevelopment(Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, SupportDevelopmentActivity.class), null);
}
public static void goToPlayStore(Activity activity) {
openUrl(activity, RATE_ON_GOOGLE_PLAY);
}
}

View File

@ -137,7 +137,7 @@ public class RetroUtil {
}
public static void openUrl(AppCompatActivity context, String str) {
public static void openUrl(Activity context, String str) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
intent.setFlags(268435456);

View File

@ -92,7 +92,7 @@ public class MetalRecyclerViewPager extends RecyclerView {
}
@Override
public void onBindViewHolder(VH holder, int position) {
public void onBindViewHolder(@NonNull VH holder, int position) {
int currentItemWidth = itemWidth;
if (position == 0) {

View File

@ -1,70 +0,0 @@
package code.name.monkey.retromusic.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.Region;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import code.name.monkey.retromusic.R;
/**
* Frame layout that has rounded corners (it clips content too).
*
* @author Anton Chekulaev
*/
public class RoundCornerFrameLayout extends FrameLayout {
private final Path stencilPath = new Path();
private float cornerRadius = 0;
public RoundCornerFrameLayout(Context context) {
this(context, null);
}
public RoundCornerFrameLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundCornerFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray attrArray = context
.obtainStyledAttributes(attrs, R.styleable.RoundCornerFrameLayout, 0, 0);
try {
cornerRadius = attrArray.getDimension(R.styleable.RoundCornerFrameLayout_corner_radius, 0f);
} finally {
attrArray.recycle();
}
}
/*@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
// compute the path
stencilPath.reset();
stencilPath.addRoundRect(0, 0, w, h, cornerRadius, cornerRadius, Path.Direction.CW);
stencilPath.close();
}
*/
@Override
protected void dispatchDraw(Canvas canvas) {
final int count = canvas.save();
final Path path = new Path();
final RectF rect = new RectF(0, 0, canvas.getWidth(), canvas.getHeight());
final float[] arrayRadius = {cornerRadius, cornerRadius, cornerRadius, cornerRadius,
cornerRadius, cornerRadius, cornerRadius, cornerRadius};
path.addRoundRect(rect, arrayRadius, Path.Direction.CW);
canvas.clipPath(path, Region.Op.REPLACE);
canvas.clipPath(path);
super.dispatchDraw(canvas);
canvas.restoreToCount(count);
}
}

View File

@ -6,6 +6,9 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetDialog;
import android.support.design.widget.BottomSheetDialogFragment;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.ui.activities.base.AbsThemeActivity;
import code.name.monkey.retromusic.util.PreferenceUtil;
@ -16,24 +19,31 @@ import code.name.monkey.retromusic.util.PreferenceUtil;
@SuppressLint("RestrictedApi")
public class RoundedBottomSheetDialogFragment extends BottomSheetDialogFragment {
@Override
public int getTheme() {
//noinspection ConstantConditions
return
PreferenceUtil.getInstance(getContext()).getGeneralTheme() == R.style.Theme_RetroMusic_Light
? R.style.BottomSheetDialogTheme : R.style.BottomSheetDialogThemeDark;
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AbsThemeActivity absThemeActivity = (AbsThemeActivity) getActivity();
if (absThemeActivity != null) {
absThemeActivity.setLightNavigationBar(true);
Dialog dialog = new BottomSheetDialog(getContext(), getTheme());
@Override
public int getTheme() {
//noinspection ConstantConditions
if (PreferenceUtil.getInstance(getContext()).getGeneralTheme() == R.style.Theme_RetroMusic_Light) {
return R.style.BottomSheetDialogTheme;
} else if (PreferenceUtil.getInstance(getContext()).getGeneralTheme() == R.style.Theme_RetroMusic_Color) {
int color = ThemeStore.primaryColor(getContext());
if (ColorUtil.isColorLight(color)) {
return R.style.BottomSheetDialogTheme;
} else {
return R.style.BottomSheetDialogThemeDark;
}
} else {
return R.style.BottomSheetDialogTheme;
}
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AbsThemeActivity absThemeActivity = (AbsThemeActivity) getActivity();
if (absThemeActivity != null) {
absThemeActivity.setLightNavigationBar(true);
}
//noinspection ConstantConditions
return new BottomSheetDialog(getContext(), getTheme());
}
//noinspection ConstantConditions
return new BottomSheetDialog(getContext(), getTheme());
}
}

View File

@ -29,7 +29,7 @@ public class SansFontCollapsingToolbarLayout extends CollapsingToolbarLayout {
}
private void init(Context context) {
Typeface typefaceBold = TypefaceHelper.get(context, getResources().getString(R.string.sans_bold));
Typeface typefaceBold = TypefaceHelper.get(context, getResources().getString(R.string.circular_std_black));
setExpandedTitleTypeface(typefaceBold);
setCollapsedTitleTypeface(typefaceBold);

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <stroke android:width="2dp" android:color="?attr/dividerColor" /> <corners android:topLeftRadius="12dp" android:topRightRadius="12dp" /> <solid android:color="@android:color/transparent" /> <padding android:bottom="8dp" /> </shape>

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp"/>
<solid android:color="?attr/cardBackgroundColor"/>
android:shape="rectangle">
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
<solid android:color="?attr/cardBackgroundColor" />
<padding android:top="8dp" />
</shape>

View File

@ -1,56 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:title="@string/action_settings">
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/support_development"/>
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:id="@+id/background"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
xmlns:tools="http://schemas.android.com/tools">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
app:elevation="0dp">
<FrameLayout
android:id="@+id/detail_content_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:titleEnabled="false">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
tools:ignore="UnusedAttribute"
app:layout_collapseMode="pin"
app:title="">
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
tools:ignore="MissingPrefix"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/action_settings"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<FrameLayout
android:id="@+id/detail_content_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,116 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UnusedAttribute">
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/status_bar"/>
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
tools:ignore="UnusedAttribute">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<View
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
<android.support.v7.widget.Toolbar
android:id="@+id/home_toolbar"
style="@style/Toolbar"
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:src="@drawable/ic_search_white_24dp"/>
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?android:attr/textColorPrimary"
tools:ignore="MissingPrefix"/>
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/user_image"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_weight="0"
android:layout_marginEnd="16dp"
app:civ_border="false"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginEnd="60dp"
app:behavior_overlapTop="24dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/container"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:descendantFocusability="blocksDescendants"
android:elevation="@dimen/card_elevation"
android:layout_margin="4dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
tools:ignore="UnusedAttribute">
<include layout="@layout/abs_playlists"/>
<include layout="@layout/status_bar" />
<include layout="@layout/home_section_content"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
tools:ignore="UnusedAttribute">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<View
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7" />
<android.support.v7.widget.Toolbar
android:id="@+id/home_toolbar"
style="@style/Toolbar"
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:src="@drawable/ic_search_white_24dp" />
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?android:attr/textColorPrimary"
tools:ignore="MissingPrefix" />
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/user_image"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="16dp"
android:layout_weight="0"
app:civ_border="false" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginEnd="60dp"
app:behavior_overlapTop="24dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<include layout="@layout/abs_playlists" />
<include layout="@layout/home_section_content" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>

View File

@ -82,21 +82,20 @@
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginEnd="64dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:elevation="@dimen/card_elevation"
app:behavior_overlapTop="96dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="64dp"
android:layout_marginStart="64dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:descendantFocusability="blocksDescendants"
android:elevation="@dimen/card_elevation"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">

View File

@ -49,10 +49,10 @@
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingEnd="16dp"
android:paddingStart="16dp"
android:paddingTop="8dp">
android:paddingTop="8dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp">
<TextView
android:id="@+id/title"
@ -64,8 +64,6 @@
android:focusableInTouchMode="true"
android:freezesText="true"
android:marqueeRepeatLimit="marquee_forever"
android:paddingLeft="15dip"
android:paddingRight="15dip"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UnusedAttribute">
<include layout="@layout/status_bar"/>
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
tools:ignore="UnusedAttribute">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<View
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
<android.support.v7.widget.Toolbar
android:id="@+id/home_toolbar"
style="@style/Toolbar"
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:src="@drawable/ic_search_white_24dp"/>
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textColor="?android:attr/textColorPrimary"
tools:ignore="MissingPrefix"/>
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/user_image"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_weight="0"
android:layout_marginEnd="16dp"
app:civ_border="false"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_overlapTop="24dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:descendantFocusability="blocksDescendants"
android:elevation="@dimen/card_elevation"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<include layout="@layout/abs_playlists"/>
<include layout="@layout/home_section_content"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>

View File

@ -79,20 +79,19 @@
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="96dp"
android:layout_marginEnd="96dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
app:behavior_overlapTop="112dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:elevation="@dimen/card_elevation"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="64dp"
android:layout_marginStart="64dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:background="@drawable/bg_card_line"
android:descendantFocusability="blocksDescendants"
android:focusable="true"
android:focusableInTouchMode="true"

View File

@ -1,36 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:elevation="0dp"
app:elevation="0dp">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:title="@string/action_settings">
<View
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
android:title="@string/action_settings"
app:layout_collapseMode="pin"
app:title="@string/action_settings" />
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
app:title=""
tools:ignore="UnusedAttribute">
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/action_settings"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout

View File

@ -79,21 +79,20 @@
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginEnd="64dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
app:behavior_overlapTop="96dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="64dp"
android:layout_marginStart="64dp"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:background="@drawable/bg_card_line"
android:descendantFocusability="blocksDescendants"
android:elevation="@dimen/card_elevation"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">

View File

@ -1,69 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
tools:ignore="UnusedAttribute">
<include layout="@layout/status_bar"/>
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="62dp"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<View
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute"/>
</android.support.design.widget.CollapsingToolbarLayout>
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
</android.support.design.widget.AppBarLayout>
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
tools:ignore="UnusedAttribute">
</android.support.design.widget.CoordinatorLayout>
<include layout="@layout/status_bar" />
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin">
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="48dp" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:title=""
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="?roundSelector"
android:padding="12dp"
android:src="@drawable/ic_search_white_24dp" />
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>

View File

@ -1,45 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:title="@string/action_about">
<View
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:elevation="0dp"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/support_development"/>
<android.support.design.widget.CollapsingToolbarLayout xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:title=""
tools:ignore="UnusedAttribute">
<include layout="@layout/activity_about_content"/>
</android.support.v4.widget.NestedScrollView>
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/action_about"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include layout="@layout/activity_about_content" />
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,170 +1,167 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:layout_collapseMode="parallax">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:transitionName="@string/transition_album_art"
tools:src="@drawable/hemanth_s" />
<View
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@drawable/shadow_down_strong" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:title="" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:layout_collapseMode="parallax">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:transitionName="@string/transition_album_art"
tools:src="@drawable/hemanth_s"/>
<View
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@drawable/shadow_down_strong"/>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:title=""/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never"
app:behavior_overlapTop="24dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/content"
android:layout_marginTop="4dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_circular_top_corners"
android:elevation="@dimen/card_elevation"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/artist_image"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_weight="0"
android:layout_marginStart="8dp"
app:civ_border="false"
app:civ_shadow="false"/>
android:background="@drawable/bg_circular_top_corners"
app:behavior_overlapTop="24dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="16dp"
android:paddingEnd="0dp"
android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
tools:ignore="MissingPrefix"/>
android:orientation="vertical">
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="4dp"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
tools:ignore="MissingPrefix"
tools:text="Title"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:paddingEnd="8dp">
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/artist_image"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginStart="8dp"
android:layout_weight="0"
app:civ_border="false"
app:civ_shadow="false" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingEnd="0dp">
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
tools:ignore="MissingPrefix" />
<code.name.monkey.appthemehelper.common.views.ATESecondaryTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:marqueeRepeatLimit="marquee_forever"
android:paddingTop="4dp"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
tools:ignore="MissingPrefix"
tools:text="Title" />
</LinearLayout>
</LinearLayout>
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/song_title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp"
android:text="@string/songs"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
tools:ignore="MissingPrefix" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false" />
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/more_title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="12dp"
android:paddingEnd="16dp"
android:paddingBottom="12dp"
android:text="@string/songs"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:visibility="gone"
tools:ignore="MissingPrefix" />
<android.support.v7.widget.RecyclerView
android:id="@+id/more_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/song_title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
<android.support.design.widget.FloatingActionButton
android:id="@+id/action_shuffle_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/songs"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
tools:ignore="MissingPrefix"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"/>
<code.name.monkey.appthemehelper.common.views.ATEPrimaryTextView
android:id="@+id/more_title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/songs"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:visibility="gone"
tools:ignore="MissingPrefix"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/more_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"
android:visibility="gone"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/action_shuffle_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_gravity="bottom|end"
app:layout_behavior="code.name.monkey.retromusic.misc.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_shuffle_white_24dp"/>
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:layout_behavior="code.name.monkey.retromusic.misc.ScrollAwareFABBehavior"
app:srcCompat="@drawable/ic_shuffle_white_24dp" />
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,178 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:layout_collapseMode="parallax">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:transitionName="@string/transition_artist_image" />
<View
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@drawable/shadow_down_strong" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:layout_collapseMode="parallax">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:transitionName="@string/transition_artist_image"/>
<View
android:layout_width="match_parent"
android:layout_height="72dp"
android:background="@drawable/shadow_down_strong"/>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never"
app:behavior_overlapTop="24dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_circular_top_corners"
android:elevation="@dimen/card_elevation"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
android:background="@drawable/bg_circular_top_corners"
android:overScrollMode="never"
app:behavior_overlapTop="24dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="16dp"
android:paddingEnd="0dp"
android:orientation="vertical">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
tools:ignore="MissingPrefix"
tools:text="Title"/>
android:orientation="vertical">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
tools:ignore="MissingPrefix"
tools:text="Title"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingEnd="0dp">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
tools:ignore="MissingPrefix"
tools:text="Title" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
tools:ignore="MissingPrefix"
tools:text="Title" />
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/action_shuffle_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:layout_weight="0"
android:src="@drawable/ic_shuffle_white_24dp" />
</LinearLayout>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/biography_title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:text="@string/biography"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="?android:attr/textColorPrimary"
android:visibility="gone"
tools:ignore="MissingPrefix" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/biography"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="4"
android:padding="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:visibility="gone" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/album_title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:text="@string/albums"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="?android:attr/textColorPrimary" />
<android.support.v7.widget.RecyclerView
android:id="@+id/album_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/song_title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:text="@string/songs"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="?android:attr/textColorPrimary"
tools:ignore="MissingPrefix" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" />
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/action_shuffle_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_gravity="center"
android:src="@drawable/ic_shuffle_white_24dp"/>
</LinearLayout>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/biography_title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:text="@string/biography"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="?android:attr/textColorPrimary"
android:visibility="gone"
tools:ignore="MissingPrefix"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/biography"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:ellipsize="end"
android:maxLines="4"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:visibility="gone"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/album_title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:text="@string/albums"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="?android:attr/textColorPrimary"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/album_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/song_title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:text="@string/songs"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="?android:attr/textColorPrimary"
tools:ignore="MissingPrefix"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

View File

@ -9,31 +9,41 @@
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:elevation="0dp"
app:elevation="0dp">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:title="@string/support_development">
<View
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:titleEnabled="false">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/support_development" />
app:title=""
tools:ignore="UnusedAttribute">
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/support_development"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?dividerColor" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
@ -61,10 +71,10 @@
android:layout_height="wrap_content"
android:gravity="end|center_vertical"
android:orientation="horizontal"
android:paddingBottom="@dimen/md_content_padding_top"
android:paddingLeft="@dimen/md_dialog_frame_margin"
android:paddingTop="@dimen/md_content_padding_top"
android:paddingRight="@dimen/md_dialog_frame_margin"
android:paddingTop="@dimen/md_content_padding_top">
android:paddingBottom="@dimen/md_content_padding_top">
<ProgressBar
android:id="@+id/progress"
@ -88,8 +98,8 @@
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingEnd="6dp"
android:paddingStart="6dp"
android:paddingEnd="6dp"
android:scrollbarStyle="outsideOverlay" />
<android.support.v7.widget.CardView
@ -118,11 +128,10 @@
tools:ignore="MissingPrefix" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="@string/paypal_summary"
android:textColor="@color/md_white_1000" />

View File

@ -1,151 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="match_parent">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp">
<android.support.v7.widget.SwitchCompat
android:id="@+id/equalizer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_gravity="end"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>
</android.support.v7.widget.Toolbar>
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
android:elevation="0dp"
app:elevation="0dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:text="Select preset"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>
<android.support.design.widget.CollapsingToolbarLayout xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<Spinner
android:id="@+id/presets"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"/>
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:title=""
tools:ignore="UnusedAttribute">
<LinearLayout
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/equalizer"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
<android.support.v7.widget.SwitchCompat
android:id="@+id/equalizer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<TextView
android:id="@+id/bass_boost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:text="@string/bass_boost"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<SeekBar
android:id="@+id/bass_boost_strength"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="16dp"
android:max="1000"
android:maxHeight="3dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false"
android:thumb="@drawable/switch_thumb_material"
tools:progress="20"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:text="Select preset"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
<TextView
android:id="@+id/virtualizer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:text="@string/virtualizer"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"/>
<Spinner
android:id="@+id/presets"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent" />
</LinearLayout>
<SeekBar
android:id="@+id/virtualizer_strength"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="16dp"
android:max="1000"
android:maxHeight="3dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false"
android:thumb="@drawable/switch_thumb_material"
tools:progress="20"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/bands"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:orientation="vertical"/>
<TextView
android:id="@+id/bass_boost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:text="@string/bass_boost"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="*Warning: It's alpha version. We don't recommend to use Equalizer, We believe without using Equalizer songs has better sound quality."/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<SeekBar
android:id="@+id/bass_boost_strength"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:max="1000"
android:maxHeight="3dp"
android:padding="16dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false"
android:thumb="@drawable/switch_thumb_material"
tools:progress="20" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/virtualizer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:text="@string/virtualizer"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
<SeekBar
android:id="@+id/virtualizer_strength"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:max="1000"
android:maxHeight="3dp"
android:padding="16dp"
android:progressDrawable="@drawable/color_progress_seek"
android:splitTrack="false"
android:thumb="@drawable/switch_thumb_material"
tools:progress="20" />
</LinearLayout>
<LinearLayout
android:id="@+id/bands"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="8dp"
android:paddingEnd="8dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="*Warning: It's alpha version. We don't recommend to use Equalizer, We believe without using Equalizer songs has better sound quality." />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

View File

@ -7,31 +7,43 @@
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
tools:ignore="UnusedAttribute">
android:elevation="0dp"
app:elevation="0dp">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
tools:ignore="UnusedAttribute" />
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
app:layout_collapseMode="pin"
app:title=""
tools:ignore="UnusedAttribute">
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/licenses"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"

View File

@ -1,55 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary">
android:layout_height="match_parent"
android:orientation="vertical">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<View
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
android:layout_height="wrap_content"
android:elevation="0dp"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
tools:ignore="UnusedAttribute"/>
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false">
<TextView
android:id="@+id/player_queue_sub_header"
android:layout_width="match_parent"
android:layout_height="48dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:gravity="center_vertical"
android:text="@string/up_next"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<View
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="48dp" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:title=""
tools:ignore="UnusedAttribute">
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/queue"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</android.support.v7.widget.Toolbar>
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
<TextView
android:id="@+id/player_queue_sub_header"
android:layout_width="match_parent"
android:layout_height="48dp"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="@string/up_next"
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?dividerColor" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>

View File

@ -23,31 +23,51 @@
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
tools:ignore="UnusedAttribute">
android:elevation="0dp"
app:elevation="0dp">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
tools:ignore="UnusedAttribute" />
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ViewStub
android:id="@+id/cab_stub"
<View
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="48dp" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:title=""
tools:ignore="UnusedAttribute">
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/queue"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</android.support.v7.widget.Toolbar>
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
<View
android:layout_width="match_parent"
android:layout_height="48dp" />
android:layout_height="1dp"
android:background="?dividerColor" />
</android.support.design.widget.AppBarLayout>
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView

View File

@ -1,124 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/status_bar"/>
</FrameLayout>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:title="@string/action_search">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/action_search"
tools:ignore="UnusedAttribute"/>
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
<android.support.v7.widget.CardView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
app:cardCornerRadius="25dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:gravity="center_vertical">
<code.name.monkey.retromusic.views.IconImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="12dp"
app:srcCompat="@drawable/ic_search_white_24dp"/>
<EditText
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:hint="@string/search_hint"
android:inputType="text|textAutoComplete"
/>
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/voice_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="8dp"
android:background="?roundSelector"
app:srcCompat="@drawable/ic_mic_white_24dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.design.widget.AppBarLayout>
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/search_toolbar"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.AppCompatTextView
android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="48dp"
android:paddingBottom="48dp"
android:gravity="center"
android:text="@string/no_results"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
android:visibility="gone"
tools:visibility="visible"/>
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:scrollbarStyle="outsideOverlay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<include layout="@layout/status_bar" />
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
app:elevation="0dp">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:titleEnabled="false">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin">
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/action_search"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.v7.widget.CardView
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
app:cardCornerRadius="25dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingStart="8dp"
android:paddingEnd="8dp">
<code.name.monkey.retromusic.views.IconImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="12dp"
app:srcCompat="@drawable/ic_search_white_24dp" />
<EditText
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:hint="@string/search_hint"
android:inputType="text|textAutoComplete" />
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/voice_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="?roundSelector"
android:padding="8dp"
app:srcCompat="@drawable/ic_mic_white_24dp" />
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/search_toolbar"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.AppCompatTextView
android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="48dp"
android:paddingBottom="48dp"
android:text="@string/no_results"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
android:visibility="gone"
tools:visibility="visible" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>

View File

@ -1,37 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
app:elevation="0dp"
android:elevation="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:title="@string/action_settings">
<View
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:titleEnabled="false">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_keyboard_backspace_black_24dp"
app:title="@string/support_development" />
app:title=""
tools:ignore="UnusedAttribute">
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/action_settings"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="16dp" android:paddingRight="16dp"> <WebView android:id="@+id/web_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="none" /> </FrameLayout>

View File

@ -1,107 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UnusedAttribute">
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/status_bar"/>
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UnusedAttribute">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="62dp"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<View
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
<android.support.v7.widget.Toolbar
android:id="@+id/home_toolbar"
style="@style/Toolbar48"
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="12dp"
android:src="@drawable/ic_search_white_24dp"/>
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix"/>
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/user_image"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_weight="0"
android:layout_marginEnd="16dp"
app:civ_border="false"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/overlap_toolbar_height"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/container"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_dialog_fragment"
android:descendantFocusability="blocksDescendants"
android:elevation="4dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
tools:ignore="UnusedAttribute">
<include layout="@layout/abs_playlists"/>
<include layout="@layout/status_bar" />
<include layout="@layout/home_section_content"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
app:elevation="0dp"
tools:ignore="UnusedAttribute">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
app:titleEnabled="false">
<android.support.v7.widget.Toolbar
android:id="@+id/home_toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="?roundSelector"
android:padding="12dp"
android:src="@drawable/ic_search_white_24dp" />
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/user_image"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:layout_weight="0"
app:civ_border="false" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?dividerColor" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<include layout="@layout/abs_playlists" />
<include layout="@layout/home_section_content" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>

View File

@ -1,120 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
tools:ignore="UnusedAttribute">
<include layout="@layout/status_bar"/>
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinator_layout"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UnusedAttribute">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="62dp"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<View
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/folders"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
android:orientation="vertical">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/overlap_toolbar_height"
android:background="@drawable/bg_circular_top_corners"
android:elevation="@dimen/card_elevation"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation_fall_down"
android:scrollbars="none"/>
<TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/empty"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/empty_text_size"/>
android:elevation="0dp"
tools:ignore="UnusedAttribute">
<include layout="@layout/status_bar" />
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<code.name.monkey.retromusic.views.BreadCrumbLayout
android:id="@+id/bread_crumbs"
android:layout_width="match_parent"
android:layout_height="@dimen/tab_height"
android:layout_weight="0"
android:paddingStart="60dp"
android:paddingEnd="8dp"
android:elevation="6dp"/>
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UnusedAttribute">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<View
android:layout_width="match_parent"
android:layout_height="48dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin">
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="48dp" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/folders"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:layoutAnimation="@anim/layout_animation_fall_down"
android:scrollbars="none" />
<TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/empty"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/empty_text_size" />
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?dividerColor" />
<code.name.monkey.retromusic.views.BreadCrumbLayout
android:id="@+id/bread_crumbs"
android:layout_width="match_parent"
android:layout_height="@dimen/tab_height"
android:layout_weight="0"
android:elevation="6dp"
android:paddingStart="60dp"
android:paddingEnd="8dp" />
</LinearLayout>

View File

@ -15,13 +15,8 @@
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="228dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
android:layout_height="196dp"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:statusBarScrim="?attr/colorPrimary"
app:titleEnabled="false">
@ -50,7 +45,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="16dp"
android:background="?roundSelector"
android:padding="12dp"
android:src="@drawable/ic_search_white_24dp" />
<TextView

View File

@ -1,58 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UnusedAttribute">
<include layout="@layout/status_bar"/>
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="96dp"
app:collapsedTitleTextAppearance="@style/CollapsedTitleAppearance"
app:expandedTitleGravity="top"
app:expandedTitleMarginStart="16dp"
app:expandedTitleMarginTop="48dp"
app:expandedTitleTextAppearance="@style/ExpandedTitleAppearance"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:title="@string/action_settings">
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:layout_collapseMode="pin"/>
</code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UnusedAttribute">
</android.support.design.widget.CoordinatorLayout>
<include layout="@layout/status_bar" />
</FrameLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:titleEnabled="false">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="pin">
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="48dp" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar48"
app:title=""
tools:ignore="UnusedAttribute">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/search"
android:background="?roundSelector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="12dp"
android:src="@drawable/ic_search_white_24dp" />
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:ignore="MissingPrefix" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/title" fontPath="@string/circular_std_black" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="12dp" android:text="@string/recent_artists" android:textAppearance="@style/TextAppearance.AppCompat.Title" android:textColor="?android:attr/textColorPrimary" tools:ignore="MissingPrefix" tools:text="@string/rate_app" tools:textColor="@color/md_black_1000" /> <android.support.v7.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:nestedScrollingEnabled="false" /> <View android:layout_width="match_parent" android:layout_height="1dp" android:layout_margin="12dp" android:background="?attr/dividerColor" /> </LinearLayout>

View File

@ -1,209 +1,211 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="6dp"
app:cardUseCompatPadding="true">
<ImageView
android:id="@+id/image_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</FrameLayout>
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2.68"
android:gravity="center"
android:orientation="vertical">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="6dp"
app:cardUseCompatPadding="true">
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_2"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<ImageView
android:id="@+id/image_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
android:layout_weight="2.68"
android:gravity="center"
android:orientation="vertical">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="6dp"
app:cardUseCompatPadding="true">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<ImageView
android:id="@+id/image_3"
<ImageView
android:id="@+id/image_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<ImageView
android:id="@+id/image_3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
android:layout_height="wrap_content"
android:layout_weight="2"
android:minHeight="100dp">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<ImageView
android:id="@+id/image_4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</FrameLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:minHeight="100dp">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="6dp"
app:cardUseCompatPadding="true">
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/image_4"
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</FrameLayout>
</LinearLayout>
android:layout_height="wrap_content"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/image_5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="6dp"
app:cardUseCompatPadding="true">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/image_5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/image_6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="6dp"
app:cardUseCompatPadding="true">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/image_6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="6dp"
app:cardUseCompatPadding="true">
<ImageView
android:id="@+id/image_7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<ImageView
android:id="@+id/image_7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<Space
android:layout_width="1dp"
android:layout_height="match_parent" />
<Space
android:layout_width="1dp"
android:layout_height="match_parent"/>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="6dp"
app:cardUseCompatPadding="true">
<ImageView
android:id="@+id/image_8"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<ImageView
android:id="@+id/image_8"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="6dp"
app:cardUseCompatPadding="true">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardCornerRadius="6dp"
app:cardUseCompatPadding="true">
<ImageView
android:id="@+id/image_9"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</LinearLayout>
<ImageView
android:id="@+id/image_9"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
</LinearLayout>
</LinearLayout>

View File

@ -8,8 +8,9 @@
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
app:contentPadding="16dp">
app:cardCornerRadius="8dp"
app:cardUseCompatPadding="true"
app:contentPadding="12dp">
<LinearLayout
android:layout_width="wrap_content"
@ -29,8 +30,8 @@
tools:ignore="MissingPrefix" />
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="40dp"
android:layout_height="40dp">
android:layout_width="36dp"
android:layout_height="36dp">
<code.name.monkey.retromusic.views.IconImageView
android:id="@+id/image"

View File

@ -1,69 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?rectSelector"
tools:ignore="MissingPrefix">
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:ignore="UnusedAttribute,UselessParent">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:id="@+id/image_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp">
<code.name.monkey.retromusic.views.RoundCornerFrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:corner_radius="200dp"
>
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:background="@color/md_red_400"
tools:ignore="ContentDescription"/>
</code.name.monkey.retromusic.views.RoundCornerFrameLayout>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
android:layout_height="wrap_content"
android:background="?rectSelector"
tools:ignore="MissingPrefix">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"/>
android:orientation="vertical"
tools:ignore="UnusedAttribute,UselessParent">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:gravity="center"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp"/>
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:id="@+id/image_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="4dp">
<code.name.monkey.retromusic.views.CircularImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:civ_border="false"
app:civ_shadow="false"
tools:background="@color/md_red_400"
tools:ignore="ContentDescription" />
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingStart="4dp"
android:paddingTop="8dp"
android:paddingEnd="4dp"
android:paddingBottom="8dp">
<TextView
android:id="@+id/title"
fontPath="@string/circular_std_black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="4dp"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>

View File

@ -1,40 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="128dp"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/image_container_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
app:cardCornerRadius="6dp"
app:cardElevation="4dp"
app:cardPreventCornerOverlap="true">
<code.name.monkey.retromusic.views.WidthFitSquareLayout
android:layout_width="136dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
<android.support.v7.widget.CardView
android:id="@+id/image_container_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
app:cardCornerRadius="8dp"
app:cardPreventCornerOverlap="true">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
/>
</android.support.v7.widget.CardView>
</code.name.monkey.retromusic.views.WidthFitSquareLayout>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"/>
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:padding="12dp"
android:textColor="?android:attr/textColorPrimary" />
</LinearLayout>

View File

@ -11,8 +11,7 @@
android:id="@+id/image_container"
android:layout_width="match_parent"
android:layout_height="182dp"
app:cardCornerRadius="8dp"
app:cardElevation="6dp"
app:cardCornerRadius="12dp"
app:cardUseCompatPadding="true">
<android.support.v7.widget.AppCompatImageView
@ -39,9 +38,9 @@
android:layout_height="match_parent"
android:ellipsize="end"
android:maxLines="1"
android:paddingEnd="8dp"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:paddingEnd="8dp"
android:textColor="?android:attr/textColorSecondary"
tools:ignore="MissingPrefix"
tools:text="My top tracks" />

View File

@ -1,78 +1,71 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".DrawerActivity">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".DrawerActivity">
<item
android:id="@+id/action_search"
android:icon="@drawable/ic_search_white_24dp"
android:title="@string/action_search"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_shuffle_all"
android:icon="@drawable/ic_shuffle_white_24dp"
android:title="@string/action_shuffle_all"
app:showAsAction="never" />
<item
android:id="@+id/action_shuffle_all"
android:icon="@drawable/ic_shuffle_white_24dp"
android:title="@string/action_shuffle_all"
app:showAsAction="never"/>
<item
android:id="@+id/action_grid_size"
android:title="@string/action_grid_size">
<menu>
<group
android:id="@+id/group_grid_size"
android:checkableBehavior="single"
tools:ignore="HardcodedText">
<item
android:id="@+id/action_grid_size_1"
android:title="@string/grid_size_1" />
<item
android:id="@+id/action_grid_size_2"
android:title="@string/grid_size_2" />
<item
android:id="@+id/action_grid_size_3"
android:title="@string/grid_size_3" />
<item
android:id="@+id/action_grid_size_4"
android:title="@string/grid_size_4" />
<item
android:id="@+id/action_grid_size_5"
android:title="@string/grid_size_5" />
<item
android:id="@+id/action_grid_size_6"
android:title="@string/grid_size_6" />
<item
android:id="@+id/action_grid_size_7"
android:title="@string/grid_size_7" />
<item
android:id="@+id/action_grid_size_8"
android:title="@string/grid_size_8" />
</group>
</menu>
</item>
<item
android:id="@+id/action_grid_size"
android:title="@string/action_grid_size">
<menu>
<group
android:id="@+id/group_grid_size"
android:checkableBehavior="single"
tools:ignore="HardcodedText">
<item
android:id="@+id/action_grid_size_1"
android:title="@string/grid_size_1"/>
<item
android:id="@+id/action_grid_size_2"
android:title="@string/grid_size_2"/>
<item
android:id="@+id/action_grid_size_3"
android:title="@string/grid_size_3"/>
<item
android:id="@+id/action_grid_size_4"
android:title="@string/grid_size_4"/>
<item
android:id="@+id/action_grid_size_5"
android:title="@string/grid_size_5"/>
<item
android:id="@+id/action_grid_size_6"
android:title="@string/grid_size_6"/>
<item
android:id="@+id/action_grid_size_7"
android:title="@string/grid_size_7"/>
<item
android:id="@+id/action_grid_size_8"
android:title="@string/grid_size_8"/>
</group>
</menu>
</item>
<item
android:id="@+id/action_sort_order"
android:title="@string/action_sort_order">
<menu></menu>
</item>
<item
android:id="@+id/action_sort_order"
android:title="@string/action_sort_order">
<menu>
</menu>
</item>
<item
android:id="@+id/action_sleep_timer"
android:orderInCategory="98"
android:title="@string/action_sleep_timer"
app:showAsAction="never" />
<item
android:id="@+id/action_sleep_timer"
android:orderInCategory="98"
android:title="@string/action_sleep_timer"
app:showAsAction="never"/>
<item
android:id="@+id/action_equalizer"
android:orderInCategory="99"
android:title="@string/equalizer"
app:showAsAction="never" />
<item
android:id="@+id/action_equalizer"
android:orderInCategory="99"
android:title="@string/equalizer"
app:showAsAction="never"/>
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"/>
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>

View File

@ -5,6 +5,7 @@
<item>@string/only_on_wifi</item>
<item>@string/never</item>
</array>
<string-array name="pref_general_theme_list_titles">
<item>@string/light_theme_name</item>
<item>@string/dark_theme_name</item>
@ -16,19 +17,23 @@
<item>@string/normal_style</item>
<item>@string/card_style</item>
<item>@string/card_color_style</item>
<item>@string/card_circular_style</item>
</string-array>
<string-array name="pref_grid_style_list_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<array name="pref_grid_style_layout">
<item>@layout/item_grid</item>
<item>@layout/item_card</item>
<item>@layout/item_card_color</item>
<item>@layout/item_grid_circle</item>
</array>
<string-array name="pref_general_theme_list_values">
<item>light</item>
<item>dark</item>

View File

@ -12,9 +12,6 @@
<attr format="color" name="iconColor"/>
<attr format="color" name="dividerColor"/>
<declare-styleable name="RoundCornerFrameLayout">
<attr format="dimension" name="corner_radius"/>
</declare-styleable>
<declare-styleable name="BlurLayout">
<attr format="float" name="blk_downscaleFactor"/>
@ -26,6 +23,7 @@
<declare-styleable name="NetworkImageView">
<attr format="string" name="url_link"/>
</declare-styleable>
<declare-styleable name="LyricView">
<attr format="string" name="hint"/>
<attr format="color" name="hintColor"/>

View File

@ -36,8 +36,6 @@
<string name="hosur_india" translatable="false">Hosur, India</string>
<string name="circular_std_black" translatable="false">fonts/circular_std_black.otf</string>
<string name="circular_std_book" translatable="false">fonts/circular_std_book.otf</string>
<string name="sans_regular" translatable="false">fonts/product_sans_regular.ttf</string>
<string name="sans_bold" translatable="false">fonts/product_sans_bold.ttf</string>
<string name="marko_name" translatable="false">Marko Ivanović </string>
<string name="marko_summary" translatable="false">Contributor</string>
<string name="yt_gaming_name" translatable="false">Gaming Inc</string>

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +0,0 @@
package code.name.monkey.retromusic.ui.fragments.settings;
import junit.framework.TestCase;
/**
* @author Hemanth S (h4h13).
*/
public class PersonaliseSettingsFragmentTest extends TestCase {
}