Skip to content

Commit 059d715

Browse files
committed
code sync and add website files
1 parent e07cd98 commit 059d715

29 files changed

Lines changed: 1376 additions & 635 deletions

app/build.gradle

Lines changed: 67 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
import java.util.Properties
2-
import java.io.FileInputStream
3-
import java.util.Base64
4-
import org.gradle.api.GradleException
5-
61
plugins {
72
alias(libs.plugins.android.application)
83
alias(libs.plugins.aboutlibraries)
@@ -21,32 +16,32 @@ def getSecret = { key ->
2116
}
2217

2318
android {
24-
namespace "com.xapps.media.xmusic"
25-
compileSdk 37
19+
namespace = "com.xapps.media.xmusic"
20+
compileSdk = 37
2621

2722
defaultConfig {
28-
applicationId "com.xapps.media.xmusic"
29-
minSdk 26
30-
targetSdk 37
31-
versionCode 40
32-
versionName '0.40 Alpha'
23+
applicationId = "com.xapps.media.xmusic"
24+
minSdk = 26
25+
targetSdk = 37
26+
versionCode = 40
27+
versionName = '0.40 Alpha'
3328
}
3429

3530
buildFeatures {
36-
viewBinding true
37-
buildConfig true
31+
viewBinding = true
32+
buildConfig = true
3833
}
3934

4035
sourceSets {
4136
main {
42-
manifest.srcFile "src/main/AndroidManifest.xml"
37+
manifest.srcFile("src/main/AndroidManifest.xml")
4338
java.srcDirs += "src/extra/java"
4439
}
4540
}
4641

4742
compileOptions {
48-
sourceCompatibility JavaVersion.VERSION_17
49-
targetCompatibility JavaVersion.VERSION_17
43+
sourceCompatibility = JavaVersion.VERSION_17
44+
targetCompatibility = JavaVersion.VERSION_17
5045
}
5146

5247
signingConfigs {
@@ -55,100 +50,100 @@ android {
5550
def tmpFile = file("build/tmp_keystore.jks")
5651
tmpFile.parentFile.mkdirs()
5752
tmpFile.bytes = Base64.decoder.decode(base64Key)
58-
59-
storeFile tmpFile
60-
storePassword getSecret("KEYSTORE_PASSWORD")
61-
keyAlias getSecret("KEY_ALIAS")
62-
keyPassword getSecret("ALIAS_PASSWORD")
53+
54+
storeFile = tmpFile
55+
storePassword = getSecret("KEYSTORE_PASSWORD")
56+
keyAlias = getSecret("KEY_ALIAS")
57+
keyPassword = getSecret("ALIAS_PASSWORD")
6358
}
6459

6560
debug {
66-
initWith release
61+
initWith(release)
6762
}
6863

6964
preview {
70-
initWith release
65+
initWith(release)
7166
}
7267
}
7368

7469
buildTypes {
7570
debug {
76-
debuggable true
77-
minifyEnabled false
78-
shrinkResources false
79-
signingConfig signingConfigs.debug
71+
debuggable = true
72+
minifyEnabled = false
73+
shrinkResources = false
74+
signingConfig = signingConfigs.debug
8075
}
8176

8277
preview {
83-
initWith release
78+
initWith(release)
8479
matchingFallbacks = ["release", "debug"]
85-
debuggable false
86-
minifyEnabled false
87-
shrinkResources false
88-
signingConfig signingConfigs.preview
80+
debuggable = false
81+
minifyEnabled = false
82+
shrinkResources = false
83+
signingConfig = signingConfigs.preview
8984
}
9085

9186
release {
92-
debuggable false
93-
minifyEnabled true
94-
shrinkResources true
95-
signingConfig signingConfigs.release
87+
debuggable = false
88+
minifyEnabled = true
89+
shrinkResources = true
90+
signingConfig = signingConfigs.release
9691
}
9792
}
9893

9994
lint {
100-
abortOnError true
101-
checkReleaseBuilds false
102-
explainIssues true
103-
htmlReport true
95+
abortOnError = true
96+
checkReleaseBuilds = false
97+
explainIssues = true
98+
htmlReport = true
10499
}
105100

106101
splits {
107102
abi {
108-
enable true
103+
enable = true
109104
reset()
110-
include "armeabi-v7a", "arm64-v8a"
111-
universalApk true
105+
include("armeabi-v7a", "arm64-v8a", "x86_64")
106+
universalApk = true
112107
}
113108
}
114109
}
115110

116111
dependencies {
117-
implementation libs.taglib
118-
implementation libs.glide
119-
implementation libs.material
120-
implementation libs.transition
121-
implementation libs.fragment
122-
implementation libs.palette
123-
implementation libs.coordinatorlayout
124-
125-
implementation libs.media3.exoplayer
126-
implementation libs.media3.session
127-
// implementation libs.media3.cast
128-
129-
implementation libs.core.splashscreen
130-
implementation libs.activity
131-
132-
implementation libs.androidx.media
133-
implementation libs.customview.poolingcontainer
134-
implementation libs.recyclerview
135-
implementation libs.lifecycle.process
112+
implementation(libs.taglib)
113+
implementation(libs.glide)
114+
implementation(libs.material)
115+
implementation(libs.transition)
116+
implementation(libs.fragment)
117+
implementation(libs.palette)
118+
implementation(libs.coordinatorlayout)
119+
120+
implementation(libs.media3.exoplayer)
121+
implementation(libs.media3.session)
122+
123+
implementation(libs.core.splashscreen)
124+
implementation(libs.activity)
125+
126+
implementation(libs.androidx.media)
127+
implementation(libs.customview.poolingcontainer)
128+
implementation(libs.recyclerview)
129+
implementation(libs.lifecycle.process)
136130

137131
implementation(libs.media3.ffmpeg.decoder) {
138-
exclude group: "androidx.media3"
132+
exclude(group: "androidx.media3")
139133
}
140134

141-
implementation libs.colorseekbar
142-
implementation libs.lottie
143-
implementation libs.aboutlibraries.core
135+
implementation(libs.colorseekbar)
136+
implementation(libs.lottie)
137+
implementation(libs.aboutlibraries.core)
138+
144139

145-
implementation(name: "fastscroller", ext: "aar")
146-
implementation(name: "roundedimageview", ext: "aar")
140+
implementation files("libs/fastscroller.aar")
141+
implementation files("libs/roundedimageview.aar")
147142
}
148143

149144
tasks.withType(JavaCompile).configureEach {
150-
options.compilerArgs += [
145+
options.compilerArgs.addAll([
151146
"-Xlint:unchecked",
152147
"-Xlint:deprecation"
153-
]
154-
}
148+
])
149+
}

