code refactor

main
h4h13 2018-08-05 22:05:59 +05:30
parent 8d9fb4c0df
commit 4aa0ccc283
37 changed files with 1939 additions and 2476 deletions

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="RetroMusicPlayer" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="imageWizard">
<value>
<PersistentState />
</value>
</entry>
</map>
</option>
</component>
</project>

View File

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="Gradle: __local_aars__:/Users/hemanths/Desktop/KeepSafe/RetroMusicPlayer/app/libs/jsoup-1.11.2.jar:unspecified@jar">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/libs/jsoup-1.11.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="Gradle: com.mpatric:mp3agic:0.8.3@jar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.mpatric/mp3agic/0.8.3/ddbccc4219ef1bd38f7f6ed6fa0a5374159f9b9f/mp3agic-0.8.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.mpatric/mp3agic/0.8.3/bfd1267d2d5bdf5fa8ce9a4197cdfc0ed9bc5205/mp3agic-0.8.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,14 +0,0 @@
<component name="libraryTable">
<library name="Gradle: jp.wasabeef:glide-transformations-2.0.2">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/glide-transformations-2.0.2.aar/a8e2dae52526ebad94e3e6c842f0daec/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/glide-transformations-2.0.2.aar/a8e2dae52526ebad94e3e6c842f0daec/jars/classes.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/jp.wasabeef/glide-transformations/2.0.2/d77158225e8aff098f2269c5b42cebb8cd1ebc6f/glide-transformations-2.0.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/jp.wasabeef/glide-transformations/2.0.2/87061eb6c96686339ab1a2d30dbd77c247486014/glide-transformations-2.0.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -5,25 +5,32 @@
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables"> <option name="myNullables">
<value> <value>
<list size="5"> <list size="6">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" /> <item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> <item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> <item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
</list> </list>
</value> </value>
</option> </option>
<option name="myNotNulls"> <option name="myNotNulls">
<value> <value>
<list size="4"> <list size="5">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
</list> </list>
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8 (4)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project> </project>

View File

@ -2,7 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/RetroMusicPlayer.iml" filepath="$PROJECT_DIR$/.idea/RetroMusicPlayer.iml" /> <module fileurl="file://$PROJECT_DIR$/RetroMusicPlayer.iml" filepath="$PROJECT_DIR$/RetroMusicPlayer.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/appthemehelper/appthemehelper.iml" filepath="$PROJECT_DIR$/appthemehelper/appthemehelper.iml" /> <module fileurl="file://$PROJECT_DIR$/appthemehelper/appthemehelper.iml" filepath="$PROJECT_DIR$/appthemehelper/appthemehelper.iml" />
</modules> </modules>

View File

@ -2,6 +2,5 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" /> <mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

View File

@ -13,7 +13,7 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" /> <excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="jdk" jdkName="1.8 (4)" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

View File

@ -130,6 +130,8 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-libraries" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/compatible_screen_manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
@ -141,11 +143,16 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/linked_res_for_bundle" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint_jar" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged-not-compiled-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/module_bundle" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/processed_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-rules" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
@ -159,7 +166,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 28 Platform (1)" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: com.android.support:support-v4-27.1.1" level="project" /> <orderEntry type="library" name="Gradle: com.android.support:support-v4-27.1.1" level="project" />
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:okhttp3-integration:1.5.0@jar" level="project" /> <orderEntry type="library" name="Gradle: com.github.bumptech.glide:okhttp3-integration:1.5.0@jar" level="project" />

View File

@ -11,8 +11,8 @@ android {
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic" applicationId "code.name.monkey.retromusic"
versionCode 206 versionCode 207
versionName 'R - 1.7.10' versionName '1.7.10'
multiDexEnabled true multiDexEnabled true

View File

@ -1,13 +0,0 @@
package code.name.monkey.retromusic.swipebtn;
import android.content.Context;
final class DimentionUtils {
private DimentionUtils() {
}
static float convertPixelsToSp(float px, Context context) {
return px / context.getResources().getDisplayMetrics().scaledDensity;
}
}

View File

@ -1,5 +0,0 @@
package code.name.monkey.retromusic.swipebtn;
public interface OnActiveListener {
void onActive();
}

View File

@ -1,5 +0,0 @@
package code.name.monkey.retromusic.swipebtn;
public interface OnStateChangeListener {
void onStateChange(boolean active);
}

View File

@ -1,486 +0,0 @@
package code.name.monkey.retromusic.swipebtn;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import code.name.monkey.retromusic.R;
public class SwipeButton extends RelativeLayout {
private static final int ENABLED = 0;
private static final int DISABLED = 1;
private ImageView swipeButtonInner;
private float initialX;
private boolean active;
private TextView centerText;
private ViewGroup background;
private Drawable disabledDrawable;
private Drawable enabledDrawable;
private OnStateChangeListener onStateChangeListener;
private OnActiveListener onActiveListener;
private int collapsedWidth;
private int collapsedHeight;
private LinearLayout layer;
private boolean trailEnabled = false;
private boolean hasActivationState;
public SwipeButton(Context context) {
super(context);
init(context, null, -1, -1);
}
public SwipeButton(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs, -1, -1);
}
public SwipeButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs, defStyleAttr, -1);
}
@TargetApi(21)
public SwipeButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init(context, attrs, defStyleAttr, defStyleRes);
}
public void setCenterTextColor(int color) {
if (centerText == null) {
return;
}
centerText.setTextColor(color);
}
public boolean isActive() {
return active;
}
public void setText(String text) {
centerText.setText(text);
}
public void setBackground(Drawable drawable) {
background.setBackground(drawable);
}
public ViewGroup getSwipeBackground() {
return background;
}
public void setSlidingButtonBackground(Drawable drawable) {
background.setBackground(drawable);
}
public void setDisabledDrawable(Drawable drawable) {
disabledDrawable = drawable;
if (!active) {
swipeButtonInner.setImageDrawable(drawable);
}
}
public void setButtonBackground(Drawable buttonBackground) {
if (buttonBackground != null) {
swipeButtonInner.setBackground(buttonBackground);
}
}
public void setEnabledDrawable(Drawable drawable) {
enabledDrawable = drawable;
if (active) {
swipeButtonInner.setImageDrawable(drawable);
}
}
public void setOnStateChangeListener(OnStateChangeListener onStateChangeListener) {
this.onStateChangeListener = onStateChangeListener;
}
public void setOnActiveListener(OnActiveListener onActiveListener) {
this.onActiveListener = onActiveListener;
}
public void setInnerTextPadding(int left, int top, int right, int bottom) {
centerText.setPadding(left, top, right, bottom);
}
public void setSwipeButtonPadding(int left, int top, int right, int bottom) {
swipeButtonInner.setPadding(left, top, right, bottom);
}
public void setHasActivationState(boolean hasActivationState) {
this.hasActivationState = hasActivationState;
}
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
hasActivationState = true;
background = new RelativeLayout(context);
LayoutParams layoutParamsView = new LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParamsView.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
addView(background, layoutParamsView);
final TextView centerText = new TextView(context);
this.centerText = centerText;
centerText.setGravity(Gravity.CENTER);
LayoutParams layoutParams = new LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
background.addView(centerText, layoutParams);
final ImageView swipeButton = new ImageView(context);
this.swipeButtonInner = swipeButton;
if (attrs != null && defStyleAttr == -1 && defStyleRes == -1) {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.SwipeButton,
defStyleAttr, defStyleRes);
collapsedWidth = (int) typedArray.getDimension(R.styleable.SwipeButton_button_image_width,
ViewGroup.LayoutParams.WRAP_CONTENT);
collapsedHeight = (int) typedArray.getDimension(R.styleable.SwipeButton_button_image_height,
ViewGroup.LayoutParams.WRAP_CONTENT);
trailEnabled = typedArray.getBoolean(R.styleable.SwipeButton_button_trail_enabled,
false);
Drawable trailingDrawable = typedArray.getDrawable(R.styleable.SwipeButton_button_trail_drawable);
Drawable backgroundDrawable = typedArray.getDrawable(R.styleable.SwipeButton_inner_text_background);
if (backgroundDrawable != null) {
background.setBackground(backgroundDrawable);
} else {
background.setBackground(ContextCompat.getDrawable(context, R.drawable.shape_rounded_edit));
}
if (trailEnabled) {
layer = new LinearLayout(context);
if (trailingDrawable != null) {
layer.setBackground(trailingDrawable);
} else {
layer.setBackground(typedArray.getDrawable(R.styleable.SwipeButton_button_background));
}
layer.setGravity(Gravity.START);
layer.setVisibility(View.GONE);
background.addView(layer, layoutParamsView);
}
centerText.setText(typedArray.getText(R.styleable.SwipeButton_inner_text));
centerText.setTextColor(typedArray.getColor(R.styleable.SwipeButton_inner_text_color,
Color.WHITE));
float textSize = DimentionUtils.convertPixelsToSp(
typedArray.getDimension(R.styleable.SwipeButton_inner_text_size, 0), context);
if (textSize != 0) {
centerText.setTextSize(textSize);
} else {
centerText.setTextSize(12);
}
disabledDrawable = typedArray.getDrawable(R.styleable.SwipeButton_button_image_disabled);
enabledDrawable = typedArray.getDrawable(R.styleable.SwipeButton_button_image_enabled);
float innerTextLeftPadding = typedArray.getDimension(
R.styleable.SwipeButton_inner_text_left_padding, 0);
float innerTextTopPadding = typedArray.getDimension(
R.styleable.SwipeButton_inner_text_top_padding, 0);
float innerTextRightPadding = typedArray.getDimension(
R.styleable.SwipeButton_inner_text_right_padding, 0);
float innerTextBottomPadding = typedArray.getDimension(
R.styleable.SwipeButton_inner_text_bottom_padding, 0);
int initialState = typedArray.getInt(R.styleable.SwipeButton_initial_state, DISABLED);
if (initialState == ENABLED) {
LayoutParams layoutParamsButton = new LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParamsButton.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
layoutParamsButton.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
swipeButton.setImageDrawable(enabledDrawable);
addView(swipeButton, layoutParamsButton);
active = true;
} else {
LayoutParams layoutParamsButton = new LayoutParams(collapsedWidth, collapsedHeight);
layoutParamsButton.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
layoutParamsButton.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
swipeButton.setImageDrawable(disabledDrawable);
addView(swipeButton, layoutParamsButton);
active = false;
}
centerText.setPadding((int) innerTextLeftPadding,
(int) innerTextTopPadding,
(int) innerTextRightPadding,
(int) innerTextBottomPadding);
Drawable buttonBackground = typedArray.getDrawable(R.styleable.SwipeButton_button_background);
if (buttonBackground != null) {
swipeButton.setBackground(buttonBackground);
} else {
swipeButton.setBackground(ContextCompat.getDrawable(context, R.drawable.shape_rounded_edit));
}
float buttonLeftPadding = typedArray.getDimension(
R.styleable.SwipeButton_button_left_padding, 0);
float buttonTopPadding = typedArray.getDimension(
R.styleable.SwipeButton_button_top_padding, 0);
float buttonRightPadding = typedArray.getDimension(
R.styleable.SwipeButton_button_right_padding, 0);
float buttonBottomPadding = typedArray.getDimension(
R.styleable.SwipeButton_button_bottom_padding, 0);
swipeButton.setPadding((int) buttonLeftPadding,
(int) buttonTopPadding,
(int) buttonRightPadding,
(int) buttonBottomPadding);
hasActivationState = typedArray.getBoolean(R.styleable.SwipeButton_has_activate_state, true);
typedArray.recycle();
}
setOnTouchListener(getButtonTouchListener());
}
private OnTouchListener getButtonTouchListener() {
return new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
return !TouchUtils.isTouchOutsideInitialPosition(event, swipeButtonInner);
case MotionEvent.ACTION_MOVE:
if (initialX == 0) {
initialX = swipeButtonInner.getX();
}
if (event.getX() > swipeButtonInner.getWidth() / 2 &&
event.getX() + swipeButtonInner.getWidth() / 2 < getWidth()) {
swipeButtonInner.setX(event.getX() - swipeButtonInner.getWidth() / 2);
centerText.setAlpha(1 - 1.3f * (swipeButtonInner.getX() + swipeButtonInner.getWidth()) / getWidth());
setTrailingEffect();
}
if (event.getX() + swipeButtonInner.getWidth() / 2 > getWidth() &&
swipeButtonInner.getX() + swipeButtonInner.getWidth() / 2 < getWidth()) {
swipeButtonInner.setX(getWidth() - swipeButtonInner.getWidth());
}
if (event.getX() < swipeButtonInner.getWidth() / 2) {
swipeButtonInner.setX(0);
}
return true;
case MotionEvent.ACTION_UP:
if (active) {
collapseButton();
} else {
if (swipeButtonInner.getX() + swipeButtonInner.getWidth() > getWidth() * 0.9) {
if (hasActivationState) {
expandButton();
} else if (onActiveListener != null) {
onActiveListener.onActive();
moveButtonBack();
}
} else {
moveButtonBack();
}
}
return true;
}
return false;
}
};
}
private void expandButton() {
final ValueAnimator positionAnimator =
ValueAnimator.ofFloat(swipeButtonInner.getX(), 0);
positionAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float x = (Float) positionAnimator.getAnimatedValue();
swipeButtonInner.setX(x);
}
});
final ValueAnimator widthAnimator = ValueAnimator.ofInt(
swipeButtonInner.getWidth(),
getWidth());
widthAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
ViewGroup.LayoutParams params = swipeButtonInner.getLayoutParams();
params.width = (Integer) widthAnimator.getAnimatedValue();
swipeButtonInner.setLayoutParams(params);
}
});
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
active = true;
swipeButtonInner.setImageDrawable(enabledDrawable);
if (onStateChangeListener != null) {
onStateChangeListener.onStateChange(active);
}
if (onActiveListener != null) {
onActiveListener.onActive();
}
}
});
animatorSet.playTogether(positionAnimator, widthAnimator);
animatorSet.start();
}
private void moveButtonBack() {
final ValueAnimator positionAnimator =
ValueAnimator.ofFloat(swipeButtonInner.getX(), 0);
positionAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
positionAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float x = (Float) positionAnimator.getAnimatedValue();
swipeButtonInner.setX(x);
setTrailingEffect();
}
});
positionAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (layer != null) {
layer.setVisibility(View.GONE);
}
}
});
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(
centerText, "alpha", 1);
positionAnimator.setDuration(200);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(objectAnimator, positionAnimator);
animatorSet.start();
}
private void collapseButton() {
int finalWidth;
if (collapsedWidth == ViewGroup.LayoutParams.WRAP_CONTENT) {
finalWidth = swipeButtonInner.getHeight();
} else {
finalWidth = collapsedWidth;
}
final ValueAnimator widthAnimator = ValueAnimator.ofInt(swipeButtonInner.getWidth(), finalWidth);
widthAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
ViewGroup.LayoutParams params = swipeButtonInner.getLayoutParams();
params.width = (Integer) widthAnimator.getAnimatedValue();
swipeButtonInner.setLayoutParams(params);
setTrailingEffect();
}
});
widthAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
active = false;
swipeButtonInner.setImageDrawable(disabledDrawable);
if (onStateChangeListener != null) {
onStateChangeListener.onStateChange(active);
}
if (layer != null) {
layer.setVisibility(View.GONE);
}
}
});
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(
centerText, "alpha", 1);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(objectAnimator, widthAnimator);
animatorSet.start();
}
private void setTrailingEffect() {
if (trailEnabled) {
layer.setVisibility(View.VISIBLE);
layer.setLayoutParams(new LayoutParams(
(int) (swipeButtonInner.getX() + swipeButtonInner.getWidth() / 3), centerText.getHeight()));
}
}
public void toggleState() {
if (isActive()) {
collapseButton();
} else {
expandButton();
}
}
}

