Skip to content

Commit

Permalink
[optimize] Convert PlayerView.java to Kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyD666 committed Apr 12, 2024
1 parent 29560aa commit 1c5e6c9
Show file tree
Hide file tree
Showing 4 changed files with 1,740 additions and 2,131 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
minSdk = 24
targetSdk = 34
versionCode = 10
versionName = "1.1-beta05"
versionName = "1.1-beta06"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down
29 changes: 14 additions & 15 deletions app/src/main/java/com/skyd/anivu/ui/player/PlayerControlView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,11 @@ private void supportDisplayCutouts() {
if (activity != null) {
View decorView = activity.getWindow().getDecorView();
decorView.post(() -> {
DisplayCutout displayCutout = decorView.getRootWindowInsets().getDisplayCutout();
var windowInsets = decorView.getRootWindowInsets();
if (windowInsets == null) {
return;
}
DisplayCutout displayCutout = windowInsets.getDisplayCutout();
if (displayCutout == null) {
return;
}
Expand Down Expand Up @@ -2287,20 +2291,15 @@ public void onBindViewHolder(SubSettingViewHolder holder, int position) {
if (position < playbackSpeedTexts.length) {
holder.textView.setText(playbackSpeedTexts[position]);
}
if (position == selectedIndex) {
holder.itemView.setSelected(true);
holder.checkView.setVisibility(VISIBLE);
} else {
holder.itemView.setSelected(false);
holder.checkView.setVisibility(INVISIBLE);
}
holder.itemView.setOnClickListener(
v -> {
if (position != selectedIndex) {
setPlaybackSpeed(playbackSpeeds[position]);
}
settingsWindow.dismiss();
});
holder.description.setVisibility(GONE);
holder.itemView.setSelected(position == selectedIndex);
holder.checkView.setVisibility(position == selectedIndex ? VISIBLE : INVISIBLE);
holder.itemView.setOnClickListener(v -> {
if (position != selectedIndex) {
setPlaybackSpeed(playbackSpeeds[position]);
}
settingsWindow.dismiss();
});
}

@Override
Expand Down
Loading

0 comments on commit 1c5e6c9

Please sign in to comment.