Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lictex committed Dec 6, 2019
1 parent eca4c67 commit fa3ad0a
Show file tree
Hide file tree
Showing 28 changed files with 73 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,19 @@ public ImageSwitcher(@NonNull Context context, @Nullable AttributeSet attrs, int

public void to(Bitmap b) {
i[second ? 0 : 1].setImageBitmap(b);
if (second) i[0].setVisibility(VISIBLE);
else i[0].postDelayed(() -> i[0].setVisibility(INVISIBLE), animationDuration);
i[1].animate().setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(animationDuration).alpha(second ? 0 : 1).start();
var animator = i[1].animate().setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(animationDuration);
if (second) animator.alpha(0).withStartAction(() -> i[0].setVisibility(VISIBLE));
else animator.alpha(1).withEndAction(() -> i[0].setVisibility(INVISIBLE));
animator.start();
second = !second;
}

public void to(Drawable d) {
i[second ? 0 : 1].setImageDrawable(d);
if (second) i[0].setVisibility(VISIBLE);
else i[0].postDelayed(() -> i[0].setVisibility(INVISIBLE), animationDuration);
i[1].animate().setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(animationDuration).alpha(second ? 0 : 1).start();
var animator = i[1].animate().setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(animationDuration);
if (second) animator.alpha(0).withStartAction(() -> i[0].setVisibility(VISIBLE));
else animator.alpha(1).withEndAction(() -> i[0].setVisibility(INVISIBLE));
animator.start();
second = !second;
}
}
14 changes: 11 additions & 3 deletions app/src/main/java/pw/lictex/osuplayer/activity/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pw.lictex.osuplayer.activity;

import android.*;
import android.animation.*;
import android.content.*;
import android.content.pm.*;
import android.content.res.*;
Expand Down Expand Up @@ -58,10 +59,17 @@ public class MainActivity extends AppCompatActivity {
private PreferenceFragment preferenceFragment;
@Getter private PlayerService playerService;
@Getter private int baseAnimationDuration;
private ObjectAnimator progressAnimator;
private boolean progressTouched;
private Runnable runnable = new Runnable() {
@Override
public void run() {
seekBar.setProgress((int) (((double) playerService.getOsuAudioPlayer().getCurrentTime() / playerService.getOsuAudioPlayer().getAudioLength()) * seekBar.getMax()));
if (!progressTouched) {
progressAnimator = ObjectAnimator.ofInt(seekBar, "progress", seekBar.getProgress(), (int) (((double) playerService.getOsuAudioPlayer().getCurrentTime() / playerService.getOsuAudioPlayer().getAudioLength()) * seekBar.getMax()));
progressAnimator.setInterpolator(new LinearOutSlowInInterpolator());
progressAnimator.setDuration(750);
progressAnimator.start();
}
handler.postDelayed(this, 1000);
}
};
Expand Down Expand Up @@ -191,9 +199,9 @@ public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
if (b) getPlayerService().getOsuAudioPlayer().seekTo((long) ((float) i / seekBar.getMax() * getPlayerService().getOsuAudioPlayer().getAudioLength()));
}

@Override public void onStartTrackingTouch(SeekBar seekBar) { }
@Override public void onStartTrackingTouch(SeekBar seekBar) {progressAnimator.cancel(); progressTouched = true; }

@Override public void onStopTrackingTouch(SeekBar seekBar) { }
@Override public void onStopTrackingTouch(SeekBar seekBar) {progressTouched = false; }
});

playerServiceConnection = new ServiceConnection() {
Expand Down
Binary file removed app/src/main/res/drawable-hdpi/progress_bar_100.9.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/drawable-hdpi/progress_bar_50.9.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/drawable-mdpi/progress_bar_100.9.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/drawable-mdpi/progress_bar_50.9.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/drawable-xhdpi/progress_bar_100.9.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/drawable-xhdpi/progress_bar_50.9.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/drawable-xxhdpi/progress_bar_100.9.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/drawable-xxhdpi/progress_bar_50.9.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/drawable-xxxhdpi/progress_bar_50.9.png
Binary file not shown.
Binary file not shown.
11 changes: 9 additions & 2 deletions app/src/main/res/drawable/progress_bar_100_0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@
<item android:id="@android:id/background">
<color android:color="@android:color/transparent" />
</item>
<item android:id="@android:id/progress">
<item
android:id="@android:id/progress"
android:gravity="center">
<scale android:scaleWidth="100%">
<selector>
<item android:state_enabled="false">
<color android:color="@android:color/transparent" />
</item>
<item android:drawable="@drawable/progress_bar_100" />
<item>
<shape>
<corners android:radius="144dp" />
<solid android:color="#ffffff" />
</shape>
</item>
</selector>
</scale>
</item>
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/res/drawable/progress_bar_100_0_light.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@
<item android:id="@android:id/background">
<color android:color="@android:color/transparent" />
</item>
<item android:id="@android:id/progress">
<item
android:id="@android:id/progress"
android:gravity="center">
<scale android:scaleWidth="100%">
<selector>
<item android:state_enabled="false">
<color android:color="@android:color/transparent" />
</item>
<item android:drawable="@drawable/progress_bar_100_light" />
<item>
<shape>
<corners android:radius="144dp" />
<solid android:color="#000000" />
</shape>
</item>
</selector>
</scale>
</item>
Expand Down
18 changes: 15 additions & 3 deletions app/src/main/res/drawable/progress_bar_100_50.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:drawable="@drawable/progress_bar_50" />
<item android:id="@android:id/progress">
android:gravity="center">
<shape>
<corners android:radius="144dp" />
<solid android:color="#7fffffff" />
</shape>
</item>
<item
android:id="@android:id/progress"
android:gravity="center">
<scale android:scaleWidth="100%">
<selector>
<item android:state_enabled="false">
<color android:color="@android:color/transparent" />
</item>
<item android:drawable="@drawable/progress_bar_100" />
<item>
<shape>
<corners android:radius="144dp" />
<solid android:color="#ffffff" />
</shape>
</item>
</selector>
</scale>
</item>
Expand Down
18 changes: 15 additions & 3 deletions app/src/main/res/drawable/progress_bar_100_50_light.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:drawable="@drawable/progress_bar_50_light" />
<item android:id="@android:id/progress">
android:gravity="center">
<shape>
<corners android:radius="144dp" />
<solid android:color="#7F000000" />
</shape>
</item>
<item
android:id="@android:id/progress"
android:gravity="center">
<scale android:scaleWidth="100%">
<selector>
<item android:state_enabled="false">
<color android:color="@android:color/transparent" />
</item>
<item android:drawable="@drawable/progress_bar_100_light" />
<item>
<shape>
<corners android:radius="144dp" />
<solid android:color="#000000" />
</shape>
</item>
</selector>
</scale>
</item>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:max="2048"
android:maxHeight="2dp"
android:paddingStart="0dp"
android:paddingTop="8dp"
android:paddingEnd="0dp"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/layout/fragment_audiosetting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
android:text="@string/double_time"
android:textColor="?android:textColor"
android:textSize="14dp"
app:buttonCompat="@null"
app:drawableRightCompat="?checkboxDrawable" />

<androidx.appcompat.widget.AppCompatCheckBox
Expand All @@ -52,6 +53,7 @@
android:text="@string/half_time"
android:textColor="?android:textColor"
android:textSize="14dp"
app:buttonCompat="@null"
app:drawableRightCompat="?checkboxDrawable" />

<androidx.appcompat.widget.AppCompatCheckBox
Expand All @@ -67,6 +69,7 @@
android:text="@string/nightcore"
android:textColor="?android:textColor"
android:textSize="14dp"
app:buttonCompat="@null"
app:drawableRightCompat="?checkboxDrawable" />
</LinearLayout>

Expand Down Expand Up @@ -108,6 +111,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:max="100"
android:maxHeight="2dp"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:paddingEnd="8dp"
Expand All @@ -134,6 +138,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:max="100"
android:maxHeight="2dp"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:paddingEnd="8dp"
Expand Down

0 comments on commit fa3ad0a

Please sign in to comment.