improved lyrics view
This commit is contained in:
parent
d8fc32ff30
commit
36ae526dc7
6 changed files with 1405 additions and 1389 deletions
|
@ -1,5 +1,7 @@
|
|||
package code.name.monkey.retromusic.dialogs;
|
||||
|
||||
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
|
@ -9,15 +11,13 @@ import android.support.v7.widget.AppCompatTextView;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import butterknife.Unbinder;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.ui.activities.MainActivity;
|
||||
import code.name.monkey.retromusic.ui.fragments.mainactivity.folders.FoldersFragment;
|
||||
import code.name.monkey.retromusic.util.Compressor;
|
||||
import code.name.monkey.retromusic.util.NavigationUtil;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
|
@ -26,13 +26,14 @@ import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment;
|
|||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @author Hemanth S (h4h13).
|
||||
*/
|
||||
public class HomeOptionDialog extends RoundedBottomSheetDialogFragment {
|
||||
|
||||
private static final String TAG = "HomeOptionDialog";
|
||||
Unbinder mUnbinder;
|
||||
@BindView(R.id.user_image_bottom)
|
||||
|
@ -43,7 +44,8 @@ public class HomeOptionDialog extends RoundedBottomSheetDialogFragment {
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View layout = inflater.inflate(R.layout.user_action_details, container, false);
|
||||
mUnbinder = ButterKnife.bind(this, layout);
|
||||
return layout;
|
||||
|
@ -54,7 +56,8 @@ public class HomeOptionDialog extends RoundedBottomSheetDialogFragment {
|
|||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
loadImageFromStorage();
|
||||
titleWelcome.setText(String.format("%s, %s!", getTimeOfTheDay(), PreferenceUtil.getInstance(getContext()).getUserName()));
|
||||
titleWelcome.setText(String.format("%s, %s!", getTimeOfTheDay(),
|
||||
PreferenceUtil.getInstance(getContext()).getUserName()));
|
||||
}
|
||||
|
||||
private String getTimeOfTheDay() {
|
||||
|
@ -83,14 +86,20 @@ public class HomeOptionDialog extends RoundedBottomSheetDialogFragment {
|
|||
mUnbinder.unbind();
|
||||
}
|
||||
|
||||
@OnClick({R.id.action_about, R.id.user_info_container, R.id.action_folder, R.id.action_settings, R.id.action_sleep_timer})
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@OnClick({R.id.action_about, R.id.user_info_container, R.id.action_folder, R.id.action_settings,
|
||||
R.id.action_sleep_timer})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.user_info_container:
|
||||
NavigationUtil.goToUserInfo(getActivity());
|
||||
break;
|
||||
case R.id.action_folder:
|
||||
//getMainActivity().setCurrentFragment(FoldersFragment.newInstance(getContext()), true);
|
||||
MainActivity mainActivity = (MainActivity) getActivity();
|
||||
if (mainActivity == null) {
|
||||
return;
|
||||
}
|
||||
mainActivity.setCurrentFragment(FoldersFragment.newInstance(getContext()), true);
|
||||
break;
|
||||
case R.id.action_settings:
|
||||
NavigationUtil.goToSettings(getActivity());
|
||||
|
|
|
@ -2,9 +2,11 @@ package code.name.monkey.retromusic.ui.activities;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
|
@ -31,6 +33,7 @@ import code.name.monkey.retromusic.util.LyricUtil;
|
|||
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.LyricView;
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
@ -48,7 +51,8 @@ public class LyricsActivity extends AbsMusicServiceActivity implements
|
|||
TextView songTitle;
|
||||
@BindView(R.id.text)
|
||||
TextView songText;
|
||||
|
||||
@BindView(R.id.lyrics_view)
|
||||
LyricView lyricView;
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
@BindView(R.id.offline_lyrics)
|
||||
|
@ -91,11 +95,11 @@ public class LyricsActivity extends AbsMusicServiceActivity implements
|
|||
radioButton.setTextColor(ThemeStore.textColorPrimary(this));
|
||||
|
||||
offlineLyrics.setVisibility(View.GONE);
|
||||
|
||||
lyricView.setVisibility(View.GONE);
|
||||
switch (group) {
|
||||
case R.id.synced_lyrics:
|
||||
loadLRCLyrics();
|
||||
|
||||
lyricView.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
default:
|
||||
case R.id.normal_lyrics:
|
||||
|
@ -117,6 +121,13 @@ public class LyricsActivity extends AbsMusicServiceActivity implements
|
|||
|
||||
private void setupLyricsView() {
|
||||
disposable = new CompositeDisposable();
|
||||
|
||||
lyricView
|
||||
.setOnPlayerClickListener((progress, content) -> MusicPlayerRemote.seekTo((int) progress));
|
||||
//lyricView.setHighLightTextColor(ThemeStore.accentColor(this));
|
||||
lyricView.setDefaultColor(ContextCompat.getColor(this, R.color.md_grey_400));
|
||||
//lyricView.setTouchable(false);
|
||||
lyricView.setHintColor(Color.WHITE);
|
||||
}
|
||||
|
||||
private void setupToolbar() {
|
||||
|
@ -170,7 +181,7 @@ public class LyricsActivity extends AbsMusicServiceActivity implements
|
|||
|
||||
@Override
|
||||
public void onUpdateProgressViews(int progress, int total) {
|
||||
|
||||
lyricView.setCurrentTimeMillis(progress);
|
||||
}
|
||||
|
||||
private void loadLrcFile() {
|
||||
|
@ -193,7 +204,11 @@ public class LyricsActivity extends AbsMusicServiceActivity implements
|
|||
}
|
||||
|
||||
private void showLyricsLocal(File file) {
|
||||
|
||||
if (file == null) {
|
||||
lyricView.reset();
|
||||
} else {
|
||||
lyricView.setLyricFile(file, "UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick({R.id.edit_lyrics})
|
||||
|
|
|
@ -22,12 +22,6 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
@ -43,8 +37,11 @@ import code.name.monkey.retromusic.ui.activities.base.AbsSlidingMusicPanelActivi
|
|||
import code.name.monkey.retromusic.ui.fragments.mainactivity.LibraryFragment;
|
||||
import code.name.monkey.retromusic.ui.fragments.mainactivity.home.HomeFragment;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class MainActivity extends AbsSlidingMusicPanelActivity implements
|
||||
SharedPreferences.OnSharedPreferenceChangeListener,
|
||||
|
@ -228,7 +225,8 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
|
|||
final int id = (int) parseIdFromIntent(intent, "artistId", "artist");
|
||||
if (id >= 0) {
|
||||
int position = intent.getIntExtra("position", 0);
|
||||
MusicPlayerRemote.openQueue(ArtistLoader.getArtist(this, id).blockingFirst().getSongs(), position, true);
|
||||
MusicPlayerRemote
|
||||
.openQueue(ArtistLoader.getArtist(this, id).blockingFirst().getSongs(), position, true);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
@ -298,14 +296,14 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
|
|||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (key.equalsIgnoreCase(PreferenceUtil.GENERAL_THEME) ||
|
||||
key.equalsIgnoreCase(PreferenceUtil.ADAPTIVE_COLOR_APP) ||
|
||||
key.equalsIgnoreCase(PreferenceUtil.DOMINANT_COLOR) ||
|
||||
key.equalsIgnoreCase(PreferenceUtil.USER_NAME) ||
|
||||
key.equalsIgnoreCase(PreferenceUtil.TOGGLE_FULL_SCREEN) ||
|
||||
key.equalsIgnoreCase(PreferenceUtil.TOGGLE_VOLUME) ||
|
||||
key.equalsIgnoreCase(PreferenceUtil.TOGGLE_TAB_TITLES) ||
|
||||
key.equalsIgnoreCase(PreferenceUtil.ROUND_CORNERS) ||
|
||||
if (key.equals(PreferenceUtil.GENERAL_THEME) ||
|
||||
key.equals(PreferenceUtil.ADAPTIVE_COLOR_APP) ||
|
||||
key.equals(PreferenceUtil.DOMINANT_COLOR) ||
|
||||
key.equals(PreferenceUtil.USER_NAME) ||
|
||||
key.equals(PreferenceUtil.TOGGLE_FULL_SCREEN) ||
|
||||
key.equals(PreferenceUtil.TOGGLE_VOLUME) ||
|
||||
key.equals(PreferenceUtil.TOGGLE_TAB_TITLES) ||
|
||||
key.equals(PreferenceUtil.ROUND_CORNERS) ||
|
||||
key.equals(PreferenceUtil.CAROUSEL_EFFECT) ||
|
||||
key.equals(PreferenceUtil.NOW_PLAYING_SCREEN_ID) ||
|
||||
key.equals(PreferenceUtil.TOGGLE_GENRE) ||
|
||||
|
@ -313,7 +311,9 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
|
|||
key.equals(PreferenceUtil.PROFILE_IMAGE_PATH) ||
|
||||
key.equals(PreferenceUtil.CIRCULAR_ALBUM_ART) ||
|
||||
key.equals(PreferenceUtil.KEEP_SCREEN_ON) ||
|
||||
key.equals(PreferenceUtil.TOGGLE_SEPARATE_LINE)) {
|
||||
key.equals(PreferenceUtil.TOGGLE_SEPARATE_LINE) ||
|
||||
key.equals(PreferenceUtil.ALBUM_GRID_STYLE) ||
|
||||
key.equals(PreferenceUtil.ARTIST_GRID_STYLE)) {
|
||||
postRecreate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package code.name.monkey.retromusic.ui.fragments.mainactivity.home;
|
||||
|
||||
import static code.name.monkey.retromusic.Constants.USER_BANNER;
|
||||
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
|
@ -20,15 +23,6 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
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.Random;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
@ -61,15 +55,19 @@ 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 com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
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;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Random;
|
||||
|
||||
public class HomeFragment extends AbsMainActivityFragment implements MainActivityFragmentCallbacks,
|
||||
HomeContract.HomeView {
|
||||
|
||||
private static final String TAG = "HomeFragment";
|
||||
Unbinder unbinder;
|
||||
@BindView(R.id.home_toolbar)
|
||||
|
|
|
@ -9,21 +9,18 @@ import android.preference.PreferenceManager;
|
|||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.StyleRes;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.RetroApplication;
|
||||
import code.name.monkey.retromusic.helper.SortOrder;
|
||||
import code.name.monkey.retromusic.model.CategoryInfo;
|
||||
import code.name.monkey.retromusic.ui.fragments.NowPlayingScreen;
|
||||
import code.name.monkey.retromusic.ui.fragments.mainactivity.folders.FoldersFragment;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public final class PreferenceUtil {
|
||||
|
||||
|
@ -49,9 +46,9 @@ public final class PreferenceUtil {
|
|||
public static final String BANNER_IMAGE_PATH = "banner_image_path";
|
||||
public static final String ADAPTIVE_COLOR_APP = "adaptive_color_app";
|
||||
public static final String TOGGLE_SEPARATE_LINE = "toggle_separate_line";
|
||||
public static final String ALBUM_GRID_STYLE = "album_grid_style";
|
||||
public static final String ARTIST_GRID_STYLE = "artist_grid_style";
|
||||
private static final String GENRE_SORT_ORDER = "genre_sort_order";
|
||||
private static final String ALBUM_GRID_STYLE = "album_grid_style";
|
||||
private static final String ARTIST_GRID_STYLE = "artist_grid_style";
|
||||
private static final String LIBRARY_CATEGORIES = "library_categories";
|
||||
private static final String LAST_PAGE = "last_start_page";
|
||||
private static final String LAST_MUSIC_CHOOSER = "last_music_chooser";
|
||||
|
|
|
@ -25,9 +25,7 @@ import android.view.View;
|
|||
import android.view.ViewConfiguration;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
|
||||
import org.mozilla.universalchardet.UniversalDetector;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -40,8 +38,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
import org.mozilla.universalchardet.UniversalDetector;
|
||||
|
||||
/**
|
||||
* Created by zhengken.me on 2016/11/27.
|
||||
|
|
Loading…
Reference in a new issue