app/src/main/java/com/xapps/media/xmusic/activity/manager/LogicManager.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.os.Handler;
55
import android.os.Looper;
66
import android.view.View;
7+
import android.view.WindowManager;
78
import android.widget.SeekBar;
89

910
import androidx.activity.BackEventCompat;
@@ -23,6 +24,7 @@
2324
import com.xapps.media.xmusic.activity.RootActivity;
2425
import com.xapps.media.xmusic.activity.controller.ActivityMediaController;
2526
import com.xapps.media.xmusic.callback.CallbackInterface;
27+
import com.xapps.media.xmusic.data.DataManager;
2628
import com.xapps.media.xmusic.data.RuntimeData;
2729
import com.xapps.media.xmusic.databinding.ActivityRootBinding;
2830
import com.xapps.media.xmusic.service.XPlayerService;
@@ -106,8 +108,6 @@ public void onStopTrackingTouch(SeekBar seekBar) {
106108
}
107109
});
108110

109-
// ----- THIS PREVENTS SEEKBAR FROM STEALING FOCUS IN PLAYER SHEET
110-
111111
binding.expandedPlayer.songSeekbar.setOnClickListener(v -> {});
112112

113113
binding.expandedPlayer.previousButton.setOnHoldListener(R.drawable.ic_rewind_10, () -> {
@@ -217,11 +217,13 @@ public void onClick(View _view) {
217217

218218
if (checked) {
219219
binding.miniPlayer.setDraggable(false);
220+
if (DataManager.getKeepScreenAwakeState()) activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
220221
binding.lyricsContainer.animate().alpha(1f).translationY(0f).setDuration(300L).withStartAction(() -> {
221222
if (binding.lyricsContainer.getParent() == null) binding.miniPlayer.addView(binding.lyricsContainer);
222223
binding.lyricsContainer.setVisibility(View.VISIBLE);
223224
}).start();
224225
} else {
226+
if (DataManager.getKeepScreenAwakeState()) activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
225227
binding.miniPlayer.setDraggable(true);
226228
binding.lyricsContainer.animate().alpha(0f).translationY(150f).setDuration(300L).withEndAction(() -> {
227229
binding.lyricsContainer.setVisibility(View.GONE);
@@ -287,6 +289,8 @@ public void handleOnBackPressed() {
287289
lyricsCallback.setEnabled(false);
288290
binding.expandedPlayer.lyricsButton.setChecked(false);
289291
binding.miniPlayer.setDraggable(true);
292+
293+
if (DataManager.getKeepScreenAwakeState()) activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
290294
}
291295

292296
@Override

app/src/main/java/com/xapps/media/xmusic/activity/manager/UIManager.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ private void setupInitialState() {
215215
binding.collapsedPlayer.motionRoot.setClipChildren(false);
216216

217217
loadSettings();
218+
updateLyrics();
218219
}
219220

220221
// [ -------------- Layout State management methods ----------
@@ -1045,14 +1046,16 @@ public void loadSettings() {
10451046
isBlurOn = DataManager.isBlurOn();
10461047
if (XUtils.areBlursOrDynamicColorsSupported() && !isBlurOn) binding.Coordinator.setRenderEffect(null);
10471048
binding.xlyricsView.updateActiveStates();
1048-
binding.gradientView.setVisibility((DataManager.sp.getBoolean("enable_lyrics_gradient", false) && !isOledTheme )? View.VISIBLE : View.GONE);
10491049
updateFontConfig();
10501050
}
10511051

10521052
public void updateLyrics() {
10531053
binding.lyricsView.setStaticScroll(DataManager.getStaticScrollState());
10541054
binding.lyricsView.setUserStaticScroll(DataManager.getUserStaticScrollState());
10551055
binding.lyricsView.setEnableSparkles(DataManager.getUseSparklesState());
1056+
binding.lyricsView.setLyricAnticipation(DataManager.getLyricsAnticipationState());
1057+
binding.gradientView.setVisibility((DataManager.sp.getBoolean("enable_lyrics_gradient", false) && !isOledTheme )? View.VISIBLE : View.GONE);
1058+
binding.lyricsView.setEnableBlurs(DataManager.getLyricsBlurState());
10561059
}
10571060

10581061
public void updateFontConfig() {

app/src/main/java/com/xapps/media/xmusic/data/DataManager.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,15 @@ public static boolean getUseSparklesState() {
185185
return sp.getBoolean("lyrics_sparkles", false);
186186
}
187187

188+
public static boolean getLyricsAnticipationState() {
189+
return sp.getBoolean("lyrics_anticipation", false);
190+
}
191+
192+
public static boolean getLyricsBlurState() {
193+
return sp.getBoolean("lyrics_blur", false);
194+
}
195+
196+
public static boolean getKeepScreenAwakeState() {
197+
return sp.getBoolean("lyrics_keep_screen_awake", false);
198+
}
188199
}

app/src/main/java/com/xapps/media/xmusic/fragment/AboutFragment.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
package com.xapps.media.xmusic.fragment;
22

3-
import android.graphics.Color;
3+
import android.content.Intent;
4+
import android.net.Uri;
45
import android.os.Bundle;
56
import android.view.LayoutInflater;
67
import android.view.View;
78
import android.view.ViewGroup;
89
import androidx.annotation.NonNull;
910
import androidx.annotation.Nullable;
1011
import androidx.fragment.app.Fragment;
11-
import com.google.android.material.transition.MaterialContainerTransform;
1212
import com.xapps.media.xmusic.R;
1313
import com.xapps.media.xmusic.BuildConfig;
1414
import com.xapps.media.xmusic.activity.RootActivity;
1515
import com.xapps.media.xmusic.databinding.FragmentAboutBinding;
16-
import com.xapps.media.xmusic.utils.MaterialColorUtils;
17-
import com.xapps.media.xmusic.utils.XUtils;
1816
import java.util.Random;
1917

2018
public class AboutFragment extends SubFragment {
@@ -42,8 +40,11 @@ public class AboutFragment extends SubFragment {
4240
"Thanks for using the app. Seriously.",
4341
"Curiosity killed the cat",
4442
"HELP IM BEING ABUSED (/jk)",
45-
"Fun fact, fully built on a mobile IDE so far :>"
43+
"Fun fact, fully built on a mobile IDE so far :>\nUPDATE: not anymore I got anew PC :DD"
4644
};
45+
46+
private final String TELEGRAM_LINk = "https://t.me/xmusiccommunity";
47+
private final String GITHUB_LINk = "https://github.com/foedusprogramme/xmusic";
4748

4849
@Override
4950
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -74,6 +75,7 @@ private void setupUI() {
7475
});
7576

7677
binding.toolbar.setNavigationOnClickListener(v -> {
78+
assert getActivity() != null;
7779
getActivity().getOnBackPressedDispatcher().onBackPressed();
7880
activity.getUIManager().hideComponents(activity.getUIManager().playerHidden, false, activity.getUIManager().tabsHidden, "AboutFragment");
7981
});
@@ -83,15 +85,17 @@ private void setupUI() {
8385
}
8486

8587
private void setupListeners() {
86-
binding.thirdItem.setOnClickListener(v -> {
87-
activity.showInfoDialog("Build Flavors", R.drawable.ic_info_outline, "XMusic has 3 different Build Flavors : release, debug, and preview.\n\n• Debug builds are the biggest in size and usually full of logging and debug stuff, that's why it's noticeably slower and dosen't reflect real app performance.\n\n• Preview builds are significantly smaller in size than debug builds, they are stripped from most of debug logic but not obfuscated, they should be much smoother and performant.\n\n• Release builds are the smallest in size and they're highly optimized and obfuscated, you'll usually be able to get this only from GitHub releases (when I make one :P).", "Got it", binding.coordinator);
88-
});
89-
binding.secondItem.setOnClickListener(v -> {
90-
activity.showInfoDialog("Release types", R.drawable.ic_info_outline, "XMusic has 3 different Build Flavors : Alpha, Beta, and Stable.\n\n• Alpha : Experimental builds with unfinished features.\nExpect bugs, crashes, and frequent changes.\n\n• Beta : Mostly stable with new features still being tested.\nMinor bugs and performance issues may occur.\n\n• Stable : Almost fully tested and optimized for daily use.\nBest performance and reliability.", "Got it", binding.coordinator);
91-
});
92-
binding.fourthItem.setOnClickListener(v -> {
93-
openFragment(new UsedLibsFragment());
94-
});
88+
binding.thirdItem.setOnClickListener(v -> activity.showInfoDialog("Build Flavors", R.drawable.ic_info_outline, "XMusic has 3 different Build Flavors : release, debug, and preview.\n\n• Debug builds are the biggest in size and usually full of logging and debug stuff, that's why it's noticeably slower and doesn't reflect real app performance.\n\n• Preview builds are significantly smaller in size than debug builds, they are stripped from most of debug logic but not obfuscated, they should be much smoother and performant.\n\n• Release builds are the smallest in size and they're highly optimized and obfuscated, you'll usually be able to get this only from GitHub releases (when I make one :P).", "Got it", binding.coordinator));
89+
binding.secondItem.setOnClickListener(v -> activity.showInfoDialog("Release types", R.drawable.ic_info_outline, "XMusic has 3 different Build Flavors : Alpha, Beta, and Stable.\n\n• Alpha : Experimental builds with unfinished features.\nExpect bugs, crashes, and frequent changes.\n\n• Beta : Mostly stable with new features still being tested.\nMinor bugs and performance issues may occur.\n\n• Stable : Almost fully tested and optimized for daily use.\nBest performance and reliability.", "Got it", binding.coordinator));
90+
binding.fourthItem.setOnClickListener(v -> openFragment(new UsedLibsFragment()));
91+
binding.fifthItem.setOnClickListener(v -> openLink(GITHUB_LINk));
92+
binding.sixthItem.setOnClickListener(v -> openLink(TELEGRAM_LINk));
93+
}
94+
95+
private void openLink(String link) {
96+
Intent intent = new Intent(Intent.ACTION_VIEW);
97+
intent.setData(Uri.parse(link));
98+
startActivity(intent);
9599
}
96100

97101
private void openFragment(Fragment f) {

app/src/main/java/com/xapps/media/xmusic/fragment/BasePrefsFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public static class SpacingDecoration extends ItemDecoration {
240240

241241
public SpacingDecoration(Context context) {
242242
topSpacing = XUtils.convertToPx(context, 12f);
243-
bottomSpacing = XUtils.convertToPx(context, 12f);
243+
bottomSpacing = Math.round(XUtils.getNavigationBarHeight(context) * 1.5f);
244244
spacing = XUtils.convertToPx(context, 2f);
245245
}
246246

0 commit comments

Comments
 (0)