Merge remote-tracking branch 'origin/kotlin' into kotlin
# Conflicts: # app/app.iml # app/build.gradle # app/src/main/java/code/name/monkey/retromusic/ui/activities/base/AbsBaseActivity.java
This commit is contained in:
commit
8bd8d7d6ae
22 changed files with 2683 additions and 8864 deletions
134
app/app.iml
134
app/app.iml
|
@ -35,16 +35,10 @@
|
|||
<option name="languageVersion" value="1.3" />
|
||||
<option name="apiVersion" value="1.3" />
|
||||
<option name="pluginOptions">
|
||||
<array>
|
||||
<option value="plugin:org.jetbrains.kotlin.android:experimental=false" />
|
||||
<option value="plugin:org.jetbrains.kotlin.android:enabled=true" />
|
||||
<option value="plugin:org.jetbrains.kotlin.android:defaultCacheImplementation=hashMap" />
|
||||
</array>
|
||||
<array />
|
||||
</option>
|
||||
<option name="pluginClasspaths">
|
||||
<array>
|
||||
<option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-android-extensions/1.3.10/b714dd6deb5282a6545e4183d9270860a171f08e/kotlin-android-extensions-1.3.10.jar" />
|
||||
</array>
|
||||
<array />
|
||||
</option>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
|
@ -56,6 +50,7 @@
|
|||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/normal/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources/normalDebug/processNormalDebugResources/r" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/normal/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/normal/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/normal/debug" isTestSource="false" generated="true" />
|
||||
|
@ -69,6 +64,7 @@
|
|||
<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/source/aidl/androidTest/normal/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/normal/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/normal/debug" isTestSource="true" generated="true" />
|
||||
|
@ -152,13 +148,10 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/generated/not_namespaced_r_class_sources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/generated/source/r" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotation_processor_list" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/apk_list" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/build-info" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-libraries" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/checkNormalDebugClasspath" />
|
||||
|
@ -173,6 +166,7 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant_run_split_apk_resources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint_jar" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifest-checker" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_manifests" />
|
||||
|
@ -195,87 +189,87 @@
|
|||
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:okhttp3-integration:1.5.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.material:material:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.3.10@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.documentfile:documentfile:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-preference-v14:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.ksoichiro:android-observablescrollview:1.6.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.multidex:multidex:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.cardview:cardview:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.recyclerview:recyclerview:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks-16.0.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:retrofit:2.4.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-cast:16.1.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: uk.co.chrisjenx:calligraphy:2.3.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.gridlayout:gridlayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:1.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-flags-16.0.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.cardview:cardview-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.hannesa2:AndroidSlidingUpPanel-3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.afollestad:material-cab-0.1.12" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat-1.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.material:material-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement-16.0.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.h6ah4i.android.widget.advrecyclerview:advrecyclerview-0.11.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.fragment:fragment-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-annotations:9.0.0-rc1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains:annotations:13.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base-16.0.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.kabouzeid:RecyclerView-FastScroll-1.0.16-kmod" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okio:okio:1.14.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.documentfile:documentfile-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.ksoichiro:android-observablescrollview-1.6.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.10@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.slidingpanelayout:slidingpanelayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-flags:16.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.media:media:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.hannesa2:AndroidSlidingUpPanel:3.5.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-cast-16.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.recyclerview:recyclerview-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:logging-interceptor:3.11.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.mediarouter:mediarouter:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.coordinatorlayout:coordinatorlayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.afollestad.material-dialogs:core-0.9.6.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-1.0.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:adapter-rxjava2:2.4.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.anjlab.android.iab.v3:library:1.0.44@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: uk.co.chrisjenx:calligraphy-2.3.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:converter-gson:2.4.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.kabouzeid:RecyclerView-FastScroll:1.0.16-kmod@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v13:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v4:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.afollestad.material-dialogs:core:0.9.6.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife:9.0.0-rc1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-cast-framework:16.1.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v4-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-runtime-9.0.0-rc1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.palette:palette-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.asynclayoutinflater:asynclayoutinflater-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: __local_aars__:/Users/hemanths/Desktop/KeepSafe/RetroMusicPlayer/app/libs/juniversalchardet-1.0.3.jar:unspecified@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.swiperefreshlayout:swiperefreshlayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: io.reactivex.rxjava2:rxjava:2.1.17@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.loader:loader:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: io.reactivex.rxjava2:rxandroid:2.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.gridlayout:gridlayout-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.multidex:multidex-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-9.0.0-rc1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:okhttp:3.11.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.r0adkll:slidableactivity:2.0.6@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.media:media-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.r0adkll:slidableactivity-2.0.6" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.core:core-1.0.1" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.reactivestreams:reactive-streams:1.0.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.AdrienPoupa:jaudiotagger:2.2.3@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: me.zhanghai.android.materialprogressbar:library-1.4.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:glide:3.8.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.nanohttpd:nanohttpd:2.3.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.afollestad:material-cab:0.1.12@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.mediarouter:mediarouter-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.transition:transition-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-utils:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.print:print:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: me.zhanghai.android.materialprogressbar:library:1.4.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.afollestad.material-dialogs:commons-0.9.6.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-preference-v14-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.10@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-v13-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base:16.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.transition:transition:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-runtime:9.0.0-rc1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-cast-framework-16.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: io.reactivex.rxjava2:rxandroid-2.0.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime-2.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.preference:preference-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.AdrienPoupa:jaudiotagger-2.2.3" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.legacy:legacy-support-core-ui-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement:16.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.8.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.palette:palette:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.preference:preference:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.core:core:1.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.loader:loader-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.customview:customview-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.localbroadcastmanager:localbroadcastmanager-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.print:print-1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks:16.0.1@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" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,159 @@
|
|||
package code.name.monkey.retromusic.ui.activities.base;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
|
||||
|
||||
|
||||
public abstract class AbsBaseActivity extends AbsThemeActivity {
|
||||
|
||||
public static final int PERMISSION_REQUEST = 100;
|
||||
private boolean hadPermissions;
|
||||
private String[] permissions;
|
||||
private String permissionDeniedMessage;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
permissions = getPermissionsToRequest();
|
||||
hadPermissions = hasPermissions();
|
||||
|
||||
setPermissionDeniedMessage(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
if (!hasPermissions()) {
|
||||
requestPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
final boolean hasPermissions = hasPermissions();
|
||||
if (hasPermissions != hadPermissions) {
|
||||
hadPermissions = hasPermissions;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
onHasPermissionsChanged(hasPermissions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void onHasPermissionsChanged(boolean hasPermissions) {
|
||||
// implemented by sub classes
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(@NonNull KeyEvent event) {
|
||||
if (event.getKeyCode() == KeyEvent.KEYCODE_MENU && event.getAction() == KeyEvent.ACTION_UP) {
|
||||
showOverflowMenu();
|
||||
return true;
|
||||
}
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
protected void showOverflowMenu() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected String[] getPermissionsToRequest() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected View getSnackBarContainer() {
|
||||
return getWindow().getDecorView();
|
||||
}
|
||||
|
||||
private String getPermissionDeniedMessage() {
|
||||
return permissionDeniedMessage == null ? getString(R.string.permissions_denied)
|
||||
: permissionDeniedMessage;
|
||||
}
|
||||
|
||||
protected void setPermissionDeniedMessage(String message) {
|
||||
permissionDeniedMessage = message;
|
||||
}
|
||||
|
||||
protected void requestPermissions() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && permissions != null) {
|
||||
requestPermissions(permissions, PERMISSION_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean hasPermissions() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && permissions != null) {
|
||||
for (String permission : permissions) {
|
||||
if (checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
|
||||
@NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == PERMISSION_REQUEST) {
|
||||
for (int grantResult : grantResults) {
|
||||
if (grantResult != PackageManager.PERMISSION_GRANTED) {
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale(AbsBaseActivity.this,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
||||
//User has deny from permission dialog
|
||||
Snackbar.make(getSnackBarContainer(), getPermissionDeniedMessage(),
|
||||
Snackbar.LENGTH_INDEFINITE)
|
||||
.setAction(R.string.action_grant, view -> requestPermissions())
|
||||
.setActionTextColor(ThemeStore.accentColor(this))
|
||||
.show();
|
||||
} else {
|
||||
// User has deny permission and checked never show permission dialog so you can redirect to Application settings page
|
||||
Snackbar.make(getSnackBarContainer(), getPermissionDeniedMessage(),
|
||||
Snackbar.LENGTH_INDEFINITE)
|
||||
.setAction(R.string.action_settings, view -> {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", AbsBaseActivity.this.getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
startActivity(intent);
|
||||
})
|
||||
.setActionTextColor(ThemeStore.accentColor(this))
|
||||
.show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
hadPermissions = true;
|
||||
onHasPermissionsChanged(true);
|
||||
}
|
||||
}
|
||||
}
|
BIN
app/src/main/res/font/.DS_Store
vendored
Normal file
BIN
app/src/main/res/font/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
app/src/main/res/font/circular_std_black.otf
Executable file
BIN
app/src/main/res/font/circular_std_black.otf
Executable file
Binary file not shown.
BIN
app/src/main/res/font/circular_std_book.otf
Executable file
BIN
app/src/main/res/font/circular_std_book.otf
Executable file
Binary file not shown.
11
app/src/main/res/font/font.xml
Normal file
11
app/src/main/res/font/font.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<font
|
||||
android:font="@font/circular_std_book"
|
||||
android:fontStyle="normal"
|
||||
android:fontWeight="400" />
|
||||
<font
|
||||
android:font="@font/circular_std_black"
|
||||
android:fontStyle="normal"
|
||||
android:fontWeight="700" />
|
||||
</font-family>
|
|
@ -55,6 +55,7 @@
|
|||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="fontPath">@string/circular_std_black</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:layout_gravity">center</item>
|
||||
<item name="android:gravity">center</item>
|
||||
</style>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<item name="android:windowSharedElementEnterTransition">@transition/grid_exit</item>
|
||||
<item name="android:windowSharedElementExitTransition">@transition/grid_exit</item>
|
||||
|
||||
<item name="android:fontFamily">@font/font</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.RetroMusic.Base.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||
|
@ -67,6 +68,7 @@
|
|||
|
||||
<item name="android:windowSharedElementEnterTransition">@transition/grid_exit</item>
|
||||
<item name="android:windowSharedElementExitTransition">@transition/grid_exit</item>
|
||||
<item name="android:fontFamily">@font/font</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.RetroMusic.Base" parent="Theme.MaterialComponents.NoActionBar">
|
||||
|
@ -109,12 +111,14 @@
|
|||
|
||||
<item name="android:windowSharedElementEnterTransition">@transition/grid_exit</item>
|
||||
<item name="android:windowSharedElementExitTransition">@transition/grid_exit</item>
|
||||
<item name="android:fontFamily">@font/font</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.RetroMusic.Base.Color" parent="@style/Theme.RetroMusic.Base">
|
||||
<item name="colorPrimary">@color/md_deep_purple_A400</item>
|
||||
<item name="android:colorPrimary">?colorPrimary</item>
|
||||
<item name="android:windowBackground">?colorPrimary</item>
|
||||
<item name="android:fontFamily">@font/font</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
|
7
app/src/sans/res/font/font.xml
Normal file
7
app/src/sans/res/font/font.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<font
|
||||
android:font="@font/product_sans_regular"
|
||||
android:fontStyle="normal"
|
||||
android:fontWeight="400" />
|
||||
</font-family>
|
BIN
app/src/sans/res/font/product_sans_regular.ttf
Normal file
BIN
app/src/sans/res/font/product_sans_regular.ttf
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue