Added native image loader support for artist images. Automatically recreate activity onrResume when colors changed fixes issues #2 and #39. Also Butterknife should be used now everywhere #40
This commit is contained in:
parent
9c8cba612b
commit
8bdaf08a30
29 changed files with 485 additions and 521 deletions
|
|
@ -54,6 +54,7 @@ public class AddToPlaylistDialog extends DialogFragment {
|
|||
public void onSelection(@NonNull MaterialDialog materialDialog, View view, int i, CharSequence charSequence) {
|
||||
//noinspection unchecked
|
||||
final ArrayList<Song> songs = (ArrayList<Song>) getArguments().getSerializable("songs");
|
||||
if (songs == null) return;
|
||||
if (i == 0) {
|
||||
materialDialog.dismiss();
|
||||
CreatePlaylistDialog.create(songs).show(getActivity().getSupportFragmentManager(), "ADD_TO_PLAYLIST");
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import android.widget.GridView;
|
|||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.util.ColorUtil;
|
||||
import com.kabouzeid.gramophone.views.ColorView;
|
||||
|
||||
/**
|
||||
|
|
@ -33,7 +34,6 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
|
|||
|
||||
private ColorCallback mCallback;
|
||||
private int[] mColors;
|
||||
@Nullable
|
||||
private GridView mGrid;
|
||||
|
||||
@Override
|
||||
|
|
@ -149,7 +149,7 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
|
|||
new int[]{android.R.attr.state_pressed}
|
||||
};
|
||||
int[] colors = new int[]{
|
||||
shiftColorDown(mColors[position])
|
||||
ColorUtil.shiftColorDown(mColors[position])
|
||||
};
|
||||
ColorStateList rippleColors = new ColorStateList(states, colors);
|
||||
colorView.setForeground(new RippleDrawable(rippleColors, selector, null));
|
||||
|
|
@ -167,14 +167,6 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("ResourceType")
|
||||
private static int shiftColorDown(int color) {
|
||||
float[] hsv = new float[3];
|
||||
Color.colorToHSV(color, hsv);
|
||||
hsv[2] *= 0.9f; // value component
|
||||
return Color.HSVToColor(hsv);
|
||||
}
|
||||
|
||||
private static int translucentColor(int color) {
|
||||
final float factor = 0.7f;
|
||||
int alpha = Math.round(Color.alpha(color) * factor);
|
||||
|
|
@ -187,7 +179,7 @@ public class ColorChooserDialog extends DialogFragment implements View.OnClickLi
|
|||
@NonNull
|
||||
private static Drawable createSelector(int color) {
|
||||
ShapeDrawable darkerCircle = new ShapeDrawable(new OvalShape());
|
||||
darkerCircle.getPaint().setColor(translucentColor(shiftColorDown(color)));
|
||||
darkerCircle.getPaint().setColor(translucentColor(ColorUtil.shiftColorDown(color)));
|
||||
StateListDrawable stateListDrawable = new StateListDrawable();
|
||||
stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, darkerCircle);
|
||||
return stateListDrawable;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue