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,100 +26,109 @@ 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)
|
||||
CircularImageView userImageBottom;
|
||||
@BindView(R.id.title_welcome)
|
||||
AppCompatTextView titleWelcome;
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
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;
|
||||
private static final String TAG = "HomeOptionDialog";
|
||||
Unbinder mUnbinder;
|
||||
@BindView(R.id.user_image_bottom)
|
||||
CircularImageView userImageBottom;
|
||||
@BindView(R.id.title_welcome)
|
||||
AppCompatTextView titleWelcome;
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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()));
|
||||
}
|
||||
|
||||
private String getTimeOfTheDay() {
|
||||
String message = getString(R.string.title_good_day);
|
||||
Calendar c = Calendar.getInstance();
|
||||
int timeOfDay = c.get(Calendar.HOUR_OF_DAY);
|
||||
|
||||
if (timeOfDay >= 0 && timeOfDay < 6) {
|
||||
message = getString(R.string.title_good_night);
|
||||
} else if (timeOfDay >= 6 && timeOfDay < 12) {
|
||||
message = getString(R.string.title_good_morning);
|
||||
} else if (timeOfDay >= 12 && timeOfDay < 16) {
|
||||
message = getString(R.string.title_good_afternoon);
|
||||
} else if (timeOfDay >= 16 && timeOfDay < 20) {
|
||||
message = getString(R.string.title_good_evening);
|
||||
} else if (timeOfDay >= 20 && timeOfDay < 24) {
|
||||
message = getString(R.string.title_good_night);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
disposable.clear();
|
||||
mUnbinder.unbind();
|
||||
}
|
||||
|
||||
@Override
|
||||
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()));
|
||||
}
|
||||
|
||||
private String getTimeOfTheDay() {
|
||||
String message = getString(R.string.title_good_day);
|
||||
Calendar c = Calendar.getInstance();
|
||||
int timeOfDay = c.get(Calendar.HOUR_OF_DAY);
|
||||
|
||||
if (timeOfDay >= 0 && timeOfDay < 6) {
|
||||
message = getString(R.string.title_good_night);
|
||||
} else if (timeOfDay >= 6 && timeOfDay < 12) {
|
||||
message = getString(R.string.title_good_morning);
|
||||
} else if (timeOfDay >= 12 && timeOfDay < 16) {
|
||||
message = getString(R.string.title_good_afternoon);
|
||||
} else if (timeOfDay >= 16 && timeOfDay < 20) {
|
||||
message = getString(R.string.title_good_evening);
|
||||
} else if (timeOfDay >= 20 && timeOfDay < 24) {
|
||||
message = getString(R.string.title_good_night);
|
||||
@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:
|
||||
MainActivity mainActivity = (MainActivity) getActivity();
|
||||
if (mainActivity == null) {
|
||||
return;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
disposable.clear();
|
||||
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})
|
||||
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);
|
||||
break;
|
||||
case R.id.action_settings:
|
||||
NavigationUtil.goToSettings(getActivity());
|
||||
break;
|
||||
case R.id.action_about:
|
||||
NavigationUtil.goToAbout(getActivity());
|
||||
break;
|
||||
case R.id.action_sleep_timer:
|
||||
if (getFragmentManager() != null) {
|
||||
new SleepTimerDialog().show(getFragmentManager(), TAG);
|
||||
}
|
||||
break;
|
||||
mainActivity.setCurrentFragment(FoldersFragment.newInstance(getContext()), true);
|
||||
break;
|
||||
case R.id.action_settings:
|
||||
NavigationUtil.goToSettings(getActivity());
|
||||
break;
|
||||
case R.id.action_about:
|
||||
NavigationUtil.goToAbout(getActivity());
|
||||
break;
|
||||
case R.id.action_sleep_timer:
|
||||
if (getFragmentManager() != null) {
|
||||
new SleepTimerDialog().show(getFragmentManager(), TAG);
|
||||
}
|
||||
dismiss();
|
||||
break;
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
private void loadImageFromStorage() {
|
||||
//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(userImageBottom::setImageBitmap,
|
||||
throwable -> userImageBottom.setImageDrawable(ContextCompat
|
||||
.getDrawable(getContext(), R.drawable.ic_person_flat))));
|
||||
}
|
||||
private void loadImageFromStorage() {
|
||||
//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(userImageBottom::setImageBitmap,
|
||||
throwable -> userImageBottom.setImageDrawable(ContextCompat
|
||||
.getDrawable(getContext(), R.drawable.ic_person_flat))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,294 +37,300 @@ 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,
|
||||
BottomNavigationView.OnNavigationItemSelectedListener {
|
||||
SharedPreferences.OnSharedPreferenceChangeListener,
|
||||
BottomNavigationView.OnNavigationItemSelectedListener {
|
||||
|
||||
public static final int APP_INTRO_REQUEST = 2323;
|
||||
private static final String TAG = "MainActivity";
|
||||
private static final int APP_USER_INFO_REQUEST = 9003;
|
||||
private static final int REQUEST_CODE_THEME = 9002;
|
||||
public static final int APP_INTRO_REQUEST = 2323;
|
||||
private static final String TAG = "MainActivity";
|
||||
private static final int APP_USER_INFO_REQUEST = 9003;
|
||||
private static final int REQUEST_CODE_THEME = 9002;
|
||||
|
||||
@Nullable
|
||||
MainActivityFragmentCallbacks currentFragment;
|
||||
@Nullable
|
||||
MainActivityFragmentCallbacks currentFragment;
|
||||
|
||||
@BindView(R.id.parent_container)
|
||||
FrameLayout drawerLayout;
|
||||
|
||||
private boolean blockRequestPermissions;
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (action != null && action.equals(Intent.ACTION_SCREEN_OFF)) {
|
||||
if (PreferenceUtil.getInstance(context).getLockScreen() && MusicPlayerRemote.isPlaying()) {
|
||||
Intent activity = new Intent(context, LockScreenActivity.class);
|
||||
activity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||
ActivityCompat.startActivity(context, activity, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@BindView(R.id.parent_container)
|
||||
FrameLayout drawerLayout;
|
||||
|
||||
private boolean blockRequestPermissions;
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
protected View createContentView() {
|
||||
@SuppressLint("InflateParams")
|
||||
View contentView = getLayoutInflater().inflate(R.layout.activity_main_drawer_layout, null);
|
||||
ViewGroup drawerContent = contentView.findViewById(R.id.drawer_content_container);
|
||||
drawerContent.addView(wrapSlidingMusicPanel(R.layout.activity_main_content));
|
||||
return contentView;
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if (action != null && action.equals(Intent.ACTION_SCREEN_OFF)) {
|
||||
if (PreferenceUtil.getInstance(context).getLockScreen() && MusicPlayerRemote.isPlaying()) {
|
||||
Intent activity = new Intent(context, LockScreenActivity.class);
|
||||
activity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
|
||||
ActivityCompat.startActivity(context, activity, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setDrawUnderStatusbar(true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
@Override
|
||||
protected View createContentView() {
|
||||
@SuppressLint("InflateParams")
|
||||
View contentView = getLayoutInflater().inflate(R.layout.activity_main_drawer_layout, null);
|
||||
ViewGroup drawerContent = contentView.findViewById(R.id.drawer_content_container);
|
||||
drawerContent.addView(wrapSlidingMusicPanel(R.layout.activity_main_content));
|
||||
return contentView;
|
||||
}
|
||||
|
||||
setBottomBarVisibility(View.VISIBLE);
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setDrawUnderStatusbar(true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
drawerLayout.setOnApplyWindowInsetsListener((view, windowInsets) ->
|
||||
windowInsets.replaceSystemWindowInsets(0, 0, 0, 0));
|
||||
ButterKnife.bind(this);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
setCurrentFragment(PreferenceUtil.getInstance(this).getLastPage());
|
||||
} else {
|
||||
restoreCurrentFragment();
|
||||
}
|
||||
setBottomBarVisibility(View.VISIBLE);
|
||||
|
||||
drawerLayout.setOnApplyWindowInsetsListener((view, windowInsets) ->
|
||||
windowInsets.replaceSystemWindowInsets(0, 0, 0, 0));
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
setCurrentFragment(PreferenceUtil.getInstance(this).getLastPage());
|
||||
} else {
|
||||
restoreCurrentFragment();
|
||||
}
|
||||
/*if (!RetroApplication.isProVersion() &&
|
||||
!PreferenceManager.getDefaultSharedPreferences(this)
|
||||
.getBoolean("shown", false)) {
|
||||
showPromotionalOffer();
|
||||
}*/
|
||||
getBottomNavigationView().setOnNavigationItemSelectedListener(this);
|
||||
getBottomNavigationView().setOnNavigationItemSelectedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
IntentFilter screenOnOff = new IntentFilter();
|
||||
screenOnOff.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
registerReceiver(broadcastReceiver, screenOnOff);
|
||||
|
||||
PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this);
|
||||
|
||||
if (getIntent().hasExtra("expand")) {
|
||||
if (getIntent().getBooleanExtra("expand", false)) {
|
||||
expandPanel();
|
||||
getIntent().putExtra("expand", false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
IntentFilter screenOnOff = new IntentFilter();
|
||||
screenOnOff.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
registerReceiver(broadcastReceiver, screenOnOff);
|
||||
}
|
||||
|
||||
PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this);
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
disposable.clear();
|
||||
if (broadcastReceiver == null) {
|
||||
return;
|
||||
}
|
||||
unregisterReceiver(broadcastReceiver);
|
||||
PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this);
|
||||
}
|
||||
|
||||
if (getIntent().hasExtra("expand")) {
|
||||
if (getIntent().getBooleanExtra("expand", false)) {
|
||||
expandPanel();
|
||||
getIntent().putExtra("expand", false);
|
||||
}
|
||||
public void setCurrentFragment(@Nullable Fragment fragment, boolean isStackAdd) {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
||||
fragmentTransaction.replace(R.id.fragment_container, fragment, TAG);
|
||||
if (isStackAdd) {
|
||||
fragmentTransaction.addToBackStack(TAG);
|
||||
}
|
||||
fragmentTransaction.commit();
|
||||
currentFragment = (MainActivityFragmentCallbacks) fragment;
|
||||
}
|
||||
|
||||
private void restoreCurrentFragment() {
|
||||
currentFragment = (MainActivityFragmentCallbacks) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.fragment_container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
PreferenceUtil.getInstance(this).setLastPage(item.getItemId());
|
||||
disposable.add(Observable.just(item.getItemId())
|
||||
.throttleFirst(3, TimeUnit.SECONDS)
|
||||
.subscribe(this::setCurrentFragment));
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setCurrentFragment(int menuItem) {
|
||||
switch (menuItem) {
|
||||
case R.id.action_song:
|
||||
case R.id.action_album:
|
||||
case R.id.action_artist:
|
||||
case R.id.action_playlist:
|
||||
setCurrentFragment(LibraryFragment.newInstance(menuItem), false);
|
||||
break;
|
||||
default:
|
||||
case R.id.action_home:
|
||||
setCurrentFragment(HomeFragment.newInstance(), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void handlePlaybackIntent(@Nullable Intent intent) {
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = intent.getData();
|
||||
String mimeType = intent.getType();
|
||||
boolean handled = false;
|
||||
|
||||
if (intent.getAction() != null && intent.getAction()
|
||||
.equals(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH)) {
|
||||
final ArrayList<Song> songs = SearchQueryHelper.getSongs(this, intent.getExtras());
|
||||
|
||||
if (MusicPlayerRemote.getShuffleMode() == MusicService.SHUFFLE_MODE_SHUFFLE) {
|
||||
MusicPlayerRemote.openAndShuffleQueue(songs, true);
|
||||
} else {
|
||||
MusicPlayerRemote.openQueue(songs, 0, true);
|
||||
}
|
||||
handled = true;
|
||||
}
|
||||
|
||||
if (uri != null && uri.toString().length() > 0) {
|
||||
MusicPlayerRemote.playFromUri(uri);
|
||||
handled = true;
|
||||
} else if (MediaStore.Audio.Playlists.CONTENT_TYPE.equals(mimeType)) {
|
||||
final int id = (int) parseIdFromIntent(intent, "playlistId", "playlist");
|
||||
if (id >= 0) {
|
||||
int position = intent.getIntExtra("position", 0);
|
||||
ArrayList<Song> songs = new ArrayList<>(
|
||||
PlaylistSongsLoader.getPlaylistSongList(this, id).blockingFirst());
|
||||
MusicPlayerRemote.openQueue(songs, position, true);
|
||||
handled = true;
|
||||
}
|
||||
} else if (MediaStore.Audio.Albums.CONTENT_TYPE.equals(mimeType)) {
|
||||
final int id = (int) parseIdFromIntent(intent, "albumId", "album");
|
||||
if (id >= 0) {
|
||||
int position = intent.getIntExtra("position", 0);
|
||||
MusicPlayerRemote
|
||||
.openQueue(AlbumLoader.getAlbum(this, id).blockingFirst().songs, position, true);
|
||||
handled = true;
|
||||
}
|
||||
} else if (MediaStore.Audio.Artists.CONTENT_TYPE.equals(mimeType)) {
|
||||
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);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
if (handled) {
|
||||
setIntent(new Intent());
|
||||
}
|
||||
}
|
||||
|
||||
private long parseIdFromIntent(@NonNull Intent intent, String longKey, String stringKey) {
|
||||
long id = intent.getLongExtra(longKey, -1);
|
||||
if (id < 0) {
|
||||
String idString = intent.getStringExtra(stringKey);
|
||||
if (idString != null) {
|
||||
try {
|
||||
id = Long.parseLong(idString);
|
||||
} catch (NumberFormatException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
switch (requestCode) {
|
||||
case APP_INTRO_REQUEST:
|
||||
blockRequestPermissions = false;
|
||||
if (!hasPermissions()) {
|
||||
requestPermissions();
|
||||
}
|
||||
|
||||
break;
|
||||
case REQUEST_CODE_THEME:
|
||||
case APP_USER_INFO_REQUEST:
|
||||
postRecreate();
|
||||
break;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
disposable.clear();
|
||||
if (broadcastReceiver == null) {
|
||||
return;
|
||||
}
|
||||
unregisterReceiver(broadcastReceiver);
|
||||
PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleBackPress() {
|
||||
return super.handleBackPress() || (currentFragment != null &&
|
||||
currentFragment.handleBackPress());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceConnected() {
|
||||
super.onServiceConnected();
|
||||
handlePlaybackIntent(getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void requestPermissions() {
|
||||
if (!blockRequestPermissions) {
|
||||
super.requestPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentFragment(@Nullable Fragment fragment, boolean isStackAdd) {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
||||
fragmentTransaction.replace(R.id.fragment_container, fragment, TAG);
|
||||
if (isStackAdd) {
|
||||
fragmentTransaction.addToBackStack(TAG);
|
||||
}
|
||||
fragmentTransaction.commit();
|
||||
currentFragment = (MainActivityFragmentCallbacks) fragment;
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
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) ||
|
||||
key.equals(PreferenceUtil.BANNER_IMAGE_PATH) ||
|
||||
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.ALBUM_GRID_STYLE) ||
|
||||
key.equals(PreferenceUtil.ARTIST_GRID_STYLE)) {
|
||||
postRecreate();
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreCurrentFragment() {
|
||||
currentFragment = (MainActivityFragmentCallbacks) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.fragment_container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
PreferenceUtil.getInstance(this).setLastPage(item.getItemId());
|
||||
disposable.add(Observable.just(item.getItemId())
|
||||
.throttleFirst(3, TimeUnit.SECONDS)
|
||||
.subscribe(this::setCurrentFragment));
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setCurrentFragment(int menuItem) {
|
||||
switch (menuItem) {
|
||||
case R.id.action_song:
|
||||
case R.id.action_album:
|
||||
case R.id.action_artist:
|
||||
case R.id.action_playlist:
|
||||
setCurrentFragment(LibraryFragment.newInstance(menuItem), false);
|
||||
break;
|
||||
default:
|
||||
case R.id.action_home:
|
||||
setCurrentFragment(HomeFragment.newInstance(), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void handlePlaybackIntent(@Nullable Intent intent) {
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = intent.getData();
|
||||
String mimeType = intent.getType();
|
||||
boolean handled = false;
|
||||
|
||||
if (intent.getAction() != null && intent.getAction()
|
||||
.equals(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH)) {
|
||||
final ArrayList<Song> songs = SearchQueryHelper.getSongs(this, intent.getExtras());
|
||||
|
||||
if (MusicPlayerRemote.getShuffleMode() == MusicService.SHUFFLE_MODE_SHUFFLE) {
|
||||
MusicPlayerRemote.openAndShuffleQueue(songs, true);
|
||||
} else {
|
||||
MusicPlayerRemote.openQueue(songs, 0, true);
|
||||
}
|
||||
handled = true;
|
||||
}
|
||||
|
||||
if (uri != null && uri.toString().length() > 0) {
|
||||
MusicPlayerRemote.playFromUri(uri);
|
||||
handled = true;
|
||||
} else if (MediaStore.Audio.Playlists.CONTENT_TYPE.equals(mimeType)) {
|
||||
final int id = (int) parseIdFromIntent(intent, "playlistId", "playlist");
|
||||
if (id >= 0) {
|
||||
int position = intent.getIntExtra("position", 0);
|
||||
ArrayList<Song> songs = new ArrayList<>(
|
||||
PlaylistSongsLoader.getPlaylistSongList(this, id).blockingFirst());
|
||||
MusicPlayerRemote.openQueue(songs, position, true);
|
||||
handled = true;
|
||||
}
|
||||
} else if (MediaStore.Audio.Albums.CONTENT_TYPE.equals(mimeType)) {
|
||||
final int id = (int) parseIdFromIntent(intent, "albumId", "album");
|
||||
if (id >= 0) {
|
||||
int position = intent.getIntExtra("position", 0);
|
||||
MusicPlayerRemote
|
||||
.openQueue(AlbumLoader.getAlbum(this, id).blockingFirst().songs, position, true);
|
||||
handled = true;
|
||||
}
|
||||
} else if (MediaStore.Audio.Artists.CONTENT_TYPE.equals(mimeType)) {
|
||||
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);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
if (handled) {
|
||||
setIntent(new Intent());
|
||||
}
|
||||
}
|
||||
|
||||
private long parseIdFromIntent(@NonNull Intent intent, String longKey, String stringKey) {
|
||||
long id = intent.getLongExtra(longKey, -1);
|
||||
if (id < 0) {
|
||||
String idString = intent.getStringExtra(stringKey);
|
||||
if (idString != null) {
|
||||
try {
|
||||
id = Long.parseLong(idString);
|
||||
} catch (NumberFormatException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
switch (requestCode) {
|
||||
case APP_INTRO_REQUEST:
|
||||
blockRequestPermissions = false;
|
||||
if (!hasPermissions()) {
|
||||
requestPermissions();
|
||||
}
|
||||
|
||||
break;
|
||||
case REQUEST_CODE_THEME:
|
||||
case APP_USER_INFO_REQUEST:
|
||||
postRecreate();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleBackPress() {
|
||||
return super.handleBackPress() || (currentFragment != null &&
|
||||
currentFragment.handleBackPress());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceConnected() {
|
||||
super.onServiceConnected();
|
||||
handlePlaybackIntent(getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void requestPermissions() {
|
||||
if (!blockRequestPermissions) {
|
||||
super.requestPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@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) ||
|
||||
key.equals(PreferenceUtil.CAROUSEL_EFFECT) ||
|
||||
key.equals(PreferenceUtil.NOW_PLAYING_SCREEN_ID) ||
|
||||
key.equals(PreferenceUtil.TOGGLE_GENRE) ||
|
||||
key.equals(PreferenceUtil.BANNER_IMAGE_PATH) ||
|
||||
key.equals(PreferenceUtil.PROFILE_IMAGE_PATH) ||
|
||||
key.equals(PreferenceUtil.CIRCULAR_ALBUM_ART) ||
|
||||
key.equals(PreferenceUtil.KEEP_SCREEN_ON) ||
|
||||
key.equals(PreferenceUtil.TOGGLE_SEPARATE_LINE)) {
|
||||
postRecreate();
|
||||
}
|
||||
}
|
||||
|
||||
private void showPromotionalOffer() {
|
||||
new MaterialDialog.Builder(this)
|
||||
.positiveText("Buy")
|
||||
.onPositive((dialog, which) ->
|
||||
startActivity(new Intent(MainActivity.this, ProVersionActivity.class)))
|
||||
.negativeText(android.R.string.cancel)
|
||||
.customView(R.layout.dialog_promotional_offer, false)
|
||||
.dismissListener(dialog -> {
|
||||
PreferenceManager.getDefaultSharedPreferences(MainActivity.this)
|
||||
.edit()
|
||||
.putBoolean("shown", true)
|
||||
.apply();
|
||||
})
|
||||
.show();
|
||||
}
|
||||
private void showPromotionalOffer() {
|
||||
new MaterialDialog.Builder(this)
|
||||
.positiveText("Buy")
|
||||
.onPositive((dialog, which) ->
|
||||
startActivity(new Intent(MainActivity.this, ProVersionActivity.class)))
|
||||
.negativeText(android.R.string.cancel)
|
||||
.customView(R.layout.dialog_promotional_offer, false)
|
||||
.dismissListener(dialog -> {
|
||||
PreferenceManager.getDefaultSharedPreferences(MainActivity.this)
|
||||
.edit()
|
||||
.putBoolean("shown", true)
|
||||
.apply();
|
||||
})
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,353 +55,357 @@ 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)
|
||||
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.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;
|
||||
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.image)
|
||||
ImageView imageView;
|
||||
@BindView(R.id.user_image)
|
||||
CircularImageView userImage;
|
||||
@BindView(R.id.collapsing_toolbar)
|
||||
CollapsingToolbarLayout toolbarLayout;
|
||||
@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 HomeFragment newInstance() {
|
||||
Bundle args = new Bundle();
|
||||
HomeFragment fragment = new HomeFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
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();
|
||||
//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_home, container, false);
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
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 = ContextCompat.getColor(getContext(), R.color.md_white_1000);
|
||||
break;
|
||||
}
|
||||
String day = images[new Random().nextInt(images.length)];
|
||||
loadTimeImage(day);
|
||||
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<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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
//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_home, container, false);
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
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 = ContextCompat.getColor(getContext(), R.color.md_white_1000);
|
||||
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<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();
|
||||
}
|
||||
@Override
|
||||
public void onPlayingMetaChanged() {
|
||||
super.onPlayingMetaChanged();
|
||||
homePresenter.loadRecentArtists();
|
||||
homePresenter.loadRecentAlbums();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -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