View File

@ -1,13 +0,0 @@
package code.name.monkey.retromusic.swipebtn;
import android.view.MotionEvent;
import android.view.View;
final class TouchUtils {
private TouchUtils() {
}
static boolean isTouchOutsideInitialPosition(MotionEvent event, View view) {
return event.getX() > view.getX() + view.getWidth();
}
}

View File

@ -77,9 +77,6 @@ public abstract class AbsThemeActivity extends ATHToolbarActivity implements Run
: ContextCompat.getDrawable(this, R.drawable.square_window); : ContextCompat.getDrawable(this, R.drawable.square_window);
background = TintHelper.createTintedDrawable(background, ThemeStore.primaryColor(this)); background = TintHelper.createTintedDrawable(background, ThemeStore.primaryColor(this));
getWindow().setBackgroundDrawable(background); getWindow().setBackgroundDrawable(background);
//View decor = getWindow().getDecorView();
//GradientDrawable gradientDrawable = (GradientDrawable) decor.getBackground();
//gradientDrawable.setColor(ThemeStore.primaryColor(this));
} }
protected void setDrawUnderStatusBar(boolean drawUnderStatusbar) { protected void setDrawUnderStatusBar(boolean drawUnderStatusbar) {

View File

@ -120,7 +120,7 @@ public abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A extend
} }
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
applyRecyclerViewPaddingForLayoutRes(getRecyclerView(), currentLayoutRes); applyRecyclerViewPaddingForLayoutRes(getRecyclerView(), currentLayoutRes);
} }

View File

@ -12,9 +12,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.Unbinder; import butterknife.Unbinder;
@ -22,6 +19,7 @@ import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote; import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.util.ViewUtil; import code.name.monkey.retromusic.util.ViewUtil;
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
public abstract class AbsLibraryPagerRecyclerViewFragment<A extends RecyclerView.Adapter, LM extends RecyclerView.LayoutManager> extends public abstract class AbsLibraryPagerRecyclerViewFragment<A extends RecyclerView.Adapter, LM extends RecyclerView.LayoutManager> extends
@ -79,7 +77,8 @@ public abstract class AbsLibraryPagerRecyclerViewFragment<A extends RecyclerView
} }
private void checkForPadding() { private void checkForPadding() {
int height = (MusicPlayerRemote.getPlayingQueue().isEmpty() ? getResources().getDimensionPixelSize(R.dimen.mini_player_height) : 0); int height = (MusicPlayerRemote.getPlayingQueue().isEmpty() ? getResources()
.getDimensionPixelSize(R.dimen.mini_player_height) : 0);
recyclerView.setPadding(0, 0, 0, height); recyclerView.setPadding(0, 0, 0, height);
} }

View File

@ -4,9 +4,6 @@ import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.GridLayoutManager;
import java.util.ArrayList;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.Album; import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.mvp.contract.AlbumContract; import code.name.monkey.retromusic.mvp.contract.AlbumContract;
@ -14,6 +11,7 @@ import code.name.monkey.retromusic.mvp.presenter.AlbumPresenter;
import code.name.monkey.retromusic.ui.adapter.album.AlbumAdapter; import code.name.monkey.retromusic.ui.adapter.album.AlbumAdapter;
import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment; import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
import code.name.monkey.retromusic.util.PreferenceUtil; import code.name.monkey.retromusic.util.PreferenceUtil;
import java.util.ArrayList;
public class AlbumsFragment extends public class AlbumsFragment extends
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager> implements AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager> implements
@ -125,7 +123,7 @@ public class AlbumsFragment extends
public void setMenuVisibility(boolean menuVisible) { public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible); super.setMenuVisibility(menuVisible);
if (menuVisible) { if (menuVisible) {
getLibraryFragment().getToolbar().setTitle( getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library
: R.string.albums); : R.string.albums);
} }
@ -134,7 +132,7 @@ public class AlbumsFragment extends
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getLibraryFragment().getToolbar().setTitle( getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.albums); PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.albums);
if (getAdapter().getDataSet().isEmpty()) { if (getAdapter().getDataSet().isEmpty()) {
presenter.subscribe(); presenter.subscribe();

View File

@ -4,9 +4,6 @@ import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.GridLayoutManager;
import java.util.ArrayList;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.Artist; import code.name.monkey.retromusic.model.Artist;
import code.name.monkey.retromusic.mvp.contract.ArtistContract; import code.name.monkey.retromusic.mvp.contract.ArtistContract;
@ -14,6 +11,7 @@ import code.name.monkey.retromusic.mvp.presenter.ArtistPresenter;
import code.name.monkey.retromusic.ui.adapter.artist.ArtistAdapter; import code.name.monkey.retromusic.ui.adapter.artist.ArtistAdapter;
import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment; import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
import code.name.monkey.retromusic.util.PreferenceUtil; import code.name.monkey.retromusic.util.PreferenceUtil;
import java.util.ArrayList;
public class ArtistsFragment extends public class ArtistsFragment extends
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager> implements AbsLibraryPagerRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager> implements
@ -129,7 +127,7 @@ public class ArtistsFragment extends
public void setMenuVisibility(boolean menuVisible) { public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible); super.setMenuVisibility(menuVisible);
if (menuVisible) { if (menuVisible) {
getLibraryFragment().getToolbar().setTitle( getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library
: R.string.artists); : R.string.artists);
} }
@ -138,7 +136,7 @@ public class ArtistsFragment extends
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getLibraryFragment().getToolbar().setTitle( getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.artists); PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.artists);
if (getAdapter().getDataSet().isEmpty()) { if (getAdapter().getDataSet().isEmpty()) {
presenter.subscribe(); presenter.subscribe();

View File

@ -39,7 +39,7 @@ public class GenreFragment extends
public void setMenuVisibility(boolean menuVisible) { public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible); super.setMenuVisibility(menuVisible);
if (menuVisible) { if (menuVisible) {
getLibraryFragment().getToolbar().setTitle( getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library
: R.string.genres); : R.string.genres);
} }
@ -48,7 +48,7 @@ public class GenreFragment extends
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getLibraryFragment().getToolbar().setTitle( getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.genres); PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.genres);
if (getAdapter().getDataSet().isEmpty()) { if (getAdapter().getDataSet().isEmpty()) {
mPresenter.subscribe(); mPresenter.subscribe();

View File

@ -5,7 +5,9 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.design.widget.AppBarLayout; import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
@ -17,11 +19,6 @@ import android.view.MenuItem;
import android.view.SubMenu; import android.view.SubMenu;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.afollestad.materialcab.MaterialCab;
import java.util.Objects;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.Unbinder; import butterknife.Unbinder;
@ -37,16 +34,13 @@ import code.name.monkey.retromusic.helper.SortOrder;
import code.name.monkey.retromusic.interfaces.CabHolder; import code.name.monkey.retromusic.interfaces.CabHolder;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks; import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
import code.name.monkey.retromusic.loaders.SongLoader; import code.name.monkey.retromusic.loaders.SongLoader;
import code.name.monkey.retromusic.ui.activities.SearchActivity;
import code.name.monkey.retromusic.ui.activities.SettingsActivity; import code.name.monkey.retromusic.ui.activities.SettingsActivity;
import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment; import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment; import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment;
import code.name.monkey.retromusic.util.NavigationUtil; import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.RetroColorUtil; import code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.RetroUtil; import code.name.monkey.retromusic.util.RetroUtil;
import code.name.monkey.retromusic.views.SansFontCollapsingToolbarLayout; import com.afollestad.materialcab.MaterialCab;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
public class LibraryFragment extends AbsMainActivityFragment implements CabHolder, public class LibraryFragment extends AbsMainActivityFragment implements CabHolder,
MainActivityFragmentCallbacks { MainActivityFragmentCallbacks {
@ -55,10 +49,11 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
private static final String CURRENT_TAB_ID = "current_tab_id"; private static final String CURRENT_TAB_ID = "current_tab_id";
@BindView(R.id.toolbar) @BindView(R.id.toolbar)
Toolbar toolbar; Toolbar toolbar;
@BindView(R.id.appbar) @BindView(R.id.app_bar)
AppBarLayout appbar; AppBarLayout appbar;
@BindView(R.id.collapsing_toolbar) @BindView(R.id.collapsing_toolbar)
SansFontCollapsingToolbarLayout collapsingToolbar; CollapsingToolbarLayout collapsingToolbarLayout;
private Unbinder unBinder; private Unbinder unBinder;
private MaterialCab cab; private MaterialCab cab;
@ -72,8 +67,8 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
return fragment; return fragment;
} }
public SansFontCollapsingToolbarLayout getToolbar() { public void setTitle(@StringRes int name) {
return collapsingToolbar; collapsingToolbarLayout.setTitle(getString(name));
} }
public void addOnAppBarOffsetChangedListener( public void addOnAppBarOffsetChangedListener(
@ -104,9 +99,13 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
setStatusbarColorAuto(view); setStatusbarColorAuto(view);
getMainActivity().setBottomBarVisibility(View.VISIBLE); getMainActivity().setBottomBarVisibility(View.VISIBLE);
setupToolbar(); setupToolbar();
inflateFragment();
}
private void inflateFragment() {
if (getArguments() == null) { if (getArguments() == null) {
selectedFragment(SongsFragment.newInstance()); selectedFragment(SongsFragment.newInstance());
return; return;
@ -128,15 +127,14 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
} }
} }
@SuppressWarnings("ConstantConditions")
private void setupToolbar() { private void setupToolbar() {
//noinspection ConstantConditions
int primaryColor = ThemeStore.primaryColor(getContext()); int primaryColor = ThemeStore.primaryColor(getContext());
appbar.setBackgroundColor(primaryColor); appbar.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(primaryColor); toolbar.setBackgroundColor(primaryColor);
toolbar.setTitle(R.string.library);
appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext()))); getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
Objects.requireNonNull(getActivity()).setTitle(R.string.app_name); getMainActivity().setTitle(R.string.app_name);
getMainActivity().setSupportActionBar(toolbar); getMainActivity().setSupportActionBar(toolbar);
} }
@ -324,6 +322,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
ToolbarContentTintHelper.handleOnPrepareOptionsMenu(activity, toolbar); ToolbarContentTintHelper.handleOnPrepareOptionsMenu(activity, toolbar);
} }
@SuppressWarnings("ConstantConditions")
@Override @Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) { public boolean onOptionsItemSelected(@NonNull MenuItem item) {
//if (pager == null) return false; //if (pager == null) return false;
@ -343,16 +342,13 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
CreatePlaylistDialog.create().show(getChildFragmentManager(), "CREATE_PLAYLIST"); CreatePlaylistDialog.create().show(getChildFragmentManager(), "CREATE_PLAYLIST");
return true; return true;
case R.id.action_shuffle_all: case R.id.action_shuffle_all:
//noinspection ConstantConditions MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(getContext())
SongLoader.getAllSongs(getContext()).subscribeOn(Schedulers.computation()) .blockingFirst(), true);
.observeOn(AndroidSchedulers.mainThread())
.subscribe(songs -> MusicPlayerRemote.openAndShuffleQueue(songs, true));
return true; return true;
case R.id.action_search: case R.id.action_search:
startActivity(new Intent(getActivity(), SearchActivity.class)); NavigationUtil.goToSearch(getMainActivity());
return true; break;
case R.id.action_equalizer: case R.id.action_equalizer:
//noinspection ConstantConditions
NavigationUtil.openEqualizer(getActivity()); NavigationUtil.openEqualizer(getActivity());
return true; return true;
case R.id.action_sleep_timer: case R.id.action_sleep_timer:
@ -367,6 +363,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
private void setUpGridSizeMenu( private void setUpGridSizeMenu(
@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment, @NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment,
@NonNull SubMenu gridSizeMenu) { @NonNull SubMenu gridSizeMenu) {

View File

@ -54,14 +54,14 @@ public class PlaylistsFragment extends AbsLibraryPagerRecyclerViewFragment<Playl
public void setMenuVisibility(boolean menuVisible) { public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible); super.setMenuVisibility(menuVisible);
if (menuVisible) { if (menuVisible) {
getLibraryFragment().getToolbar().setTitle(PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.playlists); getLibraryFragment().setTitle(PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.playlists);
} }
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getLibraryFragment().getToolbar().setTitle(PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.playlists); getLibraryFragment().setTitle(PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.playlists);
if (getAdapter().getDataSet().isEmpty()) { if (getAdapter().getDataSet().isEmpty()) {
presenter.subscribe(); presenter.subscribe();
} }

View File

@ -4,7 +4,6 @@ import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.GridLayoutManager;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.Song; import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.mvp.contract.SongContract; import code.name.monkey.retromusic.mvp.contract.SongContract;
@ -13,7 +12,6 @@ import code.name.monkey.retromusic.ui.adapter.song.ShuffleButtonSongAdapter;
import code.name.monkey.retromusic.ui.adapter.song.SongAdapter; import code.name.monkey.retromusic.ui.adapter.song.SongAdapter;
import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment; import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
import code.name.monkey.retromusic.util.PreferenceUtil; import code.name.monkey.retromusic.util.PreferenceUtil;
import java.util.ArrayList; import java.util.ArrayList;
@SuppressWarnings("ConstantConditions") @SuppressWarnings("ConstantConditions")
@ -21,7 +19,6 @@ public class SongsFragment extends
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdapter, GridLayoutManager> implements AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdapter, GridLayoutManager> implements
SongContract.SongView { SongContract.SongView {
private static final String TAG = "Songs";
private SongPresenter presenter; private SongPresenter presenter;
public SongsFragment() { public SongsFragment() {
@ -118,7 +115,7 @@ public class SongsFragment extends
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getLibraryFragment().getToolbar().setTitle( getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.songs); PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.songs);
if (getAdapter().getDataSet().isEmpty()) { if (getAdapter().getDataSet().isEmpty()) {
presenter.subscribe(); presenter.subscribe();
@ -129,7 +126,7 @@ public class SongsFragment extends
public void setMenuVisibility(boolean menuVisible) { public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible); super.setMenuVisibility(menuVisible);
if (menuVisible) { if (menuVisible) {
getLibraryFragment().getToolbar().setTitle( getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library
: R.string.songs); : R.string.songs);
} }

View File

@ -24,6 +24,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.MimeTypeMap; import android.webkit.MimeTypeMap;
import android.widget.PopupMenu; import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
@ -31,6 +32,8 @@ import butterknife.Unbinder;
import code.name.monkey.appthemehelper.ThemeStore; import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.common.ATHToolbarActivity; import code.name.monkey.appthemehelper.common.ATHToolbarActivity;
import code.name.monkey.appthemehelper.util.ATHUtil; import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote; import code.name.monkey.retromusic.helper.MusicPlayerRemote;
@ -82,6 +85,8 @@ public class FoldersFragment extends AbsMainActivityFragment implements
CoordinatorLayout coordinatorLayout; CoordinatorLayout coordinatorLayout;
@BindView(R.id.container) @BindView(R.id.container)
View container; View container;
@BindView(R.id.title)
TextView title;
@BindView(android.R.id.empty) @BindView(android.R.id.empty)
View empty; View empty;
@BindView(R.id.toolbar) @BindView(R.id.toolbar)
@ -90,10 +95,10 @@ public class FoldersFragment extends AbsMainActivityFragment implements
BreadCrumbLayout breadCrumbs; BreadCrumbLayout breadCrumbs;
@BindView(R.id.appbar) @BindView(R.id.appbar)
AppBarLayout appbar; AppBarLayout appbar;
@BindView(R.id.status_bar)
View statusBar;
@BindView(R.id.recycler_view) @BindView(R.id.recycler_view)
FastScrollRecyclerView recyclerView; FastScrollRecyclerView recyclerView;
Comparator<File> fileComparator = (lhs, rhs) -> { Comparator<File> fileComparator = (lhs, rhs) -> {
if (lhs.isDirectory() && !rhs.isDirectory()) { if (lhs.isDirectory() && !rhs.isDirectory()) {
return -1; return -1;
@ -207,7 +212,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
setStatusbarColorAuto(view); setStatusbarColorAuto(view);
getMainActivity().getSlidingUpPanelLayout().setShadowHeight(0); getMainActivity().getSlidingUpPanelLayout().setShadowHeight(0);
getMainActivity().setBottomBarVisibility(View.GONE); getMainActivity().setBottomBarVisibility(View.GONE);
setUpAppbarColor(); setUpAppbarColor();
@ -215,24 +219,29 @@ public class FoldersFragment extends AbsMainActivityFragment implements
setUpBreadCrumbs(); setUpBreadCrumbs();
setUpRecyclerView(); setUpRecyclerView();
setUpAdapter(); setUpAdapter();
ViewUtil.setStatusBarHeight(getContext(), statusBar);
} }
private void setUpAppbarColor() { private void setUpAppbarColor() {
//noinspection ConstantConditions //noinspection ConstantConditions
int primaryColor = ThemeStore.primaryColor(getActivity()); int primaryColor = ThemeStore.primaryColor(getActivity());
appbar.setBackgroundColor(primaryColor); TintHelper.setTintAuto(container, primaryColor, true);
toolbar.setBackgroundColor(primaryColor); appbar.setBackgroundColor(ColorUtil.darkenColor(primaryColor));
toolbar.setBackgroundColor(ColorUtil.darkenColor(primaryColor));
//breadCrumbs.setBackgroundColor(primaryColor); //breadCrumbs.setBackgroundColor(primaryColor);
breadCrumbs.setActivatedContentColor( breadCrumbs.setActivatedContentColor(
ToolbarContentTintHelper.toolbarTitleColor(getActivity(), primaryColor)); ToolbarContentTintHelper
.toolbarTitleColor(getActivity(), ColorUtil.darkenColor(primaryColor)));
breadCrumbs.setDeactivatedContentColor( breadCrumbs.setDeactivatedContentColor(
ToolbarContentTintHelper.toolbarSubtitleColor(getActivity(), primaryColor)); ToolbarContentTintHelper
.toolbarSubtitleColor(getActivity(), ColorUtil.darkenColor(primaryColor)));
appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity() appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> getMainActivity()
.setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext()))); .setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
} }
private void setUpToolbar() { private void setUpToolbar() {
//noinspection ConstantConditions
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp); toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
//noinspection ConstantConditions //noinspection ConstantConditions
getActivity().setTitle(R.string.folders); getActivity().setTitle(R.string.folders);

View File

@ -1,8 +1,5 @@
package code.name.monkey.retromusic.ui.fragments.mainactivity.home; 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.app.Activity;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.os.Bundle; import android.os.Bundle;
@ -23,6 +20,15 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; 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.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
@ -55,15 +61,12 @@ import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroUtil; import code.name.monkey.retromusic.util.RetroUtil;
import code.name.monkey.retromusic.views.CircularImageView; import code.name.monkey.retromusic.views.CircularImageView;
import code.name.monkey.retromusic.views.MetalRecyclerViewPager; 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.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import java.io.File;
import java.util.ArrayList; import static code.name.monkey.retromusic.Constants.USER_BANNER;
import java.util.Calendar; import static code.name.monkey.retromusic.Constants.USER_PROFILE;
import java.util.Random;
public class HomeFragment extends AbsMainActivityFragment implements MainActivityFragmentCallbacks, public class HomeFragment extends AbsMainActivityFragment implements MainActivityFragmentCallbacks,
HomeContract.HomeView { HomeContract.HomeView {

View File

@ -16,20 +16,19 @@ import android.view.animation.LinearInterpolator;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.Unbinder; import butterknife.Unbinder;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote; import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper; import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper;
import code.name.monkey.retromusic.misc.SimpleOnSeekbarChangeListener;
import code.name.monkey.retromusic.service.MusicService; import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment; import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerControlsFragment;
import code.name.monkey.retromusic.util.MusicUtil; import code.name.monkey.retromusic.util.MusicUtil;
@ -41,6 +40,7 @@ import code.name.monkey.retromusic.views.PlayPauseDrawable;
*/ */
public class PlainPlaybackControlsFragment extends AbsPlayerControlsFragment { public class PlainPlaybackControlsFragment extends AbsPlayerControlsFragment {
@BindView(R.id.player_play_pause_button) @BindView(R.id.player_play_pause_button)
ImageButton playPauseFab; ImageButton playPauseFab;
@BindView(R.id.player_prev_button) @BindView(R.id.player_prev_button)
@ -216,7 +216,8 @@ public class PlainPlaybackControlsFragment extends AbsPlayerControlsFragment {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) { if (fromUser) {
MusicPlayerRemote.seekTo(progress); MusicPlayerRemote.seekTo(progress);
onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(), MusicPlayerRemote.getSongDurationMillis()); onUpdateProgressViews(MusicPlayerRemote.getSongProgressMillis(),
MusicPlayerRemote.getSongDurationMillis());
} }
} }
}); });
@ -285,17 +286,27 @@ public class PlainPlaybackControlsFragment extends AbsPlayerControlsFragment {
} }
if (PreferenceUtil.getInstance(getContext()).getAdaptiveColor()) { if (PreferenceUtil.getInstance(getContext()).getAdaptiveColor()) {
TintHelper.setTintAuto(playPauseFab, MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(dark)), false); TintHelper.setTintAuto(playPauseFab,
MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(dark)),
false);
TintHelper.setTintAuto(playPauseFab, dark, true); TintHelper.setTintAuto(playPauseFab, dark, true);
setProgressBarColor(progressSlider, dark); setProgressBarColor(dark);
} else {
int accentColor = ThemeStore.accentColor(getContext());
setProgressBarColor(accentColor);
TintHelper.setTintAuto(playPauseFab,
MaterialValueHelper
.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(accentColor)),
false);
TintHelper.setTintAuto(playPauseFab, accentColor, true);
} }
updateRepeatState(); updateRepeatState();
updateShuffleState(); updateShuffleState();
updatePrevNextColor(); updatePrevNextColor();
} }
public void setProgressBarColor(SeekBar progressBar, int newColor) { public void setProgressBarColor(int newColor) {
LayerDrawable ld = (LayerDrawable) progressBar.getProgressDrawable(); LayerDrawable ld = (LayerDrawable) progressSlider.getProgressDrawable();
ClipDrawable clipDrawable = (ClipDrawable) ld.findDrawableByLayerId(android.R.id.progress); ClipDrawable clipDrawable = (ClipDrawable) ld.findDrawableByLayerId(android.R.id.progress);
clipDrawable.setColorFilter(newColor, PorterDuff.Mode.SRC_IN); clipDrawable.setColorFilter(newColor, PorterDuff.Mode.SRC_IN);
} }
@ -303,7 +314,8 @@ public class PlainPlaybackControlsFragment extends AbsPlayerControlsFragment {
private void setUpPlayPauseFab() { private void setUpPlayPauseFab() {
playerFabPlayPauseDrawable = new PlayPauseDrawable(getActivity()); playerFabPlayPauseDrawable = new PlayPauseDrawable(getActivity());
playPauseFab.setImageDrawable(playerFabPlayPauseDrawable); // Note: set the drawable AFTER TintHelper.setTintAuto() was called playPauseFab.setImageDrawable(
playerFabPlayPauseDrawable); // Note: set the drawable AFTER TintHelper.setTintAuto() was called
//playPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN); //playPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN);
//playPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler()); //playPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler());
playPauseFab.post(() -> { playPauseFab.post(() -> {

View File

@ -1,8 +1,6 @@
package code.name.monkey.retromusic.ui.fragments.player.simple; package code.name.monkey.retromusic.ui.fragments.player.simple;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
@ -12,9 +10,7 @@ import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator; import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
@ -39,6 +35,7 @@ import code.name.monkey.retromusic.views.PlayPauseDrawable;
*/ */
public class SimplePlaybackControlsFragment extends AbsPlayerControlsFragment { public class SimplePlaybackControlsFragment extends AbsPlayerControlsFragment {
@BindView(R.id.player_play_pause_button) @BindView(R.id.player_play_pause_button)
ImageButton playPauseFab; ImageButton playPauseFab;
@BindView(R.id.player_prev_button) @BindView(R.id.player_prev_button)
@ -101,7 +98,8 @@ public class SimplePlaybackControlsFragment extends AbsPlayerControlsFragment {
@Nullable @Nullable
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_simple_controls_fragment, container, false); View view = inflater.inflate(R.layout.fragment_simple_controls_fragment, container, false);
unbinder = ButterKnife.bind(this, view); unbinder = ButterKnife.bind(this, view);
return view; return view;
@ -123,7 +121,8 @@ public class SimplePlaybackControlsFragment extends AbsPlayerControlsFragment {
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
setUpMusicControllers(); setUpMusicControllers();
volumeContainer.setVisibility(PreferenceUtil.getInstance(getContext()).getVolumeToggle() ? View.VISIBLE : View.GONE); volumeContainer.setVisibility(
PreferenceUtil.getInstance(getContext()).getVolumeToggle() ? View.VISIBLE : View.GONE);
} }
private void setUpMusicControllers() { private void setUpMusicControllers() {
@ -257,7 +256,8 @@ public class SimplePlaybackControlsFragment extends AbsPlayerControlsFragment {
@Override @Override
public void onUpdateProgressViews(int progress, int total) { public void onUpdateProgressViews(int progress, int total) {
songCurrentProgress.setText(String.format("%s / %s", MusicUtil.getReadableDurationString(progress), songCurrentProgress
.setText(String.format("%s / %s", MusicUtil.getReadableDurationString(progress),
MusicUtil.getReadableDurationString(total))); MusicUtil.getReadableDurationString(total)));
} }
@ -277,11 +277,19 @@ public class SimplePlaybackControlsFragment extends AbsPlayerControlsFragment {
} }
if (PreferenceUtil.getInstance(getContext()).getAdaptiveColor()) { if (PreferenceUtil.getInstance(getContext()).getAdaptiveColor()) {
TintHelper.setTintAuto(playPauseFab, MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(dark)), false); TintHelper.setTintAuto(playPauseFab,
MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(dark)),
false);
TintHelper.setTintAuto(playPauseFab, dark, true); TintHelper.setTintAuto(playPauseFab, dark, true);
text.setTextColor(dark); text.setTextColor(dark);
} else { } else {
text.setTextColor(ThemeStore.accentColor(getContext())); int accentColor = ThemeStore.accentColor(getContext());
text.setTextColor(accentColor);
TintHelper.setTintAuto(playPauseFab,
MaterialValueHelper
.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(accentColor)),
false);
TintHelper.setTintAuto(playPauseFab, accentColor, true);
} }
updateRepeatState(); updateRepeatState();
@ -289,16 +297,11 @@ public class SimplePlaybackControlsFragment extends AbsPlayerControlsFragment {
updatePrevNextColor(); updatePrevNextColor();
} }
public void setProgressBarColor(SeekBar progressBar, int newColor) {
LayerDrawable ld = (LayerDrawable) progressBar.getProgressDrawable();
ClipDrawable clipDrawable = (ClipDrawable) ld.findDrawableByLayerId(android.R.id.progress);
clipDrawable.setColorFilter(newColor, PorterDuff.Mode.SRC_IN);
}
private void setUpPlayPauseFab() { private void setUpPlayPauseFab() {
playerFabPlayPauseDrawable = new PlayPauseDrawable(getActivity()); playerFabPlayPauseDrawable = new PlayPauseDrawable(getActivity());
playPauseFab.setImageDrawable(playerFabPlayPauseDrawable); // Note: set the drawable AFTER TintHelper.setTintAuto() was called playPauseFab.setImageDrawable(
playerFabPlayPauseDrawable); // Note: set the drawable AFTER TintHelper.setTintAuto() was called
//playPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN); //playPauseFab.setColorFilter(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(fabColor)), PorterDuff.Mode.SRC_IN);
//playPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler()); //playPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler());
playPauseFab.post(() -> { playPauseFab.post(() -> {

View File

@ -87,18 +87,15 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/aapt_friendly_merged_manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/aapt_friendly_merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations_typedef_file" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations_zip" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/consumer_proguard_file" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/consumer_proguard_file" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/intermediate-jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/intermediate-jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/library_and_local_jars_jni" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/library_assets" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/library_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint_jar" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged_res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/platform_r_txt" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/platform_r_txt" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/public_res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/public_res" />
@ -111,7 +108,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 27 Platform (1)" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: com.android.support:transition-27.1.1" level="project" /> <orderEntry type="library" name="Gradle: com.android.support:transition-27.1.1" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-v4-27.1.1" level="project" /> <orderEntry type="library" name="Gradle: com.android.support:support-v4-27.1.1" level="project" />

View File

@ -7,7 +7,7 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha15' classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
} }
} }

Binary file not shown.

View File

@ -1,4 +1,4 @@
#Mon May 14 20:13:41 IST 2018 #Fri Jul 27 20:58:25 IST 2018
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

100
gradlew vendored
View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env sh
############################################################################## ##############################################################################
## ##
@ -6,42 +6,6 @@
## ##
############################################################################## ##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" PRG="$0"
@ -60,6 +24,46 @@ cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`" APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@ -85,7 +89,7 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n` MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@ -150,11 +154,19 @@ if $cygwin ; then
esac esac
fi fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules # Escape application args
function splitJvmOpts() { save () {
JVM_OPTS=("$@") for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
} }
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS APP_ARGS=$(save "$@")
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" # Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

14
gradlew.bat vendored
View File

@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail goto fail
:init :init
@rem Get command-line arguments, handling Windowz variants @rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%* set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute :execute
@rem Setup the command line @rem Setup the command line

View File

@ -1,5 +0,0 @@
# This API key is provided for convenience. Please go to https://www.last.fm/api/account/create and create your own.
GOOGLE_PLAY_LICENSE_KEY = MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnWuCg0k+BBB25J7vZUZeTf5sxzSzJhXLdyj9zRKr2k0Xf/RNAmqSXTfshQiP5dZyTeJ+cpRP4xeKijW66/bTwKgH3h0x48pgn7tQMIEdH9KaZUlPzHH9pcp+N9iJlKhX+vacZUpbnlOp0PjrJXP1Xg6gz1gs3nMDhX1z5Tr4vPKd+Wf7E3tyTc15jpfqSKSzqYzIlT4VFdcmLcPypCwRzgRzWOGqj3/oz8rxLCQ4bxtDHwtZhHAz/N6go5oZodpfrA2ETiyeNsqta2Xmwt38CyYukSQ+eYJ2irZ5wqnr1iN9duzZRfMi7id+tgC8iwicDSanUiYFt/r43C0UkGNx6wIDAQAB
LASTFM_API_KEY=206993ea109315882749d5bc7b2e704d
LASTFM_API_KEY_NEW=17c9e96bc741842d7fc84d3961a25a04