Skip to content

Commit 85992e5

Browse files
committed
Reformat code, add .editorconfig
1 parent 0deed96 commit 85992e5

File tree

243 files changed

+24462
-10905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+24462
-10905
lines changed

.editorconfig

Lines changed: 1102 additions & 0 deletions
Large diffs are not rendered by default.

app/src/debug/java/com/android/development/MediaScannerActivity.java

Lines changed: 228 additions & 231 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
2-
<background android:drawable="@android:color/black"/>
3-
<foreground android:drawable="@android:drawable/stat_notify_sdcard"/>
2+
<background android:drawable="@android:color/black" />
3+
<foreground android:drawable="@android:drawable/stat_notify_sdcard" />
44
</adaptive-icon>
Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- Copyright (C) 2007 The Android Open Source Project
1+
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2007 The Android Open Source Project
32
Licensed under the Apache License, Version 2.0 (the "License");
43
you may not use this file except in compliance with the License.
54
You may obtain a copy of the License at
@@ -11,47 +10,49 @@
1110
limitations under the License.
1211
-->
1312
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
14-
android:layout_width="match_parent"
15-
android:layout_height="match_parent"
16-
android:orientation="vertical">
17-
<!--
18-
<TextView
19-
android:id="@+id/warning"
20-
android:text="Warning, remember to run SD scanner or Android 10 on older only..."
21-
android:textSize="16sp"
22-
android:textStyle="bold"
23-
android:layout_width="match_parent"
24-
android:layout_height="wrap_content" />
25-
-->
26-
<Button
27-
android:layout_width="160dip"
28-
android:layout_height="wrap_content"
29-
android:layout_gravity="center_horizontal"
30-
android:text="@string/scancard"
31-
android:onClick="startScan" />
13+
android:layout_width="match_parent"
14+
android:layout_height="match_parent"
15+
android:orientation="vertical">
16+
<!--
17+
<TextView
18+
android:id="@+id/warning"
19+
android:text="Warning, remember to run SD scanner or Android 10 on older only..."
20+
android:textSize="16sp"
21+
android:textStyle="bold"
22+
android:layout_width="match_parent"
23+
android:layout_height="wrap_content" />
24+
-->
25+
<Button
26+
android:layout_width="160dip"
27+
android:layout_height="wrap_content"
28+
android:layout_gravity="center_horizontal"
29+
android:onClick="startScan"
30+
android:text="@string/scancard" />
3231

33-
<TextView
34-
android:id="@+id/title"
35-
android:textSize="16sp"
36-
android:textStyle="bold"
37-
android:layout_width="match_parent"
38-
android:layout_height="wrap_content" />
39-
<LinearLayout
40-
android:layout_width="match_parent"
41-
android:layout_height="match_parent"
42-
android:orientation="horizontal"
43-
android:layout_marginTop="30dip">
44-
<EditText
45-
android:id="@+id/numsongs"
46-
android:layout_width="150dip"
47-
android:layout_height="wrap_content"
48-
android:hint="@string/numsongs"
49-
android:inputType="number"
50-
/>
51-
<Button
52-
android:id="@+id/insertbutton"
53-
android:layout_width="150dip"
54-
android:layout_height="wrap_content"
55-
android:onClick="insertItems" />
56-
</LinearLayout>
32+
<TextView
33+
android:id="@+id/title"
34+
android:layout_width="match_parent"
35+
android:layout_height="wrap_content"
36+
android:textSize="16sp"
37+
android:textStyle="bold" />
38+
39+
<LinearLayout
40+
android:layout_width="match_parent"
41+
android:layout_height="match_parent"
42+
android:layout_marginTop="30dip"
43+
android:orientation="horizontal">
44+
45+
<EditText
46+
android:id="@+id/numsongs"
47+
android:layout_width="150dip"
48+
android:layout_height="wrap_content"
49+
android:hint="@string/numsongs"
50+
android:inputType="number" />
51+
52+
<Button
53+
android:id="@+id/insertbutton"
54+
android:layout_width="150dip"
55+
android:layout_height="wrap_content"
56+
android:onClick="insertItems" />
57+
</LinearLayout>
5758
</LinearLayout>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
3-
<!-- MediaScannerActivity -->
4-
<string name="scancard">Scan SD card</string>
5-
<string name="numsongs"># of albums</string>
6-
<string name="insertbutton">Insert %1d albums</string>
3+
<!-- MediaScannerActivity -->
4+
<string name="scancard">Scan SD card</string>
5+
<string name="numsongs"># of albums</string>
6+
<string name="insertbutton">Insert %1d albums</string>
77
</resources>

app/src/main/java/org/akanework/gramophone/logic/GramophoneApplication.kt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ import android.os.StrictMode
3030
import android.os.StrictMode.ThreadPolicy
3131
import android.os.StrictMode.VmPolicy
3232
import android.provider.MediaStore
33-
import androidx.media3.common.util.Log
3433
import android.util.Size
3534
import android.webkit.MimeTypeMap
3635
import androidx.appcompat.app.AppCompatDelegate
3736
import androidx.compose.runtime.Composer
3837
import androidx.compose.runtime.ExperimentalComposeRuntimeApi
3938
import androidx.fragment.app.strictmode.FragmentStrictMode
39+
import androidx.media3.common.util.Log
4040
import androidx.media3.session.DefaultMediaNotificationProvider
4141
import androidx.preference.PreferenceManager
4242
import coil3.ImageLoader
@@ -82,6 +82,7 @@ class GramophoneApplication : Application(), SingletonImageLoader.Factory,
8282

8383
companion object {
8484
private const val TAG = "GramophoneApplication"
85+
8586
// not actually defined in API, but CTS tested
8687
// https://cs.android.com/android/platform/superproject/main/+/main:packages/providers/MediaProvider/src/com/android/providers/media/LocalUriMatcher.java;drc=ddf0d00b2b84b205a2ab3581df8184e756462e8d;l=182
8788
private const val MEDIA_ALBUM_ART = "albumart"
@@ -121,7 +122,8 @@ class GramophoneApplication : Application(), SingletonImageLoader.Factory,
121122
.detectAll()
122123
.let {
123124
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.UPSIDE_DOWN_CAKE ||
124-
Build.VERSION.SDK_INT == Build.VERSION_CODES.VANILLA_ICE_CREAM) {
125+
Build.VERSION.SDK_INT == Build.VERSION_CODES.VANILLA_ICE_CREAM
126+
) {
125127
it.permitExplicitGc() // platform bug, now fixed
126128
} else it
127129
}
@@ -265,7 +267,8 @@ class GramophoneApplication : Application(), SingletonImageLoader.Factory,
265267
return@Factory Fetcher {
266268
val file = File(data.path!!)
267269
val uri = ContentUris.appendId(
268-
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI.buildUpon(), data.authority!!.toLong()
270+
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI.buildUpon(),
271+
data.authority!!.toLong()
269272
).appendPath(MEDIA_ALBUM_ART).build()
270273
val bmp = if (options.size.width.pxOrElse { 0 } > 300
271274
&& options.size.height.pxOrElse { 0 } > 300) try {
@@ -280,7 +283,8 @@ class GramophoneApplication : Application(), SingletonImageLoader.Factory,
280283
if (e.message != "No embedded album art found" &&
281284
e.message != "No thumbnails in Downloads directories" &&
282285
e.message != "No thumbnails in top-level directories" &&
283-
e.message != "No album art found")
286+
e.message != "No album art found"
287+
)
284288
throw e
285289
null
286290
} else null
@@ -311,7 +315,10 @@ class GramophoneApplication : Application(), SingletonImageLoader.Factory,
311315
val cover = MiscUtils.findBestCover(File(data.path!!))
312316
if (cover == null) {
313317
val uri =
314-
ContentUris.withAppendedId(Constants.baseAlbumCoverUri, data.authority!!.toLong())
318+
ContentUris.withAppendedId(
319+
Constants.baseAlbumCoverUri,
320+
data.authority!!.toLong()
321+
)
315322
val contentResolver = options.context.contentResolver
316323
val afd = contentResolver.openAssetFileDescriptor(uri, "r")
317324
checkNotNull(afd) { "Unable to open '$uri'." }

app/src/main/java/org/akanework/gramophone/logic/GramophoneExtensions.kt

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -214,32 +214,34 @@ fun View.fadOutAnimation(
214214
}
215215
(getTag(R.id.fade_in_animation) as ViewPropertyAnimator?)?.cancel()
216216
(getTag(R.id.fade_out_animation) as ViewPropertyAnimator?)?.cancel()
217-
setTag(R.id.fade_out_animation, animate()
218-
.alpha(0f)
219-
.setDuration(CalculationUtils.lerp(0f, duration.toFloat(), this.alpha).toLong())
220-
.withEndAction {
221-
this.visibility = visibility
222-
setTag(R.id.fade_out_animation, null)
223-
completion?.let {
224-
it()
225-
}
226-
})
217+
setTag(
218+
R.id.fade_out_animation, animate()
219+
.alpha(0f)
220+
.setDuration(CalculationUtils.lerp(0f, duration.toFloat(), this.alpha).toLong())
221+
.withEndAction {
222+
this.visibility = visibility
223+
setTag(R.id.fade_out_animation, null)
224+
completion?.let {
225+
it()
226+
}
227+
})
227228
}
228229

229230
fun View.fadInAnimation(duration: Long = 300, completion: (() -> Unit)? = null) {
230231
(getTag(R.id.fade_in_animation) as ViewPropertyAnimator?)?.cancel()
231232
(getTag(R.id.fade_out_animation) as ViewPropertyAnimator?)?.cancel()
232233
alpha = 0f
233234
visibility = View.VISIBLE
234-
setTag(R.id.fade_in_animation, animate()
235-
.alpha(1f)
236-
.setDuration(CalculationUtils.lerp(duration.toFloat(), 0f, this.alpha).toLong())
237-
.withEndAction {
238-
setTag(R.id.fade_in_animation, null)
239-
completion?.let {
240-
it()
241-
}
242-
})
235+
setTag(
236+
R.id.fade_in_animation, animate()
237+
.alpha(1f)
238+
.setDuration(CalculationUtils.lerp(duration.toFloat(), 0f, this.alpha).toLong())
239+
.withEndAction {
240+
setTag(R.id.fade_in_animation, null)
241+
completion?.let {
242+
it()
243+
}
244+
})
243245
}
244246

245247
@Suppress("NOTHING_TO_INLINE")
@@ -262,7 +264,7 @@ fun MediaController.getTimer(): Pair<Int?, Boolean> =
262264
getInt("duration")
263265
else null) to (if (containsKey("pauseOnEnd"))
264266
getBoolean("pauseOnEnd")
265-
else throw IllegalArgumentException("expected pauseOnEnd to be set"))
267+
else throw IllegalArgumentException("expected pauseOnEnd to be set"))
266268
}
267269

268270
fun MediaController.setTimer(value: Int, waitUntilSongEnd: Boolean) {
@@ -311,11 +313,16 @@ fun MediaController.getAudioFormat(): AudioFormatDetector.AudioFormats =
311313
Bundle.EMPTY
312314
).get().extras.let {
313315
AudioFormatDetector.AudioFormats(
314-
BundleCompat.getParcelableArrayList(it, "file_format",
315-
Bundle::class.java)?.let { bundles -> bundles.map { bundle ->
316-
bundle.getInt("type", C.TRACK_TYPE_UNKNOWN) to
317-
(Format.fromBundle(bundle.getBundle("format")!!)
318-
to ReplayGainUtil.ReplayGainInfo.fromBundle(bundle.getBundle("rg")!!)) } },
316+
BundleCompat.getParcelableArrayList(
317+
it, "file_format",
318+
Bundle::class.java
319+
)?.let { bundles ->
320+
bundles.map { bundle ->
321+
bundle.getInt("type", C.TRACK_TYPE_UNKNOWN) to
322+
(Format.fromBundle(bundle.getBundle("format")!!)
323+
to ReplayGainUtil.ReplayGainInfo.fromBundle(bundle.getBundle("rg")!!))
324+
}
325+
},
319326
it.getBundle("sink_format")?.let { bundle -> Format.fromBundle(bundle) },
320327
BundleCompat.getParcelable(it, "track_format", AudioTrackInfo::class.java),
321328
BundleCompat.getParcelable(it, "hal_format", AfFormatInfo::class.java),

0 commit comments

Comments
 (0)