v2.2.00
This commit is contained in:
parent
a531a1e723
commit
ca4e9e7ef0
194 changed files with 1286 additions and 2256 deletions
|
@ -55,9 +55,10 @@ public class RetroApplication extends MultiDexApplication {
|
|||
setupErrorHandler();
|
||||
|
||||
// default theme
|
||||
if (!ThemeStore.isConfigured(this, 1)) {
|
||||
if (!ThemeStore.isConfigured(this, 3)) {
|
||||
ThemeStore.editTheme(this)
|
||||
.accentColorRes(R.color.md_green_A200)
|
||||
.coloredNavigationBar(true)
|
||||
.commit();
|
||||
}
|
||||
|
||||
|
|
|
@ -93,9 +93,6 @@ public final class SortOrder {
|
|||
|
||||
/* Song sort order date */
|
||||
String SONG_DATE = MediaStore.Audio.Media.DATE_ADDED + " DESC";
|
||||
|
||||
/* Song sort order date */
|
||||
String COMPOSER = MediaStore.Audio.Media.COMPOSER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,9 +48,7 @@ public class GenreSongsLoader {
|
|||
final String albumName = cursor.getString(8);
|
||||
final int artistId = cursor.getInt(9);
|
||||
final String artistName = cursor.getString(10);
|
||||
final String composer = cursor.getString(11);
|
||||
|
||||
return new Song(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, composer);
|
||||
return new Song(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName);
|
||||
}
|
||||
|
||||
private static Cursor makeGenreSongCursor(Context context, long genreId) {
|
||||
|
@ -69,7 +67,6 @@ public class GenreSongsLoader {
|
|||
AudioColumns.ALBUM,// 8
|
||||
AudioColumns.ARTIST_ID,// 9
|
||||
AudioColumns.ARTIST,// 10
|
||||
AudioColumns.COMPOSER,// 11
|
||||
}, SongLoader.BASE_SELECTION, null,
|
||||
MediaStore.Audio.Genres.Members.DEFAULT_SORT_ORDER);
|
||||
} catch (SecurityException e) {
|
||||
|
|
|
@ -64,9 +64,8 @@ public class PlaylistSongsLoader {
|
|||
final int artistId = cursor.getInt(9);
|
||||
final String artistName = cursor.getString(10);
|
||||
final int idInPlaylist = cursor.getInt(11);
|
||||
final String composer = cursor.getString(12);
|
||||
|
||||
return new PlaylistSong(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, playlistId, idInPlaylist, composer);
|
||||
return new PlaylistSong(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, playlistId, idInPlaylist);
|
||||
}
|
||||
|
||||
private static Cursor makePlaylistSongCursor(@NonNull final Context context, final int playlistId) {
|
||||
|
@ -85,8 +84,7 @@ public class PlaylistSongsLoader {
|
|||
AudioColumns.ALBUM,// 8
|
||||
AudioColumns.ARTIST_ID,// 9
|
||||
AudioColumns.ARTIST,// 10
|
||||
MediaStore.Audio.Playlists.Members._ID, // 11
|
||||
AudioColumns.COMPOSER,// 12
|
||||
MediaStore.Audio.Playlists.Members._ID, // 11
|
||||
}, SongLoader.BASE_SELECTION, null,
|
||||
MediaStore.Audio.Playlists.Members.DEFAULT_SORT_ORDER);
|
||||
} catch (SecurityException e) {
|
||||
|
|
|
@ -38,7 +38,6 @@ public class SongLoader {
|
|||
AudioColumns.ALBUM,// 8
|
||||
AudioColumns.ARTIST_ID,// 9
|
||||
AudioColumns.ARTIST,// 10
|
||||
AudioColumns.COMPOSER,// 11
|
||||
};
|
||||
|
||||
@NonNull
|
||||
|
@ -86,10 +85,9 @@ public class SongLoader {
|
|||
final String albumName = cursor.getString(8);
|
||||
final int artistId = cursor.getInt(9);
|
||||
final String artistName = cursor.getString(10);
|
||||
final String composer = cursor.getString(11);
|
||||
|
||||
return new Song(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName,
|
||||
artistId, artistName, composer);
|
||||
artistId, artistName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -175,8 +173,8 @@ public class SongLoader {
|
|||
.flatMap((Function<ArrayList<Song>, ObservableSource<ArrayList<Song>>>) songs -> {
|
||||
ArrayList<Song> list = new ArrayList<>();
|
||||
ShuffleHelper.makeShuffleList(songs, -1);
|
||||
if (songs.size() > 10) {
|
||||
list.addAll(songs.subList(0, 10));
|
||||
if (songs.size() > 9) {
|
||||
list.addAll(songs.subList(0, 9));
|
||||
}
|
||||
return Observable.just(list);
|
||||
});
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.os.Parcel;
|
|||
import android.os.Parcelable;
|
||||
|
||||
public class PlaylistSong extends Song {
|
||||
public static final PlaylistSong EMPTY_PLAYLIST_SONG = new PlaylistSong(-1, "", -1, -1, -1, "", -1, -1, "", -1, "", -1, -1, "");
|
||||
public static final Parcelable.Creator<PlaylistSong> CREATOR = new Parcelable.Creator<PlaylistSong>() {
|
||||
public PlaylistSong createFromParcel(Parcel source) {
|
||||
return new PlaylistSong(source);
|
||||
|
@ -17,8 +16,8 @@ public class PlaylistSong extends Song {
|
|||
public final int playlistId;
|
||||
public final int idInPlayList;
|
||||
|
||||
public PlaylistSong(int id, String title, int trackNumber, int year, long duration, String data, int dateModified, int albumId, String albumName, int artistId, String artistName, final int playlistId, final int idInPlayList, final String composer) {
|
||||
super(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, composer);
|
||||
public PlaylistSong(int id, String title, int trackNumber, int year, long duration, String data, int dateModified, int albumId, String albumName, int artistId, String artistName, final int playlistId, final int idInPlayList) {
|
||||
super(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName);
|
||||
this.playlistId = playlistId;
|
||||
this.idInPlayList = idInPlayList;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import android.os.Parcelable;
|
|||
|
||||
|
||||
public class Song implements Parcelable {
|
||||
public static final Song EMPTY_SONG = new Song(-1, "", -1, -1, -1, "", -1, -1, "", -1, "", "");
|
||||
public static final Song EMPTY_SONG = new Song(-1, "", -1, -1, -1, "", -1, -1, "", -1, "");
|
||||
public static final Creator<Song> CREATOR = new Creator<Song>() {
|
||||
public Song createFromParcel(Parcel source) {
|
||||
return new Song(source);
|
||||
|
@ -26,9 +26,8 @@ public class Song implements Parcelable {
|
|||
public final String albumName;
|
||||
public final int artistId;
|
||||
public final String artistName;
|
||||
public final String composer;
|
||||
|
||||
public Song(int id, String title, int trackNumber, int year, long duration, String data, long dateModified, int albumId, String albumName, int artistId, String artistName, String composer) {
|
||||
public Song(int id, String title, int trackNumber, int year, long duration, String data, long dateModified, int albumId, String albumName, int artistId, String artistName) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.trackNumber = trackNumber;
|
||||
|
@ -40,7 +39,6 @@ public class Song implements Parcelable {
|
|||
this.albumName = albumName;
|
||||
this.artistId = artistId;
|
||||
this.artistName = artistName;
|
||||
this.composer = composer;
|
||||
}
|
||||
|
||||
protected Song(Parcel in) {
|
||||
|
@ -55,64 +53,6 @@ public class Song implements Parcelable {
|
|||
this.albumName = in.readString();
|
||||
this.artistId = in.readInt();
|
||||
this.artistName = in.readString();
|
||||
this.composer = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Song song = (Song) o;
|
||||
|
||||
if (id != song.id) return false;
|
||||
if (trackNumber != song.trackNumber) return false;
|
||||
if (year != song.year) return false;
|
||||
if (duration != song.duration) return false;
|
||||
if (dateModified != song.dateModified) return false;
|
||||
if (albumId != song.albumId) return false;
|
||||
if (artistId != song.artistId) return false;
|
||||
if (title != null ? !title.equals(song.title) : song.title != null) return false;
|
||||
if (data != null ? !data.equals(song.data) : song.data != null) return false;
|
||||
if (albumName != null ? !albumName.equals(song.albumName) : song.albumName != null)
|
||||
return false;
|
||||
return artistName != null ? artistName.equals(song.artistName) : song.artistName == null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id;
|
||||
result = 31 * result + (title != null ? title.hashCode() : 0);
|
||||
result = 31 * result + trackNumber;
|
||||
result = 31 * result + year;
|
||||
result = 31 * result + (int) (duration ^ (duration >>> 32));
|
||||
result = 31 * result + (data != null ? data.hashCode() : 0);
|
||||
result = 31 * result + (int) (dateModified ^ (dateModified >>> 32));
|
||||
result = 31 * result + albumId;
|
||||
result = 31 * result + (albumName != null ? albumName.hashCode() : 0);
|
||||
result = 31 * result + artistId;
|
||||
result = 31 * result + (artistName != null ? artistName.hashCode() : 0);
|
||||
result = 31 * result + (composer != null ? composer.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Song{" +
|
||||
"id=" + id +
|
||||
", title='" + title + '\'' +
|
||||
", trackNumber=" + trackNumber +
|
||||
", year=" + year +
|
||||
", duration=" + duration +
|
||||
", data='" + data + '\'' +
|
||||
", dateModified=" + dateModified +
|
||||
", albumId=" + albumId +
|
||||
", albumName='" + albumName + '\'' +
|
||||
", artistId=" + artistId +
|
||||
", artistName='" + artistName + '\'' +
|
||||
", composer='" + composer + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -133,6 +73,5 @@ public class Song implements Parcelable {
|
|||
dest.writeString(this.albumName);
|
||||
dest.writeInt(this.artistId);
|
||||
dest.writeString(this.artistName);
|
||||
dest.writeString(this.composer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,18 @@ import android.database.Cursor;
|
|||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.os.Environment;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import code.name.monkey.retromusic.Constants;
|
||||
import code.name.monkey.retromusic.util.FileUtil;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import code.name.monkey.retromusic.Constants;
|
||||
import code.name.monkey.retromusic.util.FileUtil;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
|
||||
public class BlacklistStore extends SQLiteOpenHelper {
|
||||
public static final String DATABASE_NAME = "blacklist.db";
|
||||
private static final int VERSION = 1;
|
||||
private static final int VERSION = 2;
|
||||
private static BlacklistStore sInstance = null;
|
||||
private Context context;
|
||||
|
||||
|
@ -45,8 +45,7 @@ public class BlacklistStore extends SQLiteOpenHelper {
|
|||
|
||||
@Override
|
||||
public void onCreate(@NonNull final SQLiteDatabase db) {
|
||||
db.execSQL("CREATE TABLE IF NOT EXISTS " + BlacklistStoreColumns.NAME + " ("
|
||||
+ BlacklistStoreColumns.PATH + " STRING NOT NULL);");
|
||||
db.execSQL("CREATE TABLE IF NOT EXISTS " + BlacklistStoreColumns.NAME + " (" + BlacklistStoreColumns.PATH + " STRING NOT NULL);");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,7 +41,7 @@ public class MusicPlaybackQueueStore extends SQLiteOpenHelper {
|
|||
public static final String DATABASE_NAME = "music_playback_state.db";
|
||||
public static final String PLAYING_QUEUE_TABLE_NAME = "playing_queue";
|
||||
public static final String ORIGINAL_PLAYING_QUEUE_TABLE_NAME = "original_playing_queue";
|
||||
private static final int VERSION = 4;
|
||||
private static final int VERSION = 5;
|
||||
@Nullable
|
||||
private static MusicPlaybackQueueStore sInstance = null;
|
||||
|
||||
|
@ -110,9 +110,6 @@ public class MusicPlaybackQueueStore extends SQLiteOpenHelper {
|
|||
builder.append(" INT NOT NULL,");
|
||||
|
||||
builder.append(AudioColumns.ARTIST);
|
||||
builder.append(" STRING NOT NULL,");
|
||||
|
||||
builder.append(AudioColumns.COMPOSER);
|
||||
builder.append(" STRING NOT NULL);");
|
||||
|
||||
db.execSQL(builder.toString());
|
||||
|
@ -176,7 +173,6 @@ public class MusicPlaybackQueueStore extends SQLiteOpenHelper {
|
|||
values.put(AudioColumns.ALBUM, song.albumName);
|
||||
values.put(AudioColumns.ARTIST_ID, song.artistId);
|
||||
values.put(AudioColumns.ARTIST, song.artistName);
|
||||
values.put(AudioColumns.COMPOSER, song.composer);
|
||||
|
||||
database.insert(tableName, null, values);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import android.view.animation.Interpolator;
|
|||
*/
|
||||
public class SongPlayCountStore extends SQLiteOpenHelper {
|
||||
public static final String DATABASE_NAME = "song_play_count.db";
|
||||
private static final int VERSION = 2;
|
||||
private static final int VERSION = 3;
|
||||
// how many weeks worth of playback to track
|
||||
private static final int NUM_WEEKS = 52;
|
||||
@Nullable
|
||||
|
|
|
@ -17,7 +17,6 @@ import android.widget.TextView;
|
|||
import com.bumptech.glide.Glide;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -27,6 +26,7 @@ import androidx.appcompat.widget.AppCompatTextView;
|
|||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.util.Pair;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
@ -36,7 +36,6 @@ import butterknife.ButterKnife;
|
|||
import butterknife.OnClick;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil;
|
||||
import code.name.monkey.appthemehelper.util.TintHelper;
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
@ -63,12 +62,14 @@ import code.name.monkey.retromusic.util.MusicUtil;
|
|||
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.CollapsingFAB;
|
||||
|
||||
public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implements
|
||||
AlbumDetailsContract.AlbumDetailsView {
|
||||
|
||||
public static final String EXTRA_ALBUM_ID = "extra_album_id";
|
||||
private static final int TAG_EDITOR_REQUEST = 2001;
|
||||
|
||||
@BindView(R.id.image)
|
||||
ImageView image;
|
||||
|
||||
|
@ -85,7 +86,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
AppCompatTextView songTitle;
|
||||
|
||||
@BindView(R.id.action_shuffle_all)
|
||||
MaterialButton shuffleButton;
|
||||
CollapsingFAB shuffleButton;
|
||||
|
||||
@BindView(R.id.collapsing_toolbar)
|
||||
@Nullable
|
||||
|
@ -96,7 +97,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
AppBarLayout appBarLayout;
|
||||
|
||||
@BindView(R.id.content)
|
||||
View contentContainer;
|
||||
NestedScrollView contentContainer;
|
||||
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
@ -141,16 +142,32 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
|
||||
ActivityCompat.postponeEnterTransition(this);
|
||||
|
||||
int albumId = getIntent().getIntExtra(EXTRA_ALBUM_ID, -1);
|
||||
albumDetailsPresenter = new AlbumDetailsPresenter(this, albumId);
|
||||
albumDetailsPresenter.subscribe();
|
||||
|
||||
setupRecyclerView();
|
||||
setupToolbarMarginHeight();
|
||||
|
||||
contentContainer.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
|
||||
if (scrollY > oldScrollY) {
|
||||
shuffleButton.setShowTitle(false);
|
||||
}
|
||||
if (scrollY < oldScrollY) {
|
||||
shuffleButton.setShowTitle(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void setupRecyclerView() {
|
||||
adapter = new SimpleSongAdapter(this, new ArrayList<>(), R.layout.item_song);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||
recyclerView.setNestedScrollingEnabled(false);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
setupToolbarMarginHeight();
|
||||
|
||||
int albumId = getIntent().getIntExtra(EXTRA_ALBUM_ID, -1);
|
||||
albumDetailsPresenter = new AlbumDetailsPresenter(this, albumId);
|
||||
}
|
||||
|
||||
private void setupToolbarMarginHeight() {
|
||||
|
@ -213,12 +230,6 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
albumDetailsPresenter.subscribe();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
@ -287,8 +298,6 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
AlbumAdapter albumAdapter = new HorizontalAlbumAdapter(this, albums, false, null);
|
||||
moreRecyclerView.setLayoutManager(new GridLayoutManager(this, 1, GridLayoutManager.HORIZONTAL, false));
|
||||
moreRecyclerView.setAdapter(albumAdapter);
|
||||
|
||||
ActivityCompat.startPostponedEnterTransition(this);
|
||||
}
|
||||
|
||||
public Album getAlbum() {
|
||||
|
@ -314,8 +323,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
songTitle.setTextColor(themeColor);
|
||||
moreTitle.setTextColor(themeColor);
|
||||
|
||||
MaterialUtil.setTint(shuffleButton, true, themeColor);
|
||||
//findViewById(R.id.root).setBackgroundColor(ThemeStore.primaryColor(this));
|
||||
shuffleButton.setColor(themeColor);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import android.widget.Toast;
|
|||
import com.bumptech.glide.Glide;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.CollapsingToolbarLayout;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
@ -31,6 +30,7 @@ import androidx.annotation.Nullable;
|
|||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
@ -40,7 +40,6 @@ import butterknife.ButterKnife;
|
|||
import butterknife.OnClick;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil;
|
||||
import code.name.monkey.appthemehelper.util.TintHelper;
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
@ -64,6 +63,7 @@ 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 code.name.monkey.retromusic.views.CollapsingFAB;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
@ -109,7 +109,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
|||
TextView text;
|
||||
|
||||
@BindView(R.id.action_shuffle_all)
|
||||
MaterialButton shuffleButton;
|
||||
CollapsingFAB shuffleButton;
|
||||
|
||||
@BindView(R.id.gradient_background)
|
||||
@Nullable
|
||||
|
@ -120,7 +120,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
|||
View imageContainer;
|
||||
|
||||
@BindView(R.id.content)
|
||||
View contentContainer;
|
||||
NestedScrollView contentContainer;
|
||||
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
@ -167,6 +167,15 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
|||
|
||||
artistDetailsPresenter = new ArtistDetailsPresenter(this, getIntent().getExtras());
|
||||
artistDetailsPresenter.subscribe();
|
||||
|
||||
contentContainer.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
|
||||
if (scrollY > oldScrollY) {
|
||||
shuffleButton.setShowTitle(false);
|
||||
}
|
||||
if (scrollY < oldScrollY) {
|
||||
shuffleButton.setShowTitle(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setUpViews() {
|
||||
|
@ -257,12 +266,6 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
@ -383,7 +386,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
|||
songTitle.setTextColor(textColor);
|
||||
biographyTitle.setTextColor(textColor);
|
||||
|
||||
MaterialUtil.setTint(shuffleButton, true, textColor);
|
||||
shuffleButton.setColor(textColor);
|
||||
|
||||
if (background != null) {
|
||||
background.setBackgroundTintList(ColorStateList.valueOf(color));
|
||||
|
|
|
@ -4,14 +4,11 @@ import android.os.Bundle;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialcab.MaterialCab;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -25,7 +22,6 @@ import butterknife.BindView;
|
|||
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;
|
||||
|
@ -39,6 +35,7 @@ import code.name.monkey.retromusic.ui.activities.base.AbsSlidingMusicPanelActivi
|
|||
import code.name.monkey.retromusic.ui.adapter.song.SongAdapter;
|
||||
import code.name.monkey.retromusic.util.RetroColorUtil;
|
||||
import code.name.monkey.retromusic.util.ViewUtil;
|
||||
import code.name.monkey.retromusic.views.CollapsingFAB;
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
|
@ -57,7 +54,7 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
TextView empty;
|
||||
|
||||
@BindView(R.id.action_shuffle)
|
||||
FloatingActionButton shuffleButton;
|
||||
CollapsingFAB shuffleButton;
|
||||
|
||||
@BindView(R.id.progress_bar)
|
||||
ProgressBar progressBar;
|
||||
|
@ -85,7 +82,6 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
super.onCreate(savedInstanceState);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
setStatusbarColorAuto();
|
||||
setNavigationbarColorAuto();
|
||||
setTaskDescriptionColorAuto();
|
||||
toggleBottomNavigationView(true);
|
||||
|
@ -119,7 +115,7 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
|
||||
setTitle(null);
|
||||
setSupportActionBar(toolbar);
|
||||
TintHelper.setTintAuto(shuffleButton, ThemeStore.accentColor(this), true);
|
||||
shuffleButton.setColor(ThemeStore.accentColor(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -172,11 +168,21 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
|
|||
private void setupRecyclerView() {
|
||||
ViewUtil.setUpFastScrollRecyclerViewColor(this,
|
||||
((FastScrollRecyclerView) recyclerView), ThemeStore.accentColor(this));
|
||||
songAdapter = new SongAdapter(this, new ArrayList<Song>(), R.layout.item_list, false, this);
|
||||
songAdapter = new SongAdapter(this, new ArrayList<>(), R.layout.item_list, false, this);
|
||||
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
recyclerView.setAdapter(songAdapter);
|
||||
|
||||
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
if (dy > 0) {
|
||||
shuffleButton.setShowTitle(false);
|
||||
} else if (dy < 0) {
|
||||
shuffleButton.setShowTitle(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
songAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
||||
@Override
|
||||
public void onChanged() {
|
||||
|
|
|
@ -66,14 +66,18 @@ public class NowPayingActivity extends AbsMusicServiceActivity implements AbsPla
|
|||
public void onPaletteColorChanged() {
|
||||
int paletteColor = playerFragment.getPaletteColor();
|
||||
if ((currentNowPlayingScreen == NowPlayingScreen.FLAT || currentNowPlayingScreen == NowPlayingScreen.NORMAL) && PreferenceUtil.getInstance().getAdaptiveColor()) {
|
||||
setNavigationbarColor(Color.TRANSPARENT);
|
||||
setLightNavigationBar(true);
|
||||
setLightStatusbar(ColorUtil.isColorLight(paletteColor));
|
||||
} else if (currentNowPlayingScreen == NowPlayingScreen.COLOR) {
|
||||
setLightStatusbar(ColorUtil.isColorLight(paletteColor));
|
||||
} else if (currentNowPlayingScreen == NowPlayingScreen.BLUR || currentNowPlayingScreen == NowPlayingScreen.BLUR_CARD) {
|
||||
setLightStatusbar(false);
|
||||
} else if (currentNowPlayingScreen == NowPlayingScreen.CARD || currentNowPlayingScreen == NowPlayingScreen.FULL) {
|
||||
setNavigationbarColor(Color.TRANSPARENT);
|
||||
} else {
|
||||
setStatusbarColor(Color.TRANSPARENT);
|
||||
setLightStatusbar(isOneOfTheseThemes() && ColorUtil.isColorLight(ThemeStore.primaryColor(this)));
|
||||
setNavigationbarColorAuto();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,10 @@ import android.os.Bundle;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.afollestad.materialcab.MaterialCab;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator;
|
||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
||||
|
@ -27,7 +24,6 @@ import butterknife.BindView;
|
|||
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;
|
||||
|
@ -47,6 +43,7 @@ import code.name.monkey.retromusic.ui.adapter.song.SongAdapter;
|
|||
import code.name.monkey.retromusic.util.PlaylistsUtil;
|
||||
import code.name.monkey.retromusic.util.RetroColorUtil;
|
||||
import code.name.monkey.retromusic.util.ViewUtil;
|
||||
import code.name.monkey.retromusic.views.CollapsingFAB;
|
||||
|
||||
public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity implements CabHolder,
|
||||
PlaylistSongsContract.PlaylistSongsView {
|
||||
|
@ -64,7 +61,7 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
|||
TextView empty;
|
||||
|
||||
@BindView(R.id.action_shuffle)
|
||||
FloatingActionButton shuffleButton;
|
||||
CollapsingFAB shuffleButton;
|
||||
|
||||
@BindView(R.id.app_bar)
|
||||
AppBarLayout appBarLayout;
|
||||
|
@ -101,31 +98,6 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
|||
setUpRecyclerView();
|
||||
}
|
||||
|
||||
public void showHeartAnimation() {
|
||||
shuffleButton.clearAnimation();
|
||||
|
||||
shuffleButton.setScaleX(0.9f);
|
||||
shuffleButton.setScaleY(0.9f);
|
||||
shuffleButton.show();
|
||||
shuffleButton.setPivotX(shuffleButton.getWidth() / 2);
|
||||
shuffleButton.setPivotY(shuffleButton.getHeight() / 2);
|
||||
|
||||
shuffleButton.animate()
|
||||
.setDuration(200)
|
||||
.setInterpolator(new DecelerateInterpolator())
|
||||
.scaleX(1.1f)
|
||||
.scaleY(1.1f)
|
||||
.withEndAction(() -> shuffleButton.animate()
|
||||
.setDuration(200)
|
||||
.setInterpolator(new AccelerateInterpolator())
|
||||
.scaleX(1f)
|
||||
.scaleY(1f)
|
||||
.alpha(1f)
|
||||
.start())
|
||||
.start();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected View createContentView() {
|
||||
return wrapSlidingMusicPanel(R.layout.activity_playlist_detail);
|
||||
|
@ -165,6 +137,17 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
|||
checkIsEmpty();
|
||||
}
|
||||
});
|
||||
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
if (dy > 0) {
|
||||
shuffleButton.setShowTitle(false);
|
||||
} else if (dy < 0) {
|
||||
shuffleButton.setShowTitle(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -176,7 +159,7 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
|||
private void setUpToolBar() {
|
||||
title.setText(playlist.name);
|
||||
title.setTextColor(ThemeStore.textColorPrimary(this));
|
||||
TintHelper.setTintAuto(shuffleButton, ThemeStore.accentColor(this), true);
|
||||
shuffleButton.setColor(ThemeStore.accentColor(this));
|
||||
|
||||
int primaryColor = ThemeStore.primaryColor(this);
|
||||
toolbar.setBackgroundColor(primaryColor);
|
||||
|
@ -320,7 +303,6 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
|||
|
||||
@OnClick(R.id.action_shuffle)
|
||||
public void onViewClicked() {
|
||||
showHeartAnimation();
|
||||
if (adapter.getDataSet().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@ package code.name.monkey.retromusic.ui.activities;
|
|||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.MediaStore.Images.Media;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
@ -31,7 +31,7 @@ import butterknife.BindView;
|
|||
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.ui.activities.base.AbsBaseActivity;
|
||||
import code.name.monkey.retromusic.util.Compressor;
|
||||
|
@ -46,7 +46,6 @@ import static code.name.monkey.retromusic.Constants.USER_BANNER;
|
|||
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
|
||||
|
||||
public class UserInfoActivity extends AbsBaseActivity {
|
||||
private static final String TAG = "UserInfoActivity";
|
||||
|
||||
private static final int PICK_IMAGE_REQUEST = 9002;
|
||||
private static final int PICK_BANNER_REQUEST = 9003;
|
||||
|
@ -82,7 +81,6 @@ public class UserInfoActivity extends AbsBaseActivity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_user_info);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
setStatusbarColorAuto();
|
||||
|
@ -106,10 +104,22 @@ public class UserInfoActivity extends AbsBaseActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void setupToolbar() {
|
||||
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
|
||||
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
|
||||
TintHelper.setTintAuto(nextButton, ThemeStore.accentColor(this), true);
|
||||
int primaryColor = ThemeStore.primaryColor(this);
|
||||
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
|
||||
toolbar.setBackgroundColor(primaryColor);
|
||||
appBarLayout.setBackgroundColor(primaryColor);
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
|
||||
setTitle(null);
|
||||
setSupportActionBar(toolbar);
|
||||
}
|
||||
|
||||
@OnClick({R.id.next, R.id.banner_select})
|
||||
|
@ -176,8 +186,7 @@ public class UserInfoActivity extends AbsBaseActivity {
|
|||
//noinspection ConstantConditions
|
||||
new MaterialDialog.Builder(this)
|
||||
.title("Set a profile photo")
|
||||
.items(Arrays.asList(getString(R.string.new_profile_photo),
|
||||
getString(R.string.remove_profile_photo)))
|
||||
.items(Arrays.asList(getString(R.string.new_profile_photo), getString(R.string.remove_profile_photo)))
|
||||
.itemsCallback((dialog, itemView, position, text) -> {
|
||||
switch (position) {
|
||||
case 0:
|
||||
|
|
|
@ -21,13 +21,14 @@ import code.name.monkey.retromusic.cast.CastHelper;
|
|||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
import code.name.monkey.retromusic.ui.fragments.MiniPlayerFragment;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
import code.name.monkey.retromusic.views.BottomNavigationBarTinted;
|
||||
|
||||
public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivity {
|
||||
|
||||
public static final String TAG = AbsSlidingMusicPanelActivity.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.bottom_navigation)
|
||||
BottomNavigationView bottomNavigationView;
|
||||
BottomNavigationBarTinted bottomNavigationView;
|
||||
|
||||
@BindView(R.id.parentPanel)
|
||||
ViewGroup parentPanel;
|
||||
|
@ -47,7 +48,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
ButterKnife.bind(this);
|
||||
setLightStatusbar(true);
|
||||
setLightNavigationBar(true);
|
||||
setupBottomView();
|
||||
//setupBottomView();
|
||||
miniPlayerFragment = (MiniPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.mini_player_fragment);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,20 +106,18 @@ public abstract class AbsThemeActivity extends ATHActivity implements Runnable {
|
|||
if (VersionUtils.hasKitKat()) {
|
||||
final View statusBar = getWindow().getDecorView().getRootView().findViewById(R.id.status_bar);
|
||||
if (statusBar != null) {
|
||||
if (VersionUtils.hasLollipop()) {
|
||||
if (VersionUtils.hasMarshmallow()) {
|
||||
getWindow().setStatusBarColor(color);
|
||||
} else if (VersionUtils.hasLollipop()) {
|
||||
statusBar.setBackgroundColor(ColorUtil.darkenColor(color));
|
||||
setLightStatusbarAuto(color);
|
||||
} else {
|
||||
statusBar.setBackgroundColor(color);
|
||||
}
|
||||
} else if (VersionUtils.hasMarshmallow()) {
|
||||
getWindow().setStatusBarColor(color);
|
||||
setLightStatusbarAuto(color);
|
||||
} else if (Build.VERSION.SDK_INT >= 21) {
|
||||
getWindow().setStatusBarColor(ColorUtil.darkenColor(color));
|
||||
setLightStatusbarAuto(color);
|
||||
}
|
||||
}
|
||||
setLightStatusbarAuto(color);
|
||||
}
|
||||
|
||||
public void setStatusbarColorAuto() {
|
||||
|
|
|
@ -345,14 +345,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected String getComposer() {
|
||||
try {
|
||||
return getAudioFile(songPaths.get(0)).getTagOrCreateAndSetDefault().getFirst(FieldKey.COMPOSER);
|
||||
} catch (Exception ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
protected Bitmap getAlbumArt() {
|
||||
|
|
|
@ -61,9 +61,6 @@ public class SongTagEditorActivity extends AbsTagEditorActivity implements TextW
|
|||
@BindView(R.id.album_artist)
|
||||
EditText albumArtist;
|
||||
|
||||
@BindView(R.id.composer)
|
||||
EditText composer;
|
||||
|
||||
private void setupToolbar() {
|
||||
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
|
||||
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
|
||||
|
@ -94,7 +91,6 @@ public class SongTagEditorActivity extends AbsTagEditorActivity implements TextW
|
|||
year.addTextChangedListener(this);
|
||||
trackNumber.addTextChangedListener(this);
|
||||
lyrics.addTextChangedListener(this);
|
||||
composer.addTextChangedListener(this);
|
||||
}
|
||||
|
||||
private void fillViewsWithFileTags() {
|
||||
|
@ -106,7 +102,6 @@ public class SongTagEditorActivity extends AbsTagEditorActivity implements TextW
|
|||
year.setText(getSongYear());
|
||||
trackNumber.setText(getTrackNumber());
|
||||
lyrics.setText(getLyrics());
|
||||
composer.setText(getComposer());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -140,7 +135,6 @@ public class SongTagEditorActivity extends AbsTagEditorActivity implements TextW
|
|||
fieldKeyValueMap.put(FieldKey.TRACK, trackNumber.getText().toString());
|
||||
fieldKeyValueMap.put(FieldKey.LYRICS, lyrics.getText().toString());
|
||||
fieldKeyValueMap.put(FieldKey.ALBUM_ARTIST, albumArtist.getText().toString());
|
||||
fieldKeyValueMap.put(FieldKey.COMPOSER, composer.getText().toString());
|
||||
writeValuesToFiles(fieldKeyValueMap, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package code.name.monkey.retromusic.ui.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
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;
|
||||
|
||||
|
@ -14,8 +16,12 @@ import java.util.List;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
import butterknife.BindViews;
|
||||
import butterknife.ButterKnife;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.glide.SongGlideRequest;
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
|
@ -39,8 +45,8 @@ public class CollageSongAdapter extends RecyclerView.Adapter<CollageSongViewHold
|
|||
@Override
|
||||
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 (dataSet.size() > 8) {
|
||||
for (int i = 0; i < dataSet.subList(0, 8).size(); i++) {
|
||||
if (holder.imageViews != null) {
|
||||
SongGlideRequest.Builder.from(Glide.with(activity), dataSet.get(i))
|
||||
.checkIgnoreMediaStore(activity)
|
||||
|
@ -59,20 +65,25 @@ public class CollageSongAdapter extends RecyclerView.Adapter<CollageSongViewHold
|
|||
@NonNull
|
||||
@Override
|
||||
public CollageSongViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new CollageSongViewHolder(
|
||||
LayoutInflater.from(activity).inflate(R.layout.item_collage, parent, false));
|
||||
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,
|
||||
@BindViews({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;
|
||||
@BindView(R.id.image_1)
|
||||
TextView view;
|
||||
|
||||
CollageSongViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
Context context = itemView.getContext();
|
||||
int color = ThemeStore.accentColor(context);
|
||||
view.setBackgroundColor(color);
|
||||
view.setTextColor(MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
|
||||
void bindSongs() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package code.name.monkey.retromusic.ui.adapter.album;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
|
@ -60,10 +61,6 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
|
||||
}
|
||||
|
||||
public AlbumAdapter(@NonNull AppCompatActivity activity, ArrayList<Album> dataSet,
|
||||
@LayoutRes int itemLayoutRes) {
|
||||
this(activity, dataSet, itemLayoutRes, false, null);
|
||||
}
|
||||
|
||||
public void useItemLayout(int itemLayoutRes) {
|
||||
this.itemLayoutRes = itemLayoutRes;
|
||||
|
@ -142,6 +139,9 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
}
|
||||
if (holder.mask != null) {
|
||||
holder.mask.setBackgroundTintList(ColorStateList.valueOf(color));
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadAlbumCover(Album album, final ViewHolder holder) {
|
||||
|
@ -235,7 +235,6 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
if (isInQuickSelectMode()) {
|
||||
toggleChecked(getAdapterPosition());
|
||||
} else {
|
||||
|
||||
Pair[] albumPairs = new Pair[]{Pair.create(image, activity.getResources().getString(R.string.transition_album_art))};
|
||||
NavigationUtil.goToAlbum(activity, dataSet.get(getAdapterPosition()).getId(), albumPairs);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package code.name.monkey.retromusic.ui.adapter.artist;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.util.Pair;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -16,6 +12,11 @@ import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.util.Pair;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
@ -115,6 +116,9 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
}
|
||||
if (holder.mask != null) {
|
||||
holder.mask.setBackgroundTintList(ColorStateList.valueOf(color));
|
||||
}
|
||||
}
|
||||
|
||||
private void loadArtistImage(Artist artist, final ViewHolder holder) {
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package code.name.monkey.retromusic.ui.adapter.base;
|
||||
|
||||
import android.os.Build;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
|
@ -61,6 +61,9 @@ public class MediaEntryViewHolder extends RecyclerView.ViewHolder implements Vie
|
|||
@BindView(R.id.play_songs)
|
||||
@Nullable
|
||||
public ImageButton playSongs;
|
||||
@BindView(R.id.mask)
|
||||
@Nullable
|
||||
public View mask;
|
||||
@BindView(R.id.image_text_container)
|
||||
@Nullable
|
||||
public CardView imageTextContainer;
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.h6ah4i.android.widget.advrecyclerview.draggable.annotation.DraggableI
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -30,6 +31,7 @@ public class PlayingQueueAdapter extends SongAdapter implements DraggableItemAda
|
|||
private static final int UP_NEXT = 2;
|
||||
|
||||
private int current;
|
||||
private int color = -1;
|
||||
|
||||
public PlayingQueueAdapter(AppCompatActivity activity, ArrayList<Song> dataSet, int current,
|
||||
@LayoutRes int itemLayoutRes) {
|
||||
|
@ -37,6 +39,13 @@ public class PlayingQueueAdapter extends SongAdapter implements DraggableItemAda
|
|||
this.current = current;
|
||||
}
|
||||
|
||||
public PlayingQueueAdapter(AppCompatActivity activity, ArrayList<Song> dataSet, int current,
|
||||
@LayoutRes int itemLayoutRes, @ColorInt int color) {
|
||||
super(activity, dataSet, itemLayoutRes, false, null);
|
||||
this.current = current;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SongAdapter.ViewHolder createViewHolder(View view) {
|
||||
return new ViewHolder(view);
|
||||
|
@ -63,6 +72,9 @@ public class PlayingQueueAdapter extends SongAdapter implements DraggableItemAda
|
|||
|
||||
if (holder.title != null) {
|
||||
holder.title.setTextColor(white);
|
||||
if (color != -1) {
|
||||
holder.title.setTextColor(color);
|
||||
}
|
||||
}
|
||||
if (holder.text != null) {
|
||||
holder.text.setTextColor(white);
|
||||
|
|
|
@ -211,9 +211,7 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
|||
break;
|
||||
case SortOrder.SongSortOrder.SONG_YEAR:
|
||||
return MusicUtil.getYearString(dataSet.get(position).year);
|
||||
case SortOrder.SongSortOrder.COMPOSER:
|
||||
sectionName = dataSet.get(position).composer;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return MusicUtil.getSectionName(sectionName);
|
||||
|
|
|
@ -80,14 +80,14 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
|
|||
//noinspection ConstantConditions
|
||||
view.setBackgroundColor(ThemeStore.primaryColor(getContext()));
|
||||
view.setOnTouchListener(new FlingPlayBackController(getActivity()));
|
||||
view.setOnClickListener(v -> NavigationUtil.gotoNowPlayingActivity(getContext(), Pair.create(v, getString(R.string.transition_mini_player))));
|
||||
view.setOnClickListener(v -> NavigationUtil.gotoNowPlayingActivity(getContext()));
|
||||
setUpMiniPlayer();
|
||||
|
||||
if (RetroUtil.isTablet(getResources())) {
|
||||
if (RetroUtil.isTablet()) {
|
||||
next.setVisibility(View.VISIBLE);
|
||||
previous.setVisibility(View.VISIBLE);
|
||||
playingQueue.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
} else{
|
||||
next.setVisibility(PreferenceUtil.getInstance().isExtraMiniExtraControls() ? View.VISIBLE : View.GONE);
|
||||
playingQueue.setVisibility(PreferenceUtil.getInstance().isExtraMiniExtraControls() ? View.GONE : View.VISIBLE);
|
||||
previous.setVisibility(PreferenceUtil.getInstance().isExtraMiniExtraControls() ? View.VISIBLE : View.GONE);
|
||||
|
|
|
@ -162,7 +162,7 @@ public abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A extend
|
|||
}
|
||||
|
||||
protected final boolean isLandscape() {
|
||||
return RetroUtil.isLandscape(getResources());
|
||||
return RetroUtil.isLandscape( );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ public abstract class AbsMainActivityFragment extends AbsMusicServiceFragment {
|
|||
getMainActivity().setBottomBarVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
// WORKAROUND
|
||||
private void setStatusbarColor(View view, int color) {
|
||||
final View statusBar = view.findViewById(R.id.status_bar);
|
||||
if (statusBar != null) {
|
||||
|
|
|
@ -210,7 +210,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment = (AbsLibraryPagerRecyclerViewCustomGridSizeFragment) currentFragment;
|
||||
|
||||
MenuItem gridSizeItem = menu.findItem(R.id.action_grid_size);
|
||||
if (RetroUtil.isLandscape(getResources())) {
|
||||
if (RetroUtil.isLandscape()) {
|
||||
gridSizeItem.setTitle(R.string.action_grid_size_land);
|
||||
}
|
||||
setUpGridSizeMenu(fragment, gridSizeItem.getSubMenu());
|
||||
|
@ -272,8 +272,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
.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.add(0, R.id.action_song_sort_composer, 4, R.string.composer)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.COMPOSER));
|
||||
|
||||
}
|
||||
|
||||
sortOrderMenu.setGroupCheckable(0, true, true);
|
||||
|
@ -327,9 +326,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
case R.id.action_song_sort_order_date:
|
||||
sortOrder = SortOrder.SongSortOrder.SONG_DATE;
|
||||
break;
|
||||
case R.id.action_song_sort_composer:
|
||||
sortOrder = SortOrder.SongSortOrder.COMPOSER;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ 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;
|
||||
|
@ -223,6 +224,7 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
|
|||
View view = inflater.inflate(PreferenceUtil.getInstance().toggleHomeBanner() ? R.layout.fragment_banner_home : R.layout.fragment_home,
|
||||
container, false);
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
setStatusbarColorAuto(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -330,7 +332,7 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
|
|||
if (!songs.isEmpty()) {
|
||||
suggestionsContainer.setVisibility(View.VISIBLE);
|
||||
CollageSongAdapter artistAdapter = new CollageSongAdapter(getMainActivity(), songs);
|
||||
suggestionsSongs.setLayoutManager(new LinearLayoutManager(getMainActivity()));
|
||||
suggestionsSongs.setLayoutManager(RetroUtil.isTablet() ? new GridLayoutManager(getMainActivity(), 2) : new LinearLayoutManager(getMainActivity()));
|
||||
suggestionsSongs.setAdapter(artistAdapter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ public class BlurPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
|||
(AppCompatActivity) getActivity(),
|
||||
MusicPlayerRemote.getPlayingQueue(),
|
||||
MusicPlayerRemote.getPosition(),
|
||||
R.layout.item_song);
|
||||
R.layout.item_song, Color.WHITE);
|
||||
layoutManager = new LinearLayoutManager(getContext());
|
||||
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
|
|
|
@ -138,7 +138,6 @@ public class PlayerFragment extends AbsPlayerFragment implements PlayerAlbumCove
|
|||
unbinder = ButterKnife.bind(this, view);
|
||||
if (getPlayerActivity() != null) {
|
||||
getPlayerActivity().setDrawUnderNavigationBar();
|
||||
//getPlayerActivity().setNavigationbarColorAuto();
|
||||
addSafeArea(view);
|
||||
}
|
||||
return view;
|
||||
|
|
|
@ -102,22 +102,6 @@ public class ThemeSettingsFragment extends AbsSettingsFragment {
|
|||
return true;
|
||||
});
|
||||
|
||||
TwoStatePreference colorNavBar = (TwoStatePreference) findPreference(
|
||||
"should_color_navigation_bar");
|
||||
if (!VersionUtils.hasLollipop()) {
|
||||
colorNavBar.setEnabled(false);
|
||||
colorNavBar.setSummary(R.string.pref_only_lollipop);
|
||||
} else {
|
||||
colorNavBar.setChecked(ThemeStore.coloredNavigationBar(getActivity()));
|
||||
colorNavBar.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
ThemeStore.editTheme(getActivity())
|
||||
.coloredNavigationBar((Boolean) newValue)
|
||||
.commit();
|
||||
getActivity().recreate();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
TwoStatePreference colorAppShortcuts = (TwoStatePreference) findPreference(
|
||||
"should_color_app_shortcuts");
|
||||
if (!VersionUtils.hasNougatMR()) {
|
||||
|
|
|
@ -80,12 +80,12 @@ public class RetroUtil {
|
|||
.replace("%5D", "]");
|
||||
}
|
||||
|
||||
public static boolean isTablet(@NonNull final Resources resources) {
|
||||
return resources.getConfiguration().smallestScreenWidthDp >= 600;
|
||||
public static boolean isTablet() {
|
||||
return RetroApplication.getContext().getResources().getConfiguration().smallestScreenWidthDp >= 600;
|
||||
}
|
||||
|
||||
public static boolean isLandscape(@NonNull final Resources resources) {
|
||||
return resources.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
|
||||
public static boolean isLandscape() {
|
||||
return RetroApplication.getContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package code.name.monkey.retromusic.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
|
||||
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.NavigationViewUtil;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
|
||||
public class BottomNavigationBarTinted extends BottomNavigationView {
|
||||
public BottomNavigationBarTinted(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public BottomNavigationBarTinted(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public BottomNavigationBarTinted(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setLabelVisibilityMode(PreferenceUtil.getInstance().getTabTitleMode());
|
||||
setBackgroundColor(ThemeStore.primaryColor(context));
|
||||
setSelectedItemId(PreferenceUtil.getInstance().getLastPage());
|
||||
|
||||
int iconColor = ATHUtil.resolveColor(context, R.attr.iconColor);
|
||||
int accentColor = ThemeStore.accentColor(context);
|
||||
NavigationViewUtil.setItemIconColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor);
|
||||
NavigationViewUtil.setItemTextColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package code.name.monkey.retromusic.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.card.MaterialCardView;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.transition.AutoTransition;
|
||||
import androidx.transition.TransitionManager;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
public class CollapsingFAB extends FrameLayout {
|
||||
@ColorInt
|
||||
int color = Color.WHITE;
|
||||
boolean showTitle;
|
||||
|
||||
ImageView shuffleIcon;
|
||||
TextView textView;
|
||||
MaterialCardView cardView;
|
||||
|
||||
public CollapsingFAB(@NonNull Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public CollapsingFAB(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public CollapsingFAB(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
TypedArray attributes = getContext().obtainStyledAttributes(attrs, R.styleable.CollapsingFAB, 0, 0);
|
||||
color = attributes.getColor(R.styleable.CollapsingFAB_shuffleBackgroundColor, 0);
|
||||
showTitle = attributes.getBoolean(R.styleable.CollapsingFAB_showTitle, false);
|
||||
View view = inflate(context, R.layout.collapsing_floating_action_button, this);
|
||||
shuffleIcon = view.findViewById(R.id.icon);
|
||||
textView = view.findViewById(R.id.shuffle_text);
|
||||
textView.setVisibility(showTitle ? VISIBLE : GONE);
|
||||
cardView = view.findViewById(R.id.container);
|
||||
attributes.recycle();
|
||||
}
|
||||
|
||||
public void setShowTitle(boolean showTitle) {
|
||||
this.showTitle = showTitle;
|
||||
TransitionManager.beginDelayedTransition(this, new AutoTransition());
|
||||
textView.setVisibility(showTitle ? VISIBLE : GONE);
|
||||
invalidate();
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
int textColor = MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(color));
|
||||
shuffleIcon.setColorFilter(textColor);
|
||||
textView.setTextColor(textColor);
|
||||
cardView.setCardBackgroundColor(ColorStateList.valueOf(color));
|
||||
postInvalidate();
|
||||
}
|
||||
}
|
|
@ -17,19 +17,20 @@ package code.name.monkey.retromusic.views;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SnapHelper;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.ui.adapter.base.MediaEntryViewHolder;
|
||||
import code.name.monkey.retromusic.util.RetroUtil;
|
||||
|
||||
public class MetalRecyclerViewPager extends RecyclerView {
|
||||
|
||||
|
@ -88,7 +89,11 @@ public class MetalRecyclerViewPager extends RecyclerView {
|
|||
}
|
||||
|
||||
void updateDisplayMetrics() {
|
||||
itemWidth = metrics.widthPixels - itemMargin * 2;
|
||||
if (RetroUtil.isTablet()) {
|
||||
itemWidth = (metrics.widthPixels / 2) - itemMargin * 3;
|
||||
} else {
|
||||
itemWidth = metrics.widthPixels - itemMargin * 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,32 +2,33 @@ package code.name.monkey.retromusic.views;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.annotation.StyleRes;
|
||||
import androidx.appcompat.app.AppCompatDialogFragment;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.VersionUtils;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
|
||||
import code.name.monkey.retromusic.util.RetroUtil;
|
||||
|
||||
/**
|
||||
* Created by yu on 2016/11/10.
|
||||
*/
|
||||
@SuppressLint("RestrictedApi")
|
||||
public class RoundedBottomSheetDialogFragment extends BottomSheetDialogFragment {
|
||||
public class RoundedBottomSheetDialogFragment extends AppCompatDialogFragment {
|
||||
|
||||
/* @Override
|
||||
public int getTheme() {
|
||||
|
@ -52,22 +53,26 @@ public class RoundedBottomSheetDialogFragment extends BottomSheetDialogFragment
|
|||
view.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
|
||||
BottomSheetDialog dialog = (BottomSheetDialog) getDialog();
|
||||
FrameLayout bottomSheet = dialog.findViewById(R.id.design_bottom_sheet);
|
||||
|
||||
if (bottomSheet != null) {
|
||||
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
|
||||
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
bottomSheet.setBackground(RetroUtil.getTintedDrawable(getContext(), R.drawable.bg_bottom_sheet_dialog_fragment, ThemeStore.primaryColor(getContext())));
|
||||
}
|
||||
});
|
||||
view.setBackground(ContextCompat.getDrawable(view.getContext(), R.drawable.bg_bottom_sheet_dialog_fragment));
|
||||
view.setBackgroundTintList(ColorStateList.valueOf(ThemeStore.primaryColor(view.getContext())));
|
||||
((AbsBaseActivity) Objects.requireNonNull(getActivity())).setNavigationbarColorAuto();
|
||||
if (getActivity() != null) {
|
||||
if (VersionUtils.hasNougat()) {
|
||||
((AbsBaseActivity) getActivity()).setNavigationbarColor(ThemeStore.primaryColor(getContext()));
|
||||
} else {
|
||||
((AbsBaseActivity) getActivity()).setNavigationbarColorAuto();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
//noinspection ConstantConditions
|
||||
return new BottomSheetDialog(getContext());
|
||||
return new CustomWidthBottomSheetDialog(getContext(), getTheme());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,4 +85,18 @@ public class RoundedBottomSheetDialogFragment extends BottomSheetDialogFragment
|
|||
window.findViewById(com.google.android.material.R.id.container).setFitsSystemWindows(true);
|
||||
}
|
||||
}
|
||||
|
||||
static class CustomWidthBottomSheetDialog extends BottomSheetDialog {
|
||||
CustomWidthBottomSheetDialog(@NonNull Context context, @StyleRes int theme) {
|
||||
super(context, theme);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
int width = getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_width);
|
||||
getWindow().setLayout(width > 0 ? width : ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package code.name.monkey.retromusic.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
|
||||
public class TintIconColorToolbar extends Toolbar {
|
||||
public TintIconColorToolbar(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public TintIconColorToolbar(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public TintIconColorToolbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setNavigationIcon(@Nullable Drawable icon) {
|
||||
super.setNavigationIcon(icon);
|
||||
if (icon != null) {
|
||||
icon.setColorFilter(ThemeStore.accentColor(getContext()), PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue