AndroidX lib refactor

This commit is contained in:
h4h13 2018-09-10 01:14:46 +05:30
parent 08f0b5e76e
commit a8dfe106bb
233 changed files with 3254 additions and 9769 deletions

View file

@ -3,11 +3,34 @@
<component name="WizardSettings">
<option name="children">
<map>
<entry key="vectorWizard">
<entry key="imageWizard">
<value>
<PersistentState />
</value>
</entry>
<entry key="vectorWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="vectorAssetStep">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="outputName" value="ate_check" />
<entry key="sourceFile" value="$USER_HOME$/Downloads/round-check-24px.svg" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>

View file

@ -3,9 +3,6 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT" />
</compositeConfiguration>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">

View file

@ -1,15 +0,0 @@
<component name="libraryTable">
<library name="Gradle: android.arch.navigation:navigation-common:1.0.0-alpha05@aar">
<ANNOTATIONS>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-navigation-common-1.0.0-alpha05.aar/5e2a2eea3403bb0077ef13b42aedf099/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-navigation-common-1.0.0-alpha05.aar/5e2a2eea3403bb0077ef13b42aedf099/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-navigation-common-1.0.0-alpha05.aar/5e2a2eea3403bb0077ef13b42aedf099/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.navigation/navigation-common/1.0.0-alpha05/c993c5c6966859560f1e30f1d620af212b751116/navigation-common-1.0.0-alpha05-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,12 +0,0 @@
<component name="libraryTable">
<library name="Gradle: android.arch.navigation:navigation-fragment:1.0.0-alpha05@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-navigation-fragment-1.0.0-alpha05.aar/84ef0a3159ce5c7b19e0bd449d3c1aa7/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-navigation-fragment-1.0.0-alpha05.aar/84ef0a3159ce5c7b19e0bd449d3c1aa7/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.navigation/navigation-fragment/1.0.0-alpha05/c2dd45048f539b5b359dbbfee9c80f3d0c646381/navigation-fragment-1.0.0-alpha05-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,12 +0,0 @@
<component name="libraryTable">
<library name="Gradle: android.arch.navigation:navigation-runtime:1.0.0-alpha05@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-navigation-runtime-1.0.0-alpha05.aar/bb310dd858183064328792edb306d025/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-navigation-runtime-1.0.0-alpha05.aar/bb310dd858183064328792edb306d025/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.navigation/navigation-runtime/1.0.0-alpha05/f65f267889cdf7a667b2a205d68d27d0d272bfd1/navigation-runtime-1.0.0-alpha05-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,12 +0,0 @@
<component name="libraryTable">
<library name="Gradle: android.arch.navigation:navigation-ui:1.0.0-alpha05@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-navigation-ui-1.0.0-alpha05.aar/02ef3e0dd7a8e383526003034c8c6f3d/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-navigation-ui-1.0.0-alpha05.aar/02ef3e0dd7a8e383526003034c8c6f3d/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/android.arch.navigation/navigation-ui/1.0.0-alpha05/b68f2152e0ef5b04c444a95f52179ea8f63b0fd8/navigation-ui-1.0.0-alpha05-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="Gradle: androidx.gridlayout:gridlayout:1.0.0-rc01@aar">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/gridlayout-1.0.0-rc01.aar/afe09fea9af66dc762f5f79528db3bcd/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/gridlayout-1.0.0-rc01.aar/afe09fea9af66dc762f5f79528db3bcd/jars/classes.jar!/" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/gridlayout-1.0.0-rc01.aar/7734364c71450e50aa2231b5ecfbc0c0/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/gridlayout-1.0.0-rc01.aar/7734364c71450e50aa2231b5ecfbc0c0/res" />
</CLASSES>
<JAVADOC />
<SOURCES>

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="Gradle: androidx.legacy:legacy-preference-v14:1.0.0-rc01@aar">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/legacy-preference-v14-1.0.0-rc01.aar/5ca2d090ca7b26d56551559e95b128eb/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/legacy-preference-v14-1.0.0-rc01.aar/5ca2d090ca7b26d56551559e95b128eb/jars/classes.jar!/" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/legacy-preference-v14-1.0.0-rc01.aar/ca65747cf84e82e771cad06d4e766a35/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/legacy-preference-v14-1.0.0-rc01.aar/ca65747cf84e82e771cad06d4e766a35/res" />
</CLASSES>
<JAVADOC />
<SOURCES>

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="Gradle: androidx.legacy:legacy-support-v13:1.0.0-rc01@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/legacy-support-v13-1.0.0-rc01.aar/cce10cbfe7168fdb432e523ed2884f7c/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/legacy-support-v13-1.0.0-rc01.aar/cce10cbfe7168fdb432e523ed2884f7c/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/legacy-support-v13-1.0.0-rc01.aar/a6641f0e0ae3e492b4aeb9f5603bee3c/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/legacy-support-v13-1.0.0-rc01.aar/a6641f0e0ae3e492b4aeb9f5603bee3c/res" />
</CLASSES>
<JAVADOC />
<SOURCES>

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="Gradle: com.google.android.gms:play-services-base:15.0.1@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-base-15.0.1.aar/c80d87a527483d26639271480c91b1f6/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-base-15.0.1.aar/c80d87a527483d26639271480c91b1f6/res" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-play-services-base-15.0.1.aar/d5c404a0dc1e524d992006025a016e21/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-play-services-base-15.0.1.aar/d5c404a0dc1e524d992006025a016e21/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="Gradle: com.google.android.gms:play-services-basement:15.0.1@aar">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-basement-15.0.1.aar/202604b3858a2553dddafe8102b81286/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-basement-15.0.1.aar/202604b3858a2553dddafe8102b81286/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-play-services-basement-15.0.1.aar/e4b2db320cbe117dbf9883186eda3125/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-play-services-basement-15.0.1.aar/e4b2db320cbe117dbf9883186eda3125/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="Gradle: com.google.android.gms:play-services-cast:16.0.1@aar">
<library name="Gradle: com.google.android.gms:play-services-cast:16.0.2@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-cast-16.0.1.aar/55de561aa1b25e2e8650358af1c1c167/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-cast-16.0.1.aar/55de561aa1b25e2e8650358af1c1c167/res" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-play-services-cast-16.0.2.aar/090e97610f0f4881a3aad1d6df238373/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-play-services-cast-16.0.2.aar/090e97610f0f4881a3aad1d6df238373/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="Gradle: com.google.android.gms:play-services-cast-framework:16.0.1@aar">
<library name="Gradle: com.google.android.gms:play-services-cast-framework:16.0.2@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-cast-framework-16.0.1.aar/d4c792212a5570fb5ee93ba33764075b/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-cast-framework-16.0.1.aar/d4c792212a5570fb5ee93ba33764075b/res" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-play-services-cast-framework-16.0.2.aar/09ad0e6e9c7d806452d3594e2836eb26/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-play-services-cast-framework-16.0.2.aar/09ad0e6e9c7d806452d3594e2836eb26/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="Gradle: com.google.android.gms:play-services-flags:15.0.1@aar">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-flags-15.0.1.aar/46c195e1b5ceacfcc2e0687cb1e57506/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-flags-15.0.1.aar/46c195e1b5ceacfcc2e0687cb1e57506/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-flags-15.0.1.aar/da0a8a0855401e16d9624ac105093a1b/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-flags-15.0.1.aar/da0a8a0855401e16d9624ac105093a1b/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -1,8 +1,8 @@
<component name="libraryTable">
<library name="Gradle: com.google.android.gms:play-services-tasks:15.0.1@aar">
<CLASSES>
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-tasks-15.0.1.aar/f30546a6c866df6aad2d39f35d2a4b95/res" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/play-services-tasks-15.0.1.aar/f30546a6c866df6aad2d39f35d2a4b95/jars/classes.jar!/" />
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-play-services-tasks-15.0.1.aar/0acc23d41ae64a617be02b56642bdfee/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-play-services-tasks-15.0.1.aar/0acc23d41ae64a617be02b56642bdfee/res" />
</CLASSES>
<JAVADOC />
<SOURCES />

View file

@ -0,0 +1,12 @@
<component name="libraryTable">
<library name="Gradle: com.jakewharton:butterknife-runtime:9.0.0-SNAPSHOT@aar">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-butterknife-runtime-9.0.0-SNAPSHOT.aar/8a035d5702a50379af5d3f475f946cd7/jars/classes.jar!/" />
<root url="file://$USER_HOME$/.gradle/caches/transforms-1/files-1.1/jetified-butterknife-runtime-9.0.0-SNAPSHOT.aar/8a035d5702a50379af5d3f475f946cd7/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.jakewharton/butterknife-runtime/9.0.0-SNAPSHOT/e87e900910a7c2fc697ea7e2937563504686b517/butterknife-runtime-9.0.0-SNAPSHOT-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<module external.linked.project.id="RetroMusicPlayer" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":" />
</configuration>
</facet>
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
@ -16,7 +11,7 @@
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

View file

@ -8,11 +8,11 @@
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="normalRelease" />
<option name="ASSEMBLE_TASK_NAME" value="assembleNormalRelease" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileNormalReleaseSources" />
<option name="SELECTED_BUILD_VARIANT" value="normalDebug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleNormalDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileNormalDebugSources" />
<afterSyncTasks>
<task>generateNormalReleaseSources</task>
<task>generateNormalDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
@ -23,32 +23,46 @@
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/build/intermediates/javac/normalRelease/compileNormalReleaseJavaWithJavac/classes" />
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/normalReleaseUnitTest/compileNormalReleaseUnitTestJavaWithJavac/classes" />
<output url="file://$MODULE_DIR$/build/intermediates/javac/normalDebug/compileNormalDebugJavaWithJavac/classes" />
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/normalDebugUnitTest/compileNormalDebugUnitTestJavaWithJavac/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/normal/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/normalRelease/processNormalReleaseResources/r" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/normalRelease/compileNormalReleaseAidl/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/normal/release" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/normalRelease/compileNormalReleaseRenderscript/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/normal/release" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/normal/release" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/normalRelease/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/normalRelease/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/normalRelease/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/normalRelease/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/normalRelease/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/normalRelease/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/normalRelease/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/normal/release" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalRelease/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalRelease/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalRelease/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalRelease/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalRelease/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalRelease/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalRelease/shaders" isTestSource="true" />
<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/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/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" />
<sourceFolder url="file://$MODULE_DIR$/src/normalDebug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/normalDebug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/normalDebug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/normalDebug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/normalDebug/rs" isTestSource="false" />
<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/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/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" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNormalDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNormalDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNormalDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNormalDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNormalDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNormalDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/test/normal/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testNormalDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/normal/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/normal/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/normal/assets" type="java-resource" />
@ -70,20 +84,27 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNormal/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNormal/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestNormal/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/release/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/release/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/release/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/release/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/release/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/release/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/release/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testRelease/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
@ -110,9 +131,9 @@
<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-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkNormalDebugClasspath" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkNormalReleaseClasspath" />
<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-runtime-classes" />
@ -125,7 +146,6 @@
<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/lint_jar" />
<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" />
@ -136,7 +156,6 @@
<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/res_stripped" />
<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" />
@ -146,7 +165,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
@ -163,24 +181,24 @@
<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: com.google.android.gms:play-services-cast-framework:16.0.1@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: android.arch.navigation:navigation-runtime:1.0.0-alpha05@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: android.arch.navigation:navigation-common:1.0.0-alpha05@aar" 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: 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" />
@ -194,7 +212,6 @@
<orderEntry type="library" name="Gradle: com.afollestad.material-dialogs:core:0.9.6.0@aar" 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: android.arch.navigation:navigation-ui:1.0.0-alpha05@aar" 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" />
@ -218,7 +235,6 @@
<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: com.google.android.gms:play-services-cast:16.0.1@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" />
@ -229,9 +245,7 @@
<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: android.arch.navigation:navigation-fragment:1.0.0-alpha05@aar" level="project" />
<orderEntry type="library" name="Gradle: com.afollestad.material-dialogs:commons:0.9.6.0@aar" level="project" />
<orderEntry type="module" module-name="appthemehelper" />
<orderEntry type="module" module-name="appthemehelper" />
</component>
</module>

View file

@ -11,8 +11,8 @@ android {
vectorDrawables.useSupportLibrary = true
applicationId "code.name.monkey.retromusic"
versionCode 216
versionName '1.8.100'
versionCode 222
versionName '2.0.010'
multiDexEnabled true
@ -102,13 +102,7 @@ static def getDate() {
new Date().format('MMdd')
}
ext {
supportLibVersion = '1.0.0-rc01'
firebase = "11.8.0"
retrofit = "2.3.0"
butterKnife = "9.0.0-SNAPSHOT"
materialDialog = "0.9.6.0"
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.multidex:multidex:2.0.0'
@ -126,7 +120,7 @@ dependencies {
//For casting
implementation 'androidx.mediarouter:mediarouter:1.0.0-beta01'
implementation 'com.google.android.gms:play-services-cast-framework:16.0.1'
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"
@ -139,9 +133,9 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.9'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:1.5.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:1.5.0'
implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') {
transitive = true
}
@ -159,8 +153,4 @@ dependencies {
implementation 'com.github.AdrienPoupa:jaudiotagger:2.2.3'
implementation 'org.nanohttpd:nanohttpd:2.3.1'
def nav_version = "1.0.0-alpha05"
implementation "android.arch.navigation:navigation-fragment:$nav_version"
implementation "android.arch.navigation:navigation-ui:$nav_version"
}

View file

@ -15,6 +15,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:usesCleartextTraffic="true"
android:name=".RetroApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
@ -125,7 +126,7 @@
<activity android:name=".ui.activities.EqualizerActivity" />
<activity android:name=".ui.activities.ErrorHandlerActivity" />
<activity
android:name=".cast.ExpandedControlsActivity"
android:name=".cast.ExpandedCastControlsActivity"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:screenOrientation="portrait"

View file

@ -0,0 +1,26 @@
[
{
"name": "Lennart Glamann",
"summary": "Moderator",
"link": "https://t.me/FlixbusLennart",
"profile_image": "https://i.imgur.com/Q5Nsx1R.jpg"
},
{
"name": "Gaming Inc.",
"summary": "Discord server maintainer",
"link": "https://t.me/Gaming_Inc",
"profile_image": "https://cdn.discordapp.com/attachments/469540889883181077/471361944385880065/91_98910_29110_20180616_17122501.jpg"
},
{
"name": "Marko Ivanović",
"summary": "Github contributor",
"link": "https://t.me/markoivanovic",
"profile_image": "https://avatars2.githubusercontent.com/u/35743654?s=400&amp;u=f8b4a90a352a661625ae71d455a82aaa9bc3316b&amp;v=4"
},
{
"name": "Gaurav Singh",
"summary": "Moderator",
"link": "https://t.me/Allstargaurav",
"profile_image": "https://cdn5.telesco.pe/file/Gnko_d39iKSqzKhsVK53sjUFz_sfLKe_OpxFE9kR-VUEjDbm6SOr8CT09tyI3zhDSuTowqOhNY4nogFx1Z8QbixyZLAWccl94JdX4dqkPrZyHMS9K7xUzq-wgZCoNIbO8_eAnGOy8Gmu3-uzLuQf2u3G7BRIxm5mzqwqGoeX7_V-fcs3Lr6Br7hPFeCHSm1U39I69E3R9ovs-kPfxCpze-riCjD-QhwwOEOfiudx9OmkmLJGvYugX2EpHSBFfNh6WFQEvBAvR6xPrXul3LxZEebH0xwz5HX-bmyuoxdGaW0J4ywDgiiu4I7cfUJe8lKqWwkPQRg8zTtYNiG3MZio7w.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 1.8.200</h3> <ol> <li><b>Fix:</b> same theme follows entire app</li> <li><b>Fix:</b> playlist rename</li> <li><b>Fix:</b> toggle tab titles</li> <li><b>Fix:</b> adaptive controls for material theme </li> <li><b>Added:</b> cast play only one song per time(WIP)</li> <li><b>Added:</b> extra controls toggle for mini player</li> <li><b>Added:</b> album & grid style(play image)</li> <li><b>Added:</b> new navigation(WIP)</li> <li><b>Added:</b> faq links about</li> <li><b>Added:</b> genre tab to library</li> <li><b>Added:</b> volume toggle for lock screen to support small screen</li> <li><b>Added:</b> on-click artist icon to artist details in album details screen</li> <li><b>Added:</b> circle style for album and artist lists</li> <li><b>Added:</b> now playing album cover style chooser</li> <li><b>Improved:</b> sleep timer</li> <li><b>Improved:</b> home page UI</li> <li><b>Improved:</b> most of the dialog UI to follow theme(WIP)</li> <li><b>Removed:</b> toggle home banner(WIP)</li> <li><b>Removed:</b> home page genre</li> <li><b>Updated:</b> internal libs</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> <h3>Version 2.0.00</h3> <ol> <li><b>Fix:</b> dialog cancel text</li> <li><b>Fix:</b> album cover edit with last.fm</li> <li><b>Fix:</b> same theme follows entire app</li> <li><b>Fix:</b> playlist rename</li> <li><b>Fix:</b> toggle tab titles</li> <li><b>Fix:</b> adaptive controls for material theme </li> <li><b>Added:</b> full card album style</li> <li><b>Added:</b> extra controls toggle for mini player</li> <li><b>Added:</b> album & grid style(play image)</li> <li><b>Added:</b> new navigation(WIP)</li> <li><b>Added:</b> faq links about</li> <li><b>Added:</b> genre tab to library</li> <li><b>Added:</b> volume toggle for lock screen to support small screen</li> <li><b>Added:</b> on-click artist icon to artist details in album details screen</li> <li><b>Added:</b> circle style for album and artist lists</li> <li><b>Added:</b> now playing album cover style chooser</li> <li><b>Improved:</b> sleep timer</li> <li><b>Improved:</b> home page UI</li> <li><b>Improved:</b> most of the dialog UI to follow theme(WIP)</li> <li><b>Removed:</b> toggle home banner(WIP)</li> <li><b>Removed:</b> home page genre</li> <li><b>Updated:</b> internal libs</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

@ -15,10 +15,6 @@ import code.name.monkey.retromusic.Constants;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.util.RetroUtil;
/**
* Created by naman on 2/12/17.
*/
public class CastHelper {
public static void startCasting(CastSession castSession, Song song) {
@ -35,6 +31,7 @@ public class CastHelper {
String songUrl = baseUrl.toString() + "/song?id=" + song.id;
String albumArtUrl = baseUrl.toString() + "/albumart?id=" + song.albumId;
MediaMetadata musicMetadata = new MediaMetadata(MediaMetadata.MEDIA_TYPE_MUSIC_TRACK);
musicMetadata.putString(MediaMetadata.KEY_TITLE, song.title);

View file

@ -24,12 +24,12 @@ public class CastOptionsProvider implements OptionsProvider {
NotificationOptions notificationOptions = new NotificationOptions.Builder()
.setActions(buttonActions, compatButtonActionsIndicies)
.setTargetActivityClassName(ExpandedControlsActivity.class.getName())
.setTargetActivityClassName(ExpandedCastControlsActivity.class.getName())
.build();
CastMediaOptions mediaOptions = new CastMediaOptions.Builder()
.setNotificationOptions(notificationOptions)
.setExpandedControllerActivityClassName(ExpandedControlsActivity.class.getName())
.setExpandedControllerActivityClassName(ExpandedCastControlsActivity.class.getName())
.build();
return new CastOptions.Builder()

View file

@ -10,7 +10,7 @@ import com.google.android.gms.cast.framework.media.widget.ExpandedControllerActi
import code.name.monkey.retromusic.R;
public class ExpandedControlsActivity extends ExpandedControllerActivity {
public class ExpandedCastControlsActivity extends ExpandedControllerActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {

View file

@ -83,12 +83,12 @@ public class CreatePlaylistDialog extends RoundedBottomSheetDialogFragment {
actionCreate.setBackgroundTintList(ColorStateList.valueOf(accentColor));
actionCancel.setStrokeColor(ColorStateList.valueOf(accentColor));
actionCancel.setTextColor(accentColor);
playlistName.setHintTextColor(ColorStateList.valueOf(accentColor));
textInputLayout.setBoxStrokeColor(accentColor);
textInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(accentColor));
playlistName.setHintTextColor(accentColor);
playlistName.setHintTextColor(ColorStateList.valueOf(accentColor));
playlistName.setTextColor(ThemeStore.textColorPrimary(getContext()));
title.setTextColor(ThemeStore.textColorPrimary(getContext()));

View file

@ -1,146 +0,0 @@
package code.name.monkey.retromusic.dialogs;
import android.graphics.Bitmap;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.appcompat.widget.AppCompatTextView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.io.File;
import java.util.Calendar;
import java.util.List;
import butterknife.BindView;
import butterknife.BindViews;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.RetroApplication;
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;
/**
* @author Hemanth S (h4h13).
*/
public class HomeOptionDialog extends RoundedBottomSheetDialogFragment {
private static final String TAG = "HomeOptionDialog";
private static ButterKnife.Setter<TextView, Integer> textColor = (view, value, index) -> view.setTextColor(value.intValue());
Unbinder mUnbinder;
@BindView(R.id.user_image_bottom)
CircularImageView userImageBottom;
@BindView(R.id.title_welcome)
AppCompatTextView titleWelcome;
@BindViews({R.id.tv_about, R.id.title_welcome, R.id.text, R.id.tv_buy_pro, R.id.tv_rate_app,
R.id.tv_settings, R.id.tv_sleep_timer})
List<TextView> textViews;
private CompositeDisposable disposable = new CompositeDisposable();
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.user_action_details, container, false);
mUnbinder = ButterKnife.bind(this, layout);
layout.findViewById(R.id.action_buy_pro).setVisibility(RetroApplication.isProVersion() ? View.GONE : View.VISIBLE);
ButterKnife.apply(textViews, textColor, ThemeStore.textColorPrimary(getContext()));
return layout;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
loadImageFromStorage();
//noinspection ConstantConditions
titleWelcome.setText(String.format("%s, %s!", getTimeOfTheDay(), PreferenceUtil.getInstance(getContext()).getUserName()));
}
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;
}
@Override
public void onDestroyView() {
super.onDestroyView();
disposable.clear();
mUnbinder.unbind();
}
@SuppressWarnings("ConstantConditions")
@OnClick({R.id.action_about, R.id.user_info_container, R.id.action_buy_pro,
R.id.action_settings, R.id.action_sleep_timer, R.id.action_rate})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.user_info_container:
NavigationUtil.goToUserInfo(getActivity());
break;
case R.id.action_rate:
NavigationUtil.goToPlayStore(getActivity());
break;
case R.id.action_settings:
NavigationUtil.goToSettings(getActivity());
break;
case R.id.action_about:
NavigationUtil.goToAbout(getActivity());
break;
case R.id.action_buy_pro:
NavigationUtil.goToProVersion(getActivity());
break;
case R.id.action_sleep_timer:
if (getFragmentManager() != null) {
new SleepTimerDialog().show(getFragmentManager(), TAG);
}
break;
}
dismiss();
}
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(getContext()).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,64 +1,166 @@
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.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import android.widget.TextView;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.google.android.material.navigation.NavigationView;
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;
import code.name.monkey.appthemehelper.ThemeStore;
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;
public class MainOptionsBottomSheetDialogFragment extends BottomSheetDialogFragment implements NavigationView.OnNavigationItemSelectedListener {
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
@BindView(R.id.navigation_view)
NavigationView navigationView;
public class MainOptionsBottomSheetDialogFragment extends RoundedBottomSheetDialogFragment {
public static MainOptionsBottomSheetDialogFragment newInstance(int home) {
private static final String TAG = "MainOptionsBottomSheetD";
private static ButterKnife.Setter<TextView, Integer> textColor = (view, value, index) -> view.setTextColor(ColorStateList.valueOf(value));
Bundle args = new Bundle();
args.putInt("selected", home);
@BindView(R.id.user_image_bottom)
CircularImageView userImageBottom;
@BindView(R.id.title_welcome)
AppCompatTextView titleWelcome;
@BindView(R.id.text)
AppCompatTextView text;
@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;
private CompositeDisposable disposable = new CompositeDisposable();
public static MainOptionsBottomSheetDialogFragment newInstance(int selected_id) {
Bundle bundle = new Bundle();
bundle.putInt("selected_id", selected_id);
MainOptionsBottomSheetDialogFragment fragment = new MainOptionsBottomSheetDialogFragment();
fragment.setArguments(args);
fragment.setArguments(bundle);
return fragment;
}
public static MainOptionsBottomSheetDialogFragment newInstance() {
return new MainOptionsBottomSheetDialogFragment();
}
@Override
public void onDestroyView() {
super.onDestroyView();
disposable.clear();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.fragment_main_options, container, false);
ButterKnife.bind(this, layout);
layout.findViewById(R.id.action_buy_pro).setVisibility(RetroApplication.isProVersion() ? View.GONE : View.VISIBLE);
ButterKnife.apply(materialButtons, textColor, ThemeStore.textColorPrimary(getContext()));
return layout;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
navigationView.setNavigationItemSelectedListener(this);
switch (getArguments().getInt("selected")) {
default:
case MainActivity.HOME:
navigationView.setCheckedItem(R.id.action_home);
break;
}
text.setTextColor(ThemeStore.textColorSecondary(getContext()));
titleWelcome.setTextColor(ThemeStore.textColorPrimary(getContext()));
titleWelcome.setText(String.format("%s %s!", getTimeOfTheDay(), PreferenceUtil.getInstance(getContext()).getUserName()));
loadImageFromStorage();
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.action_home:
Toast.makeText(getContext(), menuItem.getTitle(), Toast.LENGTH_SHORT).show();
return true;
default:
return false;
@OnClick({R.id.action_folders, R.id.action_settings, R.id.action_sleep_timer, R.id.action_rate,
R.id.user_info_container, R.id.action_buy_pro, R.id.action_about})
void onClick(View view) {
MainActivity mainActivity = (MainActivity) getActivity();
if (mainActivity == null) {
return;
}
switch (view.getId()) {
case R.id.action_folders:
mainActivity.setCurrentFragment(FoldersFragment.newInstance(getContext()), true, FoldersFragment.TAG);
break;
case R.id.action_settings:
NavigationUtil.goToSettings(mainActivity);
break;
case R.id.action_about:
NavigationUtil.goToAbout(getActivity());
break;
case R.id.action_buy_pro:
NavigationUtil.goToProVersion(getActivity());
break;
case R.id.action_sleep_timer:
if (getFragmentManager() != null) {
new SleepTimerDialog().show(getFragmentManager(), TAG);
}
break;
case R.id.user_info_container:
NavigationUtil.goToUserInfo(getActivity());
break;
case R.id.action_rate:
NavigationUtil.goToPlayStore(getActivity());
break;
}
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(getContext()).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

@ -15,17 +15,21 @@ import android.os.Environment;
import android.os.IBinder;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.Log;
import android.widget.Toast;
import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.cast.framework.CastSession;
import java.io.File;
import java.util.ArrayList;
import java.util.Random;
import java.util.WeakHashMap;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.RetroApplication;
import code.name.monkey.retromusic.loaders.SongLoader;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.service.MusicService;
@ -38,9 +42,22 @@ public class MusicPlayerRemote {
private static final WeakHashMap<Context, ServiceBinder> mConnectionMap = new WeakHashMap<>();
@Nullable
public static MusicService musicService;
private static int playbackLocation = PlaybackLocation.LOCAL;
private static CastSession getCastSession() {
CastSession castSession = CastContext.getSharedInstance(RetroApplication.getInstance()).getSessionManager().getCurrentCastSession();
if (castSession != null) {
playbackLocation = PlaybackLocation.REMOTE;
} else {
playbackLocation = PlaybackLocation.LOCAL;
}
return castSession;
}
public static ServiceToken bindToService(@NonNull final Context context,
final ServiceConnection callback) {
Activity realActivity = ((Activity) context).getParent();
if (realActivity == null) {
realActivity = (Activity) context;
@ -75,24 +92,19 @@ public class MusicPlayerRemote {
@Nullable
private static String getFilePathFromUri(Context context, Uri uri) {
Cursor cursor = null;
final String column = "_data";
final String[] projection = {
column
};
try {
cursor = context.getContentResolver().query(uri, projection, null, null,
null);
try (Cursor cursor = context.getContentResolver().query(uri, projection, null, null,
null)) {
if (cursor != null && cursor.moveToFirst()) {
final int column_index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(column_index);
}
} catch (Exception e) {
Log.e(TAG, e.getMessage());
} finally {
if (cursor != null)
cursor.close();
}
return null;
}
@ -239,8 +251,17 @@ public class MusicPlayerRemote {
}
public static int seekTo(int millis) {
getCastSession();
if (musicService != null) {
return musicService.seek(millis);
switch (playbackLocation) {
case PlaybackLocation.LOCAL:
return musicService.seek(millis);
case PlaybackLocation.REMOTE:
if (getCastSession() != null) {
getCastSession().getRemoteMediaClient().seek(millis);
}
break;
}
}
return -1;
}
@ -443,6 +464,10 @@ public class MusicPlayerRemote {
return musicService != null;
}
public static void setZeroVolume() {
}
@interface PlaybackLocation {
int REMOTE = 0;
int LOCAL = 1;
@ -480,4 +505,5 @@ public class MusicPlayerRemote {
mWrappedContext = context;
}
}
}

View file

@ -4,7 +4,7 @@ import com.google.android.material.appbar.AppBarLayout;
/**
* @author Hemanth S (h4h13).
* https://stackoverflow.com/a/33891727
* https://stackoverflow.com/a/33891727
*/
public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener {

View file

@ -1,104 +0,0 @@
package code.name.monkey.retromusic.misc;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.animation.Interpolator;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import butterknife.BindInt;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.util.RetroUtil;
/**
* {@link View.OnClickListener} used to translate the product grid sheet downward on
* the Y-axis when the navigation icon in the toolbar is pressed.
*/
public class NavigationIconClickListener implements View.OnClickListener {
private final AnimatorSet animatorSet = new AnimatorSet();
@BindInt(R.integer.options_height)
int options;
private Context context;
private View sheet, menu;
private Interpolator interpolator;
private int height;
private boolean backdropShown = false;
private Drawable openIcon;
private Drawable closeIcon;
public NavigationIconClickListener(Context context, View sheet, View menu, @Nullable Interpolator interpolator) {
this(context, sheet, menu, interpolator, null, null);
}
public NavigationIconClickListener(Context context, View sheet, View menu, @Nullable Interpolator interpolator,
@Nullable Drawable openIcon, @Nullable Drawable closeIcon) {
this.context = context;
this.sheet = sheet;
this.menu = menu;
this.interpolator = interpolator;
this.openIcon = openIcon;
this.closeIcon = closeIcon;
DisplayMetrics displayMetrics = new DisplayMetrics();
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
height = displayMetrics.heightPixels;
}
@Override
public void onClick(View view) {
backdropShown = !backdropShown;
// Cancel the existing animations
animatorSet.removeAllListeners();
animatorSet.end();
animatorSet.cancel();
if (!(view instanceof ImageView)) {
throw new IllegalArgumentException("updateIcon() must be called on an ImageView");
}
updateIcon((ImageView) view);
final int translateY = (int) RetroUtil.convertDpToPixel(getHeight(view.getContext()), view.getContext());
ObjectAnimator animator = ObjectAnimator.ofFloat(sheet, "translationY", backdropShown ? translateY : 0);
animator.setDuration(500);
if (interpolator != null) {
animator.setInterpolator(interpolator);
}
animatorSet.play(animator);
animator.start();
}
private int getHeight(Context context) {
Resources resources = context.getResources();
if (RetroUtil.isLandscape(resources)) {
return 3 * 48;
} else if (RetroUtil.isTablet(resources)) {
if (RetroUtil.isLandscape(resources)) {
return 48;
} else {
return 2 * 48;
}
} else
return 5 * 48;
}
private void updateIcon(ImageView view) {
if (openIcon != null && closeIcon != null) {
view.setImageTintList(ColorStateList.valueOf(ATHUtil.resolveColor(context, R.attr.iconColor)));
if (backdropShown) {
view.setImageDrawable(closeIcon);
} else {
view.setImageDrawable(openIcon);
}
}
}
}

View file

@ -2,15 +2,17 @@ package code.name.monkey.retromusic.misc;
import android.content.Context;
import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.core.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.animation.LinearInterpolator;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.annotation.NonNull;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.ViewCompat;
/*Don't delete even if its not showing not using*/
public class ScrollAwareFABBehavior extends CoordinatorLayout.Behavior<FloatingActionButton> {
private static final String TAG = "ScrollingFABBehavior";
@ -71,40 +73,4 @@ public class ScrollAwareFABBehavior extends CoordinatorLayout.Behavior<FloatingA
}
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
}
}
/*extends FloatingActionButton.Behavior {
public ScrollAwareFABBehavior(Context context, AttributeSet attrs) {
super();
}
@Override
public boolean onStartNestedScroll(@NonNull final CoordinatorLayout coordinatorLayout,
@NonNull final FloatingActionButton child,
@NonNull final View directTargetChild,
@NonNull final View target,
final int nestedScrollAxes) {
// Ensure we react to vertical scrolling
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL
|| super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);
}
@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
@NonNull FloatingActionButton child,
@NonNull View target,
int dxConsumed,
int dyConsumed,
int dxUnconsumed,
int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed,
dyUnconsumed);
if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
child.hide();
} else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
child.show();
}
}
}*/
}

View file

@ -0,0 +1,34 @@
package code.name.monkey.retromusic.model;
public class Contributor {
private String name;
private String summary;
private String link;
private String profile_image;
public Contributor() {
}
public Contributor(String name, String summary, String link, String profile_image) {
this.name = name;
this.summary = summary;
this.link = link;
this.profile_image = profile_image;
}
public String getName() {
return name;
}
public String getSummary() {
return summary;
}
public String getLink() {
return link;
}
public String getProfileImage() {
return profile_image;
}
}

View file

@ -17,7 +17,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
public class LastFMRestClient {
private static final String BASE_URL = "http://ws.audioscrobbler.com/2.0/";
private static final String BASE_URL = "https://ws.audioscrobbler.com/2.0/";
private LastFMService apiService;

View file

@ -5,14 +5,25 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import androidx.core.app.ShareCompat;
import androidx.appcompat.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.nio.charset.StandardCharsets;
import java.util.List;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ShareCompat;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@ -20,7 +31,9 @@ import code.name.monkey.appthemehelper.ThemeStore;
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;
import code.name.monkey.retromusic.util.NavigationUtil;
import static code.name.monkey.retromusic.Constants.APP_INSTAGRAM_LINK;
@ -49,6 +62,9 @@ public class AboutActivity extends AbsBaseActivity {
@BindView(R.id.title)
TextView title;
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -60,6 +76,7 @@ public class AboutActivity extends AbsBaseActivity {
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
loadContributors();
setUpToolbar();
appVersion.setText(getAppVersion());
@ -177,4 +194,32 @@ public class AboutActivity extends AbsBaseActivity {
Intent.createChooser(shareIntent, getResources().getText(R.string.action_share)));
}
}
public void loadContributors() {
String data = getAssetJsonData();
Type type = new TypeToken<List<Contributor>>() {
}.getType();
List<Contributor> contributors = new Gson().fromJson(data, type);
ContributorAdapter contributorAdapter = new ContributorAdapter(contributors);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(contributorAdapter);
}
public String getAssetJsonData() {
String json = null;
try {
InputStream is = getAssets().open("contributors.json");
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
json = new String(buffer, StandardCharsets.UTF_8);
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
return json;
}
}

View file

@ -20,6 +20,7 @@ import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.ImageView;
import android.widget.TextView;
@ -124,12 +125,15 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
supportPostponeEnterTransition();
setupToolbarMarginHeight();
setBottomBarVisibility(View.GONE);
setLightNavigationBar(true);
setNavigationbarColorAuto();
supportPostponeEnterTransition();
setupToolbarMarginHeight();
int albumId = getIntent().getIntExtra(EXTRA_ALBUM_ID, -1);
albumDetailsPresenter = new AlbumDetailsPresenter(this, albumId);

View file

@ -141,6 +141,8 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
super.onCreate(bundle);
ButterKnife.bind(this);
setBottomBarVisibility(View.GONE);
setNavigationbarColorAuto();
setLightNavigationBar(true);

View file

@ -87,6 +87,7 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
setBottomBarVisibility(View.GONE);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();

View file

@ -5,8 +5,6 @@ import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import android.text.InputType;
import android.text.TextUtils;
import android.view.MenuItem;
@ -27,6 +25,8 @@ import java.util.ArrayList;
import java.util.EnumMap;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@ -98,8 +98,10 @@ public class LyricsActivity extends AbsMusicServiceActivity implements
private void selectLyricsTye(int group) {
PreferenceUtil.getInstance(this).setLastLyricsType(group);
RadioButton radioButton = actionsLayout.findViewById(group);
radioButton.setBackgroundTintList(ColorStateList.valueOf(ThemeStore.accentColor(this)));
radioButton.setTextColor(ThemeStore.textColorPrimary(this));
if (radioButton != null) {
radioButton.setBackgroundTintList(ColorStateList.valueOf(ThemeStore.accentColor(this)));
radioButton.setTextColor(ThemeStore.textColorPrimary(this));
}
offlineLyrics.setVisibility(View.GONE);
lyricView.setVisibility(View.GONE);

View file

@ -19,6 +19,7 @@ import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import java.util.ArrayList;
@ -48,8 +49,7 @@ 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 {
public class MainActivity extends AbsSlidingMusicPanelActivity implements SharedPreferences.OnSharedPreferenceChangeListener, BottomNavigationView.OnNavigationItemSelectedListener {
public static final int APP_INTRO_REQUEST = 2323;
public static final int LIBRARY = 1;
@ -58,6 +58,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
private static final String TAG = "MainActivity";
private static final int APP_USER_INFO_REQUEST = 9003;
private static final int REQUEST_CODE_THEME = 9002;
@Nullable
MainActivityFragmentCallbacks currentFragment;
@ -81,6 +82,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
}
}
};
private int insideFragment = R.id.action_song;
@Override
protected View createContentView() {
@ -95,11 +97,12 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
protected void onCreate(Bundle savedInstanceState) {
setDrawUnderStatusBar(true);
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
drawerLayout.setOnApplyWindowInsetsListener((view, windowInsets) ->
windowInsets.replaceSystemWindowInsets(0, 0, 0, 0));
setBottomBarVisibility(View.VISIBLE);
getBottomNavigationView().setOnNavigationItemSelectedListener(this);
drawerLayout.setOnApplyWindowInsetsListener((view, windowInsets) -> windowInsets.replaceSystemWindowInsets(0, 0, 0, 0));
if (savedInstanceState == null) {
setCurrentFragment(PreferenceUtil.getInstance(this).getLastMusicChooser());
@ -109,7 +112,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
checkShowChangelog();
}
private void checkShowChangelog() {
try {
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
@ -165,23 +167,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
}
private void restoreCurrentFragment() {
currentFragment = (MainActivityFragmentCallbacks) getSupportFragmentManager()
.findFragmentById(R.id.fragment_container);
}
public void setCurrentFragment(int key) {
PreferenceUtil.getInstance(this).setLastMusicChooser(key);
switch (key) {
case LIBRARY:
setCurrentFragment(LibraryFragment.newInstance(), false, LibraryFragment.TAG);
break;
case FOLDERS:
setCurrentFragment(FoldersFragment.newInstance(this), false, FoldersFragment.TAG);
break;
case HOME:
setCurrentFragment(BannerHomeFragment.newInstance(), false, HomeFragment.TAG);
break;
}
currentFragment = (MainActivityFragmentCallbacks) getSupportFragmentManager().findFragmentById(R.id.fragment_container);
}
private void handlePlaybackIntent(@Nullable Intent intent) {
@ -337,4 +323,51 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements
})
.show();
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
PreferenceUtil.getInstance(this).setLastPage(menuItem.getItemId());
selectedFragment(menuItem.getItemId());
return true;
}
private void selectedFragment(int itemId) {
insideFragment = itemId;
switch (itemId) {
case R.id.action_album:
setCurrentFragment(LIBRARY);
break;
case R.id.action_artist:
setCurrentFragment(LIBRARY);
break;
case R.id.action_playlist:
setCurrentFragment(LIBRARY);
break;
case R.id.action_song:
setCurrentFragment(LIBRARY);
break;
default:
case R.id.action_home:
setCurrentFragment(HOME);
break;
}
}
public void setCurrentFragment(int key) {
PreferenceUtil.getInstance(this).setLastMusicChooser(key);
switch (key) {
case LIBRARY:
setCurrentFragment(LibraryFragment.newInstance(insideFragment), false, LibraryFragment.TAG);
break;
case FOLDERS:
setCurrentFragment(FoldersFragment.newInstance(this), false, FoldersFragment.TAG);
break;
case HOME:
setCurrentFragment(PreferenceUtil.getInstance(this).toggleHomeBanner() ? HomeFragment.newInstance() :
BannerHomeFragment.newInstance(), false, HomeFragment.TAG);
break;
}
}
}

View file

@ -2,10 +2,11 @@ package code.name.monkey.retromusic.ui.activities;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import com.google.android.material.appbar.AppBarLayout;
import androidx.appcompat.widget.Toolbar;
import android.widget.TextView;
import com.google.android.material.appbar.AppBarLayout;
import androidx.appcompat.widget.Toolbar;
import butterknife.BindDrawable;
import butterknife.BindString;
import butterknife.BindView;

View file

@ -84,6 +84,7 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
setBottomBarVisibility(View.GONE);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();

View file

@ -1,18 +1,88 @@
package code.name.monkey.retromusic.ui.activities;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.provider.MediaStore.Images.Media;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import androidx.appcompat.widget.Toolbar;
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.ui.activities.base.AbsBaseActivity;
import code.name.monkey.retromusic.ui.fragments.intro.NameFragment;
import code.name.monkey.retromusic.util.Compressor;
import code.name.monkey.retromusic.util.ImageUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.views.CircularImageView;
import code.name.monkey.retromusic.views.IconImageView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import static code.name.monkey.retromusic.Constants.USER_BANNER;
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
public class UserInfoActivity extends AbsBaseActivity {
private static final String TAG = "UserInfoActivity";
private static final int PICK_IMAGE_REQUEST = 9002;
private static final int PICK_BANNER_REQUEST = 9003;
private static final int PROFILE_ICON_SIZE = 400;
@BindView(R.id.title)
TextView title;
@BindView(R.id.name_container)
TextInputLayout nameLayout;
@BindView(R.id.name)
TextInputEditText name;
@BindView(R.id.user_image)
CircularImageView userImage;
@BindView(R.id.image)
ImageView image;
@BindView(R.id.banner_select)
IconImageView imageView;
@BindView(R.id.next)
FloatingActionButton nextButton;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
AppBarLayout appBarLayout;
private CompositeDisposable disposable;
@Override
protected void onCreate(Bundle savedInstanceState) {
setDrawUnderStatusBar(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_info);
@ -23,11 +93,199 @@ public class UserInfoActivity extends AbsBaseActivity {
setTaskDescriptionColorAuto();
setLightNavigationBar(true);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container, new NameFragment(), TAG)
.commit();
setupToolbar();
disposable = new CompositeDisposable();
title.setTextColor(ThemeStore.textColorPrimary(this));
nameLayout.setBoxStrokeColor(ThemeStore.accentColor(this));
name.setText(PreferenceUtil.getInstance(this).getUserName());
if (!PreferenceUtil.getInstance(this).getProfileImage().isEmpty()) {
loadImageFromStorage(PreferenceUtil.getInstance(this).getProfileImage());
}
if (!PreferenceUtil.getInstance(this).getBannerImage().isEmpty()) {
loadBannerFromStorage(PreferenceUtil.getInstance(this).getBannerImage());
}
}
private void setupToolbar() {
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
appBarLayout.setBackgroundColor(ThemeStore.primaryColor(this));
nextButton.setBackgroundTintList(ColorStateList.valueOf(ThemeStore.accentColor(this)));
}
@OnClick({R.id.next, R.id.banner_select})
void next(View view) {
switch (view.getId()) {
case R.id.banner_select:
showBannerOptions();
break;
case R.id.next:
String nameString = name.getText().toString().trim();
if (TextUtils.isEmpty(nameString)) {
Toast.makeText(this, "Umm name is empty", Toast.LENGTH_SHORT).show();
return;
}
//noinspection ConstantConditions
PreferenceUtil.getInstance(this).setUserName(nameString);
setResult(RESULT_OK);
//((UserInfoActivity) getActivity()).setFragment(new ChooseThemeFragment(), true);
finish();
break;
}
}
private void showBannerOptions() {
//noinspection ConstantConditions
new MaterialDialog.Builder(this)
.title(R.string.select_banner_photo)
.items(Arrays.asList(getString(R.string.new_banner_photo),
getString(R.string.remove_banner_photo)))
.itemsCallback((dialog, itemView, position, text) -> {
switch (position) {
case 0:
selectBannerImage();
break;
case 1:
PreferenceUtil.getInstance(this).setBannerImagePath("");
break;
}
}).show();
}
private void selectBannerImage() {
//noinspection ConstantConditions
if (PreferenceUtil.getInstance(this).getBannerImage().isEmpty()) {
Intent pickImageIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
pickImageIntent.setType("image/*");
pickImageIntent.putExtra("crop", "true");
pickImageIntent.putExtra("outputX", 1290);
pickImageIntent.putExtra("outputY", 720);
pickImageIntent.putExtra("aspectX", 16);
pickImageIntent.putExtra("aspectY", 9);
pickImageIntent.putExtra("scale", true);
//intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(pickImageIntent,
"Select Picture"), PICK_BANNER_REQUEST);
} else {
PreferenceUtil.getInstance(this).setBannerImagePath("");
image.setImageResource(android.R.color.transparent);
imageView.setImageResource(R.drawable.ic_edit_white_24dp);
}
}
@OnClick(R.id.image)
public void onViewClicked() {
//noinspection ConstantConditions
new MaterialDialog.Builder(this)
.title("Set a profile photo")
.items(Arrays.asList(getString(R.string.new_profile_photo),
getString(R.string.remove_profile_photo)))
.itemsCallback((dialog, itemView, position, text) -> {
switch (position) {
case 0:
pickNewPhoto();
break;
case 1:
PreferenceUtil.getInstance(this).saveProfileImage("");
break;
}
}).show();
}
private void pickNewPhoto() {
Intent pickImageIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
pickImageIntent.setType("image/*");
pickImageIntent.putExtra("crop", "true");
pickImageIntent.putExtra("outputX", 512);
pickImageIntent.putExtra("outputY", 512);
pickImageIntent.putExtra("aspectX", 1);
pickImageIntent.putExtra("aspectY", 1);
pickImageIntent.putExtra("scale", true);
startActivityForResult(Intent.createChooser(pickImageIntent, "Select Picture"),
PICK_IMAGE_REQUEST);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null &&
data.getData() != null) {
Uri uri = data.getData();
try {
Bitmap bitmap = ImageUtil.getResizedBitmap(Media.getBitmap(getContentResolver(), uri), PROFILE_ICON_SIZE);
String profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE);
PreferenceUtil.getInstance(this).saveProfileImage(profileImagePath);
loadImageFromStorage(profileImagePath);
} catch (IOException e) {
e.printStackTrace();
}
}
if (requestCode == PICK_BANNER_REQUEST && resultCode == RESULT_OK && data != null &&
data.getData() != null) {
Uri uri = data.getData();
try {
Bitmap bitmap = Media.getBitmap(getContentResolver(), uri);
String profileImagePath = saveToInternalStorage(bitmap, USER_BANNER);
PreferenceUtil.getInstance(this).setBannerImagePath(profileImagePath);
loadBannerFromStorage(profileImagePath);
} catch (IOException e) {
e.printStackTrace();
}
}
}
private void loadBannerFromStorage(String profileImagePath) {
disposable.add(new Compressor(this)
.setQuality(100)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(new File(profileImagePath, USER_BANNER))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(bitmap -> {
image.setImageBitmap(bitmap);
}));
}
private void loadImageFromStorage(String path) {
disposable.add(new Compressor(this)
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(new File(path, USER_PROFILE))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(bitmap -> {
userImage.setImageBitmap(bitmap);
}));
}
private String saveToInternalStorage(Bitmap bitmapImage, String userBanner) {
ContextWrapper cw = new ContextWrapper(this);
// path to /data/data/yourapp/app_data/imageDir
File directory = cw.getDir("imageDir", Context.MODE_PRIVATE);
// Create imageDir
File mypath = new File(directory, userBanner);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(mypath);
// Use the compress method on the BitMap object to write image to the OutputStream
bitmapImage.compress(Bitmap.CompressFormat.WEBP, 100, fos);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (fos != null) {
fos.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return directory.getAbsolutePath();
}
}

View file

@ -101,8 +101,7 @@ public abstract class AbsCastActivity extends AbsBaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
playServicesAvailable = GoogleApiAvailability
.getInstance().isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS;
playServicesAvailable = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS;
} catch (Exception ignored) {
}
@ -125,8 +124,7 @@ public abstract class AbsCastActivity extends AbsBaseActivity {
protected void onPause() {
super.onPause();
if (playServicesAvailable) {
castContext.getSessionManager().removeSessionManagerListener(
sessionManagerListener, CastSession.class);
castContext.getSessionManager().removeSessionManagerListener(sessionManagerListener, CastSession.class);
}
}

View file

@ -2,7 +2,6 @@ package code.name.monkey.retromusic.ui.activities.base;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
@ -10,7 +9,8 @@ import android.view.ViewTreeObserver;
import android.view.animation.PathInterpolator;
import com.google.android.gms.cast.framework.CastSession;
import com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
import com.sothree.slidinguppanel.SlidingUpPanelLayout.PanelState;
@ -21,7 +21,9 @@ import androidx.fragment.app.Fragment;
import butterknife.BindView;
import butterknife.ButterKnife;
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.NavigationViewUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.cast.CastHelper;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
@ -40,6 +42,7 @@ 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;
@ -50,6 +53,9 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
@BindView(R.id.sliding_layout)
SlidingUpPanelLayout slidingUpPanelLayout;
@BindView(R.id.bottom_navigation)
BottomNavigationView bottomNavigationView;
private int navigationbarColor;
private int taskColor;
private boolean lightStatusBar;
@ -59,32 +65,25 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
private MiniPlayerFragment miniPlayerFragment;
private ValueAnimator navigationBarColorAnimator;
@Override
public void onPlayingMetaChanged() {
super.onPlayingMetaChanged();
CastSession castSession = getCastSession();
if (castSession == null) {
return;
}
//MusicPlayerRemote.pauseSong();
CastHelper.startCasting(castSession, MusicPlayerRemote.getCurrentSong());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(createContentView());
ButterKnife.bind(this);
choosFragmentForTheme();
findViewById(R.id.castMiniController).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AbsSlidingMusicPanelActivity.this, ExpandedControllerActivity.class));
}
});
//noinspection ConstantConditions
miniPlayerFragment.getView().setOnClickListener(v -> expandPanel());
miniPlayerFragment.getView().setOnClickListener(v -> {
CastSession castSession = getCastSession();
if (castSession != null) {
NavigationUtil.gotoExpandedController(AbsSlidingMusicPanelActivity.this);
} else {
expandPanel();
}
}
);
slidingUpPanelLayout.getViewTreeObserver()
.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@ -104,7 +103,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
});
slidingUpPanelLayout.addPanelSlideListener(this);
setupBottomView();
}
private void choosFragmentForTheme() {
@ -203,6 +202,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
@Override
public void onPanelSlide(View panel, @FloatRange(from = 0, to = 1) float slideOffset) {
bottomNavigationView.setTranslationY(slideOffset * 400);
setMiniPlayerAlphaProgress(slideOffset);
}
@ -322,15 +322,24 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
}
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 {
//slidingUpPanelLayout.setPanelHeight(getCastSession() != null ? getResources().getDimensionPixelSize(R.dimen.mini_player_height_expanded) : getResources().getDimensionPixelSize(R.dimen.mini_player_height));
slidingUpPanelLayout.setPanelHeight(getResources().getDimensionPixelSize(R.dimen.mini_player_height));
if (!MusicPlayerRemote.getPlayingQueue().isEmpty()) {
slidingUpPanelLayout.setPanelHeight(bottomNavigationView.getVisibility() == View.VISIBLE ?
heightOfBarWithTabs : heightOfBar);
}
}
}
protected View wrapSlidingMusicPanel(@LayoutRes int resId) {
@SuppressLint("InflateParams")
View slidingMusicPanelLayout = getLayoutInflater().inflate(R.layout.sliding_music_panel_layout, null);
@ -377,8 +386,8 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
if (view.findViewById(R.id.toolbar) != null) {
view.findViewById(R.id.toolbar).setBackgroundColor(playerFragmentColorDark);
}
if (view.findViewById(R.id.appbar) != null) {
view.findViewById(R.id.appbar).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)
@ -421,15 +430,47 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
@Override
public void hideCastMiniController() {
super.hideCastMiniController();
hideBottomBar(false);
findViewById(R.id.castMiniController).setVisibility(View.GONE);
}
@Override
public void showCastMiniController() {
super.showCastMiniController();
hideBottomBar(true);
findViewById(R.id.castMiniController).setVisibility(View.VISIBLE);
MusicPlayerRemote.pauseSong();
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);
if (!PreferenceUtil.getInstance(this).tabTitles()) {
bottomNavigationView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_UNLABELED);
}
}
@Override
public void onPlayingMetaChanged() {
super.onPlayingMetaChanged();
CastSession castSession = getCastSession();
if (castSession == null) {
return;
}
//MusicPlayerRemote.pauseSong();
CastHelper.startCasting(castSession, MusicPlayerRemote.getCurrentSong());
}
public void setBottomBarVisibility(int gone) {
if (bottomNavigationView != null) {
//TransitionManager.beginDelayedTransition(bottomNavigationView);
bottomNavigationView.setVisibility(gone);
hideBottomBar(false);
}
}
public BottomNavigationView getBottomNavigationView() {
return bottomNavigationView;
}
}

View file

@ -6,9 +6,6 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
@ -17,6 +14,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.jaudiotagger.audio.AudioFile;
import org.jaudiotagger.audio.AudioFileIO;
@ -27,6 +25,8 @@ import java.io.File;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.ButterKnife;
import code.name.monkey.appthemehelper.ThemeStore;
@ -71,6 +71,9 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
}
setUpViews();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
}

View file

@ -1,26 +1,26 @@
package code.name.monkey.retromusic.ui.activities.tageditor;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.google.android.material.appbar.AppBarLayout;
import androidx.core.content.ContextCompat;
import androidx.appcompat.widget.Toolbar;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import org.jaudiotagger.tag.FieldKey;
@ -29,11 +29,16 @@ import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import butterknife.BindView;
import butterknife.BindViews;
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.TintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.glide.palette.BitmapPaletteTranscoder;
import code.name.monkey.retromusic.glide.palette.BitmapPaletteWrapper;
@ -53,43 +58,61 @@ public class AlbumTagEditorActivity extends AbsTagEditorActivity implements Text
public static final String TAG = AlbumTagEditorActivity.class.getSimpleName();
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
AppBarLayout appBarLayout;
@BindView(R.id.title)
EditText albumTitle;
TextView title;
@BindView(R.id.app_bar)
@Nullable
AppBarLayout appBarLayout;
@BindViews({R.id.album_title_container, R.id.album_artist_container, R.id.genre_container, R.id.year_container})
List<TextInputLayout> textInputLayouts;
@BindView(R.id.album_title)
TextInputEditText albumTitle;
@BindView(R.id.album_artist)
EditText albumArtist;
TextInputEditText albumArtist;
@BindView(R.id.genre)
EditText genre;
TextInputEditText genre;
@BindView(R.id.year)
EditText year;
TextInputEditText year;
@BindView(R.id.gradient_background)
View background;
@BindView(R.id.content)
View content;
ButterKnife.Setter<TextInputLayout, Integer> textColor = (view, value, index) -> {
view.setBoxStrokeColor(value);
};
private Bitmap albumArtBitmap;
private boolean deleteAlbumArt;
private LastFMRestClient lastFMRestClient;
private void setupToolbar() {
//toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
title.setTextColor(ThemeStore.textColorPrimary(this));
// toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
toolbar.setNavigationOnClickListener(v -> onBackPressed());
setTitle(R.string.action_tag_editor);
setTitle(null);
setSupportActionBar(toolbar);
}
@OnClick(R.id.edit)
void edit() {
getShow();
TintHelper.setTintAuto(content, ThemeStore.primaryColor(this), true);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
setDrawUnderStatusBar(true);
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
ButterKnife.apply(textInputLayouts, textColor, ThemeStore.accentColor((this)));
lastFMRestClient = new LastFMRestClient(this);
setUpViews();
setupToolbar();
}
@Override
@ -271,10 +294,6 @@ public class AlbumTagEditorActivity extends AbsTagEditorActivity implements Text
@Override
protected void setColors(int color) {
super.setColors(color);
background.setBackgroundColor(color);
toolbar.setBackgroundColor(color);
setStatusbarColor(ColorUtil.darkenColor(color));
setNavigationbarColor(ColorUtil.darkenColor(color));
setSupportActionBar(toolbar);
save.setBackgroundTintList(ColorStateList.valueOf(color));
}
}

View file

@ -74,12 +74,10 @@ public class SongTagEditorActivity extends AbsTagEditorActivity implements TextW
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setNoImageMode();
setUpViews();
setupToolbar();
setStatusbarColorAuto();
}
private void setUpViews() {

View file

@ -0,0 +1,71 @@
package code.name.monkey.retromusic.ui.adapter;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.Contributor;
import code.name.monkey.retromusic.ui.adapter.base.MediaEntryViewHolder;
import code.name.monkey.retromusic.views.NetworkImageView;
import static code.name.monkey.retromusic.util.RetroUtil.openUrl;
public class ContributorAdapter extends RecyclerView.Adapter<ContributorAdapter.ViewHolder> {
private List<Contributor> contributors = new ArrayList<>();
public ContributorAdapter(List<Contributor> contributors) {
this.contributors = contributors;
}
public ContributorAdapter() {
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_contributor, parent, false));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
Contributor contributor = contributors.get(position);
holder.bindData(contributor);
}
@Override
public int getItemCount() {
return contributors.size();
}
public class ViewHolder extends MediaEntryViewHolder {
public ViewHolder(View itemView) {
super(itemView);
}
void bindData(Contributor contributor) {
if (title != null) {
title.setText(contributor.getName());
}
if (text != null) {
text.setText(contributor.getSummary());
}
if (image instanceof NetworkImageView) {
((NetworkImageView) image).setImageUrl(contributor.getProfileImage());
}
}
@Override
public void onClick(View v) {
super.onClick(v);
openUrl((Activity) v.getContext(), contributors.get(getAdapterPosition()).getLink());
}
}
}

View file

@ -24,7 +24,6 @@ import code.name.monkey.retromusic.glide.SongGlideRequest;
import code.name.monkey.retromusic.misc.CustomFragmentStatePagerAdapter;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.ui.activities.LyricsActivity;
import code.name.monkey.retromusic.ui.fragments.NowPlayingScreen;
import code.name.monkey.retromusic.util.PreferenceUtil;
@ -134,12 +133,12 @@ public class AlbumCoverPagerAdapter extends CustomFragmentStatePagerAdapter {
case MATERIAL:
layout = R.layout.fragment_album_material_cover;
break;
case CAROUSAL:
layout = R.layout.fragment_album_carousal_cover;
break;
case FULL:
layout = R.layout.fragment_album_full_cover;
break;
case FULL_CARD:
layout = R.layout.fragment_album_full_card_cover;
break;
}
return layout;
}
@ -163,7 +162,7 @@ public class AlbumCoverPagerAdapter extends CustomFragmentStatePagerAdapter {
}
private void loadAlbumCover() {
SongGlideRequest.Builder.from(Glide.with(this), song)
SongGlideRequest.Builder.from(Glide.with(getContext()), song)
.checkIgnoreMediaStore(getActivity())
.generatePalette(getActivity()).build()
.into(new RetroMusicColoredTarget(albumCover) {
@ -183,7 +182,7 @@ public class AlbumCoverPagerAdapter extends CustomFragmentStatePagerAdapter {
}
}
public void receiveColor(ColorReceiver colorReceiver, int request) {
void receiveColor(ColorReceiver colorReceiver, int request) {
if (isColorReady) {
colorReceiver.onColorReady(color, request);
} else {

View file

@ -171,9 +171,6 @@ public class PlayingQueueAdapter extends SongAdapter implements DraggableItemAda
if (imageText != null) {
imageText.setVisibility(View.VISIBLE);
}
if (image != null) {
image.setVisibility(View.GONE);
}
if (dragView != null) {
dragView.setVisibility(View.VISIBLE);
}

View file

@ -6,13 +6,13 @@ import code.name.monkey.retromusic.R;
public enum AlbumCoverStyle {
NORMAL(R.string.normal, R.drawable.album_cover_card, 0),
NORMAL(R.string.normal, R.drawable.album_cover_normal, 0),
FLAT(R.string.flat, R.drawable.album_cover_square, 1),
CIRCLE(R.string.circular, R.drawable.album_cover_circle, 2),
MATERIAL(R.string.material, R.drawable.album_cover_card, 3),
MATERIAL(R.string.material, R.drawable.album_cover_normal, 3),
CARD(R.string.card, R.drawable.album_cover_card, 4),
CAROUSAL(R.string.carousal, R.drawable.album_cover_carousal, 5),
FULL(R.string.full, R.drawable.album_cover_full, 6);
FULL(R.string.full, R.drawable.album_cover_full, 5),
FULL_CARD(R.string.full_card, R.drawable.album_cover_full_card, 6);
@StringRes
public final int titleRes;

View file

@ -4,7 +4,6 @@ import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.view.GestureDetector;
import android.view.LayoutInflater;
@ -22,7 +21,6 @@ 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.retromusic.R;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.helper.MusicProgressViewUpdateHelper;
@ -30,7 +28,6 @@ import code.name.monkey.retromusic.helper.PlayPauseButtonOnClickHandler;
import code.name.monkey.retromusic.ui.fragments.base.AbsMusicServiceFragment;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroUtil;
import code.name.monkey.retromusic.views.PlayPauseDrawable;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
public class MiniPlayerFragment extends AbsMusicServiceFragment implements MusicProgressViewUpdateHelper.Callback {
@ -51,7 +48,6 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
MaterialProgressBar progressBar;
private Unbinder unbinder;
private PlayPauseDrawable miniPlayerPlayPauseDrawable;
private MusicProgressViewUpdateHelper progressViewUpdateHelper;
@Override
@ -72,10 +68,12 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//noinspection ConstantConditions
view.setBackgroundColor(ThemeStore.primaryColor(getContext()));
view.setOnTouchListener(new FlingPlayBackController(getActivity()));
setUpMiniPlayer();
if (RetroUtil.isTablet(getResources())) {
next.setVisibility(View.VISIBLE);
previous.setVisibility(View.VISIBLE);
@ -99,11 +97,6 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
private void setUpPlayPauseButton() {
//noinspection ConstantConditions
miniPlayerPlayPauseDrawable = new PlayPauseDrawable(getActivity());
miniPlayerPlayPauseButton.setImageDrawable(miniPlayerPlayPauseDrawable);
miniPlayerPlayPauseButton.setColorFilter(ATHUtil.resolveColor(getActivity(),
R.attr.iconColor,
ThemeStore.textColorSecondary(getActivity())), PorterDuff.Mode.SRC_IN);
miniPlayerPlayPauseButton.setOnClickListener(new PlayPauseButtonOnClickHandler());
}
@ -114,7 +107,7 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
@Override
public void onServiceConnected() {
updateSongTitle();
updatePlayPauseDrawableState(false);
updatePlayPauseDrawableState();
}
@Override
@ -124,7 +117,7 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
@Override
public void onPlayStateChanged() {
updatePlayPauseDrawableState(true);
updatePlayPauseDrawableState();
}
@Override
@ -148,11 +141,11 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
progressViewUpdateHelper.stop();
}
protected void updatePlayPauseDrawableState(boolean animate) {
protected void updatePlayPauseDrawableState() {
if (MusicPlayerRemote.isPlaying()) {
miniPlayerPlayPauseDrawable.setPause(animate);
miniPlayerPlayPauseButton.setImageResource(R.drawable.ic_pause_white_24dp);
} else {
miniPlayerPlayPauseDrawable.setPlay(animate);
miniPlayerPlayPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp);
}
}

View file

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

View file

@ -7,8 +7,8 @@ import android.view.View;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.MainOptionsBottomSheetDialogFragment;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.util.RetroUtil;
public abstract class AbsMainActivityFragment extends AbsMusicServiceFragment {
@ -21,7 +21,7 @@ public abstract class AbsMainActivityFragment extends AbsMusicServiceFragment {
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
getMainActivity().setStatusbarColorAuto();
//getMainActivity().setStatusbarColorAuto();
getMainActivity().setNavigationbarColorAuto();
getMainActivity().setLightNavigationBar(true);
getMainActivity().setTaskDescriptionColorAuto();
@ -47,4 +47,8 @@ public abstract class AbsMainActivityFragment extends AbsMusicServiceFragment {
//noinspection ConstantConditions
setStatusbarColor(view, ColorUtil.darkenColor(ThemeStore.primaryColor(getContext())));
}
protected void showMainMenu() {
MainOptionsBottomSheetDialogFragment.newInstance().show(getChildFragmentManager(), "Main Menu");
}
}

View file

@ -1,275 +0,0 @@
package code.name.monkey.retromusic.ui.fragments.intro;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore.Images.Media;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.afollestad.materialdialogs.MaterialDialog.Builder;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Arrays;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.util.Compressor;
import code.name.monkey.retromusic.util.ImageUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.views.CircularImageView;
import code.name.monkey.retromusic.views.IconImageView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import static android.app.Activity.RESULT_OK;
import static code.name.monkey.retromusic.Constants.USER_BANNER;
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
public class NameFragment extends Fragment {
private static final int PICK_IMAGE_REQUEST = 9002;
private static final int PICK_BANNER_REQUEST = 9003;
private static final int PROFILE_ICON_SIZE = 400;
@BindView(R.id.name)
EditText name;
@BindView(R.id.user_image)
CircularImageView userImage;
@BindView(R.id.image)
ImageView image;
@BindView(R.id.banner_select)
IconImageView imageView;
private Unbinder unbinder;
private CompositeDisposable disposable;
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity())
.inflate(R.layout.fragment_name, container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//noinspection ConstantConditions
name.setText(PreferenceUtil.getInstance(getActivity()).getUserName());
if (!PreferenceUtil.getInstance(getActivity()).getProfileImage().isEmpty()) {
loadImageFromStorage(PreferenceUtil.getInstance(getActivity()).getProfileImage());
}
if (!PreferenceUtil.getInstance(getActivity()).getBannerImage().isEmpty()) {
loadBannerFromStorage(PreferenceUtil.getInstance(getActivity()).getBannerImage());
imageView.setImageResource(R.drawable.ic_close_white_24dp);
}
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
disposable = new CompositeDisposable();
}
@OnClick({R.id.next, R.id.banner_select})
void next(View view) {
switch (view.getId()) {
case R.id.banner_select:
showBannerOptions();
break;
case R.id.next:
String nameString = name.getText().toString().trim();
if (TextUtils.isEmpty(nameString)) {
Toast.makeText(getActivity(), "Umm name is empty", Toast.LENGTH_SHORT).show();
return;
}
//noinspection ConstantConditions
PreferenceUtil.getInstance(getActivity()).setUserName(nameString);
getActivity().setResult(RESULT_OK);
//((UserInfoActivity) getActivity()).setFragment(new ChooseThemeFragment(), true);
getActivity().finish();
break;
}
}
private void showBannerOptions() {
//noinspection ConstantConditions
new Builder(getContext())
.title(R.string.select_banner_photo)
.items(Arrays.asList(getString(R.string.new_banner_photo),
getString(R.string.remove_banner_photo)))
.itemsCallback((dialog, itemView, position, text) -> {
switch (position) {
case 0:
selectBannerImage();
break;
case 1:
PreferenceUtil.getInstance(getContext()).setBannerImagePath("");
break;
}
}).show();
}
private void selectBannerImage() {
//noinspection ConstantConditions
if (PreferenceUtil.getInstance(getActivity()).getBannerImage().isEmpty()) {
Intent pickImageIntent = new Intent(Intent.ACTION_PICK,
Media.EXTERNAL_CONTENT_URI);
pickImageIntent.setType("image/*");
pickImageIntent.putExtra("crop", "true");
pickImageIntent.putExtra("outputX", 1290);
pickImageIntent.putExtra("outputY", 720);
pickImageIntent.putExtra("aspectX", 16);
pickImageIntent.putExtra("aspectY", 9);
pickImageIntent.putExtra("scale", true);
//intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(pickImageIntent,
"Select Picture"), PICK_BANNER_REQUEST);
} else {
PreferenceUtil.getInstance(getContext()).setBannerImagePath("");
image.setImageResource(android.R.color.transparent);
imageView.setImageResource(R.drawable.ic_edit_white_24dp);
}
}
@OnClick(R.id.image)
public void onViewClicked() {
//noinspection ConstantConditions
new Builder(getContext())
.title("Set a profile photo")
.items(Arrays.asList(getString(R.string.new_profile_photo),
getString(R.string.remove_profile_photo)))
.itemsCallback((dialog, itemView, position, text) -> {
switch (position) {
case 0:
pickNewPhoto();
break;
case 1:
PreferenceUtil.getInstance(getContext()).saveProfileImage("");
break;
}
}).show();
}
private void pickNewPhoto() {
Intent pickImageIntent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
pickImageIntent.setType("image/*");
pickImageIntent.putExtra("crop", "true");
pickImageIntent.putExtra("outputX", 512);
pickImageIntent.putExtra("outputY", 512);
pickImageIntent.putExtra("aspectX", 1);
pickImageIntent.putExtra("aspectY", 1);
pickImageIntent.putExtra("scale", true);
startActivityForResult(Intent.createChooser(pickImageIntent, "Select Picture"),
PICK_IMAGE_REQUEST);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null &&
data.getData() != null) {
Uri uri = data.getData();
try {
Bitmap bitmap = ImageUtil.getResizedBitmap(Media.getBitmap(getActivity()
.getContentResolver(), uri), PROFILE_ICON_SIZE);
String profileImagePath = saveToInternalStorage(bitmap, USER_PROFILE);
PreferenceUtil.getInstance(getActivity()).saveProfileImage(profileImagePath);
loadImageFromStorage(profileImagePath);
} catch (IOException e) {
e.printStackTrace();
}
}
if (requestCode == PICK_BANNER_REQUEST && resultCode == RESULT_OK && data != null &&
data.getData() != null) {
Uri uri = data.getData();
try {
Bitmap bitmap = Media.getBitmap(getActivity().getContentResolver(), uri);
String profileImagePath = saveToInternalStorage(bitmap, USER_BANNER);
PreferenceUtil.getInstance(getActivity()).setBannerImagePath(profileImagePath);
loadBannerFromStorage(profileImagePath);
} catch (IOException e) {
e.printStackTrace();
}
}
}
private void loadBannerFromStorage(String profileImagePath) {
disposable.add(new Compressor(getActivity())
.setQuality(100)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(new File(profileImagePath, USER_BANNER))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(bitmap -> {
image.setImageBitmap(bitmap);
}));
}
private void loadImageFromStorage(String path) {
disposable.add(new Compressor(getActivity())
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(new File(path, USER_PROFILE))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(bitmap -> {
userImage.setImageBitmap(bitmap);
}));
}
private String saveToInternalStorage(Bitmap bitmapImage, String userBanner) {
ContextWrapper cw = new ContextWrapper(getActivity());
// path to /data/data/yourapp/app_data/imageDir
File directory = cw.getDir("imageDir", Context.MODE_PRIVATE);
// Create imageDir
File mypath = new File(directory, userBanner);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(mypath);
// Use the compress method on the BitMap object to write image to the OutputStream
bitmapImage.compress(Bitmap.CompressFormat.WEBP, 100, fos);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (fos != null) {
fos.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return directory.getAbsolutePath();
}
}

View file

@ -1,20 +1,8 @@
package code.name.monkey.retromusic.ui.fragments.mainactivity;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.appcompat.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@ -22,22 +10,24 @@ import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.TextView;
import com.afollestad.materialcab.MaterialCab;
import com.google.android.material.appbar.AppBarLayout;
import butterknife.BindDrawable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.common.ATHToolbarActivity;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
import code.name.monkey.appthemehelper.util.NavigationViewUtil;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
@ -48,8 +38,6 @@ import code.name.monkey.retromusic.helper.SortOrder;
import code.name.monkey.retromusic.interfaces.CabHolder;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
import code.name.monkey.retromusic.loaders.SongLoader;
import code.name.monkey.retromusic.misc.NavigationIconClickListener;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.ui.activities.SettingsActivity;
import code.name.monkey.retromusic.ui.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment;
import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment;
@ -58,8 +46,7 @@ import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.RetroUtil;
public class LibraryFragment extends AbsMainActivityFragment implements CabHolder,
MainActivityFragmentCallbacks {
public class LibraryFragment extends AbsMainActivityFragment implements CabHolder, MainActivityFragmentCallbacks {
public static final String TAG = "LibraryFragment";
private static final String CURRENT_TAB_ID = "current_tab_id";
@ -73,23 +60,9 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
@BindView(R.id.title)
TextView title;
@BindView(R.id.action_library)
TextView actionLibrary;
@BindView(R.id.bottom_navigation)
BottomNavigationView bottomNavigationView;
@BindView(R.id.fragment_container)
View contentContainer;
@BindView(R.id.menu_container)
View menuContainer;
@BindDrawable(R.drawable.ic_menu_white_24dp)
Drawable menu;
@BindDrawable(R.drawable.ic_close_white_24dp)
Drawable close;
private Unbinder unBinder;
private MaterialCab cab;
@ -107,34 +80,16 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
return new LibraryFragment();
}
private void setupBottomView() {
Context context = getContext();
if (context != null) {
bottomNavigationView.setSelectedItemId(PreferenceUtil.getInstance(context).getLastPage());
bottomNavigationView.setBackgroundColor(ThemeStore.primaryColor(context));
bottomNavigationView.setOnNavigationItemSelectedListener(this::onOptionsItemSelected);
int iconColor = ATHUtil.resolveColor(context, R.attr.iconColor);
int accentColor = ThemeStore.accentColor(context);
NavigationViewUtil.setItemIconColors(bottomNavigationView, ColorUtil.withAlpha(iconColor, 0.5f), accentColor);
NavigationViewUtil.setItemTextColors(bottomNavigationView, ColorUtil.withAlpha(iconColor, 0.5f), accentColor);
if (!PreferenceUtil.getInstance(getContext()).tabTitles()) {
bottomNavigationView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_UNLABELED);
}
}
}
public void setTitle(@StringRes int name) {
title.setText(getString(name));
}
public void addOnAppBarOffsetChangedListener(
AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
public void addOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
appbar.addOnOffsetChangedListener(onOffsetChangedListener);
}
public void removeOnAppBarOffsetChangedListener(
AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
public void removeOnAppBarOffsetChangedListener(AppBarLayout.OnOffsetChangedListener onOffsetChangedListener) {
appbar.removeOnOffsetChangedListener(onOffsetChangedListener);
}
@ -154,25 +109,38 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupBottomView();
setStatusbarColorAuto(view);
setupToolbar();
inflateFragment();
}
if (savedInstanceState == null) {
private void inflateFragment() {
if (getArguments() == null) {
selectedFragment(SongsFragment.newInstance());
return;
}
switch (getArguments().getInt(CURRENT_TAB_ID)) {
default:
case R.id.action_song:
selectedFragment(SongsFragment.newInstance());
break;
case R.id.action_album:
selectedFragment(AlbumsFragment.newInstance());
break;
case R.id.action_artist:
selectedFragment(ArtistsFragment.newInstance());
break;
case R.id.action_playlist:
selectedFragment(PlaylistsFragment.newInstance());
break;
}
}
@SuppressWarnings("ConstantConditions")
private void setupToolbar() {
int accentColor = ThemeStore.accentColor(getContext());
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
actionLibrary.setTextColor(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(accentColor)));
actionLibrary.setBackgroundResource(R.drawable.et_bg_circular_top_corners);
TintHelper.setTintAuto(actionLibrary, ThemeStore.accentColor(getContext()), true);
int primaryColor = ThemeStore.primaryColor(getContext());
TintHelper.setTintAuto(contentContainer, primaryColor, true);
toolbar.setBackgroundColor(primaryColor);
@ -182,17 +150,10 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
getMainActivity().setTitle(null);
getMainActivity().setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(new NavigationIconClickListener(
getContext(),
contentContainer,
menuContainer,
new AccelerateDecelerateInterpolator(),
menu,
close
));
toolbar.setNavigationOnClickListener(v -> showMainMenu( ));
}
public Fragment getCurrentFragment() {
private Fragment getCurrentFragment() {
if (fragmentManager == null) {
return SongsFragment.newInstance();
}
@ -214,7 +175,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
return false;
}
public void selectedFragment(Fragment fragment) {
private void selectedFragment(Fragment fragment) {
fragmentManager = getChildFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
@ -394,21 +355,6 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
}
int id = item.getItemId();
switch (id) {
case R.id.action_song:
selectedFragment(SongsFragment.newInstance());
return true;
case R.id.action_album:
selectedFragment(AlbumsFragment.newInstance());
return true;
case R.id.action_artist:
selectedFragment(ArtistsFragment.newInstance());
return true;
case R.id.action_playlist:
selectedFragment(PlaylistsFragment.newInstance());
return true;
case R.id.action_genre:
selectedFragment(GenreFragment.newInstance());
return true;
case R.id.action_new_playlist:
CreatePlaylistDialog.create().show(getChildFragmentManager(), "CREATE_PLAYLIST");
return true;
@ -524,22 +470,4 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
}
return false;
}
@OnClick({R.id.action_home, R.id.action_settings, R.id.action_folders})
void startUserInfo(View view) {
Activity activity = getActivity();
if (activity != null) {
switch (view.getId()) {
case R.id.action_settings:
NavigationUtil.goToSettings(activity);
break;
case R.id.action_home:
getMainActivity().setCurrentFragment(MainActivity.HOME);
break;
case R.id.action_folders:
getMainActivity().setCurrentFragment(MainActivity.FOLDERS);
break;
}
}
}
}

View file

@ -1,21 +1,10 @@
package code.name.monkey.retromusic.ui.fragments.mainactivity.folders;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.media.MediaScannerConnection;
import android.os.Bundle;
import android.os.Environment;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.snackbar.Snackbar;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.Toolbar;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.Menu;
@ -23,7 +12,6 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.webkit.MimeTypeMap;
import android.widget.PopupMenu;
import android.widget.TextView;
@ -31,6 +19,8 @@ import android.widget.Toast;
import com.afollestad.materialcab.MaterialCab;
import com.afollestad.materialdialogs.MaterialDialog;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.snackbar.Snackbar;
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
import java.io.File;
@ -43,16 +33,20 @@ import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import butterknife.BindDrawable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.common.ATHToolbarActivity;
import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R;
@ -63,15 +57,12 @@ import code.name.monkey.retromusic.interfaces.CabHolder;
import code.name.monkey.retromusic.interfaces.LoaderIds;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
import code.name.monkey.retromusic.misc.DialogAsyncTask;
import code.name.monkey.retromusic.misc.NavigationIconClickListener;
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
import code.name.monkey.retromusic.misc.WrappedAsyncTaskLoader;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.ui.activities.MainActivity;
import code.name.monkey.retromusic.ui.adapter.SongFileAdapter;
import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment;
import code.name.monkey.retromusic.util.FileUtil;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
import code.name.monkey.retromusic.util.RetroColorUtil;
import code.name.monkey.retromusic.util.ViewUtil;
@ -116,17 +107,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
@BindView(R.id.recycler_view)
FastScrollRecyclerView recyclerView;
@BindView(R.id.action_folders)
TextView actionFolders;
@BindView(R.id.menu_container)
View menuContainer;
@BindDrawable(R.drawable.ic_menu_white_24dp)
Drawable menu;
@BindDrawable(R.drawable.ic_close_white_24dp)
Drawable close;
private Comparator<File> fileComparator = (lhs, rhs) -> {
if (lhs.isDirectory() && !rhs.isDirectory()) {
@ -201,25 +181,6 @@ public class FoldersFragment extends AbsMainActivityFragment implements
}
}
@OnClick({R.id.action_library, R.id.action_settings, R.id.action_home})
void startUserInfo(View view) {
Activity activity = getActivity();
if (activity != null) {
switch (view.getId()) {
case R.id.action_home:
getMainActivity().setCurrentFragment(MainActivity.HOME);
break;
case R.id.action_library:
getMainActivity().setCurrentFragment(MainActivity.LIBRARY);
break;
case R.id.action_settings:
NavigationUtil.goToSettings(activity);
break;
}
}
}
@Nullable
private BreadCrumbLayout.Crumb getActiveCrumb() {
return breadCrumbs != null && breadCrumbs.size() > 0 ? breadCrumbs
@ -229,12 +190,16 @@ public class FoldersFragment extends AbsMainActivityFragment implements
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelable(CRUMBS, breadCrumbs.getStateWrapper());
if (breadCrumbs != null) {
outState.putParcelable(CRUMBS, breadCrumbs.getStateWrapper());
}
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getMainActivity().setBottomBarVisibility(View.GONE);
if (savedInstanceState == null) {
//noinspection ConstantConditions
setCrumb(new BreadCrumbLayout.Crumb(
@ -255,7 +220,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
setStatusbarColorAuto(view);
getMainActivity().getSlidingUpPanelLayout().setShadowHeight(0);
setUpAppbarColor();
@ -266,12 +231,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
}
private void setUpAppbarColor() {
int accentColor = ThemeStore.accentColor(getContext());
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
actionFolders.setTextColor(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(accentColor)));
actionFolders.setBackgroundResource(R.drawable.et_bg_circular_top_corners);
TintHelper.setTintAuto(actionFolders, ThemeStore.accentColor(getContext()), true);
//noinspection ConstantConditions
int primaryColor = ThemeStore.primaryColor(getContext());
@ -281,14 +241,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
//noinspection ConstantConditions
getActivity().setTitle(null);
getMainActivity().setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(new NavigationIconClickListener(
getContext(),
container,
menuContainer,
new AccelerateDecelerateInterpolator(),
menu,
close
));
toolbar.setNavigationOnClickListener(v -> showMainMenu());
TintHelper.setTintAuto(container, primaryColor, true);
appbar.setBackgroundColor(primaryColor);
toolbar.setBackgroundColor(primaryColor);

View file

@ -2,21 +2,25 @@ package code.name.monkey.retromusic.ui.fragments.mainactivity.home;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Random;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -24,22 +28,18 @@ import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindDrawable;
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.ColorUtil;
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
import code.name.monkey.appthemehelper.util.TintHelper;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.dialogs.HomeOptionDialog;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
import code.name.monkey.retromusic.loaders.SongLoader;
import code.name.monkey.retromusic.misc.NavigationIconClickListener;
import code.name.monkey.retromusic.misc.AppBarStateChangeListener;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.model.Artist;
import code.name.monkey.retromusic.model.Genre;
@ -52,8 +52,6 @@ import code.name.monkey.retromusic.mvp.presenter.HomePresenter;
import code.name.monkey.retromusic.ui.adapter.album.AlbumFullWithAdapter;
import code.name.monkey.retromusic.ui.adapter.artist.ArtistAdapter;
import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment;
import code.name.monkey.retromusic.ui.fragments.mainactivity.LibraryFragment;
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;
@ -63,25 +61,29 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import static code.name.monkey.retromusic.Constants.USER_BANNER;
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
public class BannerHomeFragment extends AbsMainActivityFragment implements MainActivityFragmentCallbacks, HomeContract.HomeView {
private static final String TAG = "HomeFragment";
public static final String TAG = "HomeFragment";
Unbinder unbinder;
@BindView(R.id.toolbar)
@BindView(R.id.home_toolbar)
Toolbar toolbar;
@BindView(R.id.app_bar)
AppBarLayout appbar;
@BindView(R.id.menu_container)
View menuContainer;
@BindView(R.id.image)
ImageView imageView;
@BindView(R.id.user_image)
CircularImageView userImage;
@BindView(R.id.collapsing_toolbar)
CollapsingToolbarLayout toolbarLayout;
@BindView(R.id.recycler_view)
RecyclerView recentArtistRV;
@ -106,31 +108,70 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
@BindView(R.id.top_albums_container)
View topAlbumContainer;
@BindView(R.id.content_container)
View contentContainer;
@BindView(R.id.container)
View container;
@BindView(R.id.title)
TextView title;
@BindView(R.id.action_home)
TextView actionHome;
@BindDrawable(R.drawable.ic_menu_white_24dp)
Drawable menu;
@BindDrawable(R.drawable.ic_close_white_24dp)
Drawable close;
private HomePresenter homePresenter;
private CompositeDisposable disposable;
public static BannerHomeFragment newInstance() {
public static HomeFragment newInstance() {
Bundle args = new Bundle();
BannerHomeFragment fragment = new BannerHomeFragment();
HomeFragment fragment = new HomeFragment();
fragment.setArguments(args);
return fragment;
}
private void getTimeOfTheDay() {
Calendar c = Calendar.getInstance();
int timeOfDay = c.get(Calendar.HOUR_OF_DAY);
String[] images = new String[]{};
if (timeOfDay >= 0 && timeOfDay < 6) {
images = getResources().getStringArray(R.array.night);
} else if (timeOfDay >= 6 && timeOfDay < 12) {
images = getResources().getStringArray(R.array.morning);
} else if (timeOfDay >= 12 && timeOfDay < 16) {
images = getResources().getStringArray(R.array.after_noon);
} else if (timeOfDay >= 16 && timeOfDay < 20) {
images = getResources().getStringArray(R.array.evening);
} else if (timeOfDay >= 20 && timeOfDay < 24) {
images = getResources().getStringArray(R.array.night);
}
String day = images[new Random().nextInt(images.length)];
loadTimeImage(day);
}
private void loadTimeImage(String day) {
//noinspection ConstantConditions
if (PreferenceUtil.getInstance(getActivity()).getBannerImage().isEmpty()) {
if (imageView != null) {
Glide.with(getActivity()).load(day)
.asBitmap()
.placeholder(R.drawable.material_design_default)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(imageView);
}
} else {
loadBannerFromStorage();
}
}
private void loadBannerFromStorage() {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
.setQuality(100)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance(getContext()).getBannerImage(), USER_BANNER))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(imageView::setImageBitmap));
}
private void loadImageFromStorage(ImageView imageView) {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
@ -140,7 +181,7 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance(getContext()).getProfileImage(), USER_PROFILE))
.subscribeOn(Schedulers.computation())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(imageView::setImageBitmap,
throwable -> imageView.setImageDrawable(ContextCompat
@ -159,7 +200,7 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_banner_home, container, false);
View view = inflater.inflate(R.layout.fragment_home, container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
@ -167,38 +208,47 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//setStatusbarColorAuto(view);
getMainActivity().getSlidingUpPanelLayout().setShadowHeight(8);
setupToolbar();
loadImageFromStorage(userImage);
homePresenter.subscribe();
getTimeOfTheDay();
}
@SuppressWarnings("ConstantConditions")
private void setupToolbar() {
//noinspection ConstantConditions
int primaryColor = ThemeStore.primaryColor(getContext());
TintHelper.setTintAuto(contentContainer, primaryColor, true);
appbar.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state) {
int color;
switch (state) {
case COLLAPSED:
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext()));
color = ThemeStore.textColorPrimary(getContext());
break;
default:
case EXPANDED:
case IDLE:
getMainActivity().setLightStatusbar(false);
color = ContextCompat.getColor(getContext(), R.color.md_white_1000);
break;
}
title.setTextColor(color);
toolbar.getNavigationIcon().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
});
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
toolbar.setBackgroundColor(primaryColor);
appbar.setBackgroundColor(primaryColor);
appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
int primaryColor = ThemeStore.primaryColor(getContext());
TintHelper.setTintAuto(container, primaryColor, true);
toolbarLayout.setStatusBarScrimColor(primaryColor);
toolbarLayout.setContentScrimColor(primaryColor);
getActivity().setTitle(null);
getMainActivity().setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(new NavigationIconClickListener(
getContext(),
contentContainer,
menuContainer,
new AccelerateDecelerateInterpolator(),
menu,
close
));
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
actionHome.setTextColor(MaterialValueHelper.getPrimaryTextColor(getContext(), ColorUtil.isColorLight(ThemeStore.accentColor(getContext()))));
actionHome.setBackgroundResource(R.drawable.et_bg_circular_top_corners);
TintHelper.setTintAuto(actionHome, ThemeStore.accentColor(getContext()), true);
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
toolbar.setNavigationOnClickListener(v -> showMainMenu());
}
@Override
@ -234,13 +284,6 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
//homeAdapter.swapDataSet(homes);
}
@Override
public void onMediaStoreChanged() {
super.onMediaStoreChanged();
homePresenter.subscribe();
}
@Override
public void recentArtist(ArrayList<Artist> artists) {
recentArtistContainer.setVisibility(View.VISIBLE);
@ -300,14 +343,13 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
@OnClick({R.id.last_added, R.id.top_played, R.id.action_shuffle, R.id.history,
R.id.user_image, R.id.search, R.id.action_library, R.id.action_folders, R.id.action_settings})
R.id.user_image, R.id.search})
void startUserInfo(View view) {
Activity activity = getActivity();
if (activity != null) {
switch (view.getId()) {
case R.id.action_shuffle:
MusicPlayerRemote
.openAndShuffleQueue(SongLoader.getAllSongs(activity).blockingFirst(), true);
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(activity).blockingFirst(), true);
break;
case R.id.last_added:
NavigationUtil.goToPlaylistNew(activity, new LastAddedPlaylist(activity));
@ -319,16 +361,7 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
NavigationUtil.goToPlaylistNew(activity, new HistoryPlaylist(activity));
break;
case R.id.user_image:
new HomeOptionDialog().show(getFragmentManager(), TAG);
break;
case R.id.action_folders:
getMainActivity().setCurrentFragment(FoldersFragment.newInstance(getContext()), false, TAG);
break;
case R.id.action_library:
getMainActivity().setCurrentFragment(LibraryFragment.newInstance(), false, TAG);
break;
case R.id.action_settings:
NavigationUtil.goToSettings(activity);
NavigationUtil.goToUserInfo(getActivity());
break;
case R.id.search:
NavigationUtil.goToSearch(activity);
@ -337,10 +370,5 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
}
}
@Override
public void onPlayingMetaChanged() {
super.onPlayingMetaChanged();
homePresenter.loadRecentArtists();
homePresenter.loadRecentAlbums();
}
}

View file

@ -1,36 +1,31 @@
package code.name.monkey.retromusic.ui.fragments.mainactivity.home;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Random;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindDrawable;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@ -39,12 +34,9 @@ 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.dialogs.HomeOptionDialog;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
import code.name.monkey.retromusic.loaders.SongLoader;
import code.name.monkey.retromusic.misc.AppBarStateChangeListener;
import code.name.monkey.retromusic.misc.NavigationIconClickListener;
import code.name.monkey.retromusic.model.Album;
import code.name.monkey.retromusic.model.Artist;
import code.name.monkey.retromusic.model.Genre;
@ -54,7 +46,6 @@ import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist;
import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist;
import code.name.monkey.retromusic.mvp.contract.HomeContract;
import code.name.monkey.retromusic.mvp.presenter.HomePresenter;
import code.name.monkey.retromusic.ui.adapter.GenreAdapter;
import code.name.monkey.retromusic.ui.adapter.album.AlbumFullWithAdapter;
import code.name.monkey.retromusic.ui.adapter.artist.ArtistAdapter;
import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment;
@ -67,36 +58,22 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import static code.name.monkey.retromusic.Constants.USER_BANNER;
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
public class HomeFragment extends AbsMainActivityFragment implements MainActivityFragmentCallbacks,
HomeContract.HomeView {
public class HomeFragment extends AbsMainActivityFragment implements MainActivityFragmentCallbacks, HomeContract.HomeView {
public static final String TAG = "HomeFragment";
private final AnimatorSet animatorSet = new AnimatorSet();
Unbinder unbinder;
@BindView(R.id.home_toolbar)
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.menu_container)
View menuContainer;
@BindView(R.id.coordinator_layout)
View coordinatorLayout;
@BindView(R.id.app_bar)
AppBarLayout appbar;
@BindView(R.id.image)
ImageView imageView;
@BindView(R.id.user_image)
CircularImageView userImage;
@BindView(R.id.collapsing_toolbar)
CollapsingToolbarLayout toolbarLayout;
@BindView(R.id.recycler_view)
RecyclerView recentArtistRV;
@ -122,77 +99,21 @@ public class HomeFragment extends AbsMainActivityFragment implements MainActivit
View topAlbumContainer;
@BindView(R.id.content_container)
View contentContainer;
@BindView(R.id.container)
View container;
NestedScrollView contentContainer;
@BindView(R.id.title)
TextView title;
@BindDrawable(R.drawable.ic_menu_white_24dp)
Drawable menu;
@BindDrawable(R.drawable.ic_close_white_24dp)
Drawable close;
private HomePresenter homePresenter;
private CompositeDisposable disposable;
public static HomeFragment newInstance() {
public static BannerHomeFragment newInstance() {
Bundle args = new Bundle();
HomeFragment fragment = new HomeFragment();
BannerHomeFragment fragment = new BannerHomeFragment();
fragment.setArguments(args);
return fragment;
}
private void getTimeOfTheDay() {
Calendar c = Calendar.getInstance();
int timeOfDay = c.get(Calendar.HOUR_OF_DAY);
String[] images = new String[]{};
if (timeOfDay >= 0 && timeOfDay < 6) {
images = getResources().getStringArray(R.array.night);
} else if (timeOfDay >= 6 && timeOfDay < 12) {
images = getResources().getStringArray(R.array.morning);
} else if (timeOfDay >= 12 && timeOfDay < 16) {
images = getResources().getStringArray(R.array.after_noon);
} else if (timeOfDay >= 16 && timeOfDay < 20) {
images = getResources().getStringArray(R.array.evening);
} else if (timeOfDay >= 20 && timeOfDay < 24) {
images = getResources().getStringArray(R.array.night);
}
String day = images[new Random().nextInt(images.length)];
loadTimeImage(day);
}
private void loadTimeImage(String day) {
//noinspection ConstantConditions
if (PreferenceUtil.getInstance(getActivity()).getBannerImage().isEmpty()) {
if (imageView != null) {
Glide.with(getActivity()).load(day)
.asBitmap()
.placeholder(R.drawable.material_design_default)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(imageView);
}
} else {
loadBannerFromStorage();
}
}
private void loadBannerFromStorage() {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
.setQuality(100)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance(getContext()).getBannerImage(), USER_BANNER))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(imageView::setImageBitmap));
}
private void loadImageFromStorage(ImageView imageView) {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
@ -202,7 +123,7 @@ public class HomeFragment extends AbsMainActivityFragment implements MainActivit
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance(getContext()).getProfileImage(), USER_PROFILE))
.subscribeOn(Schedulers.io())
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(imageView::setImageBitmap,
throwable -> imageView.setImageDrawable(ContextCompat
@ -221,7 +142,7 @@ public class HomeFragment extends AbsMainActivityFragment implements MainActivit
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
View view = inflater.inflate(R.layout.fragment_banner_home, container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
@ -229,61 +150,44 @@ public class HomeFragment extends AbsMainActivityFragment implements MainActivit
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getMainActivity().getSlidingUpPanelLayout().setShadowHeight(8);
setStatusbarColorAuto(view);
setupToolbar();
loadImageFromStorage(userImage);
homePresenter.subscribe();
getTimeOfTheDay();
}
@SuppressWarnings("ConstantConditions")
private void setupToolbar() {
/*if (!PreferenceUtil.getInstance(getContext()).getFullScreenMode()) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
params.topMargin = RetroUtil.getStatusBarHeight(getContext());
toolbar.setLayoutParams(params);
}*/
appbar.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout, State state) {
int color;
switch (state) {
case COLLAPSED:
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext()));
color = ThemeStore.textColorPrimary(getContext());
break;
default:
case EXPANDED:
case IDLE:
getMainActivity().setLightStatusbar(false);
color = ContextCompat.getColor(getContext(), R.color.md_white_1000);
break;
}
title.setTextColor(color);
}
});
//noinspection ConstantConditions
int primaryColor = ThemeStore.primaryColor(getContext());
TintHelper.setTintAuto(contentContainer, primaryColor, true);
TintHelper.setTintAuto(container, primaryColor, true);
toolbarLayout.setStatusBarScrimColor(primaryColor);
toolbarLayout.setContentScrimColor(primaryColor);
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
toolbar.setBackgroundColor(primaryColor);
appbar.setBackgroundColor(primaryColor);
appbar.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext())));
getActivity().setTitle(null);
getMainActivity().setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
toolbar.setNavigationOnClickListener(new NavigationIconClickListener(
getContext(),
contentContainer,
menuContainer,
new AccelerateDecelerateInterpolator(),
menu,
close
));
toolbar.setNavigationOnClickListener(v -> showMainMenu());
title.setTextColor(ThemeStore.textColorPrimary(getContext()));
}
private void toggleMenu(boolean backdropShown) {
// Cancel the existing animations
animatorSet.removeAllListeners();
animatorSet.end();
animatorSet.cancel();
final int translateY = 300;
ObjectAnimator animator = ObjectAnimator.ofFloat(contentContainer, "translationY", backdropShown ? translateY : 0);
animator.setDuration(500);
animator.setInterpolator(new AccelerateInterpolator());
animatorSet.play(animator);
animator.start();
}
@Override
@ -319,27 +223,18 @@ public class HomeFragment extends AbsMainActivityFragment implements MainActivit
//homeAdapter.swapDataSet(homes);
}
@Override
public void onMediaStoreChanged() {
super.onMediaStoreChanged();
homePresenter.subscribe();
}
@Override
public void recentArtist(ArrayList<Artist> artists) {
recentArtistContainer.setVisibility(View.VISIBLE);
recentArtistRV.setLayoutManager(new GridLayoutManager(getMainActivity(),
1, GridLayoutManager.HORIZONTAL, false));
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists,
R.layout.item_artist, false, null);
recentArtistRV.setLayoutManager(new GridLayoutManager(getMainActivity(), 1, GridLayoutManager.HORIZONTAL, false));
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists, R.layout.item_artist, false, null);
recentArtistRV.setAdapter(artistAdapter);
}
@Override
public void recentAlbum(ArrayList<Album> albums) {
recentAlbumsContainer.setVisibility(View.VISIBLE);
AlbumFullWithAdapter artistAdapter = new AlbumFullWithAdapter(getMainActivity(),
getDisplayMetrics());
AlbumFullWithAdapter artistAdapter = new AlbumFullWithAdapter(getMainActivity(), getDisplayMetrics());
artistAdapter.swapData(albums);
recentAlbumRV.setAdapter(artistAdapter);
}
@ -347,10 +242,8 @@ public class HomeFragment extends AbsMainActivityFragment implements MainActivit
@Override
public void topArtists(ArrayList<Artist> artists) {
topArtistContainer.setVisibility(View.VISIBLE);
topArtistRV.setLayoutManager(new GridLayoutManager(getMainActivity(),
1, GridLayoutManager.HORIZONTAL, false));
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists,
R.layout.item_artist, false, null);
topArtistRV.setLayoutManager(new GridLayoutManager(getMainActivity(), 1, GridLayoutManager.HORIZONTAL, false));
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists, R.layout.item_artist, false, null);
topArtistRV.setAdapter(artistAdapter);
}
@ -358,8 +251,7 @@ public class HomeFragment extends AbsMainActivityFragment implements MainActivit
@Override
public void topAlbums(ArrayList<Album> albums) {
topAlbumContainer.setVisibility(View.VISIBLE);
AlbumFullWithAdapter artistAdapter = new AlbumFullWithAdapter(getMainActivity(),
getDisplayMetrics());
AlbumFullWithAdapter artistAdapter = new AlbumFullWithAdapter(getMainActivity(), getDisplayMetrics());
artistAdapter.swapData(albums);
topAlbumRV.setAdapter(artistAdapter);
}
@ -383,363 +275,7 @@ public class HomeFragment extends AbsMainActivityFragment implements MainActivit
}
@OnClick({R.id.last_added, R.id.top_played, R.id.action_shuffle, R.id.history,
R.id.user_image})
void startUserInfo(View view) {
Activity activity = getActivity();
if (activity != null) {
switch (view.getId()) {
case R.id.action_shuffle:
MusicPlayerRemote.openAndShuffleQueue(SongLoader.getAllSongs(activity).blockingFirst(), true);
break;
case R.id.last_added:
NavigationUtil.goToPlaylistNew(activity, new LastAddedPlaylist(activity));
break;
case R.id.top_played:
NavigationUtil.goToPlaylistNew(activity, new MyTopTracksPlaylist(activity));
break;
case R.id.history:
NavigationUtil.goToPlaylistNew(activity, new HistoryPlaylist(activity));
break;
case R.id.user_image:
new HomeOptionDialog().show(getFragmentManager(), TAG);
break;
}
}
}
@Override
public void onPlayingMetaChanged() {
super.onPlayingMetaChanged();
homePresenter.loadRecentArtists();
homePresenter.loadRecentAlbums();
}
}
/*
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Random;
import butterknife.BindView;
import butterknife.BindViews;
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.dialogs.HomeOptionDialog;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
import code.name.monkey.retromusic.loaders.SongLoader;
import code.name.monkey.retromusic.misc.AppBarStateChangeListener;
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.Home;
import code.name.monkey.retromusic.model.Song;
import code.name.monkey.retromusic.model.smartplaylist.HistoryPlaylist;
import code.name.monkey.retromusic.model.smartplaylist.LastAddedPlaylist;
import code.name.monkey.retromusic.model.smartplaylist.MyTopTracksPlaylist;
import code.name.monkey.retromusic.mvp.contract.HomeContract;
import code.name.monkey.retromusic.mvp.presenter.HomePresenter;
import code.name.monkey.retromusic.ui.adapter.CollageSongAdapter;
import code.name.monkey.retromusic.ui.adapter.GenreAdapter;
import code.name.monkey.retromusic.ui.adapter.album.AlbumFullWithAdapter;
import code.name.monkey.retromusic.ui.adapter.artist.ArtistAdapter;
import code.name.monkey.retromusic.ui.adapter.home.HomeAdapter;
import code.name.monkey.retromusic.ui.fragments.base.AbsMainActivityFragment;
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.util.RetroUtil;
import code.name.monkey.retromusic.views.CircularImageView;
import code.name.monkey.retromusic.views.MetalRecyclerViewPager;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import static code.name.monkey.retromusic.Constants.USER_BANNER;
import static code.name.monkey.retromusic.Constants.USER_PROFILE;
public class HomeFragment extends AbsMainActivityFragment implements MainActivityFragmentCallbacks,
HomeContract.HomeView {
public static final String TAG = "HomeFragment";
Unbinder unbinder;
@BindView(R.id.home_toolbar)
Toolbar toolbar;
@BindView(R.id.appbar)
AppBarLayout appbar;
@BindView(R.id.image)
ImageView imageView;
@BindView(R.id.user_image)
CircularImageView userImage;
@BindView(R.id.collapsing_toolbar)
CollapsingToolbarLayout toolbarLayout;
@BindView(R.id.container)
View container;
@BindView(R.id.title)
TextView title;
@BindView(R.id.search)
ImageView search;
@BindViews({R.id.recent_artist_container, R.id.recent_albums_container,
R.id.top_artist_container, R.id.top_albums_container,
R.id.genre_container})
List<View> sectionContainers;
@BindViews({R.id.recent_artist_recycler_view, R.id.top_artist_recycler_view,
R.id.genres_recycler_view})
List<RecyclerView> sectionRecyclerViews;
@BindViews({R.id.recent_albums_recycler_view, R.id.top_album_recycler_view})
List<MetalRecyclerViewPager> metalRecyclerViewPagers;
private HomePresenter homePresenter;
private CompositeDisposable disposable;
public static HomeFragment newInstance() {
Bundle args = new Bundle();
HomeFragment fragment = new HomeFragment();
fragment.setArguments(args);
return fragment;
}
private void getTimeOfTheDay() {
Calendar c = Calendar.getInstance();
int timeOfDay = c.get(Calendar.HOUR_OF_DAY);
String[] images = new String[]{};
if (timeOfDay >= 0 && timeOfDay < 6) {
images = getResources().getStringArray(R.array.night);
} else if (timeOfDay >= 6 && timeOfDay < 12) {
images = getResources().getStringArray(R.array.morning);
} else if (timeOfDay >= 12 && timeOfDay < 16) {
images = getResources().getStringArray(R.array.after_noon);
} else if (timeOfDay >= 16 && timeOfDay < 20) {
images = getResources().getStringArray(R.array.evening);
} else if (timeOfDay >= 20 && timeOfDay < 24) {
images = getResources().getStringArray(R.array.night);
}
String day = images[new Random().nextInt(images.length)];
loadTimeImage(day);
}
private void loadTimeImage(String day) {
//noinspection ConstantConditions
if (PreferenceUtil.getInstance(getActivity()).getBannerImage().isEmpty()) {
if (imageView != null) {
Glide.with(getActivity()).load(day)
.asBitmap()
.placeholder(R.drawable.material_design_default)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(imageView);
}
} else {
loadBannerFromStorage();
}
}
private void loadBannerFromStorage() {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
.setQuality(100)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance(getContext()).getBannerImage(), USER_BANNER))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(imageView::setImageBitmap));
}
private void loadImageFromStorage(ImageView imageView) {
//noinspection ConstantConditions
disposable.add(new Compressor(getContext())
.setMaxHeight(300)
.setMaxWidth(300)
.setQuality(75)
.setCompressFormat(Bitmap.CompressFormat.WEBP)
.compressToBitmapAsFlowable(
new File(PreferenceUtil.getInstance(getContext()).getProfileImage(), USER_PROFILE))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(imageView::setImageBitmap,
throwable -> imageView.setImageDrawable(ContextCompat
.getDrawable(getContext(), R.drawable.ic_person_flat))));
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
disposable = new CompositeDisposable();
homePresenter = new HomePresenter(this);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
unbinder = ButterKnife.bind(this, view);
setRetainInstance(true);
return view;
}
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getMainActivity().getSlidingUpPanelLayout().setShadowHeight(8);
getMainActivity().setBottomBarVisibility(View.VISIBLE);
setupToolbar();
loadImageFromStorage(userImage);
homePresenter.subscribe();
checkPadding();
getTimeOfTheDay();
}
@SuppressWarnings("ConstantConditions")
private void setupToolbar() {
if (!PreferenceUtil.getInstance(getContext()).getFullScreenMode()) {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) toolbar
.getLayoutParams();
params.topMargin = RetroUtil.getStatusBarHeight(getContext());
toolbar.setLayoutParams(params);
}
appbar.addOnOffsetChangedListener(new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout, State state) {
int color;
switch (state) {
case COLLAPSED:
getMainActivity().setLightStatusbar(!ATHUtil.isWindowBackgroundDark(getContext()));
color = ThemeStore.textColorPrimary(getContext());
break;
default:
case EXPANDED:
case IDLE:
getMainActivity().setLightStatusbar(false);
color = Color.WHITE;
break;
}
TintHelper.setTintAuto(search, color, false);
title.setTextColor(color);
}
});
int primaryColor = ThemeStore.primaryColor(getContext());
TintHelper.setTintAuto(container, primaryColor, true);
toolbarLayout.setStatusBarScrimColor(primaryColor);
toolbarLayout.setContentScrimColor(primaryColor);
toolbar.setTitle(R.string.home);
getMainActivity().setSupportActionBar(toolbar);
}
@Override
public boolean handleBackPress() {
return false;
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
disposable.clear();
homePresenter.unsubscribe();
}
@Override
public void loading() {
}
@Override
public void showEmptyView() {
}
@Override
public void completed() {
}
@Override
public void showData(ArrayList<Home> homes) {
HomeAdapter homeAdapter = new HomeAdapter(getMainActivity());
homeAdapter.swapData(homes);
}
@Override
public void onServiceConnected() {
super.onServiceConnected();
checkPadding();
}
@Override
public void onQueueChanged() {
super.onQueueChanged();
checkPadding();
}
private void checkPadding() {
int height = getResources().getDimensionPixelSize(R.dimen.mini_player_height);
container.setPadding(0, 0, 0, MusicPlayerRemote.getPlayingQueue().isEmpty() ? height * 2 : 0);
}
private DisplayMetrics getDisplayMetrics() {
Display display = getMainActivity().getWindowManager().getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
return metrics;
}
@OnClick({R.id.last_added, R.id.top_played, R.id.action_shuffle,
R.id.history, R.id.user_image, R.id.search})
@OnClick({R.id.last_added, R.id.top_played, R.id.action_shuffle, R.id.history, R.id.user_image, R.id.search})
void startUserInfo(View view) {
Activity activity = getActivity();
if (activity != null) {
@ -757,71 +293,14 @@ public class HomeFragment extends AbsMainActivityFragment implements MainActivit
case R.id.history:
NavigationUtil.goToPlaylistNew(activity, new HistoryPlaylist(activity));
break;
case R.id.user_image:
NavigationUtil.goToUserInfo(getActivity());
break;
case R.id.search:
NavigationUtil.goToSearch(activity);
break;
case R.id.user_image:
//noinspection ConstantConditions
new HomeOptionDialog().show(getFragmentManager(), TAG);
break;
}
}
}
@Override
public void showRecentAlbums(ArrayList<Album> albums) {
sectionContainers.get(1).setVisibility(View.VISIBLE);
AlbumFullWithAdapter albumFullWithAdapter = new AlbumFullWithAdapter(getMainActivity(),
getDisplayMetrics());
albumFullWithAdapter.swapData(albums);
MetalRecyclerViewPager recyclerView = metalRecyclerViewPagers.get(0);
recyclerView.setAdapter(albumFullWithAdapter);
}
@Override
public void showTopAlbums(ArrayList<Album> albums) {
sectionContainers.get(3).setVisibility(View.VISIBLE);
AlbumFullWithAdapter albumFullWithAdapter = new AlbumFullWithAdapter(getMainActivity(),
getDisplayMetrics());
albumFullWithAdapter.swapData(albums);
MetalRecyclerViewPager recyclerView = metalRecyclerViewPagers.get(1);
recyclerView.setAdapter(albumFullWithAdapter);
}
@Override
public void showRecentArtist(ArrayList<Artist> artists) {
sectionContainers.get(0).setVisibility(View.VISIBLE);
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 1,
GridLayoutManager.HORIZONTAL, false);
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists, R.layout.item_artist);
RecyclerView recyclerView = sectionRecyclerViews.get(0);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(artistAdapter);
}
@Override
public void showTopArtist(ArrayList<Artist> artists) {
sectionContainers.get(2).setVisibility(View.VISIBLE);
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 1,
GridLayoutManager.HORIZONTAL, false);
ArtistAdapter artistAdapter = new ArtistAdapter(getMainActivity(), artists, R.layout.item_artist);
RecyclerView recyclerView = sectionRecyclerViews.get(1);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(artistAdapter);
}
@Override
public void showGenres(ArrayList<Genre> genres) {
sectionContainers.get(4).setVisibility(View.VISIBLE);
RecyclerView recyclerView = sectionRecyclerViews.get(2);
recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(new GenreAdapter(getMainActivity(), genres, R.layout.item_list));
}
}*/
}

View file

@ -9,11 +9,6 @@ import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.palette.graphics.Palette;
import androidx.appcompat.widget.Toolbar;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
@ -24,6 +19,11 @@ import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.animation.GlideAnimation;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.palette.graphics.Palette;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

View file

@ -3,10 +3,6 @@ package code.name.monkey.retromusic.ui.fragments.player.material;
import android.animation.ObjectAnimator;
import android.graphics.PorterDuff;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatSeekBar;
import androidx.appcompat.widget.AppCompatTextView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -15,6 +11,10 @@ import android.widget.ImageButton;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatSeekBar;
import androidx.appcompat.widget.AppCompatTextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
@ -39,26 +39,37 @@ public class MaterialControlsFragment extends AbsPlayerControlsFragment {
@BindView(R.id.player_play_pause_button)
ImageButton playPauseFab;
@BindView(R.id.player_prev_button)
ImageButton prevButton;
@BindView(R.id.player_next_button)
ImageButton nextButton;
@BindView(R.id.player_repeat_button)
ImageButton repeatButton;
@BindView(R.id.player_shuffle_button)
ImageButton shuffleButton;
@BindView(R.id.player_progress_slider)
AppCompatSeekBar progressSlider;
@BindView(R.id.player_song_total_time)
TextView songTotalTime;
@BindView(R.id.player_song_current_progress)
TextView songCurrentProgress;
@BindView(R.id.title)
AppCompatTextView title;
@BindView(R.id.text)
TextView text;
@BindView(R.id.volume_fragment_container)
View mVolumeContainer;
private Unbinder unbinder;
private int lastPlaybackControlsColor;
private int lastDisabledPlaybackControlsColor;
@ -160,6 +171,7 @@ public class MaterialControlsFragment extends AbsPlayerControlsFragment {
if (PreferenceUtil.getInstance(getContext()).getAdaptiveColor()) {
lastPlaybackControlsColor = dark;
text.setTextColor(dark);
}
updatePlayPauseColor();

View file

@ -4,14 +4,15 @@ import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.media.audiofx.AudioEffect;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.util.Pair;
import android.widget.Toast;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.cast.ExpandedCastControlsActivity;
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
import code.name.monkey.retromusic.model.Genre;
import code.name.monkey.retromusic.model.Playlist;
@ -134,4 +135,8 @@ public class NavigationUtil {
public static void goToPlayStore(Activity activity) {
openUrl(activity, RATE_ON_GOOGLE_PLAY);
}
public static void gotoExpandedController(Activity activity) {
ActivityCompat.startActivity(activity, new Intent(activity, ExpandedCastControlsActivity.class), null);
}
}

View file

@ -276,7 +276,7 @@ public final class PreferenceUtil {
public final int getLastPage() {
return mPreferences.getInt(LAST_PAGE, 0);
return mPreferences.getInt(LAST_PAGE, R.id.action_home);
}
public void setLastPage(final int value) {

View file

@ -0,0 +1,61 @@
package code.name.monkey.retromusic.views;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import code.name.monkey.retromusic.R;
import static code.name.monkey.retromusic.util.RetroUtil.openUrl;
public class ContributorsView extends FrameLayout {
public ContributorsView(@NonNull Context context) {
super(context);
init(context, null);
}
public ContributorsView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public ContributorsView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attributeSet) {
final TypedArray attributes = context.obtainStyledAttributes(attributeSet, R.styleable.ContributorsView, 0, 0);
if (attributes != null) {
final View layout = LayoutInflater.from(context).inflate(R.layout.item_contributor, this);
NetworkImageView networkImageView = layout.findViewById(R.id.image);
String url = attributes.getString(R.styleable.ContributorsView_profile_url);
networkImageView.setImageUrl(url);
String name = attributes.getString(R.styleable.ContributorsView_profile_name);
TextView title = layout.findViewById(R.id.title);
title.setText(name);
String summary = attributes.getString(R.styleable.ContributorsView_profile_summary);
TextView text = layout.findViewById(R.id.text);
text.setText(summary);
String link = attributes.getString(R.styleable.ContributorsView_profile_link);
layout.setOnClickListener(v -> {
if (link == null) {
return;
}
openUrl((Activity) getContext(), link);
});
attributes.recycle();
}
}
}

View file

@ -28,14 +28,21 @@ public class NetworkImageView extends CircularImageView {
init(context, attrs);
}
private void init(Context context, AttributeSet attributeSet) {
TypedArray attributes = context
.obtainStyledAttributes(attributeSet, R.styleable.NetworkImageView, 0, 0);
String url = attributes.getString(R.styleable.NetworkImageView_url_link);
Glide.with(context).load(url).asBitmap()
public void setImageUrl(String imageUrl) {
setImageUrl(getContext(), imageUrl);
}
public void setImageUrl(Context context, String imageUrl) {
Glide.with(context).load(imageUrl).asBitmap()
.error(R.drawable.ic_person_flat)
.placeholder(R.drawable.ic_person_flat)
.into(this);
}
private void init(Context context, AttributeSet attributeSet) {
TypedArray attributes = context.obtainStyledAttributes(attributeSet, R.styleable.NetworkImageView, 0, 0);
String url = attributes.getString(R.styleable.NetworkImageView_url_link);
setImageUrl(context, url);
attributes.recycle();
}
}

View file

@ -3,11 +3,15 @@ package code.name.monkey.retromusic.views;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.os.Bundle;
import android.view.ViewGroup;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.retromusic.R;

View file

@ -2,10 +2,13 @@ package code.name.monkey.retromusic.views;
import android.content.Context;
import android.graphics.Canvas;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.view.Gravity;
public class VerticalTextView extends androidx.appcompat.widget.AppCompatTextView {
import androidx.appcompat.widget.AppCompatTextView;
public class VerticalTextView extends AppCompatTextView {
final boolean topDown;
public VerticalTextView(Context context, AttributeSet attrs) {
@ -25,20 +28,25 @@ public class VerticalTextView extends androidx.appcompat.widget.AppCompatTextVie
}
@Override
protected boolean setFrame(int l, int t, int r, int b) {
return super.setFrame(l, t, l + (b - t), t + (r - l));
}
protected void onDraw(Canvas canvas) {
TextPaint textPaint = getPaint();
textPaint.setColor(getCurrentTextColor());
textPaint.drawableState = getDrawableState();
canvas.save();
@Override
public void draw(Canvas canvas) {
if (topDown) {
canvas.translate(getHeight(), 0);
canvas.translate(getWidth(), 0);
canvas.rotate(90);
} else {
canvas.translate(0, getWidth());
canvas.translate(0, getHeight());
canvas.rotate(-90);
}
canvas.clipRect(0, 0, getWidth(), getHeight(), android.graphics.Region.Op.REPLACE);
super.draw(canvas);
canvas.translate(getCompoundPaddingLeft(), getExtendedPaddingTop());
getLayout().draw(canvas);
canvas.restore();
}
}

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/bounce_interpolator">
<!-- Use your working translate animation here-->
<translate
android:duration="300"
android:fromXDelta="100%p"
android:toXDelta="0%p" />
</set>

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<gridLayoutAnimation
xmlns:android="http://schemas.android.com/apk/res/android"
android:animation="@anim/item_animation_slide_from_bottom"
android:animationOrder="normal"
android:columnDelay="15%"
android:rowDelay="15%"
android:direction="top_to_bottom|left_to_right"
/>

View file

@ -1,7 +0,0 @@
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/anim_duration_medium">
<alpha
android:fromAlpha="0"
android:interpolator="@android:anim/decelerate_interpolator"
android:toAlpha="1" />
</set>

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/anim_duration_long">
<translate
android:interpolator="@android:anim/decelerate_interpolator"
android:fromXDelta="100%p"
android:toXDelta="0"
/>
<alpha
android:fromAlpha="0.5"
android:toAlpha="1"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
/>
</set>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation android:delay="15%" android:animation="@anim/item_animation_fade" android:animationOrder="normal" xmlns:android="http://schemas.android.com/apk/res/android">
</layoutAnimation>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:animation="@anim/item_animation_from_right"
android:animationOrder="normal"
android:delay="10%" />

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="PrivateResource">
<item>
<objectAnimator
android:propertyName="elevation"
android:valueTo="@dimen/design_appbar_elevation"
android:valueType="floatType" />
</item>
</selector>

View file

@ -1,24 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="85.03937"
android:viewportHeight="85.03937">
<group android:translateX="-11.480315"
android:translateY="-11.480315">
<path
android:pathData="M0,0h108v108h-108z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="0"
android:endY="108"
android:startX="0"
android:endX="108"
android:type="linear">
<item android:offset="0" android:color="#FFA951CD"/>
<item android:offset="1" android:color="#FF5757ED"/>
</gradient>
</aapt:attr>
</path>
</group>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/md_orange_A400" />
</shape>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="@android:color/transparent"
android:startColor="#80000000"/>
</shape>

View file

@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="8dp" /> <padding android:bottom="12dp" android:left="12dp" android:right="12dp" android:top="12dp" /> <solid android:color="@color/md_blue_A200" /> </shape>
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="8dp" /> <solid android:color="#80448AFF" /> </shape>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="#FD6A83"
android:startColor="#FFA26E"/>
</shape>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="135"
android:endColor="#b224ef"
android:startColor="#7579ff"/>
</shape>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="135"
android:endColor="@color/md_cyan_500"
android:startColor="@color/md_light_blue_500" />
</shape>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:endColor="@color/md_red_A700"
android:startColor="@color/md_red_A100" />
</shape>

View file

@ -1,9 +0,0 @@
<vector android:height="24dp" android:viewportHeight="108"
android:viewportWidth="108" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="0.1" android:fillColor="#FF000000"
android:pathData="M42,69.53 L90,108h18V68.55L66,36c-2.58,0.91 -6,2.6 -8,5.92C54.8,47.18 57.91,52 56,57.7 54.84,61.14 51.65,65.74 42,69.53Z" android:strokeAlpha="0.1"/>
<path android:fillColor="#fff" android:pathData="M53.91,39.64h0V58.38c-0.32,-0.18 -0.66,-0.33 -1,-0.48A9,9 0,0 1,57.05 70a10.88,10.88 0,0 0,1.43 -4.39V45H53.91Z"/>
<path android:fillColor="#fff" android:pathData="M52.91,57.9A9,9 0,1 0,58 66,9 9,0 0,0 52.91,57.9Z"/>
<path android:fillColor="#fff" android:pathData="M54.16,36.35h12.19v8.43h-12.19z"/>
<path android:fillColor="#fff" android:pathData="M66.1,36.6v7.93H54.41V36.6H66.1m0.5,-0.5H53.91V45H66.6V36.1Z"/>
</vector>

View file

@ -1,16 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="256dp"
android:height="256dp"
android:viewportWidth="256"
android:viewportHeight="256">
<path
android:pathData="m0,0 l0,256 256,0 0,-256 -256,0zM128,64 L176,64 176,80 144,80 144,160a32,32 0,0 1,-32 32,32 32,0 0,1 -32,-32 32,32 0,0 1,32 -32,32 32,0 0,1 16,4.313l0,-52.313 0,-16z"
android:strokeAlpha="1"
android:strokeLineJoin="round"
android:strokeWidth="4"
android:fillColor="#ffffff"
android:strokeColor="#00000000"
android:fillType="evenOdd"
android:fillAlpha="1"
android:strokeLineCap="round"/>
</vector>

View file

@ -1,8 +0,0 @@
<!-- drawable/facebook.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M17,2V2H17V6H15C14.31,6 14,6.81 14,7.5V10H14L17,10V14H14V22H10V14H7V10H10V6A4,4 0 0,1 14,2H17Z" />
</vector>

View file

@ -1,10 +0,0 @@
<!-- drawable/ic_google_pluslus.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M23,11H21V9H19V11H17V13H19V15H21V13H23M8,11V13.4H12C11.8,14.4 10.8,16.4 8,16.4C5.6,16.4 3.7,14.4 3.7,12C3.7,9.6 5.6,7.6 8,7.6C9.4,7.6 10.3,8.2 10.8,8.7L12.7,6.9C11.5,5.7 9.9,5 8,5C4.1,5 1,8.1 1,12C1,15.9 4.1,19 8,19C12,19 14.7,16.2 14.7,12.2C14.7,11.7 14.7,11.4 14.6,11H8Z" />
</vector>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="135"
android:centerColor="#6945FF"
android:endColor="#EC3C59"
android:startColor="#3393FA"/>
</shape>

View file

@ -1,17 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="135"
android:viewportHeight="135">
<group android:translateX="13.5"
android:translateY="13.5">
<path
android:fillColor="#FF000000"
android:pathData="M44,72l35,36h29V73.8L68,34c-2.74,0.28 -6.49,1.13 -9,4 -3.53,4 -2.09,9.18 -3,15C55.23,57.9 52.58,64.62 44,72Z"
android:strokeAlpha="0.1"
android:fillAlpha="0.1"/>
<path
android:pathData="M52.9,34.2V54.57A10.32,10.32 0,0 0,49.6 54a9.9,9.9 0,1 0,9.9 9.9V40.8h8.8V34.2Z"
android:fillColor="#fff"/>
</group>
</vector>

View file

@ -1,8 +0,0 @@
<!-- drawable/patreon.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M14.73,3C18.45,3 21.47,6.03 21.47,9.76C21.47,13.47 18.45,16.5 14.73,16.5C11,16.5 7.97,13.47 7.97,9.76C7.97,6.03 11,3 14.73,3M2.7,21V3H6V21H2.7Z" />
</vector>

View file

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/md_white_1000"
android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4S8,5.79 8,8S9.79,12 12,12zM12,14c-2.67,0 -8,1.34 -8,4v1c0,0.55 0.45,1 1,1h14c0.55,0 1,-0.45 1,-1v-1C20,15.34 14.67,14 12,14z"/>
</vector>

View file

@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/md_white_1000"
android:pathData="M3,8c0,0.55 0.45,1 1,1s1,-0.45 1,-1V6h2c0.55,0 1,-0.45 1,-1c0,-0.55 -0.45,-1 -1,-1H5V2c0,-0.55 -0.45,-1 -1,-1S3,1.45 3,2v2H1C0.45,4 0,4.45 0,5c0,0.55 0.45,1 1,1h2V8z" />
<path
android:fillColor="@color/md_white_1000"
android:pathData="M13,14m-3,0a3,3 0,1 1,6 0a3,3 0,1 1,-6 0" />
<path
android:fillColor="@color/md_white_1000"
android:pathData="M21,6h-3.17l-1.24,-1.35C16.22,4.24 15.68,4 15.12,4h-6.4C8.89,4.3 9,4.63 9,5c0,1.1 -0.9,2 -2,2H6v1c0,1.1 -0.9,2 -2,2c-0.37,0 -0.7,-0.11 -1,-0.28V20c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8C23,6.9 22.1,6 21,6zM13,19c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5s5,2.24 5,5S15.76,19 13,19z" />
</vector>

View file

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M2,2H8V4H16V2H22V8H20V16H22V22H16V20H8V22H2V16H4V8H2V2M16,8V6H8V8H6V16H8V18H16V16H18V8H16M4,4V6H6V4H4M18,4V6H20V4H18M4,18V20H6V18H4M18,18V20H20V18H18Z"/>
</vector>

View file

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="511.936"
android:viewportWidth="511.936">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M350.7,169.8c-0.8,-2 -2,-3.7 -3.5,-5.2c-0,-0 -0,-0.1 -0,-0.1c-23.5,-23 -38.8,-53.6 -43.2,-86.2V16c0,-8.8 -7.2,-16 -16,-16h-64c-8.8,0 -16,7.2 -16,16v62.4c-4.4,32.6 -19.7,63.1 -43.2,86.1c0,0 0,0 -0,0.1c-1.5,1.4 -2.7,3.2 -3.5,5.2c-0.8,1.9 -1.2,4 -1.2,6.1c0,0 0,0.1 0,0.1v128c0,0.3 0.1,0.4 0.1,0.7c0,1 0.4,2 0.6,3c0.3,1.1 0.5,2.2 1,3.2c0.1,0.2 0.1,0.4 0.2,0.6c18.7,35.4 18.7,77.6 0,113c-1.2,2.3 -1.9,4.9 -1.9,7.5v48c0,17.7 14.3,32 32,32h128c17.7,0 32,-14.3 32,-32v-48c0,-2.6 -0.6,-5.2 -1.9,-7.5c-18.7,-35.4 -18.7,-77.6 0,-113c0.1,-0.2 0.1,-0.4 0.2,-0.6c0.5,-1 0.7,-2.1 0.9,-3.2c0.3,-1 0.6,-2 0.6,-3c0,-0.3 0.2,-0.4 0.2,-0.7v-128c0,-0 0,-0.1 0,-0.1C351.9,173.8 351.6,171.7 350.7,169.8zM240,32h32v32h-32V32zM236.8,96h38.3c4.9,22.9 14,44.7 27.2,64h-92.7C222.8,140.6 231.9,118.9 236.8,96zM320,479.9h-128v-44.1c18,-36.3 20.5,-77.9 7.9,-115.8h112.2c-12.6,37.9 -10.1,79.5 7.9,115.8V479.9zM320,288h-128v-96h128V288z" />
</vector>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="150dp" />
<gradient
android:angle="135"
android:endColor="@color/md_blue_A200"
android:startColor="@color/md_green_A700" />
</shape>

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<padding
android:bottom="8dp"
android:left="8dp"
android:right="8dp"
android:top="8dp"/>
<gradient
android:angle="135"
android:endColor="@color/md_light_blue_A200"
android:startColor="@color/md_blue_A700"/>
</shape>
</item>
<item android:drawable="@drawable/ic_vector_square">
</item>
</layer-list>

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