main
h4h13 2018-11-05 19:23:07 +05:30
parent 3d7ba2afc6
commit 08e00b89c5
341 changed files with 7612 additions and 6811 deletions

View File

@ -29,9 +29,9 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/normal/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/normalDebug/processNormalDebugResources/r" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/normalDebug/compileNormalDebugAidl/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/normal/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/normal/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/normalDebug/compileNormalDebugRenderscript/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/normal/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/normal/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/normal/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/normalDebug/res" type="java-resource" />
@ -43,9 +43,9 @@
<sourceFolder url="file://$MODULE_DIR$/src/normalDebug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/normal/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/normalDebugAndroidTest/processNormalDebugAndroidTestResources/r" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/normalDebugAndroidTest/compileNormalDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/normal/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/normal/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/normalDebugAndroidTest/compileNormalDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/normal/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/normal/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/normal/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNormalDebug/res" type="java-test-resource" />
@ -131,39 +131,33 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<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/checkNormalDebugClasspath" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkNormalReleaseClasspath" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkSansDebugClasspath" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkSansReleaseClasspath" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check_manifest_result" />
<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-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_app_info_output_file" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_main_apk_resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_merged_manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_split_apk_resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
<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/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_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/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/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shrunk_linked_res_for_bundle" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split_list" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
@ -172,82 +166,83 @@
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:okhttp3-integration:1.5.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: com.github.ksoichiro:android-observablescrollview:1.6.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.multidex:multidex:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.preference:preference:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement-15.0.1" level="project" />
<orderEntry type="library" name="Gradle: com.sothree.slidinguppanel:library-3.4.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-2.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:retrofit:2.4.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.0.0-rc01@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.0.0-rc02@jar" level="project" />
<orderEntry type="library" name="Gradle: uk.co.chrisjenx:calligraphy:2.3.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.palette:palette:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.material:material:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v4:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.documentfile:documentfile:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.print:print:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-cast:16.0.2@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.gridlayout:gridlayout:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.cardview:cardview-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.afollestad:material-cab-0.1.12" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.material:material-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.h6ah4i.android.widget.advrecyclerview:advrecyclerview-0.11.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.fragment:fragment-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel-2.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.github.kabouzeid:RecyclerView-FastScroll-1.0.16-kmod" level="project" />
<orderEntry type="library" name="Gradle: com.squareup.okio:okio:1.14.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.0.0-rc01@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-cast-framework:16.0.2@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.documentfile:documentfile-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.github.ksoichiro:android-observablescrollview-1.6.0" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-cast-framework-16.0.2" level="project" />
<orderEntry type="library" name="Gradle: androidx.recyclerview:recyclerview-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:logging-interceptor:3.11.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.core:core:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-runtime:9.0.0-SNAPSHOT@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base:15.0.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.afollestad.material-dialogs:core-0.9.6.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:adapter-rxjava2:2.4.0@jar" level="project" />
<orderEntry type="library" name="Gradle: com.anjlab.android.iab.v3:library:1.0.44@jar" level="project" />
<orderEntry type="library" name="Gradle: uk.co.chrisjenx:calligraphy-2.3.0" level="project" />
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:converter-gson:2.4.0@jar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks:15.0.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.mediarouter:mediarouter:1.0.0-beta01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: com.afollestad.material-dialogs:core:0.9.6.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v4-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.palette:palette-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks-15.0.1" level="project" />
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-annotations:9.0.0-SNAPSHOT@jar" level="project" />
<orderEntry type="library" name="Gradle: __local_aars__:/Users/hemanths/Desktop/KeepSafe/RetroMusicPlayer/app/libs/juniversalchardet-1.0.3.jar:unspecified@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.transition:transition:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: io.reactivex.rxjava2:rxandroid:2.0.2@aar" level="project" />
<orderEntry type="library" name="Gradle: io.reactivex.rxjava2:rxjava:2.1.17@jar" level="project" />
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-runtime-9.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Gradle: androidx.gridlayout:gridlayout-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.multidex:multidex-2.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime-2.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:okhttp:3.11.0@jar" level="project" />
<orderEntry type="library" name="Gradle: com.r0adkll:slidableactivity:2.0.6@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: io.reactivex.rxjava2:rxjava:2.1.9@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.media:media-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.r0adkll:slidableactivity-2.0.6" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core-2.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.core:core-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: org.reactivestreams:reactive-streams:1.0.2@jar" level="project" />
<orderEntry type="library" name="Gradle: com.github.AdrienPoupa:jaudiotagger:2.2.3@aar" level="project" />
<orderEntry type="library" name="Gradle: me.zhanghai.android.materialprogressbar:library-1.4.2" level="project" />
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:glide:3.8.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.recyclerview:recyclerview:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base-15.0.1" level="project" />
<orderEntry type="library" name="Gradle: org.nanohttpd:nanohttpd:2.3.1@jar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement:15.0.1@aar" level="project" />
<orderEntry type="library" name="Gradle: com.simplecityapps:recyclerview-fastscroll:1.0.18@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: com.afollestad:material-cab:0.1.12@aar" level="project" />
<orderEntry type="library" name="Gradle: com.sothree.slidinguppanel:library:3.4.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-preference-v14:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: me.zhanghai.android.materialprogressbar:library:1.4.2@aar" level="project" />
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife:9.0.0-SNAPSHOT@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.cardview:cardview:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-flags:15.0.1@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.mediarouter:mediarouter-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-9.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Gradle: androidx.transition:transition-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.0.0@jar" level="project" />
<orderEntry type="library" name="Gradle: com.afollestad.material-dialogs:commons-0.9.6.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-preference-v14-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-cast-16.0.2" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v13-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.0.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: io.reactivex.rxjava2:rxandroid-2.0.2" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime-2.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.preference:preference-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.github.AdrienPoupa:jaudiotagger-2.2.3" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.0.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.8.2@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.loader:loader:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.media:media:1.0.0-rc02@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.0.0-rc02@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v13:1.0.0-rc01@aar" level="project" />
<orderEntry type="library" name="Gradle: com.afollestad.material-dialogs:commons:0.9.6.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.loader:loader-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.customview:customview-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-flags-15.0.1" level="project" />
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.print:print-1.0.0" level="project" />
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.0.0@jar" level="project" />
<orderEntry type="module" module-name="appthemehelper" />
</component>
</module>

View File

@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.2'
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
@ -11,12 +11,11 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 232
versionName '2.0.210'
versionCode 242
versionName '2.1.000'
multiDexEnabled true
buildConfigField("String", "LASTFM_API_KEY", "\"${getProperty(getProperties('../public.properties'), 'LASTFM_API_KEY')}\"")
buildConfigField("String", "GOOGLE_PLAY_LICENSE_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"")
}
signingConfigs {
@ -46,12 +45,14 @@ android {
flavorDimensions "default"
productFlavors {
normal {
versionCode defaultConfig.versionCode + 10000
versionName defaultConfig.versionName + "_" + getDate()
dimension "default"
}
}
packagingOptions {
@ -73,16 +74,7 @@ android {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
/*configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!(requested.name.startsWith("multidex") || requested.name.startsWith("mediarouter"))) {
details.useVersion $supportLibVersion
}
}
}
}*/
}
def getProperties(String fileName) {
@ -119,28 +111,30 @@ dependencies {
implementation "com.google.android.material:material:$supportLibVersion"
//For casting
implementation 'androidx.mediarouter:mediarouter:1.0.0-beta01'
implementation 'androidx.mediarouter:mediarouter:1.0.0'
implementation 'com.google.android.gms:play-services-cast-framework:16.0.2'
implementation "com.squareup.retrofit2:retrofit:2.4.0"
implementation "com.squareup.retrofit2:converter-gson:2.4.0"
implementation "com.squareup.retrofit2:adapter-rxjava2:2.4.0"
implementation "com.jakewharton:butterknife:$butterKnife"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnife"
implementation "com.afollestad.material-dialogs:core:$materialDialog"
implementation "com.afollestad.material-dialogs:commons:$materialDialog"
implementation 'com.afollestad:material-cab:0.1.12'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:1.5.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.9'
implementation 'io.reactivex.rxjava2:rxjava:2.1.17'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') {
transitive = true
}
implementation 'com.github.ksoichiro:android-observablescrollview:1.6.0'
implementation 'com.simplecityapps:recyclerview-fastscroll:1.0.18'
implementation 'com.github.kabouzeid:RecyclerView-FastScroll:1.0.16-kmod'
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
/*UI Library*/

View File

@ -95,7 +95,6 @@
<data android:mimeType="vnd.android.cursor.dir/audio" />
</intent-filter>
</activity>
<activity android:name=".ui.activities.AlbumDetailsActivity" />
<activity android:name=".ui.activities.ArtistDetailActivity" />
<activity android:name=".ui.activities.PlaylistDetailActivity" />
@ -133,7 +132,6 @@
<service
android:name=".service.MusicService"
android:enabled="true" />
<service
android:name=".service.WearBrowserService"
android:exported="true">
@ -142,25 +140,27 @@
</intent-filter>
</service>
<!--<service-->
<!--android:name=".service.daydream.RetroMusicAlbums"-->
<!--android:exported="true"-->
<!--android:label="Retro Music Albums"-->
<!--android:permission="android.permission.BIND_DREAM_SERVICE">-->
<!--<intent-filter>-->
<!--<action android:name="android.service.dreams.DreamService" />-->
<!--<category android:name="android.intent.category.DEFAULT" />-->
<!--</intent-filter>-->
<!--</service>-->
<!-- <service -->
<!-- android:name=".service.daydream.RetroMusicAlbums" -->
<!-- android:exported="true" -->
<!-- android:label="Retro Music Albums" -->
<!-- android:permission="android.permission.BIND_DREAM_SERVICE"> -->
<!-- <intent-filter> -->
<!-- <action android:name="android.service.dreams.DreamService" /> -->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<!-- </intent-filter> -->
<!-- </service> -->
<!-- Widgets -->
<!-- <receiver
<!--
<receiver
android:name=".headset.HeadsetReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.HEADSET_PLUG" />
</intent-filter>
</receiver>-->
</receiver>
-->
<receiver android:name=".appwidgets.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
@ -220,8 +220,7 @@
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
<!--Widgets ends-->
<!-- Widgets ends -->
<meta-data
android:name="android.max_aspect"
@ -238,9 +237,12 @@
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="code.name.monkey.retromusic.cast.CastOptionsProvider" />
<!-- <meta-data
<!--
<meta-data
android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc" />-->
android:resource="@xml/automotive_app_desc" />
-->
<provider
android:name="androidx.core.content.FileProvider"
@ -252,6 +254,9 @@
android:resource="@xml/provider_paths" />
</provider>
<activity android:name=".ui.activities.WhatsNewActivity"></activity>
<activity android:name=".ui.activities.album.SmallAlbumDetailsActivity" />
<activity android:name=".ui.activities.NowPayingActivity" />
</application>
</manifest>

View File

@ -5,6 +5,12 @@
"link": "https://t.me/FlixbusLennart",
"profile_image": "https://i.imgur.com/Q5Nsx1R.jpg"
},
{
"name": "Vitor Monteriro",
"summary": "Telegram contributor",
"link": "https://t.me/mluizvitor",
"profile_image": "https://i.imgur.com/vvpE4nn.jpg"
},
{
"name": "Elvan Putra",
"summary": "Design contributor",
@ -14,7 +20,7 @@
{
"name": "Gaming Inc.",
"summary": "Discord server maintainer",
"link": "https://t.me/Gaming_Inc",
"link": "https://discord.gg/qTecXXn",
"profile_image": "https://i.imgur.com/5wXLrS2.jpg"
},
{
@ -25,7 +31,7 @@
},
{
"name": "Gaurav Singh",
"summary": "Moderator",
"summary": "Telegram and Design contributor",
"link": "https://t.me/Allstargaurav",
"profile_image": "https://i.imgur.com/EertxDu.jpg"
}

View File

@ -1 +1 @@
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: #{link-color}; } a:active { color: #{link-color-active}; } ol { list-style-position: inside; padding-left: 0; padding-right: 0; } li { padding-top: 8px; } </style> </head> <body> <p>You can view the changelog dialog again at any time from the <i>about</i> section.</p> <h3>Version 2.0.200</h3> <ol> <li><b>Fix:</b> artist name on card theme</li> <li><b>Fix:</b> dialog navigation icons colors</li> <li><b>Fix:</b> album cover edit with last.fm for above Android 8.0</li> <li><b>Fix:</b> adaptive controls for material theme</li> </style> </head> <li><b>Added:</b> home artists cover style(Settings-> Personalize-> Home artist grid)</li> <li><b>Added:</b> now playing cover sliding style(Settings-> Now playing-> Now playing album cover style) </li> <li><b>Added:</b> now playing album cover style chooser(Settings->Now playing-> Album cover theme) </li> </style> <li><b>Fix:</b> dialog navigation icons colors</li> </li> </head> </head> </style> </head> </head> </head> <body> </head> </li> </head> <p>You can view the changelog dialog again at any time from the <i>about</i> section.</p> </head> <h3>Version 2.0.200</h3> <li><b>Updated:</b> internal libs</li> <li><b>Updated:</b> synced translations</li> </ol> <p><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a></p> <p>*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>
<html> <head> <style type="text/css"> * { word-wrap: break-word; } {style-placeholder} a { color: #{link-color}; } a:active { color: #{link-color-active}; } ol { list-style-position: inside; padding-left: 0; padding-right: 0; } li { padding-top: 8px; } </style> </head> <body> <p>You can view the changelog dialog again at any time from the <i>about</i> section.</p> </head> <li><b>Fix:</b> dialog navigation icons colors</li> <ol> <body> <body> </style> <body> </head> <body> <body> <body> <body> <p>You can view the changelog dialog again at any time from the <i>about</i> section.</p> <body> <h3>Version 2.0.200</h3> s</li> </ol> <p><a href="https://github.com/h4h13/RetroMusicPlayer/wiki/FAQ">FAQ's</a></p> <p>*If you face any UI related issues you clear app data and cache, if its not working try to uninstall and install again. </p> </body>

View File

@ -1,5 +1,6 @@
package code.name.monkey.retromusic;
import android.content.Context;
import android.os.Build;
import com.anjlab.android.iab.v3.BillingProcessor;
@ -24,6 +25,10 @@ public class RetroApplication extends MultiDexApplication {
return app;
}
public static Context getContext() {
return app.getApplicationContext();
}
public static boolean isProVersion() {
return BuildConfig.DEBUG || app.billingProcessor.isPurchased(PRO_VERSION_PRODUCT_ID);
}

View File

@ -22,7 +22,7 @@ import code.name.monkey.retromusic.util.RetroUtil;
@RequiresApi(Build.VERSION_CODES.N_MR1)
public final class AppShortcutIconGenerator {
public static Icon generateThemedIcon(Context context, int iconId) {
if (PreferenceUtil.getInstance(context).coloredAppShortcuts()){
if (PreferenceUtil.getInstance().coloredAppShortcuts()){
return generateUserThemedIcon(context, iconId);
} else {
return generateDefaultThemedIcon(context, iconId);

View File

@ -7,10 +7,16 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import androidx.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.RemoteViews;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.target.Target;
import androidx.annotation.Nullable;
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
import code.name.monkey.retromusic.Constants;
import code.name.monkey.retromusic.R;
@ -19,153 +25,150 @@ import code.name.monkey.retromusic.glide.SongGlideRequest;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.ui.activities.NowPayingActivity;
import code.name.monkey.retromusic.util.RetroUtil;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.target.Target;
public class AppWidgetBig extends BaseAppWidget {
public static final String NAME = "app_widget_big";
public static final String NAME = "app_widget_big";
private static AppWidgetBig mInstance;
private Target<Bitmap> target; // for cancellation
private static AppWidgetBig mInstance;
private Target<Bitmap> target; // for cancellation
public static synchronized AppWidgetBig getInstance() {
if (mInstance == null) {
mInstance = new AppWidgetBig();
}
return mInstance;
}
/**
* Initialize given widgets to default state, where we launch Music on default click and hide
* actions if service not running.
*/
protected void defaultAppWidget(final Context context, final int[] appWidgetIds) {
final RemoteViews appWidgetView = new RemoteViews(context.getPackageName(),
R.layout.app_widget_big);
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art);
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(
RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp,
MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(
RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp,
MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(
RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp,
MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
linkButtons(context, appWidgetView);
pushUpdate(context, appWidgetIds, appWidgetView);
}
/**
* Update all active widget instances by pushing changes
*/
public void performUpdate(final MusicService service, final int[] appWidgetIds) {
final RemoteViews appWidgetView = new RemoteViews(service.getPackageName(),
R.layout.app_widget_big);
final boolean isPlaying = service.isPlaying();
final Song song = service.getCurrentSong();
// Set the titles and artwork
if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) {
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
} else {
appWidgetView.setViewVisibility(R.id.media_titles, View.VISIBLE);
appWidgetView.setTextViewText(R.id.title, song.title);
appWidgetView.setTextViewText(R.id.text, getSongArtistAndAlbum(song));
}
// Set correct drawable for pause state
int playPauseRes =
isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(
RetroUtil.getTintedVectorDrawable(service, playPauseRes,
MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
// Set prev/next button drawables
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(
RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp,
MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(
RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp,
MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
// Link actions buttons to intents
linkButtons(service, appWidgetView);
// Load the album cover async and push the update on completion
Point p = RetroUtil.getScreenSize(service);
final int widgetImageSize = Math.min(p.x, p.y);
final Context appContext = service.getApplicationContext();
service.runOnUiThread(new Runnable() {
@Override
public void run() {
if (target != null) {
Glide.clear(target);
public static synchronized AppWidgetBig getInstance() {
if (mInstance == null) {
mInstance = new AppWidgetBig();
}
target = SongGlideRequest.Builder.from(Glide.with(appContext), song)
.checkIgnoreMediaStore(appContext)
.asBitmap().build()
.into(new SimpleTarget<Bitmap>(widgetImageSize, widgetImageSize) {
@Override
public void onResourceReady(Bitmap resource,
GlideAnimation<? super Bitmap> glideAnimation) {
update(resource);
}
return mInstance;
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
update(null);
}
/**
* Initialize given widgets to default state, where we launch Music on default click and hide
* actions if service not running.
*/
protected void defaultAppWidget(final Context context, final int[] appWidgetIds) {
final RemoteViews appWidgetView = new RemoteViews(context.getPackageName(),
R.layout.app_widget_big);
private void update(@Nullable Bitmap bitmap) {
if (bitmap == null) {
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art);
} else {
appWidgetView.setImageViewBitmap(R.id.image, bitmap);
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art);
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(
RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_next_white_24dp,
MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(
RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_skip_previous_white_24dp,
MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(
RetroUtil.getTintedVectorDrawable(context, R.drawable.ic_play_arrow_white_24dp,
MaterialValueHelper.getPrimaryTextColor(context, false)), 1f));
linkButtons(context, appWidgetView);
pushUpdate(context, appWidgetIds, appWidgetView);
}
/**
* Update all active widget instances by pushing changes
*/
public void performUpdate(final MusicService service, final int[] appWidgetIds) {
final RemoteViews appWidgetView = new RemoteViews(service.getPackageName(),
R.layout.app_widget_big);
final boolean isPlaying = service.isPlaying();
final Song song = service.getCurrentSong();
// Set the titles and artwork
if (TextUtils.isEmpty(song.title) && TextUtils.isEmpty(song.artistName)) {
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE);
} else {
appWidgetView.setViewVisibility(R.id.media_titles, View.VISIBLE);
appWidgetView.setTextViewText(R.id.title, song.title);
appWidgetView.setTextViewText(R.id.text, getSongArtistAndAlbum(song));
}
// Set correct drawable for pause state
int playPauseRes =
isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(
RetroUtil.getTintedVectorDrawable(service, playPauseRes,
MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
// Set prev/next button drawables
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(
RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp,
MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(
RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp,
MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
// Link actions buttons to intents
linkButtons(service, appWidgetView);
// Load the album cover async and push the update on completion
Point p = RetroUtil.getScreenSize(service);
final int widgetImageSize = Math.min(p.x, p.y);
final Context appContext = service.getApplicationContext();
service.runOnUiThread(new Runnable() {
@Override
public void run() {
if (target != null) {
Glide.clear(target);
}
pushUpdate(appContext, appWidgetIds, appWidgetView);
}
});
}
});
}
target = SongGlideRequest.Builder.from(Glide.with(appContext), song)
.checkIgnoreMediaStore(appContext)
.asBitmap().build()
.into(new SimpleTarget<Bitmap>(widgetImageSize, widgetImageSize) {
@Override
public void onResourceReady(Bitmap resource,
GlideAnimation<? super Bitmap> glideAnimation) {
update(resource);
}
/**
* Link up various button actions using {@link PendingIntent}.
*/
private void linkButtons(final Context context, final RemoteViews views) {
Intent action;
PendingIntent pendingIntent;
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
update(null);
}
final ComponentName serviceName = new ComponentName(context, MusicService.class);
private void update(@Nullable Bitmap bitmap) {
if (bitmap == null) {
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_album_art);
} else {
appWidgetView.setImageViewBitmap(R.id.image, bitmap);
}
pushUpdate(appContext, appWidgetIds, appWidgetView);
}
});
}
});
}
// Home
action = new Intent(context, MainActivity.class);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
pendingIntent = PendingIntent.getActivity(context, 0, action, 0);
views.setOnClickPendingIntent(R.id.clickable_area, pendingIntent);
/**
* Link up various button actions using {@link PendingIntent}.
*/
private void linkButtons(final Context context, final RemoteViews views) {
Intent action;
PendingIntent pendingIntent;
// Previous track
pendingIntent = buildPendingIntent(context, Constants.ACTION_REWIND, serviceName);
views.setOnClickPendingIntent(R.id.button_prev, pendingIntent);
final ComponentName serviceName = new ComponentName(context, MusicService.class);
// Play and pause
pendingIntent = buildPendingIntent(context, Constants.ACTION_TOGGLE_PAUSE, serviceName);
views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent);
// Home
action = new Intent(context, NowPayingActivity.class);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
pendingIntent = PendingIntent.getActivity(context, 0, action, 0);
views.setOnClickPendingIntent(R.id.clickable_area, pendingIntent);
// Next track
pendingIntent = buildPendingIntent(context, Constants.ACTION_SKIP, serviceName);
views.setOnClickPendingIntent(R.id.button_next, pendingIntent);
// Previous track
pendingIntent = buildPendingIntent(context, Constants.ACTION_REWIND, serviceName);
views.setOnClickPendingIntent(R.id.button_prev, pendingIntent);
// Play and pause
pendingIntent = buildPendingIntent(context, Constants.ACTION_TOGGLE_PAUSE, serviceName);
views.setOnClickPendingIntent(R.id.button_toggle_play_pause, pendingIntent);
// Next track
pendingIntent = buildPendingIntent(context, Constants.ACTION_SKIP, serviceName);
views.setOnClickPendingIntent(R.id.button_next, pendingIntent);
}
}
}

View File

@ -26,6 +26,7 @@ import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.ui.activities.NowPayingActivity;
import code.name.monkey.retromusic.util.RetroUtil;
public class AppWidgetCard extends BaseAppWidget {
@ -175,7 +176,7 @@ public class AppWidgetCard extends BaseAppWidget {
final ComponentName serviceName = new ComponentName(context, MusicService.class);
// Home
action = new Intent(context, MainActivity.class);
action = new Intent(context, NowPayingActivity.class);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
pendingIntent = PendingIntent.getActivity(context, 0, action, 0);
views.setOnClickPendingIntent(R.id.image, pendingIntent);

View File

@ -20,6 +20,7 @@ import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.ui.activities.NowPayingActivity;
import code.name.monkey.retromusic.util.RetroUtil;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
@ -160,7 +161,7 @@ public class AppWidgetClassic extends BaseAppWidget {
final ComponentName serviceName = new ComponentName(context, MusicService.class);
// Home
action = new Intent(context, MainActivity.class);
action = new Intent(context, NowPayingActivity.class);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
pendingIntent = PendingIntent.getActivity(context, 0, action, 0);
views.setOnClickPendingIntent(R.id.image, pendingIntent);

View File

@ -20,6 +20,7 @@ import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.ui.activities.NowPayingActivity;
import code.name.monkey.retromusic.util.RetroUtil;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
@ -165,7 +166,7 @@ public class AppWidgetSmall extends BaseAppWidget {
final ComponentName serviceName = new ComponentName(context, MusicService.class);
// Home
action = new Intent(context, MainActivity.class);
action = new Intent(context, NowPayingActivity.class);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
pendingIntent = PendingIntent.getActivity(context, 0, action, 0);
views.setOnClickPendingIntent(R.id.image, pendingIntent);

View File

@ -1,16 +1,18 @@
package code.name.monkey.retromusic.dialogs;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@ -22,8 +24,6 @@ import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.ui.adapter.playlist.AddToPlaylist;
import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment;
import java.util.ArrayList;
/**
* @author Karim Abou Zeid (kabouzeid), Aidan Follestad (afollestad)
*/
@ -35,8 +35,6 @@ public class AddToPlaylistDialog extends RoundedBottomSheetDialogFragment {
@BindView(R.id.title)
TextView title;
ArrayList<Playlist> playlists;
@NonNull
public static AddToPlaylistDialog create(Song song) {
ArrayList<Song> list = new ArrayList<>();
@ -75,14 +73,10 @@ public class AddToPlaylistDialog extends RoundedBottomSheetDialogFragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
final ArrayList<Song> songs = getArguments().getParcelableArrayList("songs");
playlists = PlaylistLoader.getAllPlaylists(getActivity()).blockingFirst();
AddToPlaylist playlistAdapter = new AddToPlaylist(getActivity(), playlists,
R.layout.item_playlist, songs, getDialog());
final ArrayList<Playlist> playlists = PlaylistLoader.getAllPlaylists(getActivity()).blockingFirst();
final AddToPlaylist playlistAdapter = new AddToPlaylist(getActivity(), playlists, R.layout.item_playlist, songs, getDialog());
playlist.setLayoutManager(new LinearLayoutManager(getContext()));
playlist.setItemAnimator(new DefaultItemAnimator());
playlist.setAdapter(playlistAdapter);

View File

@ -26,7 +26,7 @@ import code.name.monkey.retromusic.R;
*/
public class BlacklistFolderChooserDialog extends DialogFragment implements MaterialDialog.ListCallback {
String initialPath = Environment.getExternalStorageDirectory().getAbsolutePath();
private String initialPath = Environment.getExternalStorageDirectory().getAbsolutePath();
private File parentFolder;
private File[] parentContents;
private boolean canGoUp = false;

View File

@ -1 +0,0 @@
package code.name.monkey.retromusic.dialogs; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Color; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebView; import com.afollestad.materialdialogs.internal.ThemeSingleton; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Objects; import butterknife.BindView; import butterknife.ButterKnife; import code.name.monkey.appthemehelper.util.ATHUtil; import code.name.monkey.appthemehelper.util.ColorUtil; import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.util.PreferenceUtil; import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment; public class ChangelogDialog extends RoundedBottomSheetDialogFragment { @BindView(R.id.web_view) WebView webView; public static ChangelogDialog create() { return new ChangelogDialog(); } private static void setChangelogRead(@NonNull Context context) { try { PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); int currentVersion = pInfo.versionCode; PreferenceUtil.getInstance(context).setLastChangeLogVersion(currentVersion); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } } private static String colorToHex(int color) { return Integer.toHexString(color).substring(2); } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.dialog_changelog, container, false); ButterKnife.bind(this, layout); return layout; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); try { // Load from phonograph-changelog.html in the assets folder StringBuilder buf = new StringBuilder(); InputStream json = Objects.requireNonNull(getActivity()).getAssets().open ("retro-changelog.html"); BufferedReader in = new BufferedReader(new InputStreamReader(json, "UTF-8")); String str; while ((str = in.readLine()) != null) buf.append(str); in.close(); // Inject color values for WebView body background and links final String backgroundColor = colorToHex(ATHUtil.resolveColor(getActivity(), R.attr.md_background_color, Color.parseColor(ThemeSingleton.get().darkTheme ? "#424242" : "#ffffff"))); final String contentColor = ThemeSingleton.get().darkTheme ? "#ffffff" : "#000000"; webView.loadData(buf.toString() .replace("{style-placeholder}", String.format("body { background-color: %s; color: %s; }", backgroundColor, contentColor)) .replace("{link-color}", colorToHex(ThemeSingleton.get().positiveColor.getDefaultColor())) .replace("{link-color-active}", colorToHex(ColorUtil.lightenColor(ThemeSingleton.get().positiveColor.getDefaultColor()))) , "text/html", "UTF-8"); } catch (Throwable e) { webView.loadData("<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8"); } setChangelogRead(getActivity()); } }

View File

@ -2,13 +2,13 @@ package code.name.monkey.retromusic.dialogs;
import android.app.Dialog;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import android.text.Html;
import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.smartplaylist.AbsSmartPlaylist;

View File

@ -20,6 +20,7 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.MaterialUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.util.PlaylistsUtil;
@ -80,18 +81,18 @@ public class CreatePlaylistDialog extends RoundedBottomSheetDialogFragment {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
int accentColor = ThemeStore.accentColor(Objects.requireNonNull(getContext()));
actionCreate.setBackgroundTintList(ColorStateList.valueOf(accentColor));
actionCancel.setStrokeColor(ColorStateList.valueOf(accentColor));
actionCancel.setTextColor(accentColor);
MaterialUtil.setTint(actionCreate, true);
MaterialUtil.setTint(actionCancel, false);
MaterialUtil.setTint(textInputLayout, true);
textInputLayout.setBoxStrokeColor(accentColor);
textInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(accentColor));
playlistName.setHintTextColor(ColorStateList.valueOf(accentColor));
playlistName.setTextColor(ThemeStore.textColorPrimary(getContext()));
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
}
@OnClick({R.id.action_cancel, R.id.action_create})

View File

@ -1,6 +1,5 @@
package code.name.monkey.retromusic.dialogs;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
@ -11,7 +10,6 @@ import android.widget.TextView;
import com.google.android.material.button.MaterialButton;
import java.util.ArrayList;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -19,6 +17,7 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.MaterialUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.util.PlaylistsUtil;
@ -78,21 +77,10 @@ public class DeletePlaylistDialog extends RoundedBottomSheetDialogFragment {
this.title.setText(content);
this.title.setTextColor(ThemeStore.textColorPrimary(getContext()));
actionDelete.setText(R.string.action_delete);
int accentColor = ThemeStore.accentColor(Objects.requireNonNull(getContext()));
actionDelete.setIconTint(ColorStateList.valueOf(accentColor));
actionCancel.setIconTint(ColorStateList.valueOf(accentColor));
int iconColor = ThemeStore.textColorSecondary(getContext());
actionDelete.setStrokeColor(ColorStateList.valueOf(iconColor));
actionCancel.setStrokeColor(ColorStateList.valueOf(iconColor));
int textColor = ThemeStore.textColorPrimary(getContext());
actionDelete.setTextColor(ColorStateList.valueOf(textColor));
actionCancel.setTextColor(ColorStateList.valueOf(textColor));
MaterialUtil.setTint(actionDelete, true);
MaterialUtil.setTint(actionCancel, false);
}

View File

@ -1,6 +1,5 @@
package code.name.monkey.retromusic.dialogs;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
@ -11,7 +10,6 @@ import android.widget.TextView;
import com.google.android.material.button.MaterialButton;
import java.util.ArrayList;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -19,6 +17,7 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.MaterialUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.util.MusicUtil;
@ -72,12 +71,9 @@ public class DeleteSongsDialog extends RoundedBottomSheetDialogFragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
int accentColor = ThemeStore.accentColor(Objects.requireNonNull(getContext()));
actionDelete.setBackgroundTintList(ColorStateList.valueOf(accentColor));
actionCancel.setStrokeColor(ColorStateList.valueOf(accentColor));
actionCancel.setTextColor(accentColor);
MaterialUtil.setTint(actionDelete, true);
MaterialUtil.setTint(actionCancel, false);
//noinspection unchecked,ConstantConditions
final ArrayList<Song> songs = getArguments().getParcelableArrayList("songs");

View File

@ -1,6 +1,7 @@
package code.name.monkey.retromusic.dialogs;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -9,10 +10,15 @@ import android.widget.TextView;
import com.google.android.material.button.MaterialButton;
import java.io.File;
import java.util.Calendar;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.core.content.ContextCompat;
import butterknife.BindView;
import butterknife.BindViews;
import butterknife.ButterKnife;
import butterknife.OnClick;
@ -21,8 +27,16 @@ import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.RetroApplication;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.ui.fragments.mainactivity.folders.FoldersFragment;
import code.name.monkey.retromusic.util.Compressor;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.views.CircularImageView;
import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDialogFragment {
@ -30,10 +44,20 @@ public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDial
private static ButterKnife.Setter<TextView, Integer> textColor = (view, value, index) -> view.setTextColor(ColorStateList.valueOf(value));
@BindViews({R.id.action_folders, R.id.action_settings, R.id.action_about, R.id.action_buy_pro, R.id.action_rate,
@BindViews({R.id.action_folders, R.id.action_about, R.id.action_buy_pro, R.id.action_rate,
R.id.action_sleep_timer})
List<MaterialButton> materialButtons;
@BindView(R.id.user_image_bottom)
CircularImageView userImageBottom;
@BindView(R.id.title_welcome)
AppCompatTextView titleWelcome;
@BindView(R.id.text)
AppCompatTextView text;
private CompositeDisposable disposable = new CompositeDisposable();
public static MainOptionsBottomSheetDialogFragment newInstance(int selected_id) {
Bundle bundle = new Bundle();
@ -47,6 +71,11 @@ public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDial
return new MainOptionsBottomSheetDialogFragment();
}
@Override
public void onDestroyView() {
super.onDestroyView();
disposable.clear();
}
@Nullable
@Override
@ -61,10 +90,13 @@ public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDial
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
text.setTextColor(ThemeStore.textColorSecondary(getContext()));
titleWelcome.setTextColor(ThemeStore.textColorPrimary(getContext()));
titleWelcome.setText(String.format("%s %s!", getTimeOfTheDay(), PreferenceUtil.getInstance().getUserName()));
loadImageFromStorage();
}
@OnClick({R.id.action_folders, R.id.action_settings, R.id.action_sleep_timer, R.id.action_rate,
@OnClick({R.id.action_folders, R.id.user_info_container, R.id.action_settings, R.id.action_sleep_timer, R.id.action_rate,
R.id.action_buy_pro, R.id.action_about})
void onClick(View view) {
MainActivity mainActivity = (MainActivity) getActivity();
@ -89,6 +121,9 @@ public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDial
new SleepTimerDialog().show(getFragmentManager(), TAG);
}
break;
case R.id.user_info_container:
NavigationUtil.goToUserInfo(getActivity());
break;
case R.id.action_rate:
NavigationUtil.goToPlayStore(mainActivity);
break;
@ -96,5 +131,38 @@ public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDial
dismiss();
}
private String getTimeOfTheDay() {
String message = getString(R.string.title_good_day);
Calendar c = Calendar.getInstance();
int timeOfDay = c.get(Calendar.HOUR_OF_DAY);
if (timeOfDay >= 0 && timeOfDay < 6) {
message = getString(R.string.title_good_night);
} else if (timeOfDay >= 6 && timeOfDay < 12) {
message = getString(R.string.title_good_morning);
} else if (timeOfDay >= 12 && timeOfDay < 16) {
message = getString(R.string.title_good_afternoon);
} else if (timeOfDay >= 16 && timeOfDay < 20) {
message = getString(R.string.title_good_evening);
} else if (timeOfDay >= 20 && timeOfDay < 24) {
message = getString(R.string.title_good_night);
}
return message;
}
private void loadImageFromStorage() {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance().getProfileImage(), USER_PROFILE))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(userImageBottom::setImageBitmap,
throwable -> userImageBottom.setImageDrawable(ContextCompat
.getDrawable(getContext(), R.drawable.ic_person_flat))));
}
}

View File

@ -1,9 +1,6 @@
package code.name.monkey.retromusic.dialogs;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
@ -12,9 +9,12 @@ import android.widget.TextView;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.PlaylistSong;
import code.name.monkey.retromusic.util.PlaylistsUtil;
@ -76,7 +76,7 @@ public class RemoveFromPlaylistDialog extends RoundedBottomSheetDialogFragment {
final ArrayList<PlaylistSong> songs = getArguments().getParcelableArrayList("songs");
int title;
CharSequence content;
if (songs.size() > 1) {
if (songs != null && songs.size() > 1) {
title = R.string.remove_songs_from_playlist_title;
content = Html.fromHtml(getString(R.string.remove_x_songs_from_playlist, songs.size()));
} else {
@ -85,5 +85,9 @@ public class RemoveFromPlaylistDialog extends RoundedBottomSheetDialogFragment {
}
this.remove.setText(content);
this.title.setText(title);
this.title.setTextColor(ThemeStore.textColorPrimary(getContext()));
this.remove.setTextColor(ThemeStore.textColorSecondary(getContext()));
this.cancel.setTextColor(ThemeStore.textColorSecondary(getContext()));
}
}

View File

@ -19,6 +19,7 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.MaterialUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.util.PlaylistsUtil;
import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment;
@ -79,17 +80,13 @@ public class RenamePlaylistDialog extends RoundedBottomSheetDialogFragment {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
int accentColor = ThemeStore.accentColor(Objects.requireNonNull(getContext()));
rename.setBackgroundTintList(ColorStateList.valueOf(accentColor));
actionCancel.setStrokeColor(ColorStateList.valueOf(accentColor));
actionCancel.setTextColor(accentColor);
MaterialUtil.setTint(rename,true);
MaterialUtil.setTint(actionCancel,false);
MaterialUtil.setTint(textInputLayout,false);
playlistName.setHintTextColor(ColorStateList.valueOf(accentColor));
textInputLayout.setBoxStrokeColor(accentColor);
textInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(accentColor));
playlistName.setHintTextColor(accentColor);
playlistName.setTextColor(ThemeStore.textColorPrimary(getContext()));
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
long playlistId = 0;

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,6 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.LayerDrawable;
@ -20,10 +19,8 @@ import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputLayout;
import java.util.Locale;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -31,6 +28,7 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.MaterialUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.util.MusicUtil;
@ -89,17 +87,15 @@ public class SleepTimerDialog extends RoundedBottomSheetDialogFragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
int accentColor = ThemeStore.accentColor(Objects.requireNonNull(getContext()));
setButton.setBackgroundTintList(ColorStateList.valueOf(accentColor));
cancelButton.setStrokeColor(ColorStateList.valueOf(accentColor));
cancelButton.setTextColor(accentColor);
MaterialUtil.setTint(setButton, true);
MaterialUtil.setTint(cancelButton, false);
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
timerDisplay.setTextColor(ThemeStore.textColorSecondary(getContext()));
timerUpdater = new TimerUpdater();
seekArcProgress = PreferenceUtil.getInstance(getActivity()).getLastSleepTimerValue();
seekArcProgress = PreferenceUtil.getInstance().getLastSleepTimerValue();
updateTimeDisplayTime();
seekArc.setProgress(seekArcProgress);
setProgressBarColor(ThemeStore.accentColor(getContext()));
@ -122,7 +118,7 @@ public class SleepTimerDialog extends RoundedBottomSheetDialogFragment {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
PreferenceUtil.getInstance(getActivity()).setLastSleepTimerValue(seekArcProgress);
PreferenceUtil.getInstance().setLastSleepTimerValue(seekArcProgress);
}
});
}
@ -151,7 +147,7 @@ public class SleepTimerDialog extends RoundedBottomSheetDialogFragment {
final int minutes = seekArcProgress;
PendingIntent pi = makeTimerPendingIntent(PendingIntent.FLAG_CANCEL_CURRENT);
final long nextSleepTimerElapsedTime = SystemClock.elapsedRealtime() + minutes * 60 * 1000;
PreferenceUtil.getInstance(getActivity()).setNextSleepTimerElapsedRealtime(nextSleepTimerElapsedTime);
PreferenceUtil.getInstance().setNextSleepTimerElapsedRealtime(nextSleepTimerElapsedTime);
AlarmManager am = (AlarmManager) getActivity().getSystemService(Context.ALARM_SERVICE);
if (am != null) {
am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextSleepTimerElapsedTime, pi);
@ -178,7 +174,7 @@ public class SleepTimerDialog extends RoundedBottomSheetDialogFragment {
private class TimerUpdater extends CountDownTimer {
TimerUpdater() {
//noinspection ConstantConditions
super(PreferenceUtil.getInstance(getActivity()).getNextSleepTimerElapsedRealTime() - SystemClock.elapsedRealtime(), 1000);
super(PreferenceUtil.getInstance().getNextSleepTimerElapsedRealTime() - SystemClock.elapsedRealtime(), 1000);
}
@Override

View File

@ -3,17 +3,17 @@ package code.name.monkey.retromusic.dialogs;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.util.MusicUtil;
@ -21,8 +21,12 @@ import code.name.monkey.retromusic.views.RoundedBottomSheetDialogFragment;
public class SongShareDialog extends RoundedBottomSheetDialogFragment {
@BindView(R.id.option_1)
TextView audioFile;
@BindView(R.id.option_2)
TextView currentSong;
TextView audioText;
@BindView(R.id.title)
TextView title;
@NonNull
public static SongShareDialog create(final Song song) {
@ -46,7 +50,11 @@ public class SongShareDialog extends RoundedBottomSheetDialogFragment {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final Song song = getArguments().getParcelable("song");
currentSong.setText(getString(R.string.currently_listening_to_x_by_x, song.title, song.artistName));
audioFile.setText(getString(R.string.currently_listening_to_x_by_x, song.title, song.artistName));
audioFile.setTextColor(ThemeStore.textColorSecondary(getContext()));
audioText.setTextColor(ThemeStore.textColorSecondary(getContext()));
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
}
@OnClick({R.id.option_2, R.id.option_1})
@ -55,15 +63,13 @@ public class SongShareDialog extends RoundedBottomSheetDialogFragment {
final String currentlyListening = getString(R.string.currently_listening_to_x_by_x, song.title, song.artistName);
switch (view.getId()) {
case R.id.option_1:
startActivity(
Intent.createChooser(
MusicUtil.createShareSongFileIntent(song, getContext()), null));
startActivity(Intent.createChooser(
MusicUtil.createShareSongFileIntent(song, getContext()), null));
break;
case R.id.option_2:
getActivity().startActivity(Intent.createChooser(
new Intent().setAction(Intent.ACTION_SEND)
.putExtra(Intent.EXTRA_TEXT, currentlyListening)
.setType("text/plain"), null));
getActivity().startActivity(Intent.createChooser(new Intent().setAction(Intent.ACTION_SEND)
.putExtra(Intent.EXTRA_TEXT, currentlyListening)
.setType("text/plain"), null));
break;
}
dismiss();

View File

@ -26,7 +26,7 @@ import code.name.monkey.retromusic.util.CustomArtistImageUtil;
public class ArtistGlideRequest {
private static final int DEFAULT_ANIMATION = android.R.anim.fade_in;
private static final DiskCacheStrategy DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.SOURCE;
private static final DiskCacheStrategy DEFAULT_DISK_CACHE_STRATEGY = DiskCacheStrategy.ALL;
private static final int DEFAULT_ERROR_IMAGE = R.drawable.default_artist_art;
private static DrawableTypeRequest createBaseRequest(RequestManager requestManager, Artist artist,
@ -129,6 +129,7 @@ public class ArtistGlideRequest {
builder.forceDownload)
.asBitmap()
.transcode(new BitmapPaletteTranscoder(context), BitmapPaletteWrapper.class)
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
.error(DEFAULT_ERROR_IMAGE)
.animate(DEFAULT_ANIMATION)

View File

@ -37,7 +37,7 @@ public abstract class RetroMusicColoredTarget extends BitmapPaletteTarget {
int primaryColor = getColor(resource.getPalette(), defaultColor);
int dominantColor = getDominantColor(resource.getBitmap(), defaultColor);
onColorReady(PreferenceUtil.getInstance(RetroApplication.getInstance()).isDominantColor() ?
onColorReady(PreferenceUtil.getInstance().isDominantColor() ?
dominantColor : primaryColor);
}

View File

@ -63,7 +63,7 @@ public class SongGlideRequest {
}
public Builder checkIgnoreMediaStore(Context context) {
return ignoreMediaStore(PreferenceUtil.getInstance(context).ignoreMediaStoreArtwork());
return ignoreMediaStore(PreferenceUtil.getInstance().ignoreMediaStoreArtwork());
}
Builder ignoreMediaStore(boolean ignoreMediaStore) {

View File

@ -167,7 +167,7 @@ public class MusicPlayerRemote {
public static void openQueue(final ArrayList<Song> queue, final int startPosition, final boolean startPlaying) {
if (!tryToHandleOpenPlayingQueue(queue, startPosition, startPlaying) && musicService != null) {
musicService.openQueue(queue, startPosition, startPlaying);
if (PreferenceUtil.getInstance(musicService).isShuffleModeOn())
if (PreferenceUtil.getInstance().isShuffleModeOn())
setShuffleMode(MusicService.SHUFFLE_MODE_NONE);
}
}

View File

@ -19,155 +19,158 @@ import android.provider.MediaStore;
*/
public final class SortOrder {
/**
* This class is never instantiated
*/
public SortOrder() {
}
/**
* This class is never instantiated
*/
public SortOrder() {
}
/**
* Artist sort order entries.
*/
public interface ArtistSortOrder {
/**
* Artist sort order entries.
*/
public interface ArtistSortOrder {
/* Artist sort order A-Z */
String ARTIST_A_Z = MediaStore.Audio.Artists.DEFAULT_SORT_ORDER;
/* Artist sort order A-Z */
String ARTIST_A_Z = MediaStore.Audio.Artists.DEFAULT_SORT_ORDER;
/* Artist sort order Z-A */
String ARTIST_Z_A = ARTIST_A_Z + " DESC";
/* Artist sort order Z-A */
String ARTIST_Z_A = ARTIST_A_Z + " DESC";
/* Artist sort order number of songs */
String ARTIST_NUMBER_OF_SONGS = MediaStore.Audio.Artists.NUMBER_OF_TRACKS
+ " DESC";
/* Artist sort order number of songs */
String ARTIST_NUMBER_OF_SONGS = MediaStore.Audio.Artists.NUMBER_OF_TRACKS
+ " DESC";
/* Artist sort order number of albums */
String ARTIST_NUMBER_OF_ALBUMS = MediaStore.Audio.Artists.NUMBER_OF_ALBUMS
+ " DESC";
}
/* Artist sort order number of albums */
String ARTIST_NUMBER_OF_ALBUMS = MediaStore.Audio.Artists.NUMBER_OF_ALBUMS
+ " DESC";
}
/**
* Album sort order entries.
*/
public interface AlbumSortOrder {
/**
* Album sort order entries.
*/
public interface AlbumSortOrder {
/* Album sort order A-Z */
String ALBUM_A_Z = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
/* Album sort order A-Z */
String ALBUM_A_Z = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
/* Album sort order Z-A */
String ALBUM_Z_A = ALBUM_A_Z + " DESC";
/* Album sort order Z-A */
String ALBUM_Z_A = ALBUM_A_Z + " DESC";
/* Album sort order songs */
String ALBUM_NUMBER_OF_SONGS = MediaStore.Audio.Albums.NUMBER_OF_SONGS
+ " DESC";
/* Album sort order songs */
String ALBUM_NUMBER_OF_SONGS = MediaStore.Audio.Albums.NUMBER_OF_SONGS
+ " DESC";
/* Album sort order artist */
String ALBUM_ARTIST = MediaStore.Audio.Artists.DEFAULT_SORT_ORDER
+ ", " + MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
/* Album sort order artist */
String ALBUM_ARTIST = MediaStore.Audio.Artists.DEFAULT_SORT_ORDER
+ ", " + MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
/* Album sort order year */
String ALBUM_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
}
/* Album sort order year */
String ALBUM_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
}
/**
* Song sort order entries.
*/
public interface SongSortOrder {
/**
* Song sort order entries.
*/
public interface SongSortOrder {
/* Song sort order A-Z */
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/* Song sort order A-Z */
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/* Song sort order Z-A */
String SONG_Z_A = SONG_A_Z + " DESC";
/* Song sort order Z-A */
String SONG_Z_A = SONG_A_Z + " DESC";
/* Song sort order artist */
String SONG_ARTIST = MediaStore.Audio.Artists.DEFAULT_SORT_ORDER;
/* Song sort order artist */
String SONG_ARTIST = MediaStore.Audio.Artists.DEFAULT_SORT_ORDER;
/* Song sort order album */
String SONG_ALBUM = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
/* Song sort order album */
String SONG_ALBUM = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
/* Song sort order year */
String SONG_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
/* Song sort order year */
String SONG_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
/* Song sort order duration */
String SONG_DURATION = MediaStore.Audio.Media.DURATION + " DESC";
/* Song sort order duration */
String SONG_DURATION = MediaStore.Audio.Media.DURATION + " DESC";
/* Song sort order date */
String SONG_DATE = MediaStore.Audio.Media.DATE_ADDED + " DESC";
}
/* Song sort order date */
String SONG_DATE = MediaStore.Audio.Media.DATE_ADDED + " DESC";
/**
* Album song sort order entries.
*/
public interface AlbumSongSortOrder {
/* Song sort order date */
String COMPOSER = MediaStore.Audio.Media.COMPOSER;
}
/* Album song sort order A-Z */
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/**
* Album song sort order entries.
*/
public interface AlbumSongSortOrder {
/* Album song sort order Z-A */
String SONG_Z_A = SONG_A_Z + " DESC";
/* Album song sort order A-Z */
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/* Album song sort order track list */
String SONG_TRACK_LIST = MediaStore.Audio.Media.TRACK + ", "
+ MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/* Album song sort order Z-A */
String SONG_Z_A = SONG_A_Z + " DESC";
/* Album song sort order duration */
String SONG_DURATION = SongSortOrder.SONG_DURATION;
}
/* Album song sort order track list */
String SONG_TRACK_LIST = MediaStore.Audio.Media.TRACK + ", "
+ MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/**
* Artist song sort order entries.
*/
public interface ArtistSongSortOrder {
/* Album song sort order duration */
String SONG_DURATION = SongSortOrder.SONG_DURATION;
}
/* Artist song sort order A-Z */
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/**
* Artist song sort order entries.
*/
public interface ArtistSongSortOrder {
/* Artist song sort order Z-A */
String SONG_Z_A = SONG_A_Z + " DESC";
/* Artist song sort order A-Z */
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
/* Artist song sort order album */
String SONG_ALBUM = MediaStore.Audio.Media.ALBUM;
/* Artist song sort order Z-A */
String SONG_Z_A = SONG_A_Z + " DESC";
/* Artist song sort order year */
String SONG_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
/* Artist song sort order album */
String SONG_ALBUM = MediaStore.Audio.Media.ALBUM;
/* Artist song sort order duration */
String SONG_DURATION = MediaStore.Audio.Media.DURATION + " DESC";
/* Artist song sort order year */
String SONG_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
/* Artist song sort order date */
String SONG_DATE = MediaStore.Audio.Media.DATE_ADDED + " DESC";
}
/* Artist song sort order duration */
String SONG_DURATION = MediaStore.Audio.Media.DURATION + " DESC";
/**
* Artist album sort order entries.
*/
public interface ArtistAlbumSortOrder {
/* Artist song sort order date */
String SONG_DATE = MediaStore.Audio.Media.DATE_ADDED + " DESC";
}
/* Artist album sort order A-Z */
String ALBUM_A_Z = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
/**
* Artist album sort order entries.
*/
public interface ArtistAlbumSortOrder {
/* Artist album sort order Z-A */
String ALBUM_Z_A = ALBUM_A_Z + " DESC";
/* Artist album sort order A-Z */
String ALBUM_A_Z = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
/* Artist album sort order year */
String ALBUM_YEAR = MediaStore.Audio.Media.YEAR
+ " DESC";
/* Artist album sort order Z-A */
String ALBUM_Z_A = ALBUM_A_Z + " DESC";
/* Artist album sort order year */
String ALBUM_YEAR_ASC = MediaStore.Audio.Media.YEAR
+ " ASC";
}
/* Artist album sort order year */
String ALBUM_YEAR = MediaStore.Audio.Media.YEAR
+ " DESC";
/**
* Genre sort order entries.
*/
public interface GenreSortOrder {
/* Artist album sort order year */
String ALBUM_YEAR_ASC = MediaStore.Audio.Media.YEAR
+ " ASC";
}
/* Genre sort order A-Z */
String GENRE_A_Z = MediaStore.Audio.Genres.DEFAULT_SORT_ORDER;
/**
* Genre sort order entries.
*/
public interface GenreSortOrder {
/* Genre sort order Z-A */
String ALBUM_Z_A = GENRE_A_Z + " DESC";
}
/* Genre sort order A-Z */
String GENRE_A_Z = MediaStore.Audio.Genres.DEFAULT_SORT_ORDER;
/* Genre sort order Z-A */
String ALBUM_Z_A = GENRE_A_Z + " DESC";
}
}

View File

@ -97,8 +97,8 @@ public class AlbumLoader {
}
public static String getSongLoaderSortOrder(Context context) {
return PreferenceUtil.getInstance(context).getAlbumSortOrder() + ", " +
//PreferenceUtil.getInstance(context).getAlbumSongSortOrder() + "," +
PreferenceUtil.getInstance(context).getAlbumDetailSongSortOrder();
return PreferenceUtil.getInstance().getAlbumSortOrder() + ", " +
//PreferenceUtil.getInstance().getAlbumSongSortOrder() + "," +
PreferenceUtil.getInstance().getAlbumDetailSongSortOrder();
}
}

View File

@ -14,10 +14,10 @@ import io.reactivex.Observable;
public class ArtistLoader {
private static String getSongLoaderSortOrder(Context context) {
return PreferenceUtil.getInstance(context).getArtistSortOrder() + ", " +
PreferenceUtil.getInstance(context).getArtistAlbumSortOrder() + ", " +
PreferenceUtil.getInstance(context).getAlbumDetailSongSortOrder() + ", " +
PreferenceUtil.getInstance(context).getArtistDetailSongSortOrder();
return PreferenceUtil.getInstance().getArtistSortOrder() + ", " +
PreferenceUtil.getInstance().getArtistAlbumSortOrder() + ", " +
PreferenceUtil.getInstance().getAlbumDetailSongSortOrder() + ", " +
PreferenceUtil.getInstance().getArtistDetailSongSortOrder();
}
@NonNull

View File

@ -28,7 +28,7 @@ public class ArtistSongLoader extends SongLoader {
new String[]{
String.valueOf(artistId)
},
PreferenceUtil.getInstance(context).getArtistSongSortOrder()
PreferenceUtil.getInstance().getArtistSongSortOrder()
);
} catch (SecurityException e) {
return null;

View File

@ -79,7 +79,7 @@ public class GenreLoader {
try {
return context.getContentResolver().query(
Genres.Members.getContentUri("external", genreId),
SongLoader.BASE_PROJECTION, SongLoader.BASE_SELECTION, null, PreferenceUtil.getInstance(context).getSongSortOrder());
SongLoader.BASE_PROJECTION, SongLoader.BASE_SELECTION, null, PreferenceUtil.getInstance().getSongSortOrder());
} catch (SecurityException e) {
return null;
}
@ -124,7 +124,7 @@ public class GenreLoader {
try {
return context.getContentResolver().query(
Genres.EXTERNAL_CONTENT_URI,
projection, null, null, PreferenceUtil.getInstance(context).getGenreSortOrder());
projection, null, null, PreferenceUtil.getInstance().getGenreSortOrder());
} catch (SecurityException e) {
return null;
}

View File

@ -4,13 +4,12 @@ import android.content.Context;
import android.database.Cursor;
import android.provider.MediaStore;
import android.provider.MediaStore.Audio.AudioColumns;
import androidx.annotation.NonNull;
import code.name.monkey.retromusic.model.Song;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import code.name.monkey.retromusic.model.Song;
import io.reactivex.Observable;
/**
@ -19,7 +18,7 @@ import io.reactivex.Observable;
public class GenreSongsLoader {
public static Observable<ArrayList<Song>> getGenreSongsList(@NonNull Context context, @NonNull int genreId) {
public static Observable<ArrayList<Song>> getGenreSongsList(@NonNull Context context, int genreId) {
return Observable.create(e -> {
ArrayList<Song> list = new ArrayList<>();
Cursor cursor = makeGenreSongCursor(context, genreId);
@ -49,8 +48,9 @@ public class GenreSongsLoader {
final String albumName = cursor.getString(8);
final int artistId = cursor.getInt(9);
final String artistName = cursor.getString(10);
final String composer = cursor.getString(11);
return new Song(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName);
return new Song(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, composer);
}
private static Cursor makeGenreSongCursor(Context context, long genreId) {
@ -69,6 +69,7 @@ public class GenreSongsLoader {
AudioColumns.ALBUM,// 8
AudioColumns.ARTIST_ID,// 9
AudioColumns.ARTIST,// 10
AudioColumns.COMPOSER,// 11
}, SongLoader.BASE_SELECTION, null,
MediaStore.Audio.Genres.Members.DEFAULT_SORT_ORDER);
} catch (SecurityException e) {

View File

@ -4,12 +4,11 @@ import android.content.Context;
import android.database.Cursor;
import android.provider.MediaStore;
import java.util.ArrayList;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.model.Artist;
import code.name.monkey.retromusic.model.Song;
import java.util.ArrayList;
import code.name.monkey.retromusic.util.PreferenceUtil;
import io.reactivex.Observable;
import io.reactivex.annotations.NonNull;
@ -26,7 +25,7 @@ public class LastAddedSongsLoader {
}
public static Cursor makeLastAddedCursor(@NonNull final Context context) {
long cutoff = PreferenceUtil.getInstance(context).getLastAddedCutoff();
long cutoff = PreferenceUtil.getInstance().getLastAddedCutoff();
return SongLoader.makeSongCursor(
context,

View File

@ -5,14 +5,13 @@ import android.database.Cursor;
import android.provider.MediaStore;
import android.provider.MediaStore.Audio.AudioColumns;
import java.util.ArrayList;
import java.util.List;
import code.name.monkey.retromusic.model.AbsCustomPlaylist;
import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.model.PlaylistSong;
import code.name.monkey.retromusic.model.Song;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.annotations.NonNull;
@ -65,11 +64,12 @@ public class PlaylistSongsLoader {
final int artistId = cursor.getInt(9);
final String artistName = cursor.getString(10);
final int idInPlaylist = cursor.getInt(11);
final String composer = cursor.getString(12);
return new PlaylistSong(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, playlistId, idInPlaylist);
return new PlaylistSong(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, playlistId, idInPlaylist, composer);
}
public static Cursor makePlaylistSongCursor(@NonNull final Context context, final int playlistId) {
private static Cursor makePlaylistSongCursor(@NonNull final Context context, final int playlistId) {
try {
return context.getContentResolver().query(
MediaStore.Audio.Playlists.Members.getContentUri("external", playlistId),
@ -85,7 +85,8 @@ public class PlaylistSongsLoader {
AudioColumns.ALBUM,// 8
AudioColumns.ARTIST_ID,// 9
AudioColumns.ARTIST,// 10
MediaStore.Audio.Playlists.Members._ID // 11
MediaStore.Audio.Playlists.Members._ID, // 11
AudioColumns.COMPOSER,// 12
}, SongLoader.BASE_SELECTION, null,
MediaStore.Audio.Playlists.Members.DEFAULT_SORT_ORDER);
} catch (SecurityException e) {

View File

@ -5,16 +5,18 @@ import android.database.Cursor;
import android.provider.BaseColumns;
import android.provider.MediaStore;
import android.provider.MediaStore.Audio.AudioColumns;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import code.name.monkey.retromusic.helper.ShuffleHelper;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.providers.BlacklistStore;
import code.name.monkey.retromusic.util.PreferenceUtil;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.functions.Function;
/**
* Created by hemanths on 10/08/17.
@ -36,6 +38,7 @@ public class SongLoader {
AudioColumns.ALBUM,// 8
AudioColumns.ARTIST_ID,// 9
AudioColumns.ARTIST,// 10
AudioColumns.COMPOSER,// 11
};
@NonNull
@ -83,16 +86,17 @@ public class SongLoader {
final String albumName = cursor.getString(8);
final int artistId = cursor.getInt(9);
final String artistName = cursor.getString(10);
final String composer = cursor.getString(11);
return new Song(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName,
artistId, artistName);
artistId, artistName, composer);
}
@Nullable
public static Cursor makeSongCursor(@NonNull final Context context,
@Nullable final String selection, final String[] selectionValues) {
return makeSongCursor(context, selection, selectionValues,
PreferenceUtil.getInstance(context).getSongSortOrder());
PreferenceUtil.getInstance().getSongSortOrder());
}
@Nullable
@ -167,25 +171,28 @@ public class SongLoader {
}
public static Observable<ArrayList<Song>> suggestSongs(@NonNull Context context) {
return Observable.create(observer -> {
SongLoader.getAllSongs(context)
.subscribe(songs -> {
ArrayList<Song> list = new ArrayList<>();
if (songs.isEmpty()) {
observer.onNext(new ArrayList<>());
observer.onComplete();
return;
}
ShuffleHelper.makeShuffleList(songs, -1);
if (songs.size() > 10) {
list.addAll(songs.subList(0, 10));
} else {
list.addAll(songs);
}
observer.onNext(list);
observer.onComplete();
});
});
return SongLoader.getAllSongs(context)
.flatMap((Function<ArrayList<Song>, ObservableSource<ArrayList<Song>>>) songs -> {
ArrayList<Song> list = new ArrayList<>();
ShuffleHelper.makeShuffleList(songs, -1);
if (songs.size() > 10) {
list.addAll(songs.subList(0, 10));
}
return Observable.just(list);
});
/*.subscribe(songs -> {
ArrayList<Song> list = new ArrayList<>();
if (songs.isEmpty()) {
return;
}
ShuffleHelper.makeShuffleList(songs, -1);
if (songs.size() > 10) {
list.addAll(songs.subList(0, 10));
} else {
list.addAll(songs);
}
return;
});*/
}
}

View File

@ -4,17 +4,31 @@ import android.os.Parcel;
import android.os.Parcelable;
public class PlaylistSong extends Song {
public static final PlaylistSong EMPTY_PLAYLIST_SONG = new PlaylistSong(-1, "", -1, -1, -1, "", -1, -1, "", -1, "", -1, -1);
public static final PlaylistSong EMPTY_PLAYLIST_SONG = new PlaylistSong(-1, "", -1, -1, -1, "", -1, -1, "", -1, "", -1, -1, "");
public static final Parcelable.Creator<PlaylistSong> CREATOR = new Parcelable.Creator<PlaylistSong>() {
public PlaylistSong createFromParcel(Parcel source) {
return new PlaylistSong(source);
}
public PlaylistSong[] newArray(int size) {
return new PlaylistSong[size];
}
};
public final int playlistId;
public final int idInPlayList;
public PlaylistSong(int id, String title, int trackNumber, int year, long duration, String data, int dateModified, int albumId, String albumName, int artistId, String artistName, final int playlistId, final int idInPlayList) {
super(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName);
public PlaylistSong(int id, String title, int trackNumber, int year, long duration, String data, int dateModified, int albumId, String albumName, int artistId, String artistName, final int playlistId, final int idInPlayList, final String composer) {
super(id, title, trackNumber, year, duration, data, dateModified, albumId, albumName, artistId, artistName, composer);
this.playlistId = playlistId;
this.idInPlayList = idInPlayList;
}
protected PlaylistSong(Parcel in) {
super(in);
this.playlistId = in.readInt();
this.idInPlayList = in.readInt();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
@ -45,7 +59,6 @@ public class PlaylistSong extends Song {
'}';
}
@Override
public int describeContents() {
return 0;
@ -57,20 +70,4 @@ public class PlaylistSong extends Song {
dest.writeInt(this.playlistId);
dest.writeInt(this.idInPlayList);
}
protected PlaylistSong(Parcel in) {
super(in);
this.playlistId = in.readInt();
this.idInPlayList = in.readInt();
}
public static final Parcelable.Creator<PlaylistSong> CREATOR = new Parcelable.Creator<PlaylistSong>() {
public PlaylistSong createFromParcel(Parcel source) {
return new PlaylistSong(source);
}
public PlaylistSong[] newArray(int size) {
return new PlaylistSong[size];
}
};
}

View File

@ -5,8 +5,16 @@ import android.os.Parcelable;
public class Song implements Parcelable {
public static final Song EMPTY_SONG = new Song(-1, "", -1, -1, -1, "", -1, -1, "", -1, "");
public static final Song EMPTY_SONG = new Song(-1, "", -1, -1, -1, "", -1, -1, "", -1, "", "");
public static final Creator<Song> CREATOR = new Creator<Song>() {
public Song createFromParcel(Parcel source) {
return new Song(source);
}
public Song[] newArray(int size) {
return new Song[size];
}
};
public final int id;
public final String title;
public final int trackNumber;
@ -18,8 +26,9 @@ public class Song implements Parcelable {
public final String albumName;
public final int artistId;
public final String artistName;
public final String composer;
public Song(int id, String title, int trackNumber, int year, long duration, String data, long dateModified, int albumId, String albumName, int artistId, String artistName) {
public Song(int id, String title, int trackNumber, int year, long duration, String data, long dateModified, int albumId, String albumName, int artistId, String artistName, String composer) {
this.id = id;
this.title = title;
this.trackNumber = trackNumber;
@ -31,6 +40,22 @@ public class Song implements Parcelable {
this.albumName = albumName;
this.artistId = artistId;
this.artistName = artistName;
this.composer = composer;
}
protected Song(Parcel in) {
this.id = in.readInt();
this.title = in.readString();
this.trackNumber = in.readInt();
this.year = in.readInt();
this.duration = in.readLong();
this.data = in.readString();
this.dateModified = in.readLong();
this.albumId = in.readInt();
this.albumName = in.readString();
this.artistId = in.readInt();
this.artistName = in.readString();
this.composer = in.readString();
}
@Override
@ -68,6 +93,7 @@ public class Song implements Parcelable {
result = 31 * result + (albumName != null ? albumName.hashCode() : 0);
result = 31 * result + artistId;
result = 31 * result + (artistName != null ? artistName.hashCode() : 0);
result = 31 * result + (composer != null ? composer.hashCode() : 0);
return result;
}
@ -85,10 +111,10 @@ public class Song implements Parcelable {
", albumName='" + albumName + '\'' +
", artistId=" + artistId +
", artistName='" + artistName + '\'' +
", composer='" + composer + '\'' +
'}';
}
@Override
public int describeContents() {
return 0;
@ -107,29 +133,6 @@ public class Song implements Parcelable {
dest.writeString(this.albumName);
dest.writeInt(this.artistId);
dest.writeString(this.artistName);
dest.writeString(this.composer);
}
protected Song(Parcel in) {
this.id = in.readInt();
this.title = in.readString();
this.trackNumber = in.readInt();
this.year = in.readInt();
this.duration = in.readLong();
this.data = in.readString();
this.dateModified = in.readLong();
this.albumId = in.readInt();
this.albumName = in.readString();
this.artistId = in.readInt();
this.artistName = in.readString();
}
public static final Creator<Song> CREATOR = new Creator<Song>() {
public Song createFromParcel(Parcel source) {
return new Song(source);
}
public Song[] newArray(int size) {
return new Song[size];
}
};
}

View File

@ -2,10 +2,12 @@ package code.name.monkey.retromusic.mvp.contract;
import java.util.ArrayList;
import code.name.monkey.retromusic.model.AbsCustomPlaylist;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.model.Artist;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.mvp.BasePresenter;
import code.name.monkey.retromusic.mvp.BaseView;
@ -21,7 +23,9 @@ public interface HomeContract {
void topAlbums(ArrayList<Album> albums);
void suggestions(ArrayList<Playlist> songs);
void suggestions(ArrayList<Song> songs);
void playlists(ArrayList<Playlist> playlists);
void geners(ArrayList<Genre> songs);
}

View File

@ -1,7 +1,6 @@
package code.name.monkey.retromusic.mvp.presenter;
import androidx.annotation.NonNull;
import code.name.monkey.retromusic.RetroApplication;
import code.name.monkey.retromusic.mvp.Presenter;
import code.name.monkey.retromusic.mvp.contract.HomeContract;
import code.name.monkey.retromusic.util.PreferenceUtil;
@ -20,14 +19,11 @@ public class HomePresenter extends Presenter implements HomeContract.HomePresent
loadRecentAlbums();
loadRecentArtists();
loadTopAlbums();
loadTopArtists();
loadSuggestions();
if (PreferenceUtil.getInstance(RetroApplication.getInstance()).isGenreShown()) loadGenres();
if (PreferenceUtil.getInstance().isGenreShown()) loadGenres();
}
@ -40,9 +36,9 @@ public class HomePresenter extends Presenter implements HomeContract.HomePresent
disposable.add(repository.getAllPlaylists()
.observeOn(schedulerProvider.ui())
.subscribeOn(schedulerProvider.io())
.subscribe(playlists -> {
if (!playlists.isEmpty()) {
view.suggestions(playlists);
.subscribe(playlist -> {
if (!playlist.isEmpty()) {
view.playlists(playlist);
}
},
throwable -> view.showEmptyView(), () -> view.completed()));
@ -107,7 +103,11 @@ public class HomePresenter extends Presenter implements HomeContract.HomePresent
@Override
public void loadSuggestions() {
disposable.add(repository.getSuggestionSongs()
.observeOn(schedulerProvider.ui())
.subscribeOn(schedulerProvider.io())
.doOnSubscribe(disposable1 -> view.loading())
.subscribe(songs -> view.suggestions(songs), throwable -> view.showEmptyView(), () -> view.completed()));
}
@Override

View File

@ -44,7 +44,7 @@ public class AlbumCoverStylePreferenceDialog extends DialogFragment implements
viewPager.setAdapter(new AlbumCoverStyleAdapter(getActivity()));
viewPager.addOnPageChangeListener(this);
viewPager.setPageMargin((int) ViewUtil.convertDpToPixel(32, getResources()));
viewPager.setCurrentItem(PreferenceUtil.getInstance(getActivity()).getAlbumCoverStyle().ordinal());
viewPager.setCurrentItem(PreferenceUtil.getInstance().getAlbumCoverStyle().ordinal());
return new MaterialDialog.Builder(getActivity())
.title(R.string.pref_title_album_cover_style)
@ -67,7 +67,7 @@ public class AlbumCoverStylePreferenceDialog extends DialogFragment implements
super.onDismiss(dialog);
if (whichButtonClicked == DialogAction.POSITIVE) {
AlbumCoverStyle nowPlayingScreen = AlbumCoverStyle.values()[viewPagerPosition];
PreferenceUtil.getInstance(getActivity()).setAlbumCoverStyle(nowPlayingScreen);
PreferenceUtil.getInstance().setAlbumCoverStyle(nowPlayingScreen);
}
}

View File

@ -48,7 +48,7 @@ public class NowPlayingScreenPreferenceDialog extends DialogFragment implements
viewPager.setAdapter(new NowPlayingScreenAdapter(getActivity()));
viewPager.addOnPageChangeListener(this);
viewPager.setPageMargin((int) ViewUtil.convertDpToPixel(32, getResources()));
viewPager.setCurrentItem(PreferenceUtil.getInstance(getActivity()).getNowPlayingScreen().ordinal());
viewPager.setCurrentItem(PreferenceUtil.getInstance().getNowPlayingScreen().ordinal());
return new MaterialDialog.Builder(getActivity())
.title(R.string.pref_title_now_playing_screen_appearance)
@ -76,7 +76,7 @@ public class NowPlayingScreenPreferenceDialog extends DialogFragment implements
Toast.makeText(getContext(), result, Toast.LENGTH_SHORT).show();
NavigationUtil.goToProVersion(getActivity());
} else {
PreferenceUtil.getInstance(getActivity()).setNowPlayingScreen(nowPlayingScreen);
PreferenceUtil.getInstance().setNowPlayingScreen(nowPlayingScreen);
}
}
}
@ -84,8 +84,8 @@ public class NowPlayingScreenPreferenceDialog extends DialogFragment implements
private boolean isNowPlayingThemes(NowPlayingScreen nowPlayingScreen) {
if (nowPlayingScreen.equals(NowPlayingScreen.BLUR_CARD)) {
PreferenceUtil.getInstance(getContext()).resetCarouselEffect();
PreferenceUtil.getInstance(getContext()).resetCircularAlbumArt();
PreferenceUtil.getInstance().resetCarouselEffect();
PreferenceUtil.getInstance().resetCircularAlbumArt();
}
return (nowPlayingScreen.equals(NowPlayingScreen.FULL) ||

View File

@ -31,13 +31,13 @@ public class BlacklistStore extends SQLiteOpenHelper {
public static synchronized BlacklistStore getInstance(@NonNull final Context context) {
if (sInstance == null) {
sInstance = new BlacklistStore(context.getApplicationContext());
if (!PreferenceUtil.getInstance(context).initializedBlacklist()) {
if (!PreferenceUtil.getInstance().initializedBlacklist()) {
// blacklisted by default
sInstance.addPathImpl(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_ALARMS));
sInstance.addPathImpl(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_NOTIFICATIONS));
sInstance.addPathImpl(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RINGTONES));
PreferenceUtil.getInstance(context).setInitializedBlacklist();
PreferenceUtil.getInstance().setInitializedBlacklist();
}
}
return sInstance;

View File

@ -41,7 +41,7 @@ public class MusicPlaybackQueueStore extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "music_playback_state.db";
public static final String PLAYING_QUEUE_TABLE_NAME = "playing_queue";
public static final String ORIGINAL_PLAYING_QUEUE_TABLE_NAME = "original_playing_queue";
private static final int VERSION = 3;
private static final int VERSION = 4;
@Nullable
private static MusicPlaybackQueueStore sInstance = null;
@ -110,6 +110,9 @@ public class MusicPlaybackQueueStore extends SQLiteOpenHelper {
builder.append(" INT NOT NULL,");
builder.append(AudioColumns.ARTIST);
builder.append(" STRING NOT NULL,");
builder.append(AudioColumns.COMPOSER);
builder.append(" STRING NOT NULL);");
db.execSQL(builder.toString());
@ -173,6 +176,7 @@ public class MusicPlaybackQueueStore extends SQLiteOpenHelper {
values.put(AudioColumns.ALBUM, song.albumName);
values.put(AudioColumns.ARTIST_ID, song.artistId);
values.put(AudioColumns.ARTIST, song.artistName);
values.put(AudioColumns.COMPOSER, song.composer);
database.insert(tableName, null, values);
}

View File

@ -52,8 +52,8 @@ public class RepositoryImpl implements Repository {
}
@Override
public Observable<ArrayList<AbsSmartPlaylist>> getSuggestionSongs() {
return HomeLoader.getRecentAndTopThings(context);
public Observable<ArrayList<Song>> getSuggestionSongs() {
return SongLoader.suggestSongs(context);
}
@Override

View File

@ -18,7 +18,7 @@ public interface Repository {
Observable<ArrayList<Song>> getAllSongs();
Observable<ArrayList<AbsSmartPlaylist>> getSuggestionSongs();
Observable<ArrayList<Song>> getSuggestionSongs();
Observable<Song> getSong(int id);

View File

@ -1,12 +1,9 @@
package code.name.monkey.retromusic.rest.service;
import androidx.annotation.Nullable;
import code.name.monkey.retromusic.BuildConfig;
import code.name.monkey.retromusic.rest.model.LastFmAlbum;
import code.name.monkey.retromusic.rest.model.LastFmArtist;
import code.name.monkey.retromusic.rest.model.LastFmTrack;
import io.reactivex.Observable;
import retrofit2.Call;
import retrofit2.http.GET;
@ -14,18 +11,16 @@ import retrofit2.http.Header;
import retrofit2.http.Query;
public interface LastFMService {
String API_KEY = "bd9c6ea4d55ec9ed3af7d276e5ece304";
//String API_KEY = BuildConfig.LASTFM_API_KEY;
//String BASE_QUERY_PARAMETERS = "?format=json&autocorrect=1&api_key=" + API_KEY;
String API_KEY_BAK = "bd9c6ea4d55ec9ed3af7d276e5ece304";
String API_KEY = "c679c8d3efa84613dc7dcb2e8d42da4c";
String BASE_QUERY_PARAMETERS = "?format=json&autocorrect=1&api_key=" + API_KEY;
String METHOD_TRACK = "track.getInfo";
@GET(BASE_QUERY_PARAMETERS + "&method=album.getinfo")
Observable<LastFmAlbum> getAlbumInfo(@Query("album") String albumName, @Query("artist") String artistName, @Nullable @Query("lang") String language);
@GET("?api_key=" + BuildConfig.LASTFM_API_KEY + "&format=json&autocorrect=1" + "&method=" + METHOD_TRACK)
@GET("?api_key=" + API_KEY + "&format=json&autocorrect=1" + "&method=" + METHOD_TRACK)
Observable<LastFmTrack> getTrackInfo(@Query("artist") String artist, @Query("track") String track);
@GET(BASE_QUERY_PARAMETERS + "&method=artist.getinfo")

View File

@ -115,7 +115,7 @@ public class MultiPlayer implements Playback, MediaPlayer.OnErrorListener, Media
if (path == null) {
return;
}
if (PreferenceUtil.getInstance(context).gaplessPlayback()) {
if (PreferenceUtil.getInstance().gaplessPlayback()) {
mNextMediaPlayer = new MediaPlayer();
mNextMediaPlayer.setWakeMode(context, PowerManager.PARTIAL_WAKE_LOCK);
mNextMediaPlayer.setAudioSessionId(getAudioSessionId());

View File

@ -27,8 +27,6 @@ import android.os.PowerManager;
import android.os.Process;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
@ -37,7 +35,6 @@ import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
import code.name.monkey.retromusic.service.notification.PlayingNotificationOreo;
import com.bumptech.glide.BitmapRequestBuilder;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
@ -48,6 +45,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.appwidgets.AppWidgetBig;
import code.name.monkey.retromusic.appwidgets.AppWidgetCard;
@ -66,6 +65,7 @@ import code.name.monkey.retromusic.providers.MusicPlaybackQueueStore;
import code.name.monkey.retromusic.providers.SongPlayCountStore;
import code.name.monkey.retromusic.service.notification.PlayingNotification;
import code.name.monkey.retromusic.service.notification.PlayingNotificationImpl24;
import code.name.monkey.retromusic.service.notification.PlayingNotificationOreo;
import code.name.monkey.retromusic.service.playback.Playback;
import code.name.monkey.retromusic.util.MusicUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
@ -295,7 +295,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
getContentResolver().registerContentObserver(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, true, mediaStoreObserver);
PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this);
PreferenceUtil.getInstance().registerOnSharedPreferenceChangedListener(this);
restoreState();
@ -446,7 +446,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
quit();
releaseResources();
getContentResolver().unregisterContentObserver(mediaStoreObserver);
PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this);
PreferenceUtil.getInstance().unregisterOnSharedPreferenceChangedListener(this);
wakeLock.release();
sendBroadcast(new Intent("code.name.monkey.retromusic.RETRO_MUSIC_MUSIC_SERVICE_DESTROYED"));
@ -627,7 +627,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
}
public void initNotification() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !PreferenceUtil.getInstance(this).classicNotification()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !PreferenceUtil.getInstance().classicNotification()) {
playingNotification = new PlayingNotificationImpl24();
} else {
playingNotification = new PlayingNotificationOreo();
@ -672,12 +672,12 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
metaData.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, getPlayingQueue().size());
}
if (PreferenceUtil.getInstance(this).albumArtOnLockscreen()) {
if (PreferenceUtil.getInstance().albumArtOnLockscreen()) {
final Point screenSize = RetroUtil.getScreenSize(MusicService.this);
final BitmapRequestBuilder<?, Bitmap> request = SongGlideRequest.Builder.from(Glide.with(MusicService.this), song)
.checkIgnoreMediaStore(MusicService.this)
.asBitmap().build();
if (PreferenceUtil.getInstance(this).blurredAlbumArt()) {
if (PreferenceUtil.getInstance().blurredAlbumArt()) {
request.transform(new BlurTransformation.Builder(MusicService.this).build());
}
runOnUiThread(new Runnable() {
@ -1090,16 +1090,12 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
final Song song = getCurrentSong();
intent.putExtra("id", song.id);
intent.putExtra("artist", song.artistName);
intent.putExtra("album", song.albumName);
intent.putExtra("track", song.title);
intent.putExtra("duration", song.duration);
intent.putExtra("position", (long) getSongProgressMillis());
intent.putExtra("playing", isPlaying());
intent.putExtra("scrobbling_source", RETRO_MUSIC_PACKAGE_NAME);
sendStickyBroadcast(intent);
@ -1196,7 +1192,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
}
private void registerHeadsetEvents() {
if (!headsetReceiverRegistered && PreferenceUtil.getInstance(this).getHeadsetPlugged()) {
if (!headsetReceiverRegistered && PreferenceUtil.getInstance().getHeadsetPlugged()) {
registerReceiver(headsetReceiver, headsetReceiverIntentFilter);
headsetReceiverRegistered = true;
}
@ -1252,7 +1248,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
switch (msg.what) {
case DUCK:
if (PreferenceUtil.getInstance(service).audioDucking()) {
if (PreferenceUtil.getInstance().audioDucking()) {
currentDuckVolume -= .05f;
if (currentDuckVolume > .2f) {
sendEmptyMessageDelayed(DUCK, 10);
@ -1266,7 +1262,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
break;
case UNDUCK:
if (PreferenceUtil.getInstance(service).audioDucking()) {
if (PreferenceUtil.getInstance().audioDucking()) {
currentDuckVolume += .03f;
if (currentDuckVolume < 1f) {
sendEmptyMessageDelayed(UNDUCK, 10);
@ -1444,4 +1440,4 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
sendPublicIntent(PLAY_STATE_CHANGED); // for musixmatch synced lyrics
}
}
}
}

View File

@ -1,81 +1,82 @@
package code.name.monkey.retromusic.service.notification;
import static android.content.Context.NOTIFICATION_SERVICE;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.os.Build;
import androidx.annotation.RequiresApi;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.service.MusicService;
import static android.content.Context.NOTIFICATION_SERVICE;
public abstract class PlayingNotification {
protected static final float NOTIFICATION_CONTROLS_SIZE_MULTIPLIER = 1.0f;
protected static final float NOTIFICATION_CONTROLS_SIZE_MULTIPLIER = 1.0f;
static final String NOTIFICATION_CHANNEL_ID = "playing_notification";
private static final int NOTIFICATION_ID = 1;
private static final int NOTIFY_MODE_FOREGROUND = 1;
private static final int NOTIFY_MODE_BACKGROUND = 0;
protected MusicService service;
boolean stopped;
private int notifyMode = NOTIFY_MODE_BACKGROUND;
private NotificationManager notificationManager;
private static final int NOTIFICATION_ID = 1;
private static final int NOTIFY_MODE_FOREGROUND = 1;
private static final int NOTIFY_MODE_BACKGROUND = 0;
protected MusicService service;
boolean stopped;
private int notifyMode = NOTIFY_MODE_BACKGROUND;
private NotificationManager notificationManager;
public synchronized void init(MusicService service) {
this.service = service;
notificationManager = (NotificationManager) service.getSystemService(NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel();
}
}
public abstract void update();
public synchronized void stop() {
stopped = true;
service.stopForeground(true);
notificationManager.cancel(NOTIFICATION_ID);
}
void updateNotifyModeAndPostNotification(Notification notification) {
int newNotifyMode;
if (service.isPlaying()) {
newNotifyMode = NOTIFY_MODE_FOREGROUND;
} else {
newNotifyMode = NOTIFY_MODE_BACKGROUND;
public synchronized void init(MusicService service) {
this.service = service;
notificationManager = (NotificationManager) service.getSystemService(NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createNotificationChannel();
}
}
if (notifyMode != newNotifyMode && newNotifyMode == NOTIFY_MODE_BACKGROUND) {
service.stopForeground(false);
public abstract void update();
public synchronized void stop() {
stopped = true;
service.stopForeground(true);
notificationManager.cancel(NOTIFICATION_ID);
}
if (newNotifyMode == NOTIFY_MODE_FOREGROUND) {
service.startForeground(NOTIFICATION_ID, notification);
} else if (newNotifyMode == NOTIFY_MODE_BACKGROUND) {
notificationManager.notify(NOTIFICATION_ID, notification);
void updateNotifyModeAndPostNotification(Notification notification) {
int newNotifyMode;
if (service.isPlaying()) {
newNotifyMode = NOTIFY_MODE_FOREGROUND;
} else {
newNotifyMode = NOTIFY_MODE_BACKGROUND;
}
if (notifyMode != newNotifyMode && newNotifyMode == NOTIFY_MODE_BACKGROUND) {
service.stopForeground(false);
}
if (newNotifyMode == NOTIFY_MODE_FOREGROUND) {
service.startForeground(NOTIFICATION_ID, notification);
} else if (newNotifyMode == NOTIFY_MODE_BACKGROUND) {
notificationManager.notify(NOTIFICATION_ID, notification);
}
notifyMode = newNotifyMode;
}
notifyMode = newNotifyMode;
}
@RequiresApi(26)
private void createNotificationChannel() {
NotificationChannel notificationChannel = notificationManager
.getNotificationChannel(NOTIFICATION_CHANNEL_ID);
if (notificationChannel == null) {
notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID,
service.getString(R.string.playing_notification_name),
NotificationManager.IMPORTANCE_LOW);
notificationChannel
.setDescription(service.getString(R.string.playing_notification_description));
notificationChannel.enableLights(false);
notificationChannel.enableVibration(false);
notificationChannel.setShowBadge(false);
@RequiresApi(26)
private void createNotificationChannel() {
NotificationChannel notificationChannel = notificationManager
.getNotificationChannel(NOTIFICATION_CHANNEL_ID);
if (notificationChannel == null) {
notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID,
service.getString(R.string.playing_notification_name),
NotificationManager.IMPORTANCE_LOW);
notificationChannel
.setDescription(service.getString(R.string.playing_notification_description));
notificationChannel.enableLights(false);
notificationChannel.enableVibration(false);
notificationChannel.setShowBadge(false);
notificationManager.createNotificationChannel(notificationChannel);
notificationManager.createNotificationChannel(notificationChannel);
}
}
}
}

View File

@ -9,8 +9,6 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import android.text.TextUtils;
import android.view.View;
import android.widget.RemoteViews;
@ -20,6 +18,8 @@ import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.target.Target;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
import code.name.monkey.retromusic.R;
@ -28,6 +28,7 @@ import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.ui.activities.NowPayingActivity;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.RetroUtil;
@ -76,7 +77,7 @@ public class PlayingNotificationImpl extends PlayingNotification {
linkButtons(notificationLayout, notificationLayoutBig);
Intent action = new Intent(service, MainActivity.class);
Intent action = new Intent(service, NowPayingActivity.class);
action.putExtra("expand", true);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
@ -114,7 +115,7 @@ public class PlayingNotificationImpl extends PlayingNotification {
public void onResourceReady(BitmapPaletteWrapper resource,
GlideAnimation<? super BitmapPaletteWrapper> glideAnimation) {
update(resource.getBitmap(),
PreferenceUtil.getInstance(service).isDominantColor() ?
PreferenceUtil.getInstance().isDominantColor() ?
RetroColorUtil.getDominantColor(resource.getBitmap(), Color.TRANSPARENT) :
RetroColorUtil.getColor(resource.getPalette(), Color.TRANSPARENT));
}
@ -135,7 +136,7 @@ public class PlayingNotificationImpl extends PlayingNotification {
.setImageViewResource(R.id.image, R.drawable.default_album_art);
}
if (!PreferenceUtil.getInstance(service).coloredNotification()) {
if (!PreferenceUtil.getInstance().coloredNotification()) {
bgColor = Color.WHITE;
}
setBackgroundColor(bgColor);

View File

@ -1,10 +1,5 @@
package code.name.monkey.retromusic.service.notification;
import static code.name.monkey.retromusic.Constants.ACTION_QUIT;
import static code.name.monkey.retromusic.Constants.ACTION_REWIND;
import static code.name.monkey.retromusic.Constants.ACTION_SKIP;
import static code.name.monkey.retromusic.Constants.ACTION_TOGGLE_PAUSE;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Intent;
@ -13,131 +8,137 @@ import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import androidx.media.app.NotificationCompat.MediaStyle;
import android.text.Html;
import code.name.monkey.retromusic.Constants;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.RetroApplication;
import code.name.monkey.retromusic.glide.SongGlideRequest;
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroColorUtil;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import androidx.core.app.NotificationCompat;
import androidx.media.app.NotificationCompat.MediaStyle;
import code.name.monkey.retromusic.Constants;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.glide.SongGlideRequest;
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.ui.activities.NowPayingActivity;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroColorUtil;
import static code.name.monkey.retromusic.Constants.ACTION_QUIT;
import static code.name.monkey.retromusic.Constants.ACTION_REWIND;
import static code.name.monkey.retromusic.Constants.ACTION_SKIP;
import static code.name.monkey.retromusic.Constants.ACTION_TOGGLE_PAUSE;
public class PlayingNotificationImpl24 extends PlayingNotification {
@Override
public synchronized void update() {
stopped = false;
@Override
public synchronized void update() {
stopped = false;
final Song song = service.getCurrentSong();
final boolean isPlaying = service.isPlaying();
final Song song = service.getCurrentSong();
final boolean isPlaying = service.isPlaying();
final int playButtonResId = isPlaying ? R.drawable.ic_pause_white_24dp :
R.drawable.ic_play_arrow_white_24dp;
final int playButtonResId = isPlaying ? R.drawable.ic_pause_white_24dp :
R.drawable.ic_play_arrow_white_24dp;
Intent action = new Intent(service, MainActivity.class);
action.putExtra("expand", true);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
final PendingIntent clickIntent = PendingIntent
.getActivity(service, 0, action, PendingIntent.FLAG_UPDATE_CURRENT);
Intent action = new Intent(service, NowPayingActivity.class);
action.putExtra("expand", true);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
final PendingIntent clickIntent = PendingIntent
.getActivity(service, 0, action, PendingIntent.FLAG_UPDATE_CURRENT);
final ComponentName serviceName = new ComponentName(service, MusicService.class);
Intent intent = new Intent(Constants.ACTION_QUIT);
intent.setComponent(serviceName);
final PendingIntent deleteIntent = PendingIntent.getService(service, 0, intent, 0);
final ComponentName serviceName = new ComponentName(service, MusicService.class);
Intent intent = new Intent(Constants.ACTION_QUIT);
intent.setComponent(serviceName);
final PendingIntent deleteIntent = PendingIntent.getService(service, 0, intent, 0);
final int bigNotificationImageSize = service.getResources()
.getDimensionPixelSize(R.dimen.notification_big_image_size);
service.runOnUiThread(() -> SongGlideRequest.Builder.from(Glide.with(service), song)
.checkIgnoreMediaStore(service)
.generatePalette(service).build()
.into(new SimpleTarget<BitmapPaletteWrapper>(bigNotificationImageSize,
bigNotificationImageSize) {
@Override
public void onResourceReady(BitmapPaletteWrapper resource,
GlideAnimation<? super BitmapPaletteWrapper> glideAnimation) {
update(resource.getBitmap(),
PreferenceUtil.getInstance(RetroApplication.getInstance()).isDominantColor() ?
RetroColorUtil.getDominantColor(resource.getBitmap(), Color.TRANSPARENT) :
RetroColorUtil.getColor(resource.getPalette(), Color.TRANSPARENT));
}
final int bigNotificationImageSize = service.getResources()
.getDimensionPixelSize(R.dimen.notification_big_image_size);
service.runOnUiThread(() -> SongGlideRequest.Builder.from(Glide.with(service), song)
.checkIgnoreMediaStore(service)
.generatePalette(service).build()
.into(new SimpleTarget<BitmapPaletteWrapper>(bigNotificationImageSize,
bigNotificationImageSize) {
@Override
public void onResourceReady(BitmapPaletteWrapper resource,
GlideAnimation<? super BitmapPaletteWrapper> glideAnimation) {
update(resource.getBitmap(),
PreferenceUtil.getInstance().isDominantColor() ?
RetroColorUtil.getDominantColor(resource.getBitmap(), Color.TRANSPARENT) :
RetroColorUtil.getColor(resource.getPalette(), Color.TRANSPARENT));
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
update(null, Color.TRANSPARENT);
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
update(null, Color.TRANSPARENT);
}
void update(Bitmap bitmap, int color) {
if (bitmap == null) {
bitmap = BitmapFactory
.decodeResource(service.getResources(), R.drawable.default_album_art);
}
NotificationCompat.Action playPauseAction = new NotificationCompat.Action(
playButtonResId,
service.getString(R.string.action_play_pause),
retrievePlaybackAction(ACTION_TOGGLE_PAUSE));
void update(Bitmap bitmap, int color) {
if (bitmap == null) {
bitmap = BitmapFactory
.decodeResource(service.getResources(), R.drawable.default_album_art);
}
NotificationCompat.Action playPauseAction = new NotificationCompat.Action(
playButtonResId,
service.getString(R.string.action_play_pause),
retrievePlaybackAction(ACTION_TOGGLE_PAUSE));
NotificationCompat.Action closeAction = new NotificationCompat.Action(
R.drawable.ic_close_white_24dp,
service.getString(R.string.close_notification),
retrievePlaybackAction(ACTION_QUIT));
NotificationCompat.Action closeAction = new NotificationCompat.Action(
R.drawable.ic_close_white_24dp,
service.getString(R.string.close_notification),
retrievePlaybackAction(ACTION_QUIT));
NotificationCompat.Action previousAction = new NotificationCompat.Action(
R.drawable.ic_skip_previous_white_24dp,
service.getString(R.string.action_previous),
retrievePlaybackAction(ACTION_REWIND));
NotificationCompat.Action previousAction = new NotificationCompat.Action(
R.drawable.ic_skip_previous_white_24dp,
service.getString(R.string.action_previous),
retrievePlaybackAction(ACTION_REWIND));
NotificationCompat.Action nextAction = new NotificationCompat.Action(
R.drawable.ic_skip_next_white_24dp,
service.getString(R.string.action_next),
retrievePlaybackAction(ACTION_SKIP));
NotificationCompat.Action nextAction = new NotificationCompat.Action(
R.drawable.ic_skip_next_white_24dp,
service.getString(R.string.action_next),
retrievePlaybackAction(ACTION_SKIP));
NotificationCompat.Builder builder = new NotificationCompat.Builder(service,
NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setLargeIcon(bitmap)
.setContentIntent(clickIntent)
.setDeleteIntent(deleteIntent)
.setContentTitle(Html.fromHtml("<b>" + song.title + "</b>"))
.setContentText(song.artistName)
.setSubText(Html.fromHtml("<b>" + song.albumName + "</b>"))
.setOngoing(isPlaying)
.setShowWhen(false)
.addAction(previousAction)
.addAction(playPauseAction)
.addAction(nextAction)
.addAction(closeAction);
NotificationCompat.Builder builder = new NotificationCompat.Builder(service,
NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setLargeIcon(bitmap)
.setContentIntent(clickIntent)
.setDeleteIntent(deleteIntent)
.setContentTitle(Html.fromHtml("<b>" + song.title + "</b>"))
.setContentText(song.artistName)
.setSubText(Html.fromHtml("<b>" + song.albumName + "</b>"))
.setOngoing(isPlaying)
.setShowWhen(false)
.addAction(previousAction)
.addAction(playPauseAction)
.addAction(nextAction)
.addAction(closeAction);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.setStyle(new MediaStyle()
.setMediaSession(service.getMediaSession().getSessionToken())
.setShowActionsInCompactView(0, 1, 2, 3, 4))
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O && PreferenceUtil
.getInstance(service).coloredNotification()) {
builder.setColor(color);
}
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.setStyle(new MediaStyle()
.setMediaSession(service.getMediaSession().getSessionToken())
.setShowActionsInCompactView(0, 1, 2, 3, 4))
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.O &&
PreferenceUtil.getInstance().coloredNotification()) {
builder.setColor(color);
}
}
if (stopped) {
return; // notification has been stopped before loading was finished
}
updateNotifyModeAndPostNotification(builder.build());
}
}));
}
if (stopped) {
return; // notification has been stopped before loading was finished
}
updateNotifyModeAndPostNotification(builder.build());
}
}));
}
private PendingIntent retrievePlaybackAction(final String action) {
final ComponentName serviceName = new ComponentName(service, MusicService.class);
Intent intent = new Intent(action);
intent.setComponent(serviceName);
return PendingIntent.getService(service, 0, intent, 0);
}
private PendingIntent retrievePlaybackAction(final String action) {
final ComponentName serviceName = new ComponentName(service, MusicService.class);
Intent intent = new Intent(action);
intent.setComponent(serviceName);
return PendingIntent.getService(service, 0, intent, 0);
}
}

View File

@ -1,11 +1,5 @@
package code.name.monkey.retromusic.service.notification;
import static code.name.monkey.retromusic.Constants.ACTION_QUIT;
import static code.name.monkey.retromusic.Constants.ACTION_REWIND;
import static code.name.monkey.retromusic.Constants.ACTION_SKIP;
import static code.name.monkey.retromusic.Constants.ACTION_TOGGLE_PAUSE;
import static code.name.monkey.retromusic.util.RetroUtil.createBitmap;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
@ -14,9 +8,15 @@ import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.widget.RemoteViews;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.target.Target;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import android.widget.RemoteViews;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
import code.name.monkey.retromusic.R;
@ -24,223 +24,225 @@ import code.name.monkey.retromusic.glide.SongGlideRequest;
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.ui.activities.NowPayingActivity;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroUtil;
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.target.Target;
import static code.name.monkey.retromusic.Constants.ACTION_QUIT;
import static code.name.monkey.retromusic.Constants.ACTION_REWIND;
import static code.name.monkey.retromusic.Constants.ACTION_SKIP;
import static code.name.monkey.retromusic.Constants.ACTION_TOGGLE_PAUSE;
import static code.name.monkey.retromusic.util.RetroUtil.createBitmap;
/**
* @author Hemanth S (h4h13).
*/
public class PlayingNotificationOreo extends PlayingNotification {
private Target<BitmapPaletteWrapper> target;
private Target<BitmapPaletteWrapper> target;
private RemoteViews getCombinedRemoteViews(boolean collapsed, Song song) {
RemoteViews remoteViews = new RemoteViews(service.getPackageName(),
collapsed ? R.layout.layout_notification_collapsed : R.layout.layout_notification_expanded);
private RemoteViews getCombinedRemoteViews(boolean collapsed, Song song) {
RemoteViews remoteViews = new RemoteViews(service.getPackageName(),
collapsed ? R.layout.layout_notification_collapsed : R.layout.layout_notification_expanded);
remoteViews.setTextViewText(R.id.appName,
service.getString(R.string.app_name) + " • " + song.albumName);
remoteViews.setTextViewText(R.id.title, song.title);
remoteViews.setTextViewText(R.id.subtitle, song.artistName);
remoteViews.setTextViewText(R.id.appName,
service.getString(R.string.app_name) + " • " + song.albumName);
remoteViews.setTextViewText(R.id.title, song.title);
remoteViews.setTextViewText(R.id.subtitle, song.artistName);
TypedArray typedArray = service
.obtainStyledAttributes(new int[]{android.R.attr.selectableItemBackground});
int selectableItemBackground = typedArray.getResourceId(0, 0);
typedArray.recycle();
TypedArray typedArray = service
.obtainStyledAttributes(new int[]{android.R.attr.selectableItemBackground});
int selectableItemBackground = typedArray.getResourceId(0, 0);
typedArray.recycle();
remoteViews.setInt(R.id.content, "setBackgroundResource", selectableItemBackground);
remoteViews.setInt(R.id.content, "setBackgroundResource", selectableItemBackground);
linkButtons(remoteViews);
linkButtons(remoteViews);
//setNotificationContent(remoteViews, ColorUtil.isColorLight(backgroundColor));
return remoteViews;
}
@Override
public void update() {
stopped = false;
final Song song = service.getCurrentSong();
final boolean isPlaying = service.isPlaying();
final RemoteViews notificationLayout = getCombinedRemoteViews(true, song);
final RemoteViews notificationLayoutBig = getCombinedRemoteViews(false, song);
Intent action = new Intent(service, MainActivity.class);
action.putExtra("expand", true);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
final PendingIntent clickIntent = PendingIntent
.getActivity(service, 0, action, PendingIntent.FLAG_UPDATE_CURRENT);
final PendingIntent deleteIntent = buildPendingIntent(service, ACTION_QUIT, null);
final NotificationCompat.Builder builder = new NotificationCompat.Builder(service,
NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setContentIntent(clickIntent)
.setDeleteIntent(deleteIntent)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setCustomContentView(notificationLayout)
.setCustomBigContentView(notificationLayoutBig)
.setOngoing(isPlaying);
final int bigNotificationImageSize = service.getResources()
.getDimensionPixelSize(R.dimen.notification_big_image_size);
service.runOnUiThread(new Runnable() {
@Override
public void run() {
if (target != null) {
Glide.clear(target);
}
target = SongGlideRequest.Builder.from(Glide.with(service), song)
.checkIgnoreMediaStore(service)
.generatePalette(service).build()
.into(new SimpleTarget<BitmapPaletteWrapper>(bigNotificationImageSize,
bigNotificationImageSize) {
@Override
public void onResourceReady(BitmapPaletteWrapper resource,
GlideAnimation<? super BitmapPaletteWrapper> glideAnimation) {
MediaNotificationProcessor mediaNotificationProcessor = new MediaNotificationProcessor(
service, service, (i, i2) -> update(resource.getBitmap(), i, i2));
mediaNotificationProcessor.processNotification(resource.getBitmap());
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
update(null, Color.WHITE, Color.BLACK);
}
private void update(@Nullable Bitmap bitmap, int bgColor, int textColor) {
if (bitmap != null) {
notificationLayout.setImageViewBitmap(R.id.largeIcon, bitmap);
notificationLayoutBig.setImageViewBitmap(R.id.largeIcon, bitmap);
} else {
notificationLayout
.setImageViewResource(R.id.largeIcon, R.drawable.default_album_art);
notificationLayoutBig
.setImageViewResource(R.id.largeIcon, R.drawable.default_album_art);
}
if (!PreferenceUtil.getInstance(service).coloredNotification()) {
bgColor = Color.WHITE;
}
setBackgroundColor(bgColor);
setNotificationContent(ColorUtil.isColorLight(bgColor));
if (stopped) {
return; // notification has been stopped before loading was finished
}
updateNotifyModeAndPostNotification(builder.build());
}
private void setBackgroundColor(int color) {
notificationLayout.setInt(R.id.image, "setBackgroundColor", color);
notificationLayoutBig.setInt(R.id.image, "setBackgroundColor", color);
notificationLayout.setInt(R.id.foregroundImage, "setColorFilter", color);
notificationLayoutBig.setInt(R.id.foregroundImage, "setColorFilter", color);
}
private void setNotificationContent(boolean dark) {
int primary = MaterialValueHelper.getPrimaryTextColor(service, dark);
int secondary = MaterialValueHelper.getSecondaryTextColor(service, dark);
Bitmap close = createBitmap(
RetroUtil
.getTintedVectorDrawable(service, R.drawable.ic_close_white_24dp, primary),
NOTIFICATION_CONTROLS_SIZE_MULTIPLIER);
Bitmap prev = createBitmap(
RetroUtil
.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp,
primary), NOTIFICATION_CONTROLS_SIZE_MULTIPLIER);
Bitmap next = createBitmap(
RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp,
primary), NOTIFICATION_CONTROLS_SIZE_MULTIPLIER);
Bitmap playPause = createBitmap(RetroUtil.getTintedVectorDrawable(service,
isPlaying ? R.drawable.ic_pause_white_24dp
: R.drawable.ic_play_arrow_white_24dp, primary),
NOTIFICATION_CONTROLS_SIZE_MULTIPLIER);
notificationLayout.setTextColor(R.id.title, primary);
notificationLayout.setTextColor(R.id.subtitle, secondary);
notificationLayout.setTextColor(R.id.appName, secondary);
notificationLayout.setImageViewBitmap(R.id.action_prev, prev);
notificationLayout.setImageViewBitmap(R.id.action_next, next);
notificationLayout.setImageViewBitmap(R.id.action_play_pause, playPause);
notificationLayoutBig.setTextColor(R.id.title, primary);
notificationLayoutBig.setTextColor(R.id.subtitle, secondary);
notificationLayoutBig.setTextColor(R.id.appName, secondary);
notificationLayoutBig.setImageViewBitmap(R.id.action_quit, close);
notificationLayoutBig.setImageViewBitmap(R.id.action_prev, prev);
notificationLayoutBig.setImageViewBitmap(R.id.action_next, next);
notificationLayoutBig.setImageViewBitmap(R.id.action_play_pause, playPause);
notificationLayout.setImageViewBitmap(R.id.smallIcon,
createBitmap(RetroUtil
.getTintedVectorDrawable(service, R.drawable.ic_notification, secondary),
0.6f));
notificationLayoutBig.setImageViewBitmap(R.id.smallIcon,
createBitmap(RetroUtil
.getTintedVectorDrawable(service, R.drawable.ic_notification, secondary),
0.6f));
notificationLayout.setInt(R.id.arrow, "setColorFilter", secondary);
notificationLayoutBig.setInt(R.id.arrow, "setColorFilter", secondary);
}
});
}
});
if (stopped) {
return; // notification has been stopped before loading was finished
//setNotificationContent(remoteViews, ColorUtil.isColorLight(backgroundColor));
return remoteViews;
}
@Override
public void update() {
stopped = false;
final Song song = service.getCurrentSong();
final boolean isPlaying = service.isPlaying();
final RemoteViews notificationLayout = getCombinedRemoteViews(true, song);
final RemoteViews notificationLayoutBig = getCombinedRemoteViews(false, song);
Intent action = new Intent(service, NowPayingActivity.class);
action.putExtra("expand", true);
action.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
final PendingIntent clickIntent = PendingIntent
.getActivity(service, 0, action, PendingIntent.FLAG_UPDATE_CURRENT);
final PendingIntent deleteIntent = buildPendingIntent(service, ACTION_QUIT, null);
final NotificationCompat.Builder builder = new NotificationCompat.Builder(service,
NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_notification)
.setContentIntent(clickIntent)
.setDeleteIntent(deleteIntent)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setCustomContentView(notificationLayout)
.setCustomBigContentView(notificationLayoutBig)
.setOngoing(isPlaying);
final int bigNotificationImageSize = service.getResources()
.getDimensionPixelSize(R.dimen.notification_big_image_size);
service.runOnUiThread(new Runnable() {
@Override
public void run() {
if (target != null) {
Glide.clear(target);
}
target = SongGlideRequest.Builder.from(Glide.with(service), song)
.checkIgnoreMediaStore(service)
.generatePalette(service).build()
.into(new SimpleTarget<BitmapPaletteWrapper>(bigNotificationImageSize,
bigNotificationImageSize) {
@Override
public void onResourceReady(BitmapPaletteWrapper resource,
GlideAnimation<? super BitmapPaletteWrapper> glideAnimation) {
MediaNotificationProcessor mediaNotificationProcessor = new MediaNotificationProcessor(
service, service, (i, i2) -> update(resource.getBitmap(), i, i2));
mediaNotificationProcessor.processNotification(resource.getBitmap());
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
super.onLoadFailed(e, errorDrawable);
update(null, Color.WHITE, Color.BLACK);
}
private void update(@Nullable Bitmap bitmap, int bgColor, int textColor) {
if (bitmap != null) {
notificationLayout.setImageViewBitmap(R.id.largeIcon, bitmap);
notificationLayoutBig.setImageViewBitmap(R.id.largeIcon, bitmap);
} else {
notificationLayout
.setImageViewResource(R.id.largeIcon, R.drawable.default_album_art);
notificationLayoutBig
.setImageViewResource(R.id.largeIcon, R.drawable.default_album_art);
}
if (!PreferenceUtil.getInstance().coloredNotification()) {
bgColor = Color.WHITE;
}
setBackgroundColor(bgColor);
setNotificationContent(ColorUtil.isColorLight(bgColor));
if (stopped) {
return; // notification has been stopped before loading was finished
}
updateNotifyModeAndPostNotification(builder.build());
}
private void setBackgroundColor(int color) {
notificationLayout.setInt(R.id.image, "setBackgroundColor", color);
notificationLayoutBig.setInt(R.id.image, "setBackgroundColor", color);
notificationLayout.setInt(R.id.foregroundImage, "setColorFilter", color);
notificationLayoutBig.setInt(R.id.foregroundImage, "setColorFilter", color);
}
private void setNotificationContent(boolean dark) {
int primary = MaterialValueHelper.getPrimaryTextColor(service, dark);
int secondary = MaterialValueHelper.getSecondaryTextColor(service, dark);
Bitmap close = createBitmap(
RetroUtil
.getTintedVectorDrawable(service, R.drawable.ic_close_white_24dp, primary),
NOTIFICATION_CONTROLS_SIZE_MULTIPLIER);
Bitmap prev = createBitmap(
RetroUtil
.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp,
primary), NOTIFICATION_CONTROLS_SIZE_MULTIPLIER);
Bitmap next = createBitmap(
RetroUtil.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp,
primary), NOTIFICATION_CONTROLS_SIZE_MULTIPLIER);
Bitmap playPause = createBitmap(RetroUtil.getTintedVectorDrawable(service,
isPlaying ? R.drawable.ic_pause_white_24dp
: R.drawable.ic_play_arrow_white_24dp, primary),
NOTIFICATION_CONTROLS_SIZE_MULTIPLIER);
notificationLayout.setTextColor(R.id.title, primary);
notificationLayout.setTextColor(R.id.subtitle, secondary);
notificationLayout.setTextColor(R.id.appName, secondary);
notificationLayout.setImageViewBitmap(R.id.action_prev, prev);
notificationLayout.setImageViewBitmap(R.id.action_next, next);
notificationLayout.setImageViewBitmap(R.id.action_play_pause, playPause);
notificationLayoutBig.setTextColor(R.id.title, primary);
notificationLayoutBig.setTextColor(R.id.subtitle, secondary);
notificationLayoutBig.setTextColor(R.id.appName, secondary);
notificationLayoutBig.setImageViewBitmap(R.id.action_quit, close);
notificationLayoutBig.setImageViewBitmap(R.id.action_prev, prev);
notificationLayoutBig.setImageViewBitmap(R.id.action_next, next);
notificationLayoutBig.setImageViewBitmap(R.id.action_play_pause, playPause);
notificationLayout.setImageViewBitmap(R.id.smallIcon,
createBitmap(RetroUtil
.getTintedVectorDrawable(service, R.drawable.ic_notification, secondary),
0.6f));
notificationLayoutBig.setImageViewBitmap(R.id.smallIcon,
createBitmap(RetroUtil
.getTintedVectorDrawable(service, R.drawable.ic_notification, secondary),
0.6f));
notificationLayout.setInt(R.id.arrow, "setColorFilter", secondary);
notificationLayoutBig.setInt(R.id.arrow, "setColorFilter", secondary);
}
});
}
});
if (stopped) {
return; // notification has been stopped before loading was finished
}
updateNotifyModeAndPostNotification(builder.build());
}
updateNotifyModeAndPostNotification(builder.build());
}
private PendingIntent buildPendingIntent(Context context, final String action,
final ComponentName serviceName) {
Intent intent = new Intent(action);
intent.setComponent(serviceName);
return PendingIntent.getService(context, 0, intent, 0);
}
private PendingIntent buildPendingIntent(Context context, final String action,
final ComponentName serviceName) {
Intent intent = new Intent(action);
intent.setComponent(serviceName);
return PendingIntent.getService(context, 0, intent, 0);
}
private void linkButtons(final RemoteViews notificationLayout) {
PendingIntent pendingIntent;
private void linkButtons(final RemoteViews notificationLayout) {
PendingIntent pendingIntent;
final ComponentName serviceName = new ComponentName(service, MusicService.class);
final ComponentName serviceName = new ComponentName(service, MusicService.class);
// Previous track
pendingIntent = buildPendingIntent(service, ACTION_REWIND, serviceName);
notificationLayout.setOnClickPendingIntent(R.id.action_prev, pendingIntent);
// Previous track
pendingIntent = buildPendingIntent(service, ACTION_REWIND, serviceName);
notificationLayout.setOnClickPendingIntent(R.id.action_prev, pendingIntent);
// Play and pause
pendingIntent = buildPendingIntent(service, ACTION_TOGGLE_PAUSE, serviceName);
notificationLayout.setOnClickPendingIntent(R.id.action_play_pause, pendingIntent);
// Play and pause
pendingIntent = buildPendingIntent(service, ACTION_TOGGLE_PAUSE, serviceName);
notificationLayout.setOnClickPendingIntent(R.id.action_play_pause, pendingIntent);
// Next track
pendingIntent = buildPendingIntent(service, ACTION_SKIP, serviceName);
notificationLayout.setOnClickPendingIntent(R.id.action_next, pendingIntent);
// Next track
pendingIntent = buildPendingIntent(service, ACTION_SKIP, serviceName);
notificationLayout.setOnClickPendingIntent(R.id.action_next, pendingIntent);
// Close
pendingIntent = buildPendingIntent(service, ACTION_QUIT, serviceName);
notificationLayout.setOnClickPendingIntent(R.id.action_quit, pendingIntent);
}
// Close
pendingIntent = buildPendingIntent(service, ACTION_QUIT, serviceName);
notificationLayout.setOnClickPendingIntent(R.id.action_quit, pendingIntent);
}
}

View File

@ -13,7 +13,6 @@ import androidx.viewpager.widget.ViewPager;
* * * * * * * * * * *.Yang Web site:www.ocnyang.com
*******************************************************************/
public class CascadingPageTransformer implements ViewPager.PageTransformer {
/**
*

View File

@ -0,0 +1,30 @@
package code.name.monkey.retromusic.transform;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.ViewPager;
public class DepthTransformation implements ViewPager.PageTransformer {
@Override
public void transformPage(@NonNull View page, float position) {
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
page.setAlpha(0);
} else if (position <= 0) { // [-1,0]
page.setAlpha(1);
page.setTranslationX(0);
page.setScaleX(1);
page.setScaleY(1);
} else if (position <= 1) { // (0,1]
page.setTranslationX(-position * page.getWidth());
page.setAlpha(1 - Math.abs(position));
page.setScaleX(1 - Math.abs(position));
page.setScaleY(1 - Math.abs(position));
} else { // (1,+Infinity]
// This page is way off-screen to the right.
page.setAlpha(0);
}
}
}

View File

@ -0,0 +1,35 @@
package code.name.monkey.retromusic.transform;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.ViewPager;
public class HingeTransformation implements ViewPager.PageTransformer {
@Override
public void transformPage(@NonNull View page, float position) {
page.setTranslationX(-position * page.getWidth());
page.setPivotX(0);
page.setPivotY(0);
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
page.setAlpha(0);
} else if (position <= 0) { // [-1,0]
page.setRotation(90 * Math.abs(position));
page.setAlpha(1 - Math.abs(position));
} else if (position <= 1) { // (0,1]
page.setRotation(0);
page.setAlpha(1);
} else { // (1,+Infinity]
// This page is way off-screen to the right.
page.setAlpha(0);
}
}
}

View File

@ -0,0 +1,39 @@
package code.name.monkey.retromusic.transform;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.ViewPager;
public class HorizontalFlipTransformation implements ViewPager.PageTransformer {
@Override
public void transformPage(@NonNull View page, float position) {
page.setTranslationX(-position * page.getWidth());
page.setCameraDistance(20000);
if (position < 0.5 && position > -0.5) {
page.setVisibility(View.VISIBLE);
} else {
page.setVisibility(View.INVISIBLE);
}
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
page.setAlpha(0);
} else if (position <= 0) { // [-1,0]
page.setAlpha(1);
page.setRotationX(180 * (1 - Math.abs(position) + 1));
} else if (position <= 1) { // (0,1]
page.setAlpha(1);
page.setRotationX(-180 * (1 - Math.abs(position) + 1));
} else { // (1,+Infinity]
// This page is way off-screen to the right.
page.setAlpha(0);
}
}
}

View File

@ -0,0 +1,42 @@
package code.name.monkey.retromusic.transform;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.ViewPager;
public class VerticalFlipTransformation implements ViewPager.PageTransformer {
@Override
public void transformPage(@NonNull View page, float position) {
page.setTranslationX(-position * page.getWidth());
page.setCameraDistance(100000);
if (position < 0.5 && position > -0.5) {
page.setVisibility(View.VISIBLE);
} else {
page.setVisibility(View.INVISIBLE);
}
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
page.setAlpha(0);
} else if (position <= 0) { // [-1,0]
page.setAlpha(1);
page.setRotationY(180 * (1 - Math.abs(position) + 1));
} else if (position <= 1) { // (0,1]
page.setAlpha(1);
page.setRotationY(-180 * (1 - Math.abs(position) + 1));
} else { // (1,+Infinity]
// This page is way off-screen to the right.
page.setAlpha(0);
}
}
}

View File

@ -10,6 +10,7 @@ import android.view.View;
import android.widget.TextView;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.material.appbar.AppBarLayout;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@ -28,9 +29,9 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.Constants;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.ChangelogDialog;
import code.name.monkey.retromusic.model.Contributor;
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
import code.name.monkey.retromusic.ui.adapter.ContributorAdapter;
@ -50,12 +51,12 @@ import static code.name.monkey.retromusic.Constants.TRANSLATE;
public class AboutActivity extends AbsBaseActivity {
@BindView(R.id.app_bar)
AppBarLayout appBarLayout;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
View background;
@BindView(R.id.app_version)
TextView appVersion;
@ -73,7 +74,6 @@ public class AboutActivity extends AbsBaseActivity {
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
loadContributors();
@ -92,16 +92,15 @@ public class AboutActivity extends AbsBaseActivity {
}
private void setUpToolbar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
int primaryColor = ThemeStore.primaryColor(this);
toolbar.setBackgroundColor(primaryColor);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
toolbar.setNavigationOnClickListener(v -> onBackPressed());
setTitle(null);
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
setSupportActionBar(toolbar);
//noinspection ConstantConditions
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setTitle(null);
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
}
private void openUrl(String url) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
@ -166,7 +165,7 @@ public class AboutActivity extends AbsBaseActivity {
if (position == 0) {
openUrl(TELEGRAM_CHANGE_LOG);
} else {
ChangelogDialog.create().show(getSupportFragmentManager(), "change-log");
NavigationUtil.gotoWhatNews(AboutActivity.this);
}
}
})

View File

@ -1,41 +1,42 @@
package code.name.monkey.retromusic.ui.activities;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.core.content.ContextCompat;
import androidx.core.util.Pair;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar;
import android.transition.Slide;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.button.MaterialButton;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.util.Pair;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
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.MaterialUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
@ -44,7 +45,6 @@ import code.name.monkey.retromusic.dialogs.DeleteSongsDialog;
import code.name.monkey.retromusic.glide.ArtistGlideRequest;
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget;
import code.name.monkey.retromusic.glide.SongGlideRequest;
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.SortOrder.AlbumSongSortOrder;
import code.name.monkey.retromusic.loaders.ArtistLoader;
@ -85,7 +85,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
AppCompatTextView songTitle;
@BindView(R.id.action_shuffle_all)
FloatingActionButton shuffleButton;
MaterialButton shuffleButton;
@BindView(R.id.collapsing_toolbar)
@Nullable
@ -108,35 +108,49 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
TextView moreTitle;
@BindView(R.id.artist_image)
@Nullable
ImageView artistImage;
private AlbumDetailsPresenter albumDetailsPresenter;
private Album album;
private SimpleSongAdapter adapter;
private Album album;
@Override
protected View createContentView() {
return wrapSlidingMusicPanel(R.layout.activity_album);
}
void setupWindowTransition() {
Slide slide = new Slide(Gravity.BOTTOM);
slide.setInterpolator(
AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in));
getWindow().setEnterTransition(slide);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
setDrawUnderStatusBar(true);
setDrawUnderStatusBar();
setupWindowTransition();
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
setBottomBarVisibility(View.GONE);
toggleBottomNavigationView(true);
setLightNavigationBar(true);
setNavigationbarColorAuto();
supportPostponeEnterTransition();
setupToolbarMarginHeight();
ActivityCompat.postponeEnterTransition(this);
adapter = new SimpleSongAdapter(this, new ArrayList<>(), R.layout.item_song);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setAdapter(adapter);
setupToolbarMarginHeight();
int albumId = getIntent().getIntExtra(EXTRA_ALBUM_ID, -1);
albumDetailsPresenter = new AlbumDetailsPresenter(this, albumId);
}
private void setupToolbarMarginHeight() {
@ -153,7 +167,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
getSupportActionBar().setTitle(null);
if (toolbar != null && !PreferenceUtil.getInstance(this).getFullScreenMode()) {
if (toolbar != null && !PreferenceUtil.getInstance().getFullScreenMode()) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
params.topMargin = RetroUtil.getStatusBarHeight(this);
toolbar.setLayoutParams(params);
@ -166,21 +180,20 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
int color;
switch (state) {
case COLLAPSED:
setLightStatusbar(!ATHUtil.isWindowBackgroundDark(AlbumDetailsActivity.this));
color = ATHUtil.resolveColor(AlbumDetailsActivity.this, R.attr.iconColor);
setLightStatusbar(ColorUtil.isColorLight(ThemeStore.primaryColor(AlbumDetailsActivity.this)));
color = ThemeStore.primaryColor(AlbumDetailsActivity.this);
break;
default:
case EXPANDED:
case IDLE:
setLightStatusbar(false);
color = ContextCompat.getColor(AlbumDetailsActivity.this, R.color.md_white_1000);
color = Color.TRANSPARENT;
break;
}
ToolbarContentTintHelper.colorizeToolbar(toolbar, color, AlbumDetailsActivity.this);
ToolbarContentTintHelper.setToolbarContentColorBasedOnToolbarColor(AlbumDetailsActivity.this, toolbar, color);
}
});
}
}
@OnClick({R.id.action_shuffle_all, R.id.artist_image})
@ -193,8 +206,8 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
artistPairs);
break;
case R.id.action_shuffle_all:
if (album.songs != null) {
MusicPlayerRemote.openAndShuffleQueue(album.songs, true);
if (getAlbum().songs != null) {
MusicPlayerRemote.openAndShuffleQueue(getAlbum().songs, true);
}
break;
}
@ -224,7 +237,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
@Override
public void completed() {
supportStartPostponedEnterTransition();
ActivityCompat.startPostponedEnterTransition(this);
}
@Override
@ -241,31 +254,24 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(this, album.songs))));
loadAlbumCover();
adapter = new SimpleSongAdapter(this, this.album.songs, R.layout.item_song);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
recyclerView.setNestedScrollingEnabled(false);
loadMoreFrom(album);
adapter.swapDataSet(album.songs);
}
private void loadMoreFrom(Album album) {
ArtistGlideRequest.Builder.from(Glide.with(this),
ArtistLoader.getArtist(this, album.getArtistId()).blockingFirst())
.forceDownload(false)
.generatePalette(this).build()
.dontAnimate()
.into(new RetroMusicColoredTarget(artistImage) {
@Override
public void onColorReady(int color) {
//setColors(color);
}
});
if (artistImage != null) {
ArtistGlideRequest.Builder.from(Glide.with(this),
ArtistLoader.getArtist(this, album.getArtistId()).blockingFirst())
.forceDownload(false)
.generatePalette(this).build()
.dontAnimate()
.into(new RetroMusicColoredTarget(artistImage) {
@Override
public void onColorReady(int color) {
//setColors(color);
}
});
}
ArrayList<Album> albums = ArtistLoader.getArtist(this, album.getArtistId())
.blockingFirst().albums;
@ -278,11 +284,11 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
}
moreTitle.setText(String.format("More from %s", album.getArtistName()));
AlbumAdapter albumAdapter = new HorizontalAlbumAdapter(this, albums,
false, null);
moreRecyclerView
.setLayoutManager(new GridLayoutManager(this, 1, GridLayoutManager.HORIZONTAL, false));
AlbumAdapter albumAdapter = new HorizontalAlbumAdapter(this, albums, false, null);
moreRecyclerView.setLayoutManager(new GridLayoutManager(this, 1, GridLayoutManager.HORIZONTAL, false));
moreRecyclerView.setAdapter(albumAdapter);
ActivityCompat.startPostponedEnterTransition(this);
}
public Album getAlbum() {
@ -294,22 +300,6 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
.checkIgnoreMediaStore(this)
.generatePalette(this).build()
.dontAnimate()
.listener(new RequestListener<Object, BitmapPaletteWrapper>() {
@Override
public boolean onException(Exception e, Object model, Target<BitmapPaletteWrapper> target,
boolean isFirstResource) {
supportStartPostponedEnterTransition();
return false;
}
@Override
public boolean onResourceReady(BitmapPaletteWrapper resource, Object model,
Target<BitmapPaletteWrapper> target, boolean isFromMemoryCache,
boolean isFirstResource) {
supportStartPostponedEnterTransition();
return false;
}
})
.into(new RetroMusicColoredTarget(image) {
@Override
public void onColorReady(int color) {
@ -320,14 +310,15 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
private void setColors(int color) {
int themeColor =
PreferenceUtil.getInstance(this).getAdaptiveColor() ? color : ThemeStore.accentColor(this);
PreferenceUtil.getInstance().getAdaptiveColor() ? color : ThemeStore.accentColor(this);
songTitle.setTextColor(themeColor);
moreTitle.setTextColor(themeColor);
TintHelper.setTintAuto(shuffleButton, themeColor, true);
MaterialUtil.setTint(shuffleButton, true, themeColor);
//findViewById(R.id.root).setBackgroundColor(ThemeStore.primaryColor(this));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_album_detail, menu);
@ -390,7 +381,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
}
private String getSavedSortOrder() {
return PreferenceUtil.getInstance(this).getAlbumDetailSongSortOrder();
return PreferenceUtil.getInstance().getAlbumDetailSongSortOrder();
}
private void setUpSortOrderMenu(@NonNull SubMenu sortOrder) {
@ -411,7 +402,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
}
private void setSaveSortOrder(String sortOrder) {
PreferenceUtil.getInstance(this).setAlbumDetailSongSortOrder(sortOrder);
PreferenceUtil.getInstance().setAlbumDetailSongSortOrder(sortOrder);
reload();
}

View File

@ -2,41 +2,45 @@ package code.name.monkey.retromusic.ui.activities;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.core.content.ContextCompat;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar;
import android.text.Html;
import android.text.Spanned;
import android.transition.Slide;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.button.MaterialButton;
import java.util.ArrayList;
import java.util.Locale;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
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.MaterialUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
@ -105,7 +109,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
TextView text;
@BindView(R.id.action_shuffle_all)
FloatingActionButton shuffleButton;
MaterialButton shuffleButton;
@BindView(R.id.gradient_background)
@Nullable
@ -130,6 +134,15 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
private AlbumAdapter albumAdapter;
private boolean forceDownload;
void setupWindowTransistion() {
Slide slide = new Slide(Gravity.BOTTOM);
slide.setInterpolator(
AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in));
getWindow().setEnterTransition(slide);
}
@Override
protected View createContentView() {
return wrapSlidingMusicPanel(R.layout.activity_artist_details);
@ -137,17 +150,16 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
@Override
protected void onCreate(Bundle bundle) {
setDrawUnderStatusBar(true);
setDrawUnderStatusBar();
setupWindowTransistion();
super.onCreate(bundle);
ButterKnife.bind(this);
setBottomBarVisibility(View.GONE);
toggleBottomNavigationView(true);
setNavigationbarColorAuto();
setLightNavigationBar(true);
supportPostponeEnterTransition();
ActivityCompat.postponeEnterTransition(this);
lastFMRestClient = new LastFMRestClient(this);
@ -159,7 +171,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
private void setUpViews() {
setupRecyclerView();
setupToolbar();
setupToolbarMarginHeight();
setupContainerHeight();
}
@ -171,49 +183,47 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
}
}
private void setupToolbar() {
private void setupToolbarMarginHeight() {
int primaryColor = ThemeStore.primaryColor(this);
TintHelper.setTintAuto(contentContainer, primaryColor, true);
if (collapsingToolbarLayout != null) {
collapsingToolbarLayout.setContentScrimColor(primaryColor);
collapsingToolbarLayout.setStatusBarScrimColor(ColorUtil.darkenColor(primaryColor));
}
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
setSupportActionBar(toolbar);
//noinspection ConstantConditions
getSupportActionBar().setTitle(null);
if (toolbar != null && !PreferenceUtil.getInstance(this).getFullScreenMode()) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar
.getLayoutParams();
if (toolbar != null && !PreferenceUtil.getInstance().getFullScreenMode()) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
params.topMargin = RetroUtil.getStatusBarHeight(this);
toolbar.setLayoutParams(params);
}
int primaryColor = ThemeStore.primaryColor(this);
TintHelper.setTintAuto(contentContainer, primaryColor, true);
if (appBarLayout != null) {
appBarLayout.setBackgroundColor(primaryColor);
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout,
AppBarStateChangeListener.State state) {
public void onStateChanged(AppBarLayout appBarLayout, State state) {
int color;
switch (state) {
case COLLAPSED:
setLightStatusbar(!ATHUtil.isWindowBackgroundDark(ArtistDetailActivity.this));
color = ATHUtil.resolveColor(ArtistDetailActivity.this, R.attr.iconColor);
setLightStatusbar(ColorUtil.isColorLight(ThemeStore.primaryColor(appBarLayout.getContext())));
color = ThemeStore.primaryColor(appBarLayout.getContext());
break;
default:
case EXPANDED:
case IDLE:
setLightStatusbar(false);
color = ContextCompat.getColor(ArtistDetailActivity.this, R.color.md_white_1000);
color = Color.TRANSPARENT;
break;
}
ToolbarContentTintHelper.colorizeToolbar(toolbar, color, ArtistDetailActivity.this);
ToolbarContentTintHelper.setToolbarContentColorBasedOnToolbarColor(appBarLayout.getContext(), toolbar, color);
}
});
}
if (collapsingToolbarLayout != null) {
collapsingToolbarLayout.setContentScrimColor(primaryColor);
collapsingToolbarLayout.setStatusBarScrimColor(ColorUtil.darkenColor(primaryColor));
}
}
private void setupRecyclerView() {
@ -270,7 +280,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
@Override
public void completed() {
supportStartPostponedEnterTransition();
ActivityCompat.startPostponedEnterTransition(this);
}
@Override
@ -367,14 +377,13 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
private void setColors(int color) {
int textColor =
PreferenceUtil.getInstance(this).getAdaptiveColor() ? color : ThemeStore.accentColor(this);
int textColor = PreferenceUtil.getInstance().getAdaptiveColor() ? color : ThemeStore.accentColor(this);
albumTitle.setTextColor(textColor);
songTitle.setTextColor(textColor);
biographyTitle.setTextColor(textColor);
TintHelper.setTintAuto(shuffleButton, textColor, true);
MaterialUtil.setTint(shuffleButton, true, textColor);
if (background != null) {
background.setBackgroundTintList(ColorStateList.valueOf(color));

View File

@ -1,13 +1,6 @@
package code.name.monkey.retromusic.ui.activities;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@ -17,22 +10,27 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import com.afollestad.materialcab.MaterialCab;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.menu.GenreMenuHelper;
import code.name.monkey.retromusic.interfaces.CabHolder;
import code.name.monkey.retromusic.misc.AppBarStateChangeListener;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.mvp.contract.GenreDetailsContract;
@ -83,14 +81,14 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
@Override
protected void onCreate(Bundle savedInstanceState) {
setDrawUnderStatusBar(true);
setDrawUnderStatusBar();
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
setBottomBarVisibility(View.GONE);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
toggleBottomNavigationView(true);
setLightNavigationBar(true);
@ -113,29 +111,14 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
private void setUpToolBar() {
title.setText(genre.name);
title.setTextColor(ThemeStore.textColorPrimary(this));
int primaryColor = ThemeStore.primaryColor(this);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
toolbar.setBackgroundColor(primaryColor);
appBarLayout.setBackgroundColor(primaryColor);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
setTitle(null);
setSupportActionBar(toolbar);
appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state) {
int color;
switch (state) {
default:
case COLLAPSED:
case EXPANDED:
case IDLE:
color = ATHUtil.resolveColor(GenreDetailsActivity.this, android.R.attr.textColorPrimary);
break;
}
ToolbarContentTintHelper.colorizeToolbar(toolbar, color, GenreDetailsActivity.this);
}
});
TintHelper.setTintAuto(shuffleButton, ThemeStore.accentColor(this), true);
}
@ -208,30 +191,6 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
songAdapter.swapDataSet(songs);
}
public void showHeartAnimation() {
shuffleButton.clearAnimation();
shuffleButton.setScaleX(0.9f);
shuffleButton.setScaleY(0.9f);
shuffleButton.setVisibility(View.VISIBLE);
shuffleButton.setPivotX(shuffleButton.getWidth() / 2);
shuffleButton.setPivotY(shuffleButton.getHeight() / 2);
shuffleButton.animate()
.setDuration(200)
.setInterpolator(new DecelerateInterpolator())
.scaleX(1.1f)
.scaleY(1.1f)
.withEndAction(() -> shuffleButton.animate()
.setDuration(200)
.setInterpolator(new AccelerateInterpolator())
.scaleX(1f)
.scaleY(1f)
.alpha(1f)
.start())
.start();
}
@NonNull
@Override
public MaterialCab openCab(final int menu, final MaterialCab.Callback callback) {

View File

@ -11,6 +11,7 @@ import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
@ -19,7 +20,7 @@ public class LicenseActivity extends AbsBaseActivity {
WebView mLicense;
@BindView(R.id.toolbar)
Toolbar mToolbar;
Toolbar toolbar;
@BindView(R.id.app_bar)
AppBarLayout mAppbar;
@ -50,11 +51,12 @@ public class LicenseActivity extends AbsBaseActivity {
mLicense.loadUrl("file:///android_asset/index.html");
title.setTextColor(ThemeStore.textColorPrimary(this));
mToolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
mToolbar.setNavigationOnClickListener(view -> onBackPressed());
mToolbar.setBackgroundColor(ThemeStore.primaryColor(this));
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
toolbar.setNavigationOnClickListener(view -> onBackPressed());
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
mAppbar.setBackgroundColor(ThemeStore.primaryColor(this));
setTitle(null);
setSupportActionBar(mToolbar);
setSupportActionBar(toolbar);
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
}
}

View File

@ -30,7 +30,7 @@ public class LockScreenActivity extends AbsMusicServiceActivity {
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
setDrawUnderStatusBar(true);
setDrawUnderStatusBar();
setContentView(R.layout.activity_lock_screen_old_style);
hideStatusBar();

View File

@ -92,11 +92,11 @@ public class LyricsActivity extends AbsMusicServiceActivity implements
loadLrcFile();
actionsLayout.setOnCheckedChangeListener((group, checkedId) -> selectLyricsTye(checkedId));
actionsLayout.check(PreferenceUtil.getInstance(this).getLastLyricsType());
actionsLayout.check(PreferenceUtil.getInstance().getLastLyricsType());
}
private void selectLyricsTye(int group) {
PreferenceUtil.getInstance(this).setLastLyricsType(group);
PreferenceUtil.getInstance().setLastLyricsType(group);
RadioButton radioButton = actionsLayout.findViewById(group);
if (radioButton != null) {
radioButton.setBackgroundTintList(ColorStateList.valueOf(ThemeStore.accentColor(this)));
@ -198,7 +198,7 @@ public class LyricsActivity extends AbsMusicServiceActivity implements
.into(new RetroMusicColoredTarget(findViewById(R.id.image)) {
@Override
public void onColorReady(int color) {
if (PreferenceUtil.getInstance(LyricsActivity.this).getAdaptiveColor()) {
if (PreferenceUtil.getInstance( ).getAdaptiveColor()) {
background.setBackgroundColor(color);
}
}

View File

@ -33,7 +33,6 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.RetroApplication;
import code.name.monkey.retromusic.dialogs.ChangelogDialog;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.SearchQueryHelper;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
@ -45,12 +44,10 @@ import code.name.monkey.retromusic.service.MusicService;
import code.name.monkey.retromusic.ui.activities.base.AbsSlidingMusicPanelActivity;
import code.name.monkey.retromusic.ui.fragments.mainactivity.LibraryFragment;
import code.name.monkey.retromusic.ui.fragments.mainactivity.home.BannerHomeFragment;
import code.name.monkey.retromusic.ui.fragments.mainactivity.home.HomeFragment;
import code.name.monkey.retromusic.util.PreferenceUtil;
import io.reactivex.disposables.CompositeDisposable;
public class MainActivity extends AbsSlidingMusicPanelActivity implements SharedPreferences.OnSharedPreferenceChangeListener, BottomNavigationView.OnNavigationItemSelectedListener {
public static final int APP_INTRO_REQUEST = 2323;
public static final int LIBRARY = 1;
public static final int FOLDERS = 3;
@ -65,15 +62,15 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements Shared
@BindView(R.id.parent_container)
FrameLayout drawerLayout;
private boolean blockRequestPermissions;
private CompositeDisposable disposable = new CompositeDisposable();
private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action != null && action.equals(Intent.ACTION_SCREEN_OFF)) {
if (PreferenceUtil.getInstance(context).getLockScreen() && MusicPlayerRemote.isPlaying()) {
if (PreferenceUtil.getInstance().getLockScreen() && MusicPlayerRemote.isPlaying()) {
Intent activity = new Intent(context, LockScreenActivity.class);
activity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
@ -94,7 +91,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements Shared
@Override
protected void onCreate(Bundle savedInstanceState) {
setDrawUnderStatusBar(true);
setDrawUnderStatusBar();
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
@ -103,7 +100,8 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements Shared
drawerLayout.setOnApplyWindowInsetsListener((view, windowInsets) -> windowInsets.replaceSystemWindowInsets(0, 0, 0, 0));
if (savedInstanceState == null) {
selectedFragment(PreferenceUtil.getInstance(this).getLastPage());
selectedFragment(PreferenceUtil.getInstance().getLastPage());
//setCurrentFragment(new LibraryFragment(), false, LibraryFragment.TAG);
} else {
restoreCurrentFragment();
}
@ -118,8 +116,8 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements Shared
try {
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
int currentVersion = pInfo.versionCode;
if (currentVersion != PreferenceUtil.getInstance(this).getLastChangelogVersion()) {
ChangelogDialog.create().show(getSupportFragmentManager(), "CHANGE_LOG_DIALOG");
if (currentVersion != PreferenceUtil.getInstance().getLastChangelogVersion()) {
startActivity(new Intent(this, WhatsNewActivity.class));
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
@ -133,11 +131,11 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements Shared
screenOnOff.addAction(Intent.ACTION_SCREEN_OFF);
registerReceiver(broadcastReceiver, screenOnOff);
PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this);
PreferenceUtil.getInstance().registerOnSharedPreferenceChangedListener(this);
if (getIntent().hasExtra("expand")) {
if (getIntent().getBooleanExtra("expand", false)) {
expandPanel();
//expandPanel();
getIntent().putExtra("expand", false);
}
}
@ -152,7 +150,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements Shared
return;
}
unregisterReceiver(broadcastReceiver);
PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this);
PreferenceUtil.getInstance().unregisterOnSharedPreferenceChangedListener(this);
}
public void setCurrentFragment(@NonNull Fragment fragment, boolean isStackAdd, String tag) {
@ -327,9 +325,10 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements Shared
.show();
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
PreferenceUtil.getInstance(this).setLastPage(menuItem.getItemId());
PreferenceUtil.getInstance().setLastPage(menuItem.getItemId());
selectedFragment(menuItem.getItemId());
return true;
}
@ -343,8 +342,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements Shared
setCurrentFragment(LibraryFragment.newInstance(itemId), false, LibraryFragment.TAG);
break;
case R.id.action_home:
setCurrentFragment(PreferenceUtil.getInstance(this).toggleHomeBanner() ? HomeFragment.newInstance() :
BannerHomeFragment.newInstance(), false, HomeFragment.TAG);
setCurrentFragment(BannerHomeFragment.newInstance(), false, BannerHomeFragment.TAG);
break;
}

View File

@ -0,0 +1,162 @@
package code.name.monkey.retromusic.ui.activities;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.transition.Slide;
import android.view.Gravity;
import android.view.animation.AnimationUtils;
import androidx.fragment.app.Fragment;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.ui.activities.base.AbsMusicServiceActivity;
import code.name.monkey.retromusic.ui.fragments.NowPlayingScreen;
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.adaptive.AdaptiveFragment;
import code.name.monkey.retromusic.ui.fragments.player.blur.BlurPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.card.CardFragment;
import code.name.monkey.retromusic.ui.fragments.player.cardblur.CardBlurFragment;
import code.name.monkey.retromusic.ui.fragments.player.color.ColorFragment;
import code.name.monkey.retromusic.ui.fragments.player.fit.FitFragment;
import code.name.monkey.retromusic.ui.fragments.player.flat.FlatPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.full.FullPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.hmm.HmmPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.material.MaterialFragment;
import code.name.monkey.retromusic.ui.fragments.player.normal.PlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.plain.PlainPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.simple.SimplePlayerFragment;
import code.name.monkey.retromusic.util.PreferenceUtil;
public class NowPayingActivity extends AbsMusicServiceActivity implements AbsPlayerFragment.Callbacks, SharedPreferences.OnSharedPreferenceChangeListener {
private NowPlayingScreen currentNowPlayingScreen;
private AbsPlayerFragment playerFragment;
void setupWindowTransition() {
Slide slide = new Slide(Gravity.BOTTOM);
slide.setInterpolator(
AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in));
getWindow().setEnterTransition(slide);
//getWindow().setExitTransition(slide);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
setLightNavigationBar(true);
setupWindowTransition();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_now_playng);
chooseFragmentForTheme();
}
private boolean isOneOfTheseThemes() {
return currentNowPlayingScreen == NowPlayingScreen.FLAT
|| currentNowPlayingScreen == NowPlayingScreen.PLAIN
|| currentNowPlayingScreen == NowPlayingScreen.SIMPLE
|| currentNowPlayingScreen == NowPlayingScreen.NORMAL
|| currentNowPlayingScreen == NowPlayingScreen.ADAPTIVE
|| currentNowPlayingScreen == NowPlayingScreen.TINY
|| currentNowPlayingScreen == NowPlayingScreen.MATERIAL;
}
@Override
public void onPaletteColorChanged() {
int paletteColor = playerFragment.getPaletteColor();
if ((currentNowPlayingScreen == NowPlayingScreen.FLAT || currentNowPlayingScreen == NowPlayingScreen.NORMAL) && PreferenceUtil.getInstance().getAdaptiveColor()) {
setNavigationbarColor(Color.TRANSPARENT);
setLightStatusbar(ColorUtil.isColorLight(paletteColor));
} else if (currentNowPlayingScreen == NowPlayingScreen.COLOR) {
setLightStatusbar(ColorUtil.isColorLight(paletteColor));
} else if (currentNowPlayingScreen == NowPlayingScreen.BLUR || currentNowPlayingScreen == NowPlayingScreen.BLUR_CARD) {
setLightStatusbar(false);
} else {
setLightStatusbar(isOneOfTheseThemes() && ColorUtil.isColorLight(ThemeStore.primaryColor(this)));
}
}
@Override
protected void onResume() {
super.onResume();
if (currentNowPlayingScreen != PreferenceUtil.getInstance().getNowPlayingScreen()) {
postRecreate();
}
PreferenceUtil.getInstance().registerOnSharedPreferenceChangedListener(this);
}
@Override
protected void onPause() {
super.onPause();
PreferenceUtil.getInstance().unregisterOnSharedPreferenceChangedListener(this);
}
@Override
public void onQueueChanged() {
super.onQueueChanged();
if (MusicPlayerRemote.getPlayingQueue().isEmpty()) {
finish();
}
}
private void chooseFragmentForTheme() {
currentNowPlayingScreen = PreferenceUtil.getInstance().getNowPlayingScreen();
Fragment fragment; // must implement AbsPlayerFragment
switch (currentNowPlayingScreen) {
case MATERIAL:
fragment = new MaterialFragment();
break;
case FIT:
fragment = new FitFragment();
break;
case BLUR:
fragment = new BlurPlayerFragment();
break;
case FLAT:
fragment = new FlatPlayerFragment();
break;
case PLAIN:
fragment = new PlainPlayerFragment();
break;
case FULL:
fragment = new FullPlayerFragment();
break;
case COLOR:
fragment = new ColorFragment();
break;
case CARD:
fragment = new CardFragment();
break;
case SIMPLE:
fragment = new SimplePlayerFragment();
break;
case TINY:
fragment = new HmmPlayerFragment();
break;
case BLUR_CARD:
fragment = new CardBlurFragment();
break;
case ADAPTIVE:
fragment = new AdaptiveFragment();
break;
case NORMAL:
default:
fragment = new PlayerFragment();
break;
}
getSupportFragmentManager().beginTransaction().replace(R.id.player_fragment_container, fragment).commit();
getSupportFragmentManager().executePendingTransactions();
playerFragment = (AbsPlayerFragment) getSupportFragmentManager()
.findFragmentById(R.id.player_fragment_container);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals(PreferenceUtil.ALBUM_COVER_STYLE) || key.equals(PreferenceUtil.ALBUM_COVER_TRANSFORM)) {
recreate();
}
}
}

View File

@ -12,6 +12,7 @@ import butterknife.BindString;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.ui.activities.base.AbsMusicServiceActivity;
@ -22,19 +23,19 @@ import code.name.monkey.retromusic.util.MusicUtil;
public class PlayingQueueActivity extends AbsMusicServiceActivity {
@BindView(R.id.toolbar)
Toolbar mToolbar;
Toolbar toolbar;
@BindDrawable(R.drawable.ic_keyboard_backspace_black_24dp)
Drawable mClose;
Drawable close;
@BindView(R.id.player_queue_sub_header)
TextView mPlayerQueueSubHeader;
TextView textView;
@BindString(R.string.queue)
String queue;
@BindView(R.id.app_bar)
AppBarLayout mAppBarLayout;
AppBarLayout appBarLayout;
@BindView(R.id.title)
TextView title;
@ -64,13 +65,15 @@ public class PlayingQueueActivity extends AbsMusicServiceActivity {
private void setupToolbar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
mPlayerQueueSubHeader.setText(getUpNextAndQueueTime());
mPlayerQueueSubHeader.setTextColor(ThemeStore.accentColor(this));
mAppBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
mToolbar.setBackgroundColor(ThemeStore.primaryColor(this));
mToolbar.setNavigationIcon(mClose);
setSupportActionBar(mToolbar);
textView.setText(getUpNextAndQueueTime());
textView.setTextColor(ThemeStore.accentColor(this));
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
toolbar.setNavigationIcon(close);
setSupportActionBar(toolbar);
setTitle(null);
mToolbar.setNavigationOnClickListener(v -> onBackPressed());
toolbar.setNavigationOnClickListener(v -> onBackPressed());
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
}
}

View File

@ -28,6 +28,7 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.menu.PlaylistMenuHelper;
@ -80,16 +81,15 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
@Override
protected void onCreate(Bundle savedInstanceState) {
setDrawUnderStatusBar(true);
setDrawUnderStatusBar();
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
setBottomBarVisibility(View.GONE);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
toggleBottomNavigationView(true);
playlist = getIntent().getExtras().getParcelable(EXTRA_PLAYLIST);
@ -106,7 +106,7 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
shuffleButton.setScaleX(0.9f);
shuffleButton.setScaleY(0.9f);
shuffleButton.setVisibility(View.VISIBLE);
shuffleButton.show();
shuffleButton.setPivotX(shuffleButton.getWidth() / 2);
shuffleButton.setPivotY(shuffleButton.getHeight() / 2);
@ -185,6 +185,8 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
setTitle(null);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
}
@Override

View File

@ -3,10 +3,6 @@ package code.name.monkey.retromusic.ui.activities;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.appbar.AppBarLayout;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
@ -15,13 +11,20 @@ import android.widget.Toast;
import com.anjlab.android.iab.v3.BillingProcessor;
import com.anjlab.android.iab.v3.TransactionDetails;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.button.MaterialButton;
import java.lang.ref.WeakReference;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.MaterialUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.BuildConfig;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.RetroApplication;
@ -39,10 +42,10 @@ public class ProVersionActivity extends AbsBaseActivity implements
Toolbar toolbar;
@BindView(R.id.restore_button)
View restoreButton;
MaterialButton restoreButton;
@BindView(R.id.purchase_button)
View purchaseButton;
MaterialButton purchaseButton;
@BindView(R.id.app_bar)
AppBarLayout appBar;
@ -57,7 +60,7 @@ public class ProVersionActivity extends AbsBaseActivity implements
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pro_version);
setDrawUnderStatusBar(true);
setDrawUnderStatusBar();
ButterKnife.bind(this);
setStatusbarColorAuto();
@ -73,14 +76,17 @@ public class ProVersionActivity extends AbsBaseActivity implements
toolbar.setNavigationOnClickListener(v -> onBackPressed());
title.setTextColor(ThemeStore.textColorPrimary(this));
setSupportActionBar(toolbar);
//noinspection ConstantConditions
getSupportActionBar().setTitle(null);
setTitle(null);
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
restoreButton.setEnabled(false);
purchaseButton.setEnabled(false);
billingProcessor = new BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSE_KEY, this);
MaterialUtil.setTint(restoreButton, false);
MaterialUtil.setTint(purchaseButton, true);
}
private void restorePurchase() {

View File

@ -60,7 +60,7 @@ public class SearchActivity extends AbsMusicServiceActivity implements OnQueryTe
@Override
protected void onCreate(Bundle savedInstanceState) {
setDrawUnderStatusBar(true);
setDrawUnderStatusBar();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);

View File

@ -24,6 +24,7 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.appshortcuts.DynamicShortcutManager;
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
@ -32,6 +33,8 @@ import code.name.monkey.retromusic.util.PreferenceUtil;
public class SettingsActivity extends AbsBaseActivity implements ColorChooserDialog.ColorCallback, SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = "SettingsActivity";
@BindView(R.id.toolbar)
Toolbar toolbar;
@ -44,6 +47,7 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
@BindView(R.id.detail_content_frame)
@Nullable
FrameLayout detailsFrame;
private FragmentManager fragmentManager = getSupportFragmentManager();
@Override
@ -80,7 +84,7 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
setupToolbar();
@ -92,17 +96,15 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
}
private void setupToolbar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
int primaryColor = ThemeStore.primaryColor(this);
toolbar.setBackgroundColor(primaryColor);
appBarLayout.setBackgroundColor(primaryColor);
setTitle(null);
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
setTitle(null);
toolbar.setNavigationOnClickListener(v -> onBackPressed());
title.setTextColor(ThemeStore.textColorPrimary(this));
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
}
public void setupFragment(Fragment fragment, @StringRes int titleName) {
FragmentTransaction fragmentTransaction = fragmentManager
.beginTransaction()
@ -120,7 +122,6 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
}
}
@Override
public void onBackPressed() {
if (fragmentManager.getBackStackEntryCount() == 0) {
@ -145,20 +146,18 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
appBarLayout.setElevation(v);
}
@Override
public void onPause() {
super.onPause();
PreferenceUtil.getInstance(this).unregisterOnSharedPreferenceChangedListener(this);
PreferenceUtil.getInstance().unregisterOnSharedPreferenceChangedListener(this);
}
@Override
public void onResume() {
super.onResume();
PreferenceUtil.getInstance(this).registerOnSharedPreferenceChangedListener(this);
PreferenceUtil.getInstance().registerOnSharedPreferenceChangedListener(this);
}
private static final String TAG = "SettingsActivity";
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
Log.i(TAG, "onSharedPreferenceChanged: ");

View File

@ -1,6 +1,7 @@
package code.name.monkey.retromusic.ui.activities;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Paint;
import android.os.AsyncTask;
import android.os.Bundle;
@ -18,6 +19,7 @@ import com.anjlab.android.iab.v3.BillingProcessor;
import com.anjlab.android.iab.v3.SkuDetails;
import com.anjlab.android.iab.v3.TransactionDetails;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.button.MaterialButton;
import org.json.JSONException;
import org.json.JSONObject;
@ -39,6 +41,7 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.BuildConfig;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
@ -56,26 +59,30 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
private static final int DONATION_PRODUCT_IDS = R.array.donation_ids;
@BindView(R.id.progress)
ProgressBar mProgressBar;
ProgressBar progressBar;
@BindView(R.id.progress_container)
View mProgressContainer;
View progressContainer;
@BindView(R.id.list)
RecyclerView mListView;
RecyclerView recyclerView;
@BindView(R.id.toolbar)
Toolbar mToolbar;
Toolbar toolbar;
@BindView(R.id.app_bar)
AppBarLayout mAppBarLayout;
AppBarLayout appBarLayout;
@BindView(R.id.root)
ViewGroup mViewGroup;
ViewGroup viewGroup;
@BindView(R.id.title)
TextView title;
private BillingProcessor mBillingProcessor;
@BindView(R.id.donate)
MaterialButton materialButton;
private BillingProcessor billingProcessor;
private AsyncTask skuDetailsLoadAsyncTask;
private static List<SkuDetails> getDetails() {
@ -107,7 +114,7 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
private void donate(int i) {
final String[] ids = getResources().getStringArray(DONATION_PRODUCT_IDS);
mBillingProcessor.purchase(this, ids[i]);
billingProcessor.purchase(this, ids[i]);
}
@OnClick(R.id.donate)
@ -129,9 +136,8 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
setupToolbar();
mBillingProcessor
= new BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSE_KEY, this);
MDTintHelper.setTint(mProgressBar, ThemeStore.accentColor(this));
billingProcessor = new BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSE_KEY, this);
MDTintHelper.setTint(progressBar, ThemeStore.accentColor(this));
((TextView) findViewById(R.id.donation)).setTextColor(ThemeStore.accentColor(this));
}
@ -139,12 +145,16 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
private void setupToolbar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
int primaryColor = ThemeStore.primaryColor(this);
mAppBarLayout.setBackgroundColor(primaryColor);
mToolbar.setBackgroundColor(primaryColor);
mToolbar.setNavigationOnClickListener(view -> onBackPressed());
mToolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
setSupportActionBar(mToolbar);
appBarLayout.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(primaryColor);
toolbar.setNavigationOnClickListener(view -> onBackPressed());
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
setSupportActionBar(toolbar);
setTitle(null);
materialButton.setBackgroundTintList(ColorStateList.valueOf(ThemeStore.accentColor(this)));
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
}
@Override
@ -179,15 +189,15 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (!mBillingProcessor.handleActivityResult(requestCode, resultCode, data)) {
if (!billingProcessor.handleActivityResult(requestCode, resultCode, data)) {
super.onActivityResult(requestCode, resultCode, data);
}
}
@Override
public void onDestroy() {
if (mBillingProcessor != null) {
mBillingProcessor.release();
if (billingProcessor != null) {
billingProcessor.release();
}
if (skuDetailsLoadAsyncTask != null) {
skuDetailsLoadAsyncTask.cancel(true);
@ -208,8 +218,8 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
SupportDevelopmentActivity dialog = donationDialogWeakReference.get();
if (dialog == null) return;
dialog.mProgressContainer.setVisibility(View.VISIBLE);
dialog.mListView.setVisibility(View.GONE);
dialog.progressContainer.setVisibility(View.VISIBLE);
dialog.recyclerView.setVisibility(View.GONE);
}
@Override
@ -217,7 +227,7 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
SupportDevelopmentActivity dialog = donationDialogWeakReference.get();
if (dialog != null) {
final String[] ids = dialog.getResources().getStringArray(DONATION_PRODUCT_IDS);
return dialog.mBillingProcessor.getPurchaseListingDetails(new ArrayList<>(Arrays.asList(ids)));
return dialog.billingProcessor.getPurchaseListingDetails(new ArrayList<>(Arrays.asList(ids)));
}
cancel(false);
return null;
@ -230,16 +240,16 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
if (dialog == null) return;
if (skuDetails == null || skuDetails.isEmpty()) {
dialog.mProgressContainer.setVisibility(View.GONE);
dialog.progressContainer.setVisibility(View.GONE);
return;
}
//noinspection ConstantConditions
dialog.mProgressContainer.setVisibility(View.GONE);
dialog.mListView.setItemAnimator(new DefaultItemAnimator());
dialog.mListView.setLayoutManager(new GridLayoutManager(dialog, 2));
dialog.mListView.setAdapter(new SkuDetailsAdapter(dialog, skuDetails));
dialog.mListView.setVisibility(View.VISIBLE);
dialog.progressContainer.setVisibility(View.GONE);
dialog.recyclerView.setItemAnimator(new DefaultItemAnimator());
dialog.recyclerView.setLayoutManager(new GridLayoutManager(dialog, 2));
dialog.recyclerView.setAdapter(new SkuDetailsAdapter(dialog, skuDetails));
dialog.recyclerView.setVisibility(View.VISIBLE);
}
@ -300,7 +310,7 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
viewHolder.price.setText(skuDetails.priceText);
viewHolder.image.setImageResource(getIcon(i));
final boolean purchased = donationsDialog.mBillingProcessor.isPurchased(skuDetails.productId);
final boolean purchased = donationsDialog.billingProcessor.isPurchased(skuDetails.productId);
int titleTextColor = purchased ? ATHUtil.resolveColor(donationsDialog, android.R.attr.textColorHint) : ThemeStore.textColorPrimary(donationsDialog);
int contentTextColor = purchased ? titleTextColor : ThemeStore.textColorSecondary(donationsDialog);

View File

@ -31,6 +31,7 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
import code.name.monkey.retromusic.util.Compressor;
@ -95,20 +96,20 @@ public class UserInfoActivity extends AbsBaseActivity {
title.setTextColor(ThemeStore.textColorPrimary(this));
nameLayout.setBoxStrokeColor(ThemeStore.accentColor(this));
name.setText(PreferenceUtil.getInstance(this).getUserName());
name.setText(PreferenceUtil.getInstance().getUserName());
if (!PreferenceUtil.getInstance(this).getProfileImage().isEmpty()) {
loadImageFromStorage(PreferenceUtil.getInstance(this).getProfileImage());
if (!PreferenceUtil.getInstance().getProfileImage().isEmpty()) {
loadImageFromStorage(PreferenceUtil.getInstance().getProfileImage());
}
if (!PreferenceUtil.getInstance(this).getBannerImage().isEmpty()) {
loadBannerFromStorage(PreferenceUtil.getInstance(this).getBannerImage());
if (!PreferenceUtil.getInstance().getBannerImage().isEmpty()) {
loadBannerFromStorage(PreferenceUtil.getInstance().getBannerImage());
}
}
private void setupToolbar() {
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
nextButton.setBackgroundTintList(ColorStateList.valueOf(ThemeStore.accentColor(this)));
TintHelper.setTintAuto(nextButton, ThemeStore.accentColor(this), true);
}
@OnClick({R.id.next, R.id.banner_select})
@ -124,7 +125,7 @@ public class UserInfoActivity extends AbsBaseActivity {
return;
}
//noinspection ConstantConditions
PreferenceUtil.getInstance(this).setUserName(nameString);
PreferenceUtil.getInstance().setUserName(nameString);
setResult(RESULT_OK);
//((UserInfoActivity) getActivity()).setFragment(new ChooseThemeFragment(), true);
finish();
@ -144,7 +145,7 @@ public class UserInfoActivity extends AbsBaseActivity {
selectBannerImage();
break;
case 1:
PreferenceUtil.getInstance(this).setBannerImagePath("");
PreferenceUtil.getInstance().setBannerImagePath("");
break;
}
}).show();
@ -152,7 +153,7 @@ public class UserInfoActivity extends AbsBaseActivity {
private void selectBannerImage() {
//noinspection ConstantConditions
if (PreferenceUtil.getInstance(this).getBannerImage().isEmpty()) {
if (PreferenceUtil.getInstance().getBannerImage().isEmpty()) {
Intent pickImageIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
pickImageIntent.setType("image/*");
pickImageIntent.putExtra("crop", "true");
@ -165,7 +166,7 @@ public class UserInfoActivity extends AbsBaseActivity {
startActivityForResult(Intent.createChooser(pickImageIntent,
"Select Picture"), PICK_BANNER_REQUEST);
} else {
PreferenceUtil.getInstance(this).setBannerImagePath("");
PreferenceUtil.getInstance().setBannerImagePath("");
image.setImageResource(android.R.color.transparent);
}
}
@ -183,7 +184,7 @@ public class UserInfoActivity extends AbsBaseActivity {
pickNewPhoto();
break;
case 1:
PreferenceUtil.getInstance(this).saveProfileImage("");
PreferenceUtil.getInstance().saveProfileImage("");
break;
}
}).show();
@ -211,7 +212,7 @@ public class UserInfoActivity extends AbsBaseActivity {
try {
Bitmap bitmap = ImageUtil.getResizedBitmap(Media.getBitmap(getContentResolver(), uri), PROFILE_ICON_SIZE);
String profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE);
PreferenceUtil.getInstance(this).saveProfileImage(profileImagePath);
PreferenceUtil.getInstance().saveProfileImage(profileImagePath);
loadImageFromStorage(profileImagePath);
} catch (IOException e) {
@ -224,7 +225,7 @@ public class UserInfoActivity extends AbsBaseActivity {
try {
Bitmap bitmap = Media.getBitmap(getContentResolver(), uri);
String profileImagePath = saveToInternalStorage(bitmap, USER_BANNER);
PreferenceUtil.getInstance(this).setBannerImagePath(profileImagePath);
PreferenceUtil.getInstance().setBannerImagePath(profileImagePath);
loadBannerFromStorage(profileImagePath);
} catch (IOException e) {
e.printStackTrace();

View File

@ -0,0 +1,98 @@
package code.name.monkey.retromusic.ui.activities;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.TextView;
import com.afollestad.materialdialogs.internal.ThemeSingleton;
import com.google.android.material.appbar.AppBarLayout;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.ui.activities.base.AbsBaseActivity;
import code.name.monkey.retromusic.util.PreferenceUtil;
public class WhatsNewActivity extends AbsBaseActivity {
@BindView(R.id.web_view)
WebView webView;
@BindView(R.id.title)
TextView title;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
AppBarLayout appBarLayout;
private static void setChangelogRead(@NonNull Context context) {
try {
PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
int currentVersion = pInfo.versionCode;
PreferenceUtil.getInstance().setLastChangeLogVersion(currentVersion);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
private static String colorToHex(int color) {
return Integer.toHexString(color).substring(2);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_whats_new);
ButterKnife.bind(this);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
setSupportActionBar(toolbar);
setTitle(null);
toolbar.setNavigationOnClickListener(v -> onBackPressed());
title.setTextColor(ThemeStore.textColorPrimary(this));
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
try {
// Load from phonograph-changelog.html in the assets folder
StringBuilder buf = new StringBuilder();
InputStream json = getAssets().open("retro-changelog.html");
BufferedReader in = new BufferedReader(new InputStreamReader(json, "UTF-8"));
String str;
while ((str = in.readLine()) != null)
buf.append(str);
in.close();
// Inject color values for WebView body background and links
final String backgroundColor = colorToHex(ThemeStore.primaryColor(this));
final String contentColor = ThemeSingleton.get().darkTheme ? "#ffffff" : "#000000";
webView.loadData(buf.toString()
.replace("{style-placeholder}",
String.format("body { background-color: %s; color: %s; }", backgroundColor, contentColor))
.replace("{link-color}", colorToHex(ThemeSingleton.get().positiveColor.getDefaultColor()))
.replace("{link-color-active}", colorToHex(ColorUtil.lightenColor(ThemeSingleton.get().positiveColor.getDefaultColor())))
, "text/html", "UTF-8");
} catch (Throwable e) {
webView.loadData("<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8");
}
setChangelogRead(this);
}
}

View File

@ -9,13 +9,16 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.snackbar.Snackbar;
import androidx.core.app.ActivityCompat;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.material.snackbar.Snackbar;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.view.ViewCompat;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.retromusic.R;
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
@ -32,7 +35,6 @@ public abstract class AbsBaseActivity extends AbsThemeActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
permissions = getPermissionsToRequest();
@ -59,7 +61,6 @@ public abstract class AbsBaseActivity extends AbsThemeActivity {
onHasPermissionsChanged(hasPermissions);
}
}
}
protected void onHasPermissionsChanged(boolean hasPermissions) {

View File

@ -1,22 +1,15 @@
package code.name.monkey.retromusic.ui.activities.base;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.animation.PathInterpolator;
import com.google.android.gms.cast.framework.CastSession;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
import com.sothree.slidinguppanel.SlidingUpPanelLayout.PanelState;
import androidx.annotation.ColorInt;
import androidx.annotation.FloatRange;
import androidx.annotation.LayoutRes;
import androidx.fragment.app.Fragment;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
@ -27,169 +20,69 @@ import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.cast.CastHelper;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.ui.fragments.MiniPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.NowPlayingScreen;
import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.adaptive.AdaptiveFragment;
import code.name.monkey.retromusic.ui.fragments.player.blur.BlurPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.card.CardFragment;
import code.name.monkey.retromusic.ui.fragments.player.cardblur.CardBlurFragment;
import code.name.monkey.retromusic.ui.fragments.player.color.ColorFragment;
import code.name.monkey.retromusic.ui.fragments.player.flat.FlatPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.full.FullPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.hmm.HmmPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.material.MaterialFragment;
import code.name.monkey.retromusic.ui.fragments.player.normal.PlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.plain.PlainPlayerFragment;
import code.name.monkey.retromusic.ui.fragments.player.simple.SimplePlayerFragment;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.ViewUtil;
public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivity implements SlidingUpPanelLayout.PanelSlideListener, PlayerFragment.Callbacks {
public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivity {
public static final String TAG = AbsSlidingMusicPanelActivity.class.getSimpleName();
@BindView(R.id.sliding_layout)
SlidingUpPanelLayout slidingUpPanelLayout;
@BindView(R.id.bottom_navigation)
BottomNavigationView bottomNavigationView;
private int navigationbarColor;
private int taskColor;
private boolean lightStatusBar;
private boolean lightNavigationBar;
private NowPlayingScreen currentNowPlayingScreen;
private AbsPlayerFragment playerFragment;
private MiniPlayerFragment miniPlayerFragment;
private ValueAnimator navigationBarColorAnimator;
@BindView(R.id.parentPanel)
ViewGroup parentPanel;
@BindView(R.id.mini_player_container)
ViewGroup miniPlayerContainer;
private MiniPlayerFragment miniPlayerFragment;
protected AbsSlidingMusicPanelActivity() {
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(createContentView());
ButterKnife.bind(this);
choosFragmentForTheme();
//noinspection ConstantConditions
miniPlayerFragment.getView().setOnClickListener(v -> {
CastSession castSession = getCastSession();
if (castSession != null) {
NavigationUtil.gotoExpandedController(AbsSlidingMusicPanelActivity.this);
} else {
expandPanel();
}
}
);
slidingUpPanelLayout.getViewTreeObserver()
.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
slidingUpPanelLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
if (getPanelState() == PanelState.EXPANDED) {
onPanelSlide(slidingUpPanelLayout, 1);
onPanelExpanded(slidingUpPanelLayout);
} else if (getPanelState() == PanelState.COLLAPSED) {
onPanelCollapsed(slidingUpPanelLayout);
} else {
playerFragment.onHide();
}
}
});
slidingUpPanelLayout.addPanelSlideListener(this);
setLightStatusbar(true);
setLightNavigationBar(true);
setupBottomView();
miniPlayerFragment = (MiniPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.mini_player_fragment);
}
private void choosFragmentForTheme() {
currentNowPlayingScreen = PreferenceUtil.getInstance(this).getNowPlayingScreen();
private void setupBottomView() {
bottomNavigationView.setBackgroundColor(ThemeStore.primaryColor(this));
bottomNavigationView.setSelectedItemId(PreferenceUtil.getInstance().getLastPage());
Fragment fragment; // must implement AbsPlayerFragment
switch (currentNowPlayingScreen) {
case MATERIAL:
fragment = new MaterialFragment();
break;
case BLUR:
fragment = new BlurPlayerFragment();
break;
case FLAT:
fragment = new FlatPlayerFragment();
break;
case PLAIN:
fragment = new PlainPlayerFragment();
break;
case FULL:
fragment = new FullPlayerFragment();
break;
case COLOR:
fragment = new ColorFragment();
break;
case CARD:
fragment = new CardFragment();
break;
case SIMPLE:
fragment = new SimplePlayerFragment();
break;
case TINY:
fragment = new HmmPlayerFragment();
break;
case BLUR_CARD:
fragment = new CardBlurFragment();
break;
case ADAPTIVE:
fragment = new AdaptiveFragment();
break;
int iconColor = ATHUtil.resolveColor(this, R.attr.iconColor);
int accentColor = ThemeStore.accentColor(this);
NavigationViewUtil.setItemIconColors(bottomNavigationView, ColorUtil.withAlpha(iconColor, 0.5f), accentColor);
NavigationViewUtil.setItemTextColors(bottomNavigationView, ColorUtil.withAlpha(iconColor, 0.5f), accentColor);
case NORMAL:
default:
fragment = new PlayerFragment();
break;
}
getSupportFragmentManager().beginTransaction().replace(R.id.player_fragment_container, fragment)
.commit();
getSupportFragmentManager().executePendingTransactions();
playerFragment = (AbsPlayerFragment) getSupportFragmentManager()
.findFragmentById(R.id.player_fragment_container);
miniPlayerFragment = (MiniPlayerFragment) getSupportFragmentManager()
.findFragmentById(R.id.mini_player_fragment);
bottomNavigationView.setLabelVisibilityMode(PreferenceUtil.getInstance().getTabTitleMode());
//bottomNavigationView.getMenu().removeItem(R.id.action_playlist);
}
@Override
protected void onResume() {
super.onResume();
if (currentNowPlayingScreen != PreferenceUtil.getInstance(this).getNowPlayingScreen()) {
postRecreate();
public void setBottomBarVisibility(int gone) {
if (bottomNavigationView != null) {
bottomNavigationView.setVisibility(gone);
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (navigationBarColorAnimator != null) {
navigationBarColorAnimator.cancel(); // just in case
}
}
protected abstract View createContentView();
@Override
public void onServiceConnected() {
super.onServiceConnected();
if (!MusicPlayerRemote.getPlayingQueue().isEmpty()) {
slidingUpPanelLayout.getViewTreeObserver()
.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
slidingUpPanelLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
hideBottomBar(false);
}
});
}// don't call hideBottomBar(true) here as it causes a bug with the SlidingUpPanelLayout
if (!MusicPlayerRemote.getPlayingQueue().isEmpty())
parentPanel.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
parentPanel.getViewTreeObserver().removeOnGlobalLayoutListener(this);
hideBottomBar(false);
}
});
}
@Override
@ -198,146 +91,10 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
hideBottomBar(MusicPlayerRemote.getPlayingQueue().isEmpty());
}
@Override
public void onPanelSlide(View panel, @FloatRange(from = 0, to = 1) float slideOffset) {
bottomNavigationView.setTranslationY(slideOffset * 400);
setMiniPlayerAlphaProgress(slideOffset);
}
@Override
public void onPanelStateChanged(View panel, PanelState previousState, PanelState newState) {
switch (newState) {
case COLLAPSED:
onPanelCollapsed(panel);
break;
case EXPANDED:
onPanelExpanded(panel);
break;
case ANCHORED:
collapsePanel(); // this fixes a bug where the panel would get stuck for some reason
break;
}
}
public void onPanelCollapsed(View panel) {
// restore values
super.setLightStatusbar(lightStatusBar);
super.setTaskDescriptionColor(taskColor);
super.setNavigationbarColor(navigationbarColor);
super.setLightNavigationBar(lightNavigationBar);
playerFragment.setMenuVisibility(false);
playerFragment.setUserVisibleHint(false);
playerFragment.onHide();
}
public void onPanelExpanded(View panel) {
// setting fragments values
int playerFragmentColor = playerFragment.getPaletteColor();
super.setTaskDescriptionColor(playerFragmentColor);
if (currentNowPlayingScreen == NowPlayingScreen.COLOR) {
super.setNavigationbarColor(playerFragmentColor);
} else {
super.setNavigationbarColor(ThemeStore.primaryColor(this));
}
setLightStatusBar();
playerFragment.setMenuVisibility(true);
playerFragment.setUserVisibleHint(true);
playerFragment.onShow();
}
private void setLightStatusBar() {
super.setLightStatusbar(PreferenceUtil.getInstance(this).getAdaptiveColor() &&
ColorUtil.isColorLight(ThemeStore.primaryColor(this)) &&
(currentNowPlayingScreen == NowPlayingScreen.FLAT
|| currentNowPlayingScreen == NowPlayingScreen.PLAIN
|| currentNowPlayingScreen == NowPlayingScreen.SIMPLE
|| currentNowPlayingScreen == NowPlayingScreen.NORMAL
|| currentNowPlayingScreen == NowPlayingScreen.ADAPTIVE
|| currentNowPlayingScreen == NowPlayingScreen.TINY
|| currentNowPlayingScreen == NowPlayingScreen.MATERIAL));
}
@Override
public void setLightStatusbar(boolean enabled) {
lightStatusBar = enabled;
if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
super.setLightStatusbar(enabled);
}
}
@Override
public void setLightNavigationBar(boolean enabled) {
lightNavigationBar = enabled;
/*if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
super.setLightNavigationBar(enabled);
}*/
}
@Override
public void setTaskDescriptionColor(@ColorInt int color) {
taskColor = color;
if (getPanelState() == null || getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
super.setTaskDescriptionColor(color);
}
}
@Override
public void setNavigationbarColor(int color) {
navigationbarColor = color;
if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
if (navigationBarColorAnimator != null) {
navigationBarColorAnimator.cancel();
}
super.setNavigationbarColor(color);
}
}
@Override
public void onPaletteColorChanged() {
int playerFragmentColor = playerFragment.getPaletteColor();
if (getPanelState() == PanelState.EXPANDED) {
super.setTaskDescriptionColor(playerFragmentColor);
if (currentNowPlayingScreen == NowPlayingScreen.COLOR) {
super.setNavigationbarColor(playerFragmentColor);
}
}
}
private void setMiniPlayerAlphaProgress(@FloatRange(from = 0, to = 1) float progress) {
if (miniPlayerFragment == null) {
return;
}
float alpha = 1 - progress;
miniPlayerFragment.getView().setAlpha(alpha);
// necessary to make the views below clickable
miniPlayerFragment.getView().setVisibility(alpha == 0 ? View.GONE : View.VISIBLE);
}
public void hideBottomBar(final boolean hide) {
int heightOfBar =
getResources().getDimensionPixelSize(R.dimen.mini_player_height);
int heightOfBarWithTabs =
getResources().getDimensionPixelSize(R.dimen.mini_player_height_expanded);
if (hide) {
slidingUpPanelLayout.setPanelHeight(0);
collapsePanel();
} else {
if (!MusicPlayerRemote.getPlayingQueue().isEmpty()) {
slidingUpPanelLayout.setPanelHeight(bottomNavigationView.getVisibility() == View.VISIBLE ?
heightOfBarWithTabs : heightOfBar);
}
}
miniPlayerContainer.setVisibility(hide ? View.GONE : View.VISIBLE);
}
protected View wrapSlidingMusicPanel(@LayoutRes int resId) {
@SuppressLint("InflateParams")
View slidingMusicPanelLayout = getLayoutInflater().inflate(R.layout.sliding_music_panel_layout, null);
@ -348,51 +105,13 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
@Override
public void onBackPressed() {
if (!handleBackPress()) {
if (handleBackPress()) {
super.onBackPressed();
}
}
public boolean handleBackPress() {
if (slidingUpPanelLayout.getPanelHeight() != 0 && playerFragment.onBackPressed()) {
return true;
}
if (getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
collapsePanel();
return true;
}
return false;
}
private void animateNavigationBarColor(int color) {
if (navigationBarColorAnimator != null) {
navigationBarColorAnimator.cancel();
}
navigationBarColorAnimator = ValueAnimator.ofArgb(getWindow().getNavigationBarColor(), color)
.setDuration(ViewUtil.RETRO_MUSIC_ANIM_TIME);
navigationBarColorAnimator.setInterpolator(new PathInterpolator(0.4f, 0f, 1f, 1f));
navigationBarColorAnimator.addUpdateListener(animation -> {
int playerFragmentColorDark = ColorUtil.darkenColor((Integer) animation.getAnimatedValue());
//bottomNavigationView.setBackgroundColor(playerFragmentColorDark);
miniPlayerFragment.setColor(playerFragmentColorDark);
AbsSlidingMusicPanelActivity.super.setNavigationbarColor(playerFragmentColorDark);
View view = getWindow().getDecorView().getRootView();
view.setBackgroundColor(playerFragmentColorDark);
if (view.findViewById(R.id.toolbar) != null) {
view.findViewById(R.id.toolbar).setBackgroundColor(playerFragmentColorDark);
}
if (view.findViewById(R.id.app_bar) != null) {
view.findViewById(R.id.app_bar).setBackgroundColor(playerFragmentColorDark);
}
if (view.findViewById(R.id.status_bar) != null) {
view.findViewById(R.id.status_bar)
.setBackgroundColor(ColorUtil.darkenColor(playerFragmentColorDark));
}
});
navigationBarColorAnimator.start();
return true;
}
@Override
@ -400,31 +119,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
return findViewById(R.id.content_container);
}
public SlidingUpPanelLayout getSlidingUpPanelLayout() {
return slidingUpPanelLayout;
}
public MiniPlayerFragment getMiniPlayerFragment() {
return miniPlayerFragment;
}
public AbsPlayerFragment getPlayerFragment() {
return playerFragment;
}
public SlidingUpPanelLayout.PanelState getPanelState() {
return slidingUpPanelLayout == null ? null : slidingUpPanelLayout.getPanelState();
}
public void collapsePanel() {
slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
}
public void expandPanel() {
slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED);
}
@Override
public void hideCastMiniController() {
super.hideCastMiniController();
@ -436,16 +130,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
MusicPlayerRemote.setZeroVolume();
}
private void setupBottomView() {
bottomNavigationView.setBackgroundColor(ThemeStore.primaryColor(this));
bottomNavigationView.setSelectedItemId(PreferenceUtil.getInstance(this).getLastPage());
int iconColor = ATHUtil.resolveColor(this, R.attr.iconColor);
int accentColor = ThemeStore.accentColor(this);
NavigationViewUtil.setItemIconColors(bottomNavigationView, ColorUtil.withAlpha(iconColor, 0.5f), accentColor);
NavigationViewUtil.setItemTextColors(bottomNavigationView, ColorUtil.withAlpha(iconColor, 0.5f), accentColor);
bottomNavigationView.setLabelVisibilityMode(PreferenceUtil.getInstance(this).getTabTitleMode());
}
@Override
public void onPlayingMetaChanged() {
super.onPlayingMetaChanged();
@ -457,17 +141,12 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
CastHelper.startCasting(castSession, MusicPlayerRemote.getCurrentSong());
}
public void setBottomBarVisibility(int gone) {
if (bottomNavigationView != null) {
//TransitionManager.beginDelayedTransition(bottomNavigationView);
bottomNavigationView.setVisibility(gone);
hideBottomBar(false);
}
public void toggleBottomNavigationView(boolean toggle) {
bottomNavigationView.setVisibility(toggle ? View.GONE : View.VISIBLE);
}
public BottomNavigationView getBottomNavigationView() {
return bottomNavigationView;
}
}

View File

@ -5,12 +5,12 @@ import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.ColorInt;
import androidx.core.content.ContextCompat;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import androidx.annotation.ColorInt;
import androidx.core.content.ContextCompat;
import code.name.monkey.appthemehelper.ATH;
import code.name.monkey.appthemehelper.ATHActivity;
import code.name.monkey.appthemehelper.ThemeStore;
@ -29,7 +29,7 @@ public abstract class AbsThemeActivity extends ATHActivity implements Runnable {
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(PreferenceUtil.getInstance(this).getGeneralTheme());
setTheme(PreferenceUtil.getInstance().getGeneralTheme());
hideStatusBar();
super.onCreate(savedInstanceState);
MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this);
@ -41,7 +41,7 @@ public abstract class AbsThemeActivity extends ATHActivity implements Runnable {
}
private void toggleScreenOn() {
if (PreferenceUtil.getInstance(this).isScreenOnEnabled()) {
if (PreferenceUtil.getInstance().isScreenOnEnabled()) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} else {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@ -61,7 +61,7 @@ public abstract class AbsThemeActivity extends ATHActivity implements Runnable {
}
public void hideStatusBar() {
hideStatusBar(PreferenceUtil.getInstance(this).getFullScreenMode());
hideStatusBar(PreferenceUtil.getInstance().getFullScreenMode());
}
private void hideStatusBar(boolean fullscreen) {
@ -73,14 +73,14 @@ public abstract class AbsThemeActivity extends ATHActivity implements Runnable {
private void changeBackgroundShape() {
Drawable background = PreferenceUtil.getInstance(this).isRoundCorners() ?
Drawable background = PreferenceUtil.getInstance().isRoundCorners() ?
ContextCompat.getDrawable(this, R.drawable.round_window)
: ContextCompat.getDrawable(this, R.drawable.square_window);
background = TintHelper.createTintedDrawable(background, ThemeStore.primaryColor(this));
getWindow().setBackgroundDrawable(background);
}
protected void setDrawUnderStatusBar(boolean drawUnderStatusbar) {
public void setDrawUnderStatusBar() {
if (VersionUtils.hasLollipop()) {
RetroUtil.setAllowDrawUnderStatusBar(getWindow());
} else if (VersionUtils.hasKitKat()) {
@ -88,6 +88,14 @@ public abstract class AbsThemeActivity extends ATHActivity implements Runnable {
}
}
public void setDrawUnderNavigationBar() {
if (VersionUtils.hasLollipop()) {
RetroUtil.setAllowDrawUnderNavigationBar(getWindow());
} else if (VersionUtils.hasKitKat()) {
RetroUtil.setStatusBarTranslucent(getWindow());
}
}
/**
* This will set the color of the view with the id "status_bar" on KitKat and Lollipop. On
* Lollipop if no such view is found it will set the statusbar color using the native method.
@ -104,6 +112,9 @@ public abstract class AbsThemeActivity extends ATHActivity implements Runnable {
} else {
statusBar.setBackgroundColor(color);
}
} else if (VersionUtils.hasMarshmallow()) {
getWindow().setStatusBarColor(color);
setLightStatusbarAuto(color);
} else if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(ColorUtil.darkenColor(color));
setLightStatusbarAuto(color);
@ -171,7 +182,7 @@ public abstract class AbsThemeActivity extends ATHActivity implements Runnable {
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
if (PreferenceUtil.getInstance(this).getFullScreenMode()) {
if (PreferenceUtil.getInstance().getFullScreenMode()) {
getWindow().getDecorView().setSystemUiVisibility(flags);
}
}

View File

@ -345,6 +345,15 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
}
}
@Nullable
protected String getComposer() {
try {
return getAudioFile(songPaths.get(0)).getTagOrCreateAndSetDefault().getFirst(FieldKey.COMPOSER);
} catch (Exception ignored) {
return null;
}
}
@Nullable
protected Bitmap getAlbumArt() {
try {

View File

@ -39,6 +39,7 @@ import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder;
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
@ -50,6 +51,7 @@ import code.name.monkey.retromusic.util.ImageUtil;
import code.name.monkey.retromusic.util.LastFMUtil;
import code.name.monkey.retromusic.util.RetroColorUtil;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
@ -92,11 +94,12 @@ public class AlbumTagEditorActivity extends AbsTagEditorActivity implements Text
private Bitmap albumArtBitmap;
private boolean deleteAlbumArt;
private LastFMRestClient lastFMRestClient;
private CompositeDisposable disposable = new CompositeDisposable();
private void setupToolbar() {
title.setTextColor(ThemeStore.textColorPrimary(this));
// toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
title.setTextColor(Color.WHITE);
toolbar.setNavigationOnClickListener(v -> onBackPressed());
ToolbarContentTintHelper.setToolbarContentColorBasedOnToolbarColor(this, toolbar, Color.TRANSPARENT);
setTitle(null);
setSupportActionBar(toolbar);
TintHelper.setTintAuto(content, ThemeStore.primaryColor(this), true);
@ -104,7 +107,7 @@ public class AlbumTagEditorActivity extends AbsTagEditorActivity implements Text
@Override
protected void onCreate(Bundle savedInstanceState) {
setDrawUnderStatusBar(true);
setDrawUnderStatusBar();
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
ButterKnife.apply(textInputLayouts, textColor, ThemeStore.accentColor((this)));
@ -128,7 +131,6 @@ public class AlbumTagEditorActivity extends AbsTagEditorActivity implements Text
year.addTextChangedListener(this);
}
private void fillViewsWithFileTags() {
albumTitle.setText(getAlbumTitle());
albumArtist.setText(getAlbumArtistName());
@ -154,11 +156,17 @@ public class AlbumTagEditorActivity extends AbsTagEditorActivity implements Text
return;
}
lastFMRestClient.getApiService()
disposable.add(lastFMRestClient.getApiService()
.getAlbumInfo(albumTitleStr, albumArtistNameStr, null)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.computation())
.subscribe(this::extractDetails);
.subscribe(this::extractDetails));
}
@Override
protected void onPause() {
super.onPause();
disposable.clear();
}
private void extractDetails(@NonNull LastFmAlbum lastFmAlbum) {

View File

@ -2,14 +2,13 @@ package code.name.monkey.retromusic.ui.activities.tageditor;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.google.android.material.appbar.AppBarLayout;
import androidx.appcompat.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.TextView;
import com.google.android.material.appbar.AppBarLayout;
import org.jaudiotagger.tag.FieldKey;
import java.util.ArrayList;
@ -17,6 +16,8 @@ import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
@ -60,6 +61,9 @@ public class SongTagEditorActivity extends AbsTagEditorActivity implements TextW
@BindView(R.id.album_artist)
EditText albumArtist;
@BindView(R.id.composer)
EditText composer;
private void setupToolbar() {
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
@ -90,7 +94,7 @@ public class SongTagEditorActivity extends AbsTagEditorActivity implements TextW
year.addTextChangedListener(this);
trackNumber.addTextChangedListener(this);
lyrics.addTextChangedListener(this);
composer.addTextChangedListener(this);
}
private void fillViewsWithFileTags() {
@ -102,6 +106,7 @@ public class SongTagEditorActivity extends AbsTagEditorActivity implements TextW
year.setText(getSongYear());
trackNumber.setText(getTrackNumber());
lyrics.setText(getLyrics());
composer.setText(getComposer());
}
@Override
@ -135,6 +140,7 @@ public class SongTagEditorActivity extends AbsTagEditorActivity implements TextW
fieldKeyValueMap.put(FieldKey.TRACK, trackNumber.getText().toString());
fieldKeyValueMap.put(FieldKey.LYRICS, lyrics.getText().toString());
fieldKeyValueMap.put(FieldKey.ALBUM_ARTIST, albumArtist.getText().toString());
fieldKeyValueMap.put(FieldKey.COMPOSER, composer.getText().toString());
writeValuesToFiles(fieldKeyValueMap, null);
}

View File

@ -1,9 +1,6 @@
package code.name.monkey.retromusic.ui.adapter;
import android.app.Activity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -14,10 +11,14 @@ import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindViews;
import butterknife.ButterKnife;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.glide.SongGlideRequest;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.ui.adapter.CollageSongAdapter.CollageSongViewHolder;
import code.name.monkey.retromusic.ui.adapter.base.MediaEntryViewHolder;
@ -37,10 +38,7 @@ public class CollageSongAdapter extends RecyclerView.Adapter<CollageSongViewHold
@Override
public void onBindViewHolder(@NonNull CollageSongViewHolder holder, int position) {
holder.bindSongs();
if (dataSet.size() > 9) {
for (int i = 0; i < dataSet.subList(0, 9).size(); i++) {
if (holder.imageViews != null) {
@ -83,7 +81,7 @@ public class CollageSongAdapter extends RecyclerView.Adapter<CollageSongViewHold
final int startPosition = i;
ImageView imageView = imageViews.get(i);
imageView.setOnClickListener(view -> {
MusicPlayerRemote.playNext(dataSet.get(startPosition));
});
}
}

View File

@ -1,9 +1,6 @@
package code.name.monkey.retromusic.ui.adapter;
import android.app.Activity;
import android.graphics.PorterDuff;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -11,7 +8,8 @@ import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.Locale;
import code.name.monkey.appthemehelper.util.ATHUtil;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.ui.adapter.base.MediaEntryViewHolder;
@ -36,13 +34,14 @@ public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder>
return mGenres;
}
@NonNull
@Override
public GenreAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
public GenreAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(mActivity).inflate(mItemLayoutRes, parent, false));
}
@Override
public void onBindViewHolder(GenreAdapter.ViewHolder holder, int position) {
public void onBindViewHolder(@NonNull GenreAdapter.ViewHolder holder, int position) {
Genre genre = mGenres.get(position);
if (holder.title != null) {
holder.title.setText(genre.name);
@ -52,11 +51,9 @@ public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder>
mActivity.getString(R.string.songs) :
mActivity.getString(R.string.song)));
}
if (holder.image != null) {
holder.image.setImageResource(R.drawable.ic_recent_actors_white_24dp);
}
if (holder.shortSeparator != null) {
holder.shortSeparator.setVisibility(View.VISIBLE);
if (holder.separator != null) {
holder.separator.setVisibility(View.VISIBLE);
}
}
@ -76,11 +73,8 @@ public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder>
if (menu != null) {
menu.setVisibility(View.GONE);
}
if (image != null) {
int iconPadding = mActivity.getResources().getDimensionPixelSize(R.dimen.list_item_image_icon_padding);
image.setPadding(iconPadding, iconPadding, iconPadding, iconPadding);
image.setColorFilter(ATHUtil.resolveColor(mActivity, R.attr.iconColor), PorterDuff.Mode.SRC_IN);
}
assert imageContainer != null;
imageContainer.setVisibility(View.GONE);
}
@Override

View File

@ -205,7 +205,7 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
@Override
public String getSectionName(int position) {
@Nullable String sectionName = null;
switch (PreferenceUtil.getInstance(activity).getAlbumSortOrder()) {
switch (PreferenceUtil.getInstance().getAlbumSortOrder()) {
case SortOrder.AlbumSortOrder.ALBUM_A_Z:
case SortOrder.AlbumSortOrder.ALBUM_Z_A:
sectionName = dataSet.get(position).getTitle();
@ -235,8 +235,8 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
if (isInQuickSelectMode()) {
toggleChecked(getAdapterPosition());
} else {
Pair[] albumPairs = new Pair[]{
Pair.create(image, activity.getResources().getString(R.string.transition_album_art))};
Pair[] albumPairs = new Pair[]{Pair.create(image, activity.getResources().getString(R.string.transition_album_art))};
NavigationUtil.goToAlbum(activity, dataSet.get(getAdapterPosition()).getId(), albumPairs);
}
}

View File

@ -116,7 +116,7 @@ public class AlbumCoverPagerAdapter extends CustomFragmentStatePagerAdapter {
private int getLayout() {
int layout;
switch (PreferenceUtil.getInstance(getContext()).getAlbumCoverStyle()) {
switch (PreferenceUtil.getInstance().getAlbumCoverStyle()) {
default:
case NORMAL:
layout = R.layout.fragment_album_cover;

View File

@ -2,23 +2,20 @@ package code.name.monkey.retromusic.ui.adapter.playlist;
import android.app.Activity;
import android.app.Dialog;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import code.name.monkey.retromusic.model.Playlist;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.ui.adapter.base.MediaEntryViewHolder;
import code.name.monkey.retromusic.ui.adapter.playlist.AddToPlaylist.ViewHolder;
import code.name.monkey.retromusic.util.PlaylistsUtil;
/**
* @author Hemanth S (h4h13).
*/
public class AddToPlaylist extends RecyclerView.Adapter<ViewHolder> {
private Activity activity;

View File

@ -2,11 +2,6 @@ package code.name.monkey.retromusic.ui.adapter.playlist;
import android.graphics.Bitmap;
import android.graphics.PorterDuff;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.PopupMenu;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
@ -20,6 +15,11 @@ import java.util.List;
import java.util.Locale;
import java.util.concurrent.ExecutionException;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.PopupMenu;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.retromusic.R;
@ -41,9 +41,6 @@ import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.RetroUtil;
import io.reactivex.Observable;
/**
* Created by BlackFootSanji on 9/19/2016.
*/
public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewHolder, Playlist> {
public static final String TAG = PlaylistAdapter.class.getSimpleName();

View File

@ -15,11 +15,9 @@ import java.util.ArrayList;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.interfaces.CabHolder;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.util.MusicUtil;
import code.name.monkey.retromusic.util.ViewUtil;
@ -34,8 +32,8 @@ public class PlayingQueueAdapter extends SongAdapter implements DraggableItemAda
private int current;
public PlayingQueueAdapter(AppCompatActivity activity, ArrayList<Song> dataSet, int current,
@LayoutRes int itemLayoutRes, boolean usePalette, @Nullable CabHolder cabHolder) {
super(activity, dataSet, itemLayoutRes, usePalette, cabHolder);
@LayoutRes int itemLayoutRes) {
super(activity, dataSet, itemLayoutRes, false, null);
this.current = current;
}

View File

@ -198,7 +198,7 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
return "";
}
@Nullable String sectionName = null;
switch (PreferenceUtil.getInstance(activity).getSongSortOrder()) {
switch (PreferenceUtil.getInstance().getSongSortOrder()) {
case SortOrder.SongSortOrder.SONG_A_Z:
case SortOrder.SongSortOrder.SONG_Z_A:
sectionName = dataSet.get(position).title;
@ -211,6 +211,9 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
break;
case SortOrder.SongSortOrder.SONG_YEAR:
return MusicUtil.getYearString(dataSet.get(position).year);
case SortOrder.SongSortOrder.COMPOSER:
sectionName = dataSet.get(position).composer;
break;
}
return MusicUtil.getSectionName(sectionName);

View File

@ -19,12 +19,12 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.util.Pair;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper;
@ -78,8 +78,9 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//noinspection ConstantConditions
view.setBackgroundColor(ColorUtil.darkenColor(ThemeStore.primaryColor(getContext())));
view.setBackgroundColor(ThemeStore.primaryColor(getContext()));
view.setOnTouchListener(new FlingPlayBackController(getActivity()));
view.setOnClickListener(v -> NavigationUtil.gotoNowPlayingActivity(getContext(), Pair.create(v, getString(R.string.transition_mini_player))));
setUpMiniPlayer();
if (RetroUtil.isTablet(getResources())) {
@ -87,9 +88,9 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
previous.setVisibility(View.VISIBLE);
playingQueue.setVisibility(View.VISIBLE);
} else {
next.setVisibility(PreferenceUtil.getInstance(getContext()).isExtraMiniExtraControls() ? View.VISIBLE : View.GONE);
playingQueue.setVisibility(PreferenceUtil.getInstance(getContext()).isExtraMiniExtraControls() ? View.GONE : View.VISIBLE);
previous.setVisibility(PreferenceUtil.getInstance(getContext()).isExtraMiniExtraControls() ? View.VISIBLE : View.GONE);
next.setVisibility(PreferenceUtil.getInstance().isExtraMiniExtraControls() ? View.VISIBLE : View.GONE);
playingQueue.setVisibility(PreferenceUtil.getInstance().isExtraMiniExtraControls() ? View.GONE : View.VISIBLE);
previous.setVisibility(PreferenceUtil.getInstance().isExtraMiniExtraControls() ? View.VISIBLE : View.GONE);
}
}

View File

@ -18,7 +18,8 @@ public enum NowPlayingScreen {
SIMPLE(R.string.simple, R.drawable.np_simple, 8),
BLUR_CARD(R.string.blur_card, R.drawable.np_blur_card, 9),
ADAPTIVE(R.string.adaptive, R.drawable.np_adaptive, 10),
MATERIAL(R.string.material, R.drawable.np_material, 11);
MATERIAL(R.string.material, R.drawable.np_material, 11),
FIT(R.string.fit, R.drawable.np_adaptive, 12);
@StringRes
public final int titleRes;

View File

@ -56,9 +56,7 @@ public class PlayingQueueFragment extends AbsMusicServiceFragment {
(AppCompatActivity) getActivity(),
MusicPlayerRemote.getPlayingQueue(),
MusicPlayerRemote.getPosition(),
R.layout.item_queue,
false,
null);
R.layout.item_queue);
mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mPlayingQueueAdapter);
mLayoutManager = new LinearLayoutManager(getContext());

View File

@ -1,10 +1,8 @@
package code.name.monkey.retromusic.ui.fragments;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.LayoutInflater;
@ -20,9 +18,11 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.volume.AudioVolumeObserver;
import code.name.monkey.retromusic.volume.OnAudioVolumeChangedListener;
@ -31,10 +31,13 @@ public class VolumeFragment extends Fragment implements SeekBar.OnSeekBarChangeL
@BindView(R.id.volume_seekbar)
SeekBar volumeSeekbar;
@BindView(R.id.volume_down)
ImageView volumeDown;
@BindView(R.id.container)
ViewGroup viewGroup;
@BindView(R.id.volume_up)
ImageView volumeUp;
@ -58,7 +61,7 @@ public class VolumeFragment extends Fragment implements SeekBar.OnSeekBarChangeL
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//noinspection ConstantConditions
setTintable(ThemeStore.textColorSecondary(getContext()));
setTintable(ATHUtil.resolveColor(getContext(), R.attr.iconColor));
}
@Override
@ -108,8 +111,9 @@ public class VolumeFragment extends Fragment implements SeekBar.OnSeekBarChangeL
if (audioManager != null) {
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, i, 0);
}
volumeDown.setImageResource(
i == 0 ? R.drawable.ic_volume_off_white_24dp : R.drawable.ic_volume_down_white_24dp);
setPauseWhenZeroVolume(i < 1);
volumeDown.setImageResource(i == 0 ? R.drawable.ic_volume_off_white_24dp : R.drawable.ic_volume_down_white_24dp);
}
@Override
@ -139,10 +143,6 @@ public class VolumeFragment extends Fragment implements SeekBar.OnSeekBarChangeL
}
}
public void setColor(int color) {
volumeSeekbar.setProgressTintList(ColorStateList.valueOf(color));
}
public void tintWhiteColor() {
setProgressBarColor(Color.WHITE);
}
@ -160,4 +160,13 @@ public class VolumeFragment extends Fragment implements SeekBar.OnSeekBarChangeL
public void removeThumb() {
volumeSeekbar.setThumb(null);
}
private void setPauseWhenZeroVolume(boolean pauseWhenZeroVolume) {
if (PreferenceUtil.getInstance().pauseOnZeroVolume() && pauseWhenZeroVolume)
if (MusicPlayerRemote.isPlaying()) {
MusicPlayerRemote.pauseSong();
} else {
MusicPlayerRemote.resumePlaying();
}
}
}

View File

@ -1,20 +1,20 @@
package code.name.monkey.retromusic.ui.fragments.base;
import android.os.Bundle;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.AppBarLayout.OnOffsetChangedListener;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.AppBarLayout.OnOffsetChangedListener;
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

View File

@ -6,6 +6,7 @@ import android.view.View;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.VersionUtils;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.MainOptionsBottomSheetDialogFragment;
import code.name.monkey.retromusic.ui.activities.MainActivity;
@ -46,7 +47,11 @@ public abstract class AbsMainActivityFragment extends AbsMusicServiceFragment {
public void setStatusbarColorAuto(View view) {
// we don't want to use statusbar color because we are doing the color darkening on our own to support KitKat
//noinspection ConstantConditions
setStatusbarColor(view, ColorUtil.darkenColor(ThemeStore.primaryColor(getContext())));
if (VersionUtils.hasMarshmallow()) {
setStatusbarColor(view, ThemeStore.primaryColor(getContext()));
} else {
setStatusbarColor(view, ColorUtil.darkenColor(ThemeStore.primaryColor(getContext())));
}
}
protected void showMainMenu() {

View File

@ -2,10 +2,11 @@ package code.name.monkey.retromusic.ui.fragments.base;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import code.name.monkey.retromusic.interfaces.MusicServiceEventListener;
import code.name.monkey.retromusic.ui.activities.base.AbsMusicServiceActivity;
@ -17,6 +18,10 @@ public class AbsMusicServiceFragment extends Fragment implements MusicServiceEve
private AbsMusicServiceActivity activity;
@Nullable
public AbsMusicServiceActivity getPlayerActivity() {
return activity;
}
@Override
public void onAttach(Context context) {

View File

@ -1,5 +1,9 @@
package code.name.monkey.retromusic.ui.fragments.base;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper;
/**
@ -20,4 +24,29 @@ public abstract class AbsPlayerControlsFragment extends AbsMusicServiceFragment
protected abstract void setUpProgressSlider();
public abstract void setDark(int color);
public void showBouceAnimation(View view) {
view.clearAnimation();
view.setScaleX(0.9f);
view.setScaleY(0.9f);
view.setVisibility(View.VISIBLE);
view.setPivotX(view.getWidth() / 2);
view.setPivotY(view.getHeight() / 2);
view.animate()
.setDuration(200)
.setInterpolator(new DecelerateInterpolator())
.scaleX(1.1f)
.scaleY(1.1f)
.withEndAction(() -> view.animate()
.setDuration(200)
.setInterpolator(new AccelerateInterpolator())
.scaleX(1f)
.scaleY(1f)
.alpha(1f)
.start())
.start();
}
}

View File

@ -34,6 +34,7 @@ import code.name.monkey.retromusic.util.MusicUtil;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroUtil;
import code.name.monkey.retromusic.views.FitSystemWindowsLayout;
public abstract class AbsPlayerFragment extends AbsMusicServiceFragment implements Toolbar.OnMenuItemClickListener, PaletteColorHolder {
public static final String TAG = AbsPlayerFragment.class.getSimpleName();
@ -51,6 +52,14 @@ public abstract class AbsPlayerFragment extends AbsMusicServiceFragment implemen
}
}
protected void addSafeArea(View view) {
FitSystemWindowsLayout safeArea = view.findViewById(R.id.safeArea);
if (safeArea != null) {
if (PreferenceUtil.getInstance().getFullScreenMode()) safeArea.setFit(false);
else safeArea.setFit(true);
}
}
@Override
public void onDetach() {
super.onDetach();
@ -117,6 +126,9 @@ public abstract class AbsPlayerFragment extends AbsMusicServiceFragment implemen
case R.id.action_set_as_ringtone:
MusicUtil.setRingtone(getActivity(), song.id);
return true;
case R.id.action_settings:
NavigationUtil.goToSettings(getActivity());
return true;
case R.id.action_go_to_genre:
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
Uri trackUri = ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, song.id);
@ -148,23 +160,19 @@ public abstract class AbsPlayerFragment extends AbsMusicServiceFragment implemen
@Override
public void onServiceConnected() {
updateIsFavorite();
//updateLyrics();
}
@Override
public void onPlayingMetaChanged() {
updateIsFavorite();
//updateLyrics();
}
@Override
public void onDestroyView() {
if (updateIsFavoriteTask != null && !updateIsFavoriteTask.isCancelled()) {
updateIsFavoriteTask.cancel(true);
}
super.onDestroyView();
}
@SuppressLint("StaticFieldLeak")
@ -209,8 +217,9 @@ public abstract class AbsPlayerFragment extends AbsMusicServiceFragment implemen
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.setBackgroundColor(ThemeStore.primaryColor(getActivity()));
if (PreferenceUtil.getInstance(getContext()).getFullScreenMode()) {
view.findViewById(R.id.status_bar).setVisibility(View.GONE);
if (PreferenceUtil.getInstance().getFullScreenMode()) {
if (view.findViewById(R.id.status_bar) != null)
view.findViewById(R.id.status_bar).setVisibility(View.GONE);
}
}

View File

@ -40,7 +40,7 @@ public class AlbumsFragment extends AbsLibraryPagerRecyclerViewCustomGridSizeFra
notifyLayoutResChanged(itemLayoutRes);
if (itemLayoutRes != R.layout.item_list) {
//noinspection ConstantConditions
itemLayoutRes = PreferenceUtil.getInstance(getContext()).getAlbumGridStyle(getContext());
itemLayoutRes = PreferenceUtil.getInstance().getAlbumGridStyle(getContext());
}
ArrayList<Album> dataSet = getAdapter() == null ? new ArrayList<>() : getAdapter().getDataSet();
return new AlbumAdapter(getLibraryFragment().getMainActivity(), dataSet, itemLayoutRes, loadUsePalette(), getLibraryFragment());
@ -54,7 +54,7 @@ public class AlbumsFragment extends AbsLibraryPagerRecyclerViewCustomGridSizeFra
@Override
public boolean loadUsePalette() {
//noinspection ConstantConditions
return PreferenceUtil.getInstance(getActivity()).albumColoredFooters();
return PreferenceUtil.getInstance().albumColoredFooters();
}
@Override
@ -76,43 +76,43 @@ public class AlbumsFragment extends AbsLibraryPagerRecyclerViewCustomGridSizeFra
@Override
protected String loadSortOrder() {
//noinspection ConstantConditions
return PreferenceUtil.getInstance(getActivity()).getAlbumSortOrder();
return PreferenceUtil.getInstance().getAlbumSortOrder();
}
@Override
protected void saveSortOrder(String sortOrder) {
//noinspection ConstantConditions
PreferenceUtil.getInstance(getActivity()).setAlbumSortOrder(sortOrder);
PreferenceUtil.getInstance().setAlbumSortOrder(sortOrder);
}
@Override
protected int loadGridSize() {
//noinspection ConstantConditions
return PreferenceUtil.getInstance(getActivity()).getAlbumGridSize(getActivity());
return PreferenceUtil.getInstance().getAlbumGridSize(getActivity());
}
@Override
protected void saveGridSize(int gridSize) {
//noinspection ConstantConditions
PreferenceUtil.getInstance(getActivity()).setAlbumGridSize(gridSize);
PreferenceUtil.getInstance().setAlbumGridSize(gridSize);
}
@Override
protected int loadGridSizeLand() {
//noinspection ConstantConditions
return PreferenceUtil.getInstance(getActivity()).getAlbumGridSizeLand(getActivity());
return PreferenceUtil.getInstance().getAlbumGridSizeLand(getActivity());
}
@Override
protected void saveGridSizeLand(int gridSize) {
//noinspection ConstantConditions
PreferenceUtil.getInstance(getActivity()).setAlbumGridSizeLand(gridSize);
PreferenceUtil.getInstance().setAlbumGridSizeLand(gridSize);
}
@Override
protected void saveUsePalette(boolean usePalette) {
//noinspection ConstantConditions
PreferenceUtil.getInstance(getActivity()).setAlbumColoredFooters(usePalette);
PreferenceUtil.getInstance().setAlbumColoredFooters(usePalette);
}
@Override
@ -132,7 +132,7 @@ public class AlbumsFragment extends AbsLibraryPagerRecyclerViewCustomGridSizeFra
if (menuVisible) {
//noinspection ConstantConditions
getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library
PreferenceUtil.getInstance().tabTitles() ? R.string.library
: R.string.albums);
}
}
@ -142,7 +142,7 @@ public class AlbumsFragment extends AbsLibraryPagerRecyclerViewCustomGridSizeFra
super.onResume();
//noinspection ConstantConditions
getLibraryFragment().setTitle(
PreferenceUtil.getInstance(getContext()).tabTitles() ? R.string.library : R.string.albums);
PreferenceUtil.getInstance().tabTitles() ? R.string.library : R.string.albums);
if (getAdapter().getDataSet().isEmpty()) {
presenter.subscribe();
}

Some files were not shown because too many files have changed in this diff Show More