v2.10
This commit is contained in:
parent
3d7ba2afc6
commit
08e00b89c5
341 changed files with 7612 additions and 6811 deletions
|
@ -1,16 +1,18 @@
|
|||
package code.name.monkey.retromusic.dialogs;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
@ -22,8 +24,6 @@ import code.name.monkey.retromusic.model.Song;
|
|||
import code.name.monkey.retromusic.ui.adapter.playlist.AddToPlaylist;
|
||||
import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid), Aidan Follestad (afollestad)
|
||||
*/
|
||||
|
@ -35,8 +35,6 @@ public class AddToPlaylistDialog extends RoundedBottomSheetDialogFragment {
|
|||
@BindView(R.id.title)
|
||||
TextView title;
|
||||
|
||||
ArrayList<Playlist> playlists;
|
||||
|
||||
@NonNull
|
||||
public static AddToPlaylistDialog create(Song song) {
|
||||
ArrayList<Song> list = new ArrayList<>();
|
||||
|
@ -75,14 +73,10 @@ public class AddToPlaylistDialog extends RoundedBottomSheetDialogFragment {
|
|||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
final ArrayList<Song> songs = getArguments().getParcelableArrayList("songs");
|
||||
playlists = PlaylistLoader.getAllPlaylists(getActivity()).blockingFirst();
|
||||
|
||||
AddToPlaylist playlistAdapter = new AddToPlaylist(getActivity(), playlists,
|
||||
R.layout.item_playlist, songs, getDialog());
|
||||
|
||||
final ArrayList<Playlist> playlists = PlaylistLoader.getAllPlaylists(getActivity()).blockingFirst();
|
||||
final AddToPlaylist playlistAdapter = new AddToPlaylist(getActivity(), playlists, R.layout.item_playlist, songs, getDialog());
|
||||
playlist.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
playlist.setItemAnimator(new DefaultItemAnimator());
|
||||
playlist.setAdapter(playlistAdapter);
|
||||
|
|
|
@ -26,7 +26,7 @@ import code.name.monkey.retromusic.R;
|
|||
*/
|
||||
public class BlacklistFolderChooserDialog extends DialogFragment implements MaterialDialog.ListCallback {
|
||||
|
||||
String initialPath = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
private String initialPath = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
private File parentFolder;
|
||||
private File[] parentContents;
|
||||
private boolean canGoUp = false;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
package code.name.monkey.retromusic.dialogs;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import com.afollestad.materialdialogs.internal.ThemeSingleton;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Objects;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment;
public class ChangelogDialog extends RoundedBottomSheetDialogFragment {
@BindView(R.id.web_view)
WebView webView;
public static ChangelogDialog create() {
return new ChangelogDialog();
}
private static void setChangelogRead(@NonNull Context context) {
try {
PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
int currentVersion = pInfo.versionCode;
PreferenceUtil.getInstance(context).setLastChangeLogVersion(currentVersion);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
private static String colorToHex(int color) {
return Integer.toHexString(color).substring(2);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.dialog_changelog, container, false);
ButterKnife.bind(this, layout);
return layout;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
try {
// Load from phonograph-changelog.html in the assets folder
StringBuilder buf = new StringBuilder();
InputStream json = Objects.requireNonNull(getActivity()).getAssets().open
("retro-changelog.html");
BufferedReader in = new BufferedReader(new InputStreamReader(json, "UTF-8"));
String str;
while ((str = in.readLine()) != null)
buf.append(str);
in.close();
// Inject color values for WebView body background and links
final String backgroundColor = colorToHex(ATHUtil.resolveColor(getActivity(), R.attr.md_background_color, Color.parseColor(ThemeSingleton.get().darkTheme ? "#424242" : "#ffffff")));
final String contentColor = ThemeSingleton.get().darkTheme ? "#ffffff" : "#000000";
webView.loadData(buf.toString()
.replace("{style-placeholder}",
String.format("body { background-color: %s; color: %s; }", backgroundColor, contentColor))
.replace("{link-color}", colorToHex(ThemeSingleton.get().positiveColor.getDefaultColor()))
.replace("{link-color-active}", colorToHex(ColorUtil.lightenColor(ThemeSingleton.get().positiveColor.getDefaultColor())))
, "text/html", "UTF-8");
} catch (Throwable e) {
webView.loadData("<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8");
}
setChangelogRead(getActivity());
}
}
|
|
@ -2,13 +2,13 @@ package code.name.monkey.retromusic.dialogs;
|
|||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import android.text.Html;
|
||||
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.model.Song;
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil;
|
||||
|
@ -80,18 +81,18 @@ public class CreatePlaylistDialog extends RoundedBottomSheetDialogFragment {
|
|||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
int accentColor = ThemeStore.accentColor(Objects.requireNonNull(getContext()));
|
||||
actionCreate.setBackgroundTintList(ColorStateList.valueOf(accentColor));
|
||||
actionCancel.setStrokeColor(ColorStateList.valueOf(accentColor));
|
||||
actionCancel.setTextColor(accentColor);
|
||||
|
||||
MaterialUtil.setTint(actionCreate, true);
|
||||
|
||||
MaterialUtil.setTint(actionCancel, false);
|
||||
|
||||
MaterialUtil.setTint(textInputLayout, true);
|
||||
|
||||
textInputLayout.setBoxStrokeColor(accentColor);
|
||||
textInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(accentColor));
|
||||
|
||||
playlistName.setHintTextColor(ColorStateList.valueOf(accentColor));
|
||||
playlistName.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
|
||||
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
}
|
||||
|
||||
@OnClick({R.id.action_cancel, R.id.action_create})
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package code.name.monkey.retromusic.dialogs;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -11,7 +10,6 @@ import android.widget.TextView;
|
|||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
@ -19,6 +17,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.model.Playlist;
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil;
|
||||
|
@ -78,21 +77,10 @@ public class DeletePlaylistDialog extends RoundedBottomSheetDialogFragment {
|
|||
this.title.setText(content);
|
||||
this.title.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
|
||||
|
||||
actionDelete.setText(R.string.action_delete);
|
||||
|
||||
int accentColor = ThemeStore.accentColor(Objects.requireNonNull(getContext()));
|
||||
actionDelete.setIconTint(ColorStateList.valueOf(accentColor));
|
||||
actionCancel.setIconTint(ColorStateList.valueOf(accentColor));
|
||||
|
||||
int iconColor = ThemeStore.textColorSecondary(getContext());
|
||||
actionDelete.setStrokeColor(ColorStateList.valueOf(iconColor));
|
||||
actionCancel.setStrokeColor(ColorStateList.valueOf(iconColor));
|
||||
|
||||
|
||||
int textColor = ThemeStore.textColorPrimary(getContext());
|
||||
actionDelete.setTextColor(ColorStateList.valueOf(textColor));
|
||||
actionCancel.setTextColor(ColorStateList.valueOf(textColor));
|
||||
MaterialUtil.setTint(actionDelete, true);
|
||||
MaterialUtil.setTint(actionCancel, false);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package code.name.monkey.retromusic.dialogs;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -11,7 +10,6 @@ import android.widget.TextView;
|
|||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
@ -19,6 +17,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.model.Song;
|
||||
import code.name.monkey.retromusic.util.MusicUtil;
|
||||
|
@ -72,12 +71,9 @@ public class DeleteSongsDialog extends RoundedBottomSheetDialogFragment {
|
|||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
int accentColor = ThemeStore.accentColor(Objects.requireNonNull(getContext()));
|
||||
actionDelete.setBackgroundTintList(ColorStateList.valueOf(accentColor));
|
||||
actionCancel.setStrokeColor(ColorStateList.valueOf(accentColor));
|
||||
actionCancel.setTextColor(accentColor);
|
||||
MaterialUtil.setTint(actionDelete, true);
|
||||
MaterialUtil.setTint(actionCancel, false);
|
||||
|
||||
//noinspection unchecked,ConstantConditions
|
||||
final ArrayList<Song> songs = getArguments().getParcelableArrayList("songs");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package code.name.monkey.retromusic.dialogs;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -9,10 +10,15 @@ import android.widget.TextView;
|
|||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import butterknife.BindView;
|
||||
import butterknife.BindViews;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
@ -21,8 +27,16 @@ import code.name.monkey.retromusic.R;
|
|||
import code.name.monkey.retromusic.RetroApplication;
|
||||
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;
|
||||
import code.name.monkey.retromusic.views.CircularImageView;
|
||||
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;
|
||||
|
||||
public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDialogFragment {
|
||||
|
||||
|
@ -30,10 +44,20 @@ public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDial
|
|||
private static ButterKnife.Setter<TextView, Integer> textColor = (view, value, index) -> view.setTextColor(ColorStateList.valueOf(value));
|
||||
|
||||
|
||||
@BindViews({R.id.action_folders, R.id.action_settings, R.id.action_about, R.id.action_buy_pro, R.id.action_rate,
|
||||
@BindViews({R.id.action_folders, R.id.action_about, R.id.action_buy_pro, R.id.action_rate,
|
||||
R.id.action_sleep_timer})
|
||||
List<MaterialButton> materialButtons;
|
||||
|
||||
@BindView(R.id.user_image_bottom)
|
||||
CircularImageView userImageBottom;
|
||||
|
||||
@BindView(R.id.title_welcome)
|
||||
AppCompatTextView titleWelcome;
|
||||
|
||||
@BindView(R.id.text)
|
||||
AppCompatTextView text;
|
||||
|
||||
private CompositeDisposable disposable = new CompositeDisposable();
|
||||
|
||||
public static MainOptionsBottomSheetDialogFragment newInstance(int selected_id) {
|
||||
Bundle bundle = new Bundle();
|
||||
|
@ -47,6 +71,11 @@ public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDial
|
|||
return new MainOptionsBottomSheetDialogFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
disposable.clear();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
@ -61,10 +90,13 @@ public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDial
|
|||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
text.setTextColor(ThemeStore.textColorSecondary(getContext()));
|
||||
titleWelcome.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
titleWelcome.setText(String.format("%s %s!", getTimeOfTheDay(), PreferenceUtil.getInstance().getUserName()));
|
||||
loadImageFromStorage();
|
||||
}
|
||||
|
||||
@OnClick({R.id.action_folders, R.id.action_settings, R.id.action_sleep_timer, R.id.action_rate,
|
||||
@OnClick({R.id.action_folders, R.id.user_info_container, R.id.action_settings, R.id.action_sleep_timer, R.id.action_rate,
|
||||
R.id.action_buy_pro, R.id.action_about})
|
||||
void onClick(View view) {
|
||||
MainActivity mainActivity = (MainActivity) getActivity();
|
||||
|
@ -89,6 +121,9 @@ public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDial
|
|||
new SleepTimerDialog().show(getFragmentManager(), TAG);
|
||||
}
|
||||
break;
|
||||
case R.id.user_info_container:
|
||||
NavigationUtil.goToUserInfo(getActivity());
|
||||
break;
|
||||
case R.id.action_rate:
|
||||
NavigationUtil.goToPlayStore(mainActivity);
|
||||
break;
|
||||
|
@ -96,5 +131,38 @@ public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDial
|
|||
dismiss();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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().getProfileImage(), USER_PROFILE))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(userImageBottom::setImageBitmap,
|
||||
throwable -> userImageBottom.setImageDrawable(ContextCompat
|
||||
.getDrawable(getContext(), R.drawable.ic_person_flat))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package code.name.monkey.retromusic.dialogs;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import android.text.Html;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -12,9 +9,12 @@ import android.widget.TextView;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.model.PlaylistSong;
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil;
|
||||
|
@ -76,7 +76,7 @@ public class RemoveFromPlaylistDialog extends RoundedBottomSheetDialogFragment {
|
|||
final ArrayList<PlaylistSong> songs = getArguments().getParcelableArrayList("songs");
|
||||
int title;
|
||||
CharSequence content;
|
||||
if (songs.size() > 1) {
|
||||
if (songs != null && songs.size() > 1) {
|
||||
title = R.string.remove_songs_from_playlist_title;
|
||||
content = Html.fromHtml(getString(R.string.remove_x_songs_from_playlist, songs.size()));
|
||||
} else {
|
||||
|
@ -85,5 +85,9 @@ public class RemoveFromPlaylistDialog extends RoundedBottomSheetDialogFragment {
|
|||
}
|
||||
this.remove.setText(content);
|
||||
this.title.setText(title);
|
||||
|
||||
this.title.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
this.remove.setTextColor(ThemeStore.textColorSecondary(getContext()));
|
||||
this.cancel.setTextColor(ThemeStore.textColorSecondary(getContext()));
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.util.PlaylistsUtil;
|
||||
import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment;
|
||||
|
@ -79,17 +80,13 @@ public class RenamePlaylistDialog extends RoundedBottomSheetDialogFragment {
|
|||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
int accentColor = ThemeStore.accentColor(Objects.requireNonNull(getContext()));
|
||||
rename.setBackgroundTintList(ColorStateList.valueOf(accentColor));
|
||||
actionCancel.setStrokeColor(ColorStateList.valueOf(accentColor));
|
||||
actionCancel.setTextColor(accentColor);
|
||||
MaterialUtil.setTint(rename,true);
|
||||
MaterialUtil.setTint(actionCancel,false);
|
||||
MaterialUtil.setTint(textInputLayout,false);
|
||||
|
||||
playlistName.setHintTextColor(ColorStateList.valueOf(accentColor));
|
||||
|
||||
textInputLayout.setBoxStrokeColor(accentColor);
|
||||
textInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(accentColor));
|
||||
|
||||
playlistName.setHintTextColor(accentColor);
|
||||
|
||||
playlistName.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
|
||||
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
|
||||
long playlistId = 0;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,6 @@ import android.app.PendingIntent;
|
|||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.ClipDrawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
|
@ -20,10 +19,8 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
@ -31,6 +28,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.MaterialUtil;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.service.MusicService;
|
||||
import code.name.monkey.retromusic.util.MusicUtil;
|
||||
|
@ -89,17 +87,15 @@ public class SleepTimerDialog extends RoundedBottomSheetDialogFragment {
|
|||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
int accentColor = ThemeStore.accentColor(Objects.requireNonNull(getContext()));
|
||||
setButton.setBackgroundTintList(ColorStateList.valueOf(accentColor));
|
||||
cancelButton.setStrokeColor(ColorStateList.valueOf(accentColor));
|
||||
cancelButton.setTextColor(accentColor);
|
||||
MaterialUtil.setTint(setButton, true);
|
||||
MaterialUtil.setTint(cancelButton, false);
|
||||
|
||||
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
timerDisplay.setTextColor(ThemeStore.textColorSecondary(getContext()));
|
||||
|
||||
timerUpdater = new TimerUpdater();
|
||||
|
||||
seekArcProgress = PreferenceUtil.getInstance(getActivity()).getLastSleepTimerValue();
|
||||
seekArcProgress = PreferenceUtil.getInstance().getLastSleepTimerValue();
|
||||
updateTimeDisplayTime();
|
||||
seekArc.setProgress(seekArcProgress);
|
||||
setProgressBarColor(ThemeStore.accentColor(getContext()));
|
||||
|
@ -122,7 +118,7 @@ public class SleepTimerDialog extends RoundedBottomSheetDialogFragment {
|
|||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
PreferenceUtil.getInstance(getActivity()).setLastSleepTimerValue(seekArcProgress);
|
||||
PreferenceUtil.getInstance().setLastSleepTimerValue(seekArcProgress);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -151,7 +147,7 @@ public class SleepTimerDialog extends RoundedBottomSheetDialogFragment {
|
|||
final int minutes = seekArcProgress;
|
||||
PendingIntent pi = makeTimerPendingIntent(PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
final long nextSleepTimerElapsedTime = SystemClock.elapsedRealtime() + minutes * 60 * 1000;
|
||||
PreferenceUtil.getInstance(getActivity()).setNextSleepTimerElapsedRealtime(nextSleepTimerElapsedTime);
|
||||
PreferenceUtil.getInstance().setNextSleepTimerElapsedRealtime(nextSleepTimerElapsedTime);
|
||||
AlarmManager am = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE);
|
||||
if (am != null) {
|
||||
am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextSleepTimerElapsedTime, pi);
|
||||
|
@ -178,7 +174,7 @@ public class SleepTimerDialog extends RoundedBottomSheetDialogFragment {
|
|||
private class TimerUpdater extends CountDownTimer {
|
||||
TimerUpdater() {
|
||||
//noinspection ConstantConditions
|
||||
super(PreferenceUtil.getInstance(getActivity()).getNextSleepTimerElapsedRealTime() - SystemClock.elapsedRealtime(), 1000);
|
||||
super(PreferenceUtil.getInstance().getNextSleepTimerElapsedRealTime() - SystemClock.elapsedRealtime(), 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,17 +3,17 @@ package code.name.monkey.retromusic.dialogs;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.model.Song;
|
||||
import code.name.monkey.retromusic.util.MusicUtil;
|
||||
|
@ -21,8 +21,12 @@ import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment;
|
|||
|
||||
|
||||
public class SongShareDialog extends RoundedBottomSheetDialogFragment {
|
||||
@BindView(R.id.option_1)
|
||||
TextView audioFile;
|
||||
@BindView(R.id.option_2)
|
||||
TextView currentSong;
|
||||
TextView audioText;
|
||||
@BindView(R.id.title)
|
||||
TextView title;
|
||||
|
||||
@NonNull
|
||||
public static SongShareDialog create(final Song song) {
|
||||
|
@ -46,7 +50,11 @@ public class SongShareDialog extends RoundedBottomSheetDialogFragment {
|
|||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
final Song song = getArguments().getParcelable("song");
|
||||
currentSong.setText(getString(R.string.currently_listening_to_x_by_x, song.title, song.artistName));
|
||||
|
||||
audioFile.setText(getString(R.string.currently_listening_to_x_by_x, song.title, song.artistName));
|
||||
audioFile.setTextColor(ThemeStore.textColorSecondary(getContext()));
|
||||
audioText.setTextColor(ThemeStore.textColorSecondary(getContext()));
|
||||
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
|
||||
}
|
||||
|
||||
@OnClick({R.id.option_2, R.id.option_1})
|
||||
|
@ -55,15 +63,13 @@ public class SongShareDialog extends RoundedBottomSheetDialogFragment {
|
|||
final String currentlyListening = getString(R.string.currently_listening_to_x_by_x, song.title, song.artistName);
|
||||
switch (view.getId()) {
|
||||
case R.id.option_1:
|
||||
startActivity(
|
||||
Intent.createChooser(
|
||||
MusicUtil.createShareSongFileIntent(song, getContext()), null));
|
||||
startActivity(Intent.createChooser(
|
||||
MusicUtil.createShareSongFileIntent(song, getContext()), null));
|
||||
break;
|
||||
case R.id.option_2:
|
||||
getActivity().startActivity(Intent.createChooser(
|
||||
new Intent().setAction(Intent.ACTION_SEND)
|
||||
.putExtra(Intent.EXTRA_TEXT, currentlyListening)
|
||||
.setType("text/plain"), null));
|
||||
getActivity().startActivity(Intent.createChooser(new Intent().setAction(Intent.ACTION_SEND)
|
||||
.putExtra(Intent.EXTRA_TEXT, currentlyListening)
|
||||
.setType("text/plain"), null));
|
||||
break;
|
||||
}
|
||||
dismiss();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue