Add Spotless

main
Hemanth S 2020-10-06 14:16:04 +05:30
parent 2af13a4e6c
commit defcd86152
286 changed files with 15604 additions and 13757 deletions

View File

@ -167,3 +167,5 @@ dependencies {
implementation 'org.jsoup:jsoup:1.11.1' implementation 'org.jsoup:jsoup:1.11.1'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.6' debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
} }
apply from: '../spotless.gradle'

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic package code.name.monkey.retromusic
import android.widget.Toast import android.widget.Toast

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic package code.name.monkey.retromusic
import android.provider.BaseColumns import android.provider.BaseColumns

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic package code.name.monkey.retromusic
import androidx.annotation.IntDef import androidx.annotation.IntDef

View File

@ -5,10 +5,8 @@ import android.content.ContextWrapper;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.LocaleList; import android.os.LocaleList;
import java.util.Locale;
import code.name.monkey.appthemehelper.util.VersionUtils; import code.name.monkey.appthemehelper.util.VersionUtils;
import java.util.Locale;
public class LanguageContextWrapper extends ContextWrapper { public class LanguageContextWrapper extends ContextWrapper {

View File

@ -4,22 +4,17 @@ import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.bottomsheet.BottomSheetBehavior;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class RetroBottomSheetBehavior<V extends View> extends BottomSheetBehavior<V> { public class RetroBottomSheetBehavior<V extends View> extends BottomSheetBehavior<V> {
private static final String TAG = "RetroBottomSheetBehavior"; private static final String TAG = "RetroBottomSheetBehavior";
private boolean allowDragging = true; private boolean allowDragging = true;
public RetroBottomSheetBehavior() { public RetroBottomSheetBehavior() {}
}
public RetroBottomSheetBehavior(Context context, AttributeSet attrs) { public RetroBottomSheetBehavior(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
@ -30,7 +25,8 @@ public class RetroBottomSheetBehavior<V extends View> extends BottomSheetBehavio
} }
@Override @Override
public boolean onInterceptTouchEvent(@NotNull CoordinatorLayout parent, @NotNull V child, @NotNull MotionEvent event) { public boolean onInterceptTouchEvent(
@NotNull CoordinatorLayout parent, @NotNull V child, @NotNull MotionEvent event) {
if (!allowDragging) { if (!allowDragging) {
return false; return false;
} }

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2020 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.animation.ObjectAnimator import android.animation.ObjectAnimator

View File

@ -18,27 +18,21 @@ import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem; import android.view.MenuItem;
import android.webkit.WebView; import android.webkit.WebView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import org.jetbrains.annotations.Nullable;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import code.name.monkey.appthemehelper.ThemeStore; import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil; import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil; import code.name.monkey.appthemehelper.util.ColorUtil;
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.activities.base.AbsBaseActivity; import code.name.monkey.retromusic.activities.base.AbsBaseActivity;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import org.jetbrains.annotations.Nullable;
/** /** Created by hemanths on 2019-09-27. */
* Created by hemanths on 2019-09-27.
*/
public class LicenseActivity extends AbsBaseActivity { public class LicenseActivity extends AbsBaseActivity {
@Override @Override
@ -66,21 +60,28 @@ public class LicenseActivity extends AbsBaseActivity {
// Inject color values for WebView body background and links // Inject color values for WebView body background and links
final boolean isDark = ATHUtil.INSTANCE.isWindowBackgroundDark(this); final boolean isDark = ATHUtil.INSTANCE.isWindowBackgroundDark(this);
final String backgroundColor = colorToCSS(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface, final String backgroundColor =
Color.parseColor(isDark ? "#424242" : "#ffffff"))); colorToCSS(
ATHUtil.INSTANCE.resolveColor(
this, R.attr.colorSurface, Color.parseColor(isDark ? "#424242" : "#ffffff")));
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000")); final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
final String changeLog = buf.toString() final String changeLog =
.replace("{style-placeholder}", buf.toString()
String.format("body { background-color: %s; color: %s; }", backgroundColor, contentColor)) .replace(
"{style-placeholder}",
String.format(
"body { background-color: %s; color: %s; }", backgroundColor, contentColor))
.replace("{link-color}", colorToCSS(ThemeStore.Companion.accentColor(this))) .replace("{link-color}", colorToCSS(ThemeStore.Companion.accentColor(this)))
.replace("{link-color-active}", .replace(
colorToCSS(ColorUtil.INSTANCE.lightenColor(ThemeStore.Companion.accentColor(this)))); "{link-color-active}",
colorToCSS(
ColorUtil.INSTANCE.lightenColor(ThemeStore.Companion.accentColor(this))));
webView.loadData(changeLog, "text/html", "UTF-8"); webView.loadData(changeLog, "text/html", "UTF-8");
} catch (Throwable e) { } catch (Throwable e) {
webView.loadData("<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8"); webView.loadData(
"<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8");
} }
} }
@Override @Override
@ -93,7 +94,10 @@ public class LicenseActivity extends AbsBaseActivity {
} }
private String colorToCSS(int color) { private String colorToCSS(int color) {
return String.format("rgb(%d, %d, %d)", Color.red(color), Color.green(color), return String.format(
"rgb(%d, %d, %d)",
Color.red(color),
Color.green(color),
Color.blue(color)); // on API 29, WebView doesn't load with hex colors Color.blue(color)); // on API 29, WebView doesn't load with hex colors
} }
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.app.KeyguardManager import android.app.KeyguardManager

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.os.Bundle import android.os.Bundle
@ -23,7 +37,6 @@ import com.google.android.material.transition.platform.MaterialContainerTransfor
import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback
import kotlinx.android.synthetic.main.activity_lyrics.* import kotlinx.android.synthetic.main.activity_lyrics.*
class LyricsActivity : AbsMusicServiceActivity(), MusicProgressViewUpdateHelper.Callback { class LyricsActivity : AbsMusicServiceActivity(), MusicProgressViewUpdateHelper.Callback {
private lateinit var updateHelper: MusicProgressViewUpdateHelper private lateinit var updateHelper: MusicProgressViewUpdateHelper

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.content.Intent import android.content.Intent
@ -156,11 +170,11 @@ class MainActivity : AbsSlidingMusicPanelActivity(), OnSharedPreferenceChangeLis
setIntent(Intent()) setIntent(Intent())
} }
} }
} }
private fun parseLongFromIntent( private fun parseLongFromIntent(
intent: Intent, longKey: String, intent: Intent,
longKey: String,
stringKey: String stringKey: String
): Long { ): Long {
var id = intent.getLongExtra(longKey, -1) var id = intent.getLongExtra(longKey, -1)

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.content.Intent import android.content.Intent
@ -15,7 +29,6 @@ import code.name.monkey.retromusic.util.RingtoneManager
import kotlinx.android.synthetic.main.activity_permission.* import kotlinx.android.synthetic.main.activity_permission.*
import kotlinx.android.synthetic.main.fragment_library.appNameText import kotlinx.android.synthetic.main.fragment_library.appNameText
class PermissionActivity : AbsMusicServiceActivity() { class PermissionActivity : AbsMusicServiceActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.content.res.ColorStateList import android.content.res.ColorStateList

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.content.Intent import android.content.Intent
@ -17,8 +31,8 @@ import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.activities.base.AbsBaseActivity import code.name.monkey.retromusic.activities.base.AbsBaseActivity
import com.anjlab.android.iab.v3.BillingProcessor import com.anjlab.android.iab.v3.BillingProcessor
import com.anjlab.android.iab.v3.TransactionDetails import com.anjlab.android.iab.v3.TransactionDetails
import kotlinx.android.synthetic.main.activity_pro_version.*
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import kotlinx.android.synthetic.main.activity_pro_version.*
class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler { class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
@ -47,7 +61,6 @@ class PurchaseActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
if (restorePurchaseAsyncTask == null || restorePurchaseAsyncTask!!.status != AsyncTask.Status.RUNNING) { if (restorePurchaseAsyncTask == null || restorePurchaseAsyncTask!!.status != AsyncTask.Status.RUNNING) {
restorePurchase() restorePurchase()
} }
} }
purchaseButton.setOnClickListener { purchaseButton.setOnClickListener {
billingProcessor.purchase(this@PurchaseActivity, PRO_VERSION_PRODUCT_ID) billingProcessor.purchase(this@PurchaseActivity, PRO_VERSION_PRODUCT_ID)

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.os.Bundle import android.os.Bundle
@ -49,7 +63,6 @@ class SettingsActivity : AbsBaseActivity(), ColorChooserDialog.ColorCallback {
} }
override fun onColorChooserDismissed(dialog: ColorChooserDialog) { override fun onColorChooserDismissed(dialog: ColorChooserDialog) {
} }
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2020 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.content.res.ColorStateList import android.content.res.ColorStateList

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.content.Intent import android.content.Intent
@ -28,9 +42,9 @@ import code.name.monkey.retromusic.extensions.textColorSecondary
import com.anjlab.android.iab.v3.BillingProcessor import com.anjlab.android.iab.v3.BillingProcessor
import com.anjlab.android.iab.v3.SkuDetails import com.anjlab.android.iab.v3.SkuDetails
import com.anjlab.android.iab.v3.TransactionDetails import com.anjlab.android.iab.v3.TransactionDetails
import kotlinx.android.synthetic.main.activity_donation.*
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import java.util.* import java.util.*
import kotlinx.android.synthetic.main.activity_donation.*
class SupportDevelopmentActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler { class SupportDevelopmentActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
@ -165,7 +179,8 @@ private class SkuDetailsLoadAsyncTask(supportDevelopmentActivity: SupportDevelop
} }
class SkuDetailsAdapter( class SkuDetailsAdapter(
private var donationsDialog: SupportDevelopmentActivity, objects: List<SkuDetails> private var donationsDialog: SupportDevelopmentActivity,
objects: List<SkuDetails>
) : RecyclerView.Adapter<SkuDetailsAdapter.ViewHolder>() { ) : RecyclerView.Adapter<SkuDetailsAdapter.ViewHolder>() {
private var skuDetailsList: List<SkuDetails> = ArrayList() private var skuDetailsList: List<SkuDetails> = ArrayList()

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities package code.name.monkey.retromusic.activities
import android.app.Activity import android.app.Activity
@ -27,15 +41,15 @@ import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.Target import com.bumptech.glide.request.target.Target
import com.github.dhaval2404.imagepicker.ImagePicker import com.github.dhaval2404.imagepicker.ImagePicker
import com.github.dhaval2404.imagepicker.constant.ImageProvider import com.github.dhaval2404.imagepicker.constant.ImageProvider
import java.io.BufferedOutputStream
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import kotlinx.android.synthetic.main.activity_user_info.* import kotlinx.android.synthetic.main.activity_user_info.*
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.io.BufferedOutputStream
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
class UserInfoActivity : AbsBaseActivity() { class UserInfoActivity : AbsBaseActivity() {
@ -114,7 +128,6 @@ class UserInfoActivity : AbsBaseActivity() {
.start(PICK_IMAGE_REQUEST) .start(PICK_IMAGE_REQUEST)
} }
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
if (resultCode == Activity.RESULT_OK && requestCode == PICK_IMAGE_REQUEST) { if (resultCode == Activity.RESULT_OK && requestCode == PICK_IMAGE_REQUEST) {
@ -209,7 +222,6 @@ class UserInfoActivity : AbsBaseActivity() {
.into(userImage) .into(userImage)
} }
companion object { companion object {
private const val PICK_IMAGE_REQUEST = 9002 private const val PICK_IMAGE_REQUEST = 9002
private const val PICK_BANNER_REQUEST = 9004 private const val PICK_BANNER_REQUEST = 9004

View File

@ -1,23 +1,14 @@
package code.name.monkey.retromusic.activities; package code.name.monkey.retromusic.activities;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.webkit.WebView; import android.webkit.WebView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import code.name.monkey.appthemehelper.ThemeStore; import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.appthemehelper.util.ATHUtil; import code.name.monkey.appthemehelper.util.ATHUtil;
import code.name.monkey.appthemehelper.util.ColorUtil; import code.name.monkey.appthemehelper.util.ColorUtil;
@ -26,12 +17,22 @@ import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.activities.base.AbsBaseActivity; import code.name.monkey.retromusic.activities.base.AbsBaseActivity;
import code.name.monkey.retromusic.util.PreferenceUtil; import code.name.monkey.retromusic.util.PreferenceUtil;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
public class WhatsNewActivity extends AbsBaseActivity { public class WhatsNewActivity extends AbsBaseActivity {
private static String colorToCSS(int color) { private static String colorToCSS(int color) {
return String.format(Locale.getDefault(), "rgba(%d, %d, %d, %d)", Color.red(color), Color.green(color), return String.format(
Color.blue(color), Color.alpha(color)); // on API 29, WebView doesn't load with hex colors Locale.getDefault(),
"rgba(%d, %d, %d, %d)",
Color.red(color),
Color.green(color),
Color.blue(color),
Color.alpha(color)); // on API 29, WebView doesn't load with hex colors
} }
private static void setChangelogRead(@NonNull Context context) { private static void setChangelogRead(@NonNull Context context) {
@ -72,18 +73,38 @@ public class WhatsNewActivity extends AbsBaseActivity {
// Inject color values for WebView body background and links // Inject color values for WebView body background and links
final boolean isDark = ATHUtil.INSTANCE.isWindowBackgroundDark(this); final boolean isDark = ATHUtil.INSTANCE.isWindowBackgroundDark(this);
final int accentColor = ThemeStore.Companion.accentColor(this); final int accentColor = ThemeStore.Companion.accentColor(this);
final String backgroundColor = colorToCSS(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface, Color.parseColor(isDark ? "#424242" : "#ffffff"))); final String backgroundColor =
colorToCSS(
ATHUtil.INSTANCE.resolveColor(
this, R.attr.colorSurface, Color.parseColor(isDark ? "#424242" : "#ffffff")));
final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000")); final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000"));
final String textColor = colorToCSS(Color.parseColor(isDark ? "#60FFFFFF" : "#80000000")); final String textColor = colorToCSS(Color.parseColor(isDark ? "#60FFFFFF" : "#80000000"));
final String accentColorString = colorToCSS(ThemeStore.Companion.accentColor(this)); final String accentColorString = colorToCSS(ThemeStore.Companion.accentColor(this));
final String accentTextColor = colorToCSS(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.INSTANCE.isColorLight(accentColor))); final String accentTextColor =
final String changeLog = buf.toString() colorToCSS(
.replace("{style-placeholder}", String.format("body { background-color: %s; color: %s; } li {color: %s;} .colorHeader {background-color: %s; color: %s;} .tag {color: %s;}", backgroundColor, contentColor, textColor, accentColorString, accentTextColor, accentColorString)) MaterialValueHelper.getPrimaryTextColor(
this, ColorUtil.INSTANCE.isColorLight(accentColor)));
final String changeLog =
buf.toString()
.replace(
"{style-placeholder}",
String.format(
"body { background-color: %s; color: %s; } li {color: %s;} .colorHeader {background-color: %s; color: %s;} .tag {color: %s;}",
backgroundColor,
contentColor,
textColor,
accentColorString,
accentTextColor,
accentColorString))
.replace("{link-color}", colorToCSS(ThemeStore.Companion.accentColor(this))) .replace("{link-color}", colorToCSS(ThemeStore.Companion.accentColor(this)))
.replace("{link-color-active}", colorToCSS(ColorUtil.INSTANCE.lightenColor(ThemeStore.Companion.accentColor(this)))); .replace(
"{link-color-active}",
colorToCSS(
ColorUtil.INSTANCE.lightenColor(ThemeStore.Companion.accentColor(this))));
webView.loadData(changeLog, "text/html", "UTF-8"); webView.loadData(changeLog, "text/html", "UTF-8");
} catch (Throwable e) { } catch (Throwable e) {
webView.loadData("<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8"); webView.loadData(
"<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8");
} }
setChangelogRead(this); setChangelogRead(this);
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities.base package code.name.monkey.retromusic.activities.base
import android.Manifest import android.Manifest

View File

@ -1,7 +1,26 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities.base package code.name.monkey.retromusic.activities.base
import android.Manifest import android.Manifest
import android.content.* import android.content.BroadcastReceiver
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.ServiceConnection
import android.os.Bundle import android.os.Bundle
import android.os.IBinder import android.os.IBinder
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
@ -11,11 +30,11 @@ import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener import code.name.monkey.retromusic.interfaces.IMusicServiceEventListener
import code.name.monkey.retromusic.repository.RealRepository import code.name.monkey.retromusic.repository.RealRepository
import code.name.monkey.retromusic.service.MusicService.* import code.name.monkey.retromusic.service.MusicService.*
import java.lang.ref.WeakReference
import java.util.*
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import java.lang.ref.WeakReference
import java.util.*
abstract class AbsMusicServiceActivity : AbsBaseActivity(), IMusicServiceEventListener { abstract class AbsMusicServiceActivity : AbsBaseActivity(), IMusicServiceEventListener {

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities.base package code.name.monkey.retromusic.activities.base
import android.annotation.SuppressLint import android.annotation.SuppressLint

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities.base package code.name.monkey.retromusic.activities.base
import android.content.Context import android.content.Context
@ -37,7 +51,6 @@ abstract class AbsThemeActivity : ATHToolbarActivity(), Runnable {
MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this) MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this)
} }
private fun updateTheme() { private fun updateTheme() {
setTheme(ThemeManager.getThemeResValue(this)) setTheme(ThemeManager.getThemeResValue(this))
setDefaultNightMode(ThemeManager.getNightMode(this)) setDefaultNightMode(ThemeManager.getNightMode(this))

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities.bugreport package code.name.monkey.retromusic.activities.bugreport
import android.app.Activity import android.app.Activity
@ -31,6 +45,7 @@ import code.name.monkey.retromusic.misc.DialogAsyncTask
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.floatingactionbutton.FloatingActionButton import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.textfield.TextInputLayout import com.google.android.material.textfield.TextInputLayout
import java.io.IOException
import kotlinx.android.synthetic.main.activity_bug_report.* import kotlinx.android.synthetic.main.activity_bug_report.*
import kotlinx.android.synthetic.main.bug_report_card_device_info.* import kotlinx.android.synthetic.main.bug_report_card_device_info.*
import kotlinx.android.synthetic.main.bug_report_card_report.* import kotlinx.android.synthetic.main.bug_report_card_report.*
@ -38,7 +53,6 @@ import org.eclipse.egit.github.core.Issue
import org.eclipse.egit.github.core.client.GitHubClient import org.eclipse.egit.github.core.client.GitHubClient
import org.eclipse.egit.github.core.client.RequestException import org.eclipse.egit.github.core.client.RequestException
import org.eclipse.egit.github.core.service.IssueService import org.eclipse.egit.github.core.service.IssueService
import java.io.IOException
private const val RESULT_SUCCESS = "RESULT_OK" private const val RESULT_SUCCESS = "RESULT_OK"
private const val RESULT_BAD_CREDENTIALS = "RESULT_BAD_CREDENTIALS" private const val RESULT_BAD_CREDENTIALS = "RESULT_BAD_CREDENTIALS"
@ -306,7 +320,6 @@ open class BugReportActivity : AbsThemeActivity() {
} }
} }
companion object { companion object {
fun report( fun report(

View File

@ -5,28 +5,27 @@ import android.content.Context;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Build; import android.os.Build;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import code.name.monkey.retromusic.util.PreferenceUtil;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale; import java.util.Locale;
import code.name.monkey.retromusic.util.PreferenceUtil;
public class DeviceInfo { public class DeviceInfo {
@SuppressLint("NewApi") @SuppressLint("NewApi")
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
private final String[] abis = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? private final String[] abis =
Build.SUPPORTED_ABIS : new String[]{Build.CPU_ABI, Build.CPU_ABI2}; Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
? Build.SUPPORTED_ABIS
: new String[] {Build.CPU_ABI, Build.CPU_ABI2};
@SuppressLint("NewApi") @SuppressLint("NewApi")
private final String[] abis32Bits = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? private final String[] abis32Bits =
Build.SUPPORTED_32_BIT_ABIS : null; Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? Build.SUPPORTED_32_BIT_ABIS : null;
@SuppressLint("NewApi") @SuppressLint("NewApi")
private final String[] abis64Bits = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? private final String[] abis64Bits =
Build.SUPPORTED_64_BIT_ABIS : null; Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? Build.SUPPORTED_64_BIT_ABIS : null;
private final String baseTheme; private final String baseTheme;
@ -63,8 +62,7 @@ public class DeviceInfo {
public DeviceInfo(Context context) { public DeviceInfo(Context context) {
PackageInfo packageInfo; PackageInfo packageInfo;
try { try {
packageInfo = context.getPackageManager() packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
.getPackageInfo(context.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
packageInfo = null; packageInfo = null;
} }
@ -76,7 +74,8 @@ public class DeviceInfo {
versionName = null; versionName = null;
} }
baseTheme = PreferenceUtil.INSTANCE.getBaseTheme(); baseTheme = PreferenceUtil.INSTANCE.getBaseTheme();
nowPlayingTheme = context.getString(PreferenceUtil.INSTANCE.getNowPlayingScreen().getTitleRes()); nowPlayingTheme =
context.getString(PreferenceUtil.INSTANCE.getNowPlayingScreen().getTitleRes());
isAdaptive = PreferenceUtil.INSTANCE.isAdaptiveColor(); isAdaptive = PreferenceUtil.INSTANCE.isAdaptiveColor();
selectedLang = PreferenceUtil.INSTANCE.getLanguageCode(); selectedLang = PreferenceUtil.INSTANCE.getLanguageCode();
} }
@ -85,46 +84,117 @@ public class DeviceInfo {
return "Device info:\n" return "Device info:\n"
+ "---\n" + "---\n"
+ "<table>\n" + "<table>\n"
+ "<tr><td><b>App version</b></td><td>" + versionName + "</td></tr>\n" + "<tr><td><b>App version</b></td><td>"
+ "<tr><td>App version code</td><td>" + versionCode + "</td></tr>\n" + versionName
+ "<tr><td>Android build version</td><td>" + buildVersion + "</td></tr>\n" + "</td></tr>\n"
+ "<tr><td>Android release version</td><td>" + releaseVersion + "</td></tr>\n" + "<tr><td>App version code</td><td>"
+ "<tr><td>Android SDK version</td><td>" + sdkVersion + "</td></tr>\n" + versionCode
+ "<tr><td>Android build ID</td><td>" + buildID + "</td></tr>\n" + "</td></tr>\n"
+ "<tr><td>Device brand</td><td>" + brand + "</td></tr>\n" + "<tr><td>Android build version</td><td>"
+ "<tr><td>Device manufacturer</td><td>" + manufacturer + "</td></tr>\n" + buildVersion
+ "<tr><td>Device name</td><td>" + device + "</td></tr>\n" + "</td></tr>\n"
+ "<tr><td>Device model</td><td>" + model + "</td></tr>\n" + "<tr><td>Android release version</td><td>"
+ "<tr><td>Device product name</td><td>" + product + "</td></tr>\n" + releaseVersion
+ "<tr><td>Device hardware name</td><td>" + hardware + "</td></tr>\n" + "</td></tr>\n"
+ "<tr><td>ABIs</td><td>" + Arrays.toString(abis) + "</td></tr>\n" + "<tr><td>Android SDK version</td><td>"
+ "<tr><td>ABIs (32bit)</td><td>" + Arrays.toString(abis32Bits) + "</td></tr>\n" + sdkVersion
+ "<tr><td>ABIs (64bit)</td><td>" + Arrays.toString(abis64Bits) + "</td></tr>\n" + "</td></tr>\n"
+ "<tr><td>Language</td><td>" + selectedLang + "</td></tr>\n" + "<tr><td>Android build ID</td><td>"
+ buildID
+ "</td></tr>\n"
+ "<tr><td>Device brand</td><td>"
+ brand
+ "</td></tr>\n"
+ "<tr><td>Device manufacturer</td><td>"
+ manufacturer
+ "</td></tr>\n"
+ "<tr><td>Device name</td><td>"
+ device
+ "</td></tr>\n"
+ "<tr><td>Device model</td><td>"
+ model
+ "</td></tr>\n"
+ "<tr><td>Device product name</td><td>"
+ product
+ "</td></tr>\n"
+ "<tr><td>Device hardware name</td><td>"
+ hardware
+ "</td></tr>\n"
+ "<tr><td>ABIs</td><td>"
+ Arrays.toString(abis)
+ "</td></tr>\n"
+ "<tr><td>ABIs (32bit)</td><td>"
+ Arrays.toString(abis32Bits)
+ "</td></tr>\n"
+ "<tr><td>ABIs (64bit)</td><td>"
+ Arrays.toString(abis64Bits)
+ "</td></tr>\n"
+ "<tr><td>Language</td><td>"
+ selectedLang
+ "</td></tr>\n"
+ "</table>\n"; + "</table>\n";
} }
@Override @Override
public String toString() { public String toString() {
return "App version: " + versionName + "\n" return "App version: "
+ "App version code: " + versionCode + "\n" + versionName
+ "Android build version: " + buildVersion + "\n" + "\n"
+ "Android release version: " + releaseVersion + "\n" + "App version code: "
+ "Android SDK version: " + sdkVersion + "\n" + versionCode
+ "Android build ID: " + buildID + "\n" + "\n"
+ "Device brand: " + brand + "\n" + "Android build version: "
+ "Device manufacturer: " + manufacturer + "\n" + buildVersion
+ "Device name: " + device + "\n" + "\n"
+ "Device model: " + model + "\n" + "Android release version: "
+ "Device product name: " + product + "\n" + releaseVersion
+ "Device hardware name: " + hardware + "\n" + "\n"
+ "ABIs: " + Arrays.toString(abis) + "\n" + "Android SDK version: "
+ "ABIs (32bit): " + Arrays.toString(abis32Bits) + "\n" + sdkVersion
+ "ABIs (64bit): " + Arrays.toString(abis64Bits) + "\n" + "\n"
+ "Base theme: " + baseTheme + "\n" + "Android build ID: "
+ "Now playing theme: " + nowPlayingTheme + "\n" + buildID
+ "Adaptive: " + isAdaptive + "\n" + "\n"
+ "System language: " + Locale.getDefault().toLanguageTag() + "\n" + "Device brand: "
+ "In-App Language: " + selectedLang; + brand
+ "\n"
+ "Device manufacturer: "
+ manufacturer
+ "\n"
+ "Device name: "
+ device
+ "\n"
+ "Device model: "
+ model
+ "\n"
+ "Device product name: "
+ product
+ "\n"
+ "Device hardware name: "
+ hardware
+ "\n"
+ "ABIs: "
+ Arrays.toString(abis)
+ "\n"
+ "ABIs (32bit): "
+ Arrays.toString(abis32Bits)
+ "\n"
+ "ABIs (64bit): "
+ Arrays.toString(abis64Bits)
+ "\n"
+ "Base theme: "
+ baseTheme
+ "\n"
+ "Now playing theme: "
+ nowPlayingTheme
+ "\n"
+ "Adaptive: "
+ isAdaptive
+ "\n"
+ "System language: "
+ Locale.getDefault().toLanguageTag()
+ "\n"
+ "In-App Language: "
+ selectedLang;
} }
} }

View File

@ -1,6 +1,5 @@
package code.name.monkey.retromusic.activities.bugreport.model; package code.name.monkey.retromusic.activities.bugreport.model;
import code.name.monkey.retromusic.activities.bugreport.model.github.ExtraInfo; import code.name.monkey.retromusic.activities.bugreport.model.github.ExtraInfo;
public class Report { public class Report {
@ -21,9 +20,11 @@ public class Report {
} }
public String getDescription() { public String getDescription() {
return description + "\n\n" return description
+ "\n\n"
+ "-\n\n" + "-\n\n"
+ deviceInfo.toMarkdown() + "\n\n" + deviceInfo.toMarkdown()
+ "\n\n"
+ extraInfo.toMarkdown(); + extraInfo.toMarkdown();
} }

View File

@ -45,11 +45,10 @@ public class ExtraInfo {
} }
StringBuilder output = new StringBuilder(); StringBuilder output = new StringBuilder();
output.append("Extra info:\n" output.append("Extra info:\n" + "---\n" + "<table>\n");
+ "---\n"
+ "<table>\n");
for (String key : extraInfo.keySet()) { for (String key : extraInfo.keySet()) {
output.append("<tr><td>") output
.append("<tr><td>")
.append(key) .append(key)
.append("</td><td>") .append("</td><td>")
.append(extraInfo.get(key)) .append(extraInfo.get(key))

View File

@ -37,5 +37,4 @@ public class GithubLogin {
public boolean shouldUseApiToken() { public boolean shouldUseApiToken() {
return TextUtils.isEmpty(username) || TextUtils.isEmpty(password); return TextUtils.isEmpty(username) || TextUtils.isEmpty(password);
} }
} }

View File

@ -16,17 +16,12 @@ package code.name.monkey.retromusic.activities.saf;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import code.name.monkey.retromusic.R;
import com.heinrichreimersoftware.materialintro.app.IntroActivity; import com.heinrichreimersoftware.materialintro.app.IntroActivity;
import com.heinrichreimersoftware.materialintro.slide.SimpleSlide; import com.heinrichreimersoftware.materialintro.slide.SimpleSlide;
import code.name.monkey.retromusic.R; /** Created by hemanths on 2019-07-31. */
/**
* Created by hemanths on 2019-07-31.
*/
public class SAFGuideActivity extends IntroActivity { public class SAFGuideActivity extends IntroActivity {
public static final int REQUEST_CODE_SAF_GUIDE = 98; public static final int REQUEST_CODE_SAF_GUIDE = 98;
@ -41,18 +36,23 @@ public class SAFGuideActivity extends IntroActivity {
setButtonCtaTintMode(BUTTON_CTA_TINT_MODE_TEXT); setButtonCtaTintMode(BUTTON_CTA_TINT_MODE_TEXT);
String title = String.format(getString(R.string.saf_guide_slide1_title), getString(R.string.app_name)); String title =
String.format(getString(R.string.saf_guide_slide1_title), getString(R.string.app_name));
addSlide(new SimpleSlide.Builder() addSlide(
new SimpleSlide.Builder()
.title(title) .title(title)
.description(Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1 .description(
? R.string.saf_guide_slide1_description_before_o : R.string.saf_guide_slide1_description) Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1
? R.string.saf_guide_slide1_description_before_o
: R.string.saf_guide_slide1_description)
.image(R.drawable.saf_guide_1) .image(R.drawable.saf_guide_1)
.background(R.color.md_deep_purple_300) .background(R.color.md_deep_purple_300)
.backgroundDark(R.color.md_deep_purple_400) .backgroundDark(R.color.md_deep_purple_400)
.layout(R.layout.fragment_simple_slide_large_image) .layout(R.layout.fragment_simple_slide_large_image)
.build()); .build());
addSlide(new SimpleSlide.Builder() addSlide(
new SimpleSlide.Builder()
.title(R.string.saf_guide_slide2_title) .title(R.string.saf_guide_slide2_title)
.description(R.string.saf_guide_slide2_description) .description(R.string.saf_guide_slide2_description)
.image(R.drawable.saf_guide_2) .image(R.drawable.saf_guide_2)
@ -60,7 +60,8 @@ public class SAFGuideActivity extends IntroActivity {
.backgroundDark(R.color.md_deep_purple_600) .backgroundDark(R.color.md_deep_purple_600)
.layout(R.layout.fragment_simple_slide_large_image) .layout(R.layout.fragment_simple_slide_large_image)
.build()); .build());
addSlide(new SimpleSlide.Builder() addSlide(
new SimpleSlide.Builder()
.title(R.string.saf_guide_slide3_title) .title(R.string.saf_guide_slide3_title)
.description(R.string.saf_guide_slide3_description) .description(R.string.saf_guide_slide3_description)
.image(R.drawable.saf_guide_3) .image(R.drawable.saf_guide_3)

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities.tageditor package code.name.monkey.retromusic.activities.tageditor
import android.app.Activity import android.app.Activity
@ -28,13 +42,13 @@ import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.SAFUtil import code.name.monkey.retromusic.util.SAFUtil
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.File
import java.util.*
import kotlinx.android.synthetic.main.activity_album_tag_editor.* import kotlinx.android.synthetic.main.activity_album_tag_editor.*
import org.jaudiotagger.audio.AudioFile import org.jaudiotagger.audio.AudioFile
import org.jaudiotagger.audio.AudioFileIO import org.jaudiotagger.audio.AudioFileIO
import org.jaudiotagger.tag.FieldKey import org.jaudiotagger.tag.FieldKey
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import java.io.File
import java.util.*
abstract class AbsTagEditorActivity : AbsBaseActivity() { abstract class AbsTagEditorActivity : AbsBaseActivity() {
val repository by inject<Repository>() val repository by inject<Repository>()
@ -324,7 +338,8 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
} }
protected fun writeValuesToFiles( protected fun writeValuesToFiles(
fieldKeyValueMap: Map<FieldKey, String>, artworkInfo: ArtworkInfo? fieldKeyValueMap: Map<FieldKey, String>,
artworkInfo: ArtworkInfo?
) { ) {
RetroUtil.hideSoftKeyboard(this) RetroUtil.hideSoftKeyboard(this)
@ -405,5 +420,4 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
private val TAG = AbsTagEditorActivity::class.java.simpleName private val TAG = AbsTagEditorActivity::class.java.simpleName
private const val REQUEST_CODE_SELECT_IMAGE = 1000 private const val REQUEST_CODE_SELECT_IMAGE = 1000
} }
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities.tageditor package code.name.monkey.retromusic.activities.tageditor
import android.app.Activity import android.app.Activity
@ -26,9 +40,9 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.animation.GlideAnimation import com.bumptech.glide.request.animation.GlideAnimation
import com.bumptech.glide.request.target.SimpleTarget import com.bumptech.glide.request.target.SimpleTarget
import java.util.*
import kotlinx.android.synthetic.main.activity_album_tag_editor.* import kotlinx.android.synthetic.main.activity_album_tag_editor.*
import org.jaudiotagger.tag.FieldKey import org.jaudiotagger.tag.FieldKey
import java.util.*
class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher { class AlbumTagEditorActivity : AbsTagEditorActivity(), TextWatcher {

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.activities.tageditor package code.name.monkey.retromusic.activities.tageditor
import android.net.Uri import android.net.Uri
@ -9,10 +23,10 @@ import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.R import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.appHandleColor import code.name.monkey.retromusic.extensions.appHandleColor
import code.name.monkey.retromusic.repository.SongRepository import code.name.monkey.retromusic.repository.SongRepository
import java.util.*
import kotlinx.android.synthetic.main.activity_song_tag_editor.* import kotlinx.android.synthetic.main.activity_song_tag_editor.*
import org.jaudiotagger.tag.FieldKey import org.jaudiotagger.tag.FieldKey
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import java.util.*
class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher { class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
@ -111,5 +125,3 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
val TAG: String = SongTagEditorActivity::class.java.simpleName val TAG: String = SongTagEditorActivity::class.java.simpleName
} }
} }

View File

@ -7,19 +7,14 @@ import android.graphics.Bitmap;
import android.media.MediaScannerConnection; import android.media.MediaScannerConnection;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.misc.DialogAsyncTask;
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
import code.name.monkey.retromusic.util.MusicUtil;
import code.name.monkey.retromusic.util.SAFUtil;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.jaudiotagger.audio.AudioFile;
import org.jaudiotagger.audio.AudioFileIO;
import org.jaudiotagger.tag.FieldKey;
import org.jaudiotagger.tag.Tag;
import org.jaudiotagger.tag.images.Artwork;
import org.jaudiotagger.tag.images.ArtworkFactory;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
@ -27,14 +22,15 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import org.jaudiotagger.audio.AudioFile;
import org.jaudiotagger.audio.AudioFileIO;
import org.jaudiotagger.tag.FieldKey;
import org.jaudiotagger.tag.Tag;
import org.jaudiotagger.tag.images.Artwork;
import org.jaudiotagger.tag.images.ArtworkFactory;
import code.name.monkey.retromusic.R; public class WriteTagsAsyncTask
import code.name.monkey.retromusic.misc.DialogAsyncTask; extends DialogAsyncTask<WriteTagsAsyncTask.LoadingInfo, Integer, String[]> {
import code.name.monkey.retromusic.misc.UpdateToastMediaScannerCompletionListener;
import code.name.monkey.retromusic.util.MusicUtil;
import code.name.monkey.retromusic.util.SAFUtil;
public class WriteTagsAsyncTask extends DialogAsyncTask<WriteTagsAsyncTask.LoadingInfo, Integer, String[]> {
private WeakReference<Activity> activity; private WeakReference<Activity> activity;
@ -64,7 +60,8 @@ public class WriteTagsAsyncTask extends DialogAsyncTask<WriteTagsAsyncTask.Loadi
if (info.artworkInfo != null && info.artworkInfo.getArtwork() != null) { if (info.artworkInfo != null && info.artworkInfo.getArtwork() != null) {
try { try {
albumArtFile = MusicUtil.INSTANCE.createAlbumArtFile().getCanonicalFile(); albumArtFile = MusicUtil.INSTANCE.createAlbumArtFile().getCanonicalFile();
info.artworkInfo.getArtwork() info.artworkInfo
.getArtwork()
.compress(Bitmap.CompressFormat.PNG, 0, new FileOutputStream(albumArtFile)); .compress(Bitmap.CompressFormat.PNG, 0, new FileOutputStream(albumArtFile));
artwork = ArtworkFactory.createArtworkFromFile(albumArtFile); artwork = ArtworkFactory.createArtworkFromFile(albumArtFile);
} catch (IOException e) { } catch (IOException e) {
@ -120,7 +117,8 @@ public class WriteTagsAsyncTask extends DialogAsyncTask<WriteTagsAsyncTask.Loadi
Context context = getContext(); Context context = getContext();
if (context != null) { if (context != null) {
if (wroteArtwork) { if (wroteArtwork) {
MusicUtil.INSTANCE.insertAlbumArt(context, info.artworkInfo.getAlbumId(), albumArtFile.getPath()); MusicUtil.INSTANCE.insertAlbumArt(
context, info.artworkInfo.getAlbumId(), albumArtFile.getPath());
} else if (deletedArtwork) { } else if (deletedArtwork) {
MusicUtil.INSTANCE.deleteAlbumArt(context, info.artworkInfo.getAlbumId()); MusicUtil.INSTANCE.deleteAlbumArt(context, info.artworkInfo.getAlbumId());
} }
@ -166,22 +164,24 @@ public class WriteTagsAsyncTask extends DialogAsyncTask<WriteTagsAsyncTask.Loadi
private void scan(String[] toBeScanned) { private void scan(String[] toBeScanned) {
Activity activity = this.activity.get(); Activity activity = this.activity.get();
if (activity != null) { if (activity != null) {
MediaScannerConnection.scanFile(activity, toBeScanned, null, MediaScannerConnection.scanFile(
activity,
toBeScanned,
null,
new UpdateToastMediaScannerCompletionListener(activity, toBeScanned)); new UpdateToastMediaScannerCompletionListener(activity, toBeScanned));
} }
} }
public static class LoadingInfo { public static class LoadingInfo {
@Nullable @Nullable final Map<FieldKey, String> fieldKeyValueMap;
final Map<FieldKey, String> fieldKeyValueMap;
final Collection<String> filePaths; final Collection<String> filePaths;
@Nullable @Nullable private AbsTagEditorActivity.ArtworkInfo artworkInfo;
private AbsTagEditorActivity.ArtworkInfo artworkInfo;
public LoadingInfo(Collection<String> filePaths, public LoadingInfo(
Collection<String> filePaths,
@Nullable Map<FieldKey, String> fieldKeyValueMap, @Nullable Map<FieldKey, String> fieldKeyValueMap,
@Nullable AbsTagEditorActivity.ArtworkInfo artworkInfo) { @Nullable AbsTagEditorActivity.ArtworkInfo artworkInfo) {
this.filePaths = filePaths; this.filePaths = filePaths;

View File

@ -22,19 +22,15 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.checkbox.MaterialCheckBox;
import java.util.List;
import code.name.monkey.appthemehelper.ThemeStore; import code.name.monkey.appthemehelper.ThemeStore;
import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.model.CategoryInfo; import code.name.monkey.retromusic.model.CategoryInfo;
import code.name.monkey.retromusic.util.SwipeAndDragHelper; import code.name.monkey.retromusic.util.SwipeAndDragHelper;
import com.google.android.material.checkbox.MaterialCheckBox;
import java.util.List;
public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapter.ViewHolder> public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapter.ViewHolder>
implements SwipeAndDragHelper.ActionCompletionContract { implements SwipeAndDragHelper.ActionCompletionContract {
@ -72,31 +68,38 @@ public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapte
CategoryInfo categoryInfo = categoryInfos.get(position); CategoryInfo categoryInfo = categoryInfos.get(position);
holder.checkBox.setChecked(categoryInfo.isVisible()); holder.checkBox.setChecked(categoryInfo.isVisible());
holder.title.setText(holder.title.getResources().getString(categoryInfo.getCategory().getStringRes())); holder.title.setText(
holder.title.getResources().getString(categoryInfo.getCategory().getStringRes()));
holder.itemView.setOnClickListener(v -> { holder.itemView.setOnClickListener(
v -> {
if (!(categoryInfo.isVisible() && isLastCheckedCategory(categoryInfo))) { if (!(categoryInfo.isVisible() && isLastCheckedCategory(categoryInfo))) {
categoryInfo.setVisible(!categoryInfo.isVisible()); categoryInfo.setVisible(!categoryInfo.isVisible());
holder.checkBox.setChecked(categoryInfo.isVisible()); holder.checkBox.setChecked(categoryInfo.isVisible());
} else { } else {
Toast.makeText(holder.itemView.getContext(), R.string.you_have_to_select_at_least_one_category, Toast.makeText(
Toast.LENGTH_SHORT).show(); holder.itemView.getContext(),
R.string.you_have_to_select_at_least_one_category,
Toast.LENGTH_SHORT)
.show();
} }
}); });
holder.dragView.setOnTouchListener((view, event) -> { holder.dragView.setOnTouchListener(
(view, event) -> {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
touchHelper.startDrag(holder); touchHelper.startDrag(holder);
} }
return false; return false;
} });
);
} }
@Override @Override
@NonNull @NonNull
public CategoryInfoAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public CategoryInfoAdapter.ViewHolder onCreateViewHolder(
View view = LayoutInflater.from(parent.getContext()) @NonNull ViewGroup parent, int viewType) {
View view =
LayoutInflater.from(parent.getContext())
.inflate(R.layout.preference_dialog_library_categories_listitem, parent, false); .inflate(R.layout.preference_dialog_library_categories_listitem, parent, false);
return new ViewHolder(view); return new ViewHolder(view);
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter package code.name.monkey.retromusic.adapter
import android.app.Activity import android.app.Activity

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter package code.name.monkey.retromusic.adapter
import android.view.LayoutInflater import android.view.LayoutInflater

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter package code.name.monkey.retromusic.adapter
import android.view.LayoutInflater import android.view.LayoutInflater
@ -121,7 +135,6 @@ class HomeAdapter(
viewHolder.bind(home) viewHolder.bind(home)
} }
PLAYLISTS -> { PLAYLISTS -> {
} }
} }
} }
@ -181,7 +194,6 @@ class HomeAdapter(
.asBitmap() .asBitmap()
.build() .build()
.into(itemView.findViewById(id)) .into(itemView.findViewById(id))
} }
} }
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter package code.name.monkey.retromusic.adapter
import android.view.LayoutInflater import android.view.LayoutInflater

View File

@ -1,17 +1,16 @@
/* /*
* Copyright 2019 Google LLC * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the GNU General Public License v3
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* https://www.apache.org/licenses/LICENSE-2.0 * This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
package code.name.monkey.retromusic.adapter package code.name.monkey.retromusic.adapter
@ -33,11 +32,11 @@ import code.name.monkey.retromusic.util.RetroUtil
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.signature.MediaStoreSignature import com.bumptech.glide.signature.MediaStoreSignature
import me.zhanghai.android.fastscroll.PopupTextProvider
import java.io.File import java.io.File
import java.text.DecimalFormat import java.text.DecimalFormat
import kotlin.math.log10 import kotlin.math.log10
import kotlin.math.pow import kotlin.math.pow
import me.zhanghai.android.fastscroll.PopupTextProvider
class SongFileAdapter( class SongFileAdapter(
private val activity: AppCompatActivity, private val activity: AppCompatActivity,
@ -148,7 +147,6 @@ class SongFileAdapter(
return MusicUtil.getSectionName(dataSet[position].name) return MusicUtil.getSectionName(dataSet[position].name)
} }
inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) { inner class ViewHolder(itemView: View) : MediaEntryViewHolder(itemView) {
init { init {

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter package code.name.monkey.retromusic.adapter
import android.app.Activity import android.app.Activity

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.album package code.name.monkey.retromusic.adapter.album
import android.content.res.ColorStateList import android.content.res.ColorStateList
@ -129,7 +143,8 @@ open class AlbumAdapter(
} }
override fun onMultipleItemAction( override fun onMultipleItemAction(
menuItem: MenuItem, selection: List<Album> menuItem: MenuItem,
selection: List<Album>
) { ) {
SongsMenuHelper.handleMenuClick(activity, getSongList(selection), menuItem.itemId) SongsMenuHelper.handleMenuClick(activity, getSongList(selection), menuItem.itemId)
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.album package code.name.monkey.retromusic.adapter.album
import android.content.Intent import android.content.Intent
@ -205,4 +219,3 @@ class AlbumCoverPagerAdapter(
val TAG: String = AlbumCoverPagerAdapter::class.java.simpleName val TAG: String = AlbumCoverPagerAdapter::class.java.simpleName
} }
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.album package code.name.monkey.retromusic.adapter.album
import android.view.View import android.view.View

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.artist package code.name.monkey.retromusic.adapter.artist
import android.content.res.ColorStateList import android.content.res.ColorStateList
@ -22,8 +36,8 @@ import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import me.zhanghai.android.fastscroll.PopupTextProvider
import java.util.* import java.util.*
import me.zhanghai.android.fastscroll.PopupTextProvider
class ArtistAdapter( class ArtistAdapter(
val activity: FragmentActivity, val activity: FragmentActivity,
@ -107,7 +121,8 @@ class ArtistAdapter(
} }
override fun onMultipleItemAction( override fun onMultipleItemAction(
menuItem: MenuItem, selection: List<Artist> menuItem: MenuItem,
selection: List<Artist>
) { ) {
SongsMenuHelper.handleMenuClick(activity, getSongList(selection), menuItem.itemId) SongsMenuHelper.handleMenuClick(activity, getSongList(selection), menuItem.itemId)
} }

View File

@ -3,32 +3,27 @@ package code.name.monkey.retromusic.adapter.base;
import android.content.Context; import android.content.Context;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import androidx.annotation.MenuRes; import androidx.annotation.MenuRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.interfaces.ICabHolder;
import com.afollestad.materialcab.MaterialCab; import com.afollestad.materialcab.MaterialCab;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import code.name.monkey.retromusic.R; public abstract class AbsMultiSelectAdapter<V extends RecyclerView.ViewHolder, I>
import code.name.monkey.retromusic.interfaces.ICabHolder; extends RecyclerView.Adapter<V> implements MaterialCab.Callback {
@Nullable private final ICabHolder ICabHolder;
public abstract class AbsMultiSelectAdapter<V extends RecyclerView.ViewHolder, I> extends RecyclerView.Adapter<V>
implements MaterialCab.Callback {
@Nullable
private final ICabHolder ICabHolder;
private final Context context; private final Context context;
private MaterialCab cab; private MaterialCab cab;
private List<I> checked; private List<I> checked;
private int menuRes; private int menuRes;
public AbsMultiSelectAdapter(@NonNull Context context, @Nullable ICabHolder ICabHolder, @MenuRes int menuRes) { public AbsMultiSelectAdapter(
@NonNull Context context, @Nullable ICabHolder ICabHolder, @MenuRes int menuRes) {
this.ICabHolder = ICabHolder; this.ICabHolder = ICabHolder;
checked = new ArrayList<>(); checked = new ArrayList<>();
this.menuRes = menuRes; this.menuRes = menuRes;

View File

@ -19,69 +19,49 @@ import android.view.View;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import code.name.monkey.retromusic.R;
import com.google.android.material.card.MaterialCardView; import com.google.android.material.card.MaterialCardView;
import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractDraggableSwipeableItemViewHolder; import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractDraggableSwipeableItemViewHolder;
import code.name.monkey.retromusic.R;
public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHolder public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHolder
implements View.OnLongClickListener, View.OnClickListener { implements View.OnLongClickListener, View.OnClickListener {
@Nullable @Nullable public View dragView;
public View dragView;
@Nullable @Nullable public View dummyContainer;
public View dummyContainer;
@Nullable @Nullable public ImageView image;
public ImageView image;
@Nullable @Nullable public ImageView artistImage;
public ImageView artistImage;
@Nullable @Nullable public ImageView playerImage;
public ImageView playerImage;
@Nullable @Nullable public MaterialCardView imageContainerCard;
public MaterialCardView imageContainerCard;
@Nullable @Nullable public TextView imageText;
public TextView imageText;
@Nullable @Nullable public MaterialCardView imageTextContainer;
public MaterialCardView imageTextContainer;
@Nullable @Nullable public View mask;
public View mask;
@Nullable @Nullable public View menu;
public View menu;
@Nullable @Nullable public View paletteColorContainer;
public View paletteColorContainer;
@Nullable @Nullable public ImageButton playSongs;
public ImageButton playSongs;
@Nullable @Nullable public RecyclerView recyclerView;
public RecyclerView recyclerView;
@Nullable @Nullable public TextView text;
public TextView text;
@Nullable @Nullable public TextView text2;
public TextView text2;
@Nullable @Nullable public TextView time;
public TextView time;
@Nullable @Nullable public TextView title;
public TextView title;
public MediaEntryViewHolder(@NonNull View itemView) { public MediaEntryViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
@ -120,9 +100,7 @@ public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHold
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {}
}
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.playlist package code.name.monkey.retromusic.adapter.playlist
import android.view.LayoutInflater import android.view.LayoutInflater

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.playlist package code.name.monkey.retromusic.adapter.playlist
import android.graphics.Bitmap import android.graphics.Bitmap
@ -56,7 +70,7 @@ class PlaylistAdapter(
} }
override fun getItemId(position: Int): Long { override fun getItemId(position: Int): Long {
return dataSet[position].playlistEntity.playListId.toLong() return dataSet[position].playlistEntity.playListId
} }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.song package code.name.monkey.retromusic.adapter.song
import android.view.LayoutInflater import android.view.LayoutInflater

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.song package code.name.monkey.retromusic.adapter.song
import android.view.MenuItem import android.view.MenuItem

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.song package code.name.monkey.retromusic.adapter.song
import android.view.MenuItem import android.view.MenuItem

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.song package code.name.monkey.retromusic.adapter.song
import android.view.MenuItem import android.view.MenuItem

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.song package code.name.monkey.retromusic.adapter.song
import android.view.View import android.view.View

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.song package code.name.monkey.retromusic.adapter.song
import android.view.LayoutInflater import android.view.LayoutInflater

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.adapter.song package code.name.monkey.retromusic.adapter.song
import android.content.res.ColorStateList import android.content.res.ColorStateList

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appshortcuts package code.name.monkey.retromusic.appshortcuts
import android.content.Context import android.content.Context
@ -60,7 +60,10 @@ object AppShortcutIconGenerator {
} }
private fun generateThemedIcon( private fun generateThemedIcon(
context: Context, iconId: Int, foregroundColor: Int, backgroundColor: Int context: Context,
iconId: Int,
foregroundColor: Int,
backgroundColor: Int
): Icon { ): Icon {
// Get and tint foreground and background drawables // Get and tint foreground and background drawables
val vectorDrawable = RetroUtil.getTintedVectorDrawable(context, iconId, foregroundColor) val vectorDrawable = RetroUtil.getTintedVectorDrawable(context, iconId, foregroundColor)

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appshortcuts package code.name.monkey.retromusic.appshortcuts
import android.app.Activity import android.app.Activity

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appshortcuts package code.name.monkey.retromusic.appshortcuts
import android.annotation.TargetApi import android.annotation.TargetApi

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appshortcuts.shortcuttype package code.name.monkey.retromusic.appshortcuts.shortcuttype
import android.annotation.TargetApi import android.annotation.TargetApi

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appshortcuts.shortcuttype package code.name.monkey.retromusic.appshortcuts.shortcuttype
import android.annotation.TargetApi import android.annotation.TargetApi

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appshortcuts.shortcuttype package code.name.monkey.retromusic.appshortcuts.shortcuttype
import android.annotation.TargetApi import android.annotation.TargetApi

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appshortcuts.shortcuttype package code.name.monkey.retromusic.appshortcuts.shortcuttype
import android.annotation.TargetApi import android.annotation.TargetApi

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appwidgets package code.name.monkey.retromusic.appwidgets
import android.app.PendingIntent import android.app.PendingIntent
@ -229,6 +229,5 @@ class AppWidgetBig : BaseAppWidget() {
} }
return mInstance!! return mInstance!!
} }
} }
} }

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appwidgets package code.name.monkey.retromusic.appwidgets
import android.app.PendingIntent import android.app.PendingIntent

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appwidgets package code.name.monkey.retromusic.appwidgets
import android.app.PendingIntent import android.app.PendingIntent
@ -49,7 +49,6 @@ class AppWidgetClassic : BaseAppWidget() {
override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) { override fun defaultAppWidget(context: Context, appWidgetIds: IntArray) {
val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_classic) val appWidgetView = RemoteViews(context.packageName, R.layout.app_widget_classic)
appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE) appWidgetView.setViewVisibility(R.id.media_titles, View.INVISIBLE)
appWidgetView.setImageViewResource(R.id.image, R.drawable.default_audio_art) appWidgetView.setImageViewResource(R.id.image, R.drawable.default_audio_art)
appWidgetView.setImageViewBitmap( appWidgetView.setImageViewBitmap(

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appwidgets package code.name.monkey.retromusic.appwidgets
import android.app.PendingIntent import android.app.PendingIntent

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appwidgets package code.name.monkey.retromusic.appwidgets
import android.app.PendingIntent import android.app.PendingIntent
@ -153,10 +153,7 @@ class AppWidgetText : BaseAppWidget() {
) )
) )
pushUpdate(service.applicationContext, appWidgetIds, appWidgetView) pushUpdate(service.applicationContext, appWidgetIds, appWidgetView)
} }
companion object { companion object {

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appwidgets package code.name.monkey.retromusic.appwidgets
import android.appwidget.AppWidgetManager import android.appwidget.AppWidgetManager

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.appwidgets.base package code.name.monkey.retromusic.appwidgets.base
import android.app.PendingIntent import android.app.PendingIntent
@ -40,7 +40,9 @@ abstract class BaseAppWidget : AppWidgetProvider() {
* {@inheritDoc} * {@inheritDoc}
*/ */
override fun onUpdate( override fun onUpdate(
context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray context: Context,
appWidgetManager: AppWidgetManager,
appWidgetIds: IntArray
) { ) {
defaultAppWidget(context, appWidgetIds) defaultAppWidget(context, appWidgetIds)
val updateIntent = Intent(APP_WIDGET_UPDATE) val updateIntent = Intent(APP_WIDGET_UPDATE)
@ -62,7 +64,9 @@ abstract class BaseAppWidget : AppWidgetProvider() {
} }
protected fun pushUpdate( protected fun pushUpdate(
context: Context, appWidgetIds: IntArray?, views: RemoteViews context: Context,
appWidgetIds: IntArray?,
views: RemoteViews
) { ) {
val appWidgetManager = AppWidgetManager.getInstance(context) val appWidgetManager = AppWidgetManager.getInstance(context)
if (appWidgetIds != null) { if (appWidgetIds != null) {
@ -86,7 +90,9 @@ abstract class BaseAppWidget : AppWidgetProvider() {
} }
protected fun buildPendingIntent( protected fun buildPendingIntent(
context: Context, action: String, serviceName: ComponentName context: Context,
action: String,
serviceName: ComponentName
): PendingIntent { ): PendingIntent {
val intent = Intent(action) val intent = Intent(action)
intent.component = serviceName intent.component = serviceName
@ -169,7 +175,11 @@ abstract class BaseAppWidget : AppWidgetProvider() {
} }
protected fun composeRoundedRectPath( protected fun composeRoundedRectPath(
rect: RectF, tl: Float, tr: Float, bl: Float, br: Float rect: RectF,
tl: Float,
tr: Float,
bl: Float,
br: Float
): Path { ): Path {
val path = Path() val path = Path()
path.moveTo(rect.left + tl, rect.top) path.moveTo(rect.left + tl, rect.top)

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import androidx.room.* import androidx.room.*

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import androidx.room.Entity import androidx.room.Entity

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import androidx.room.ColumnInfo import androidx.room.ColumnInfo

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import androidx.room.* import androidx.room.*

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import androidx.room.Entity import androidx.room.Entity

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import androidx.room.* import androidx.room.*

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import androidx.room.ColumnInfo import androidx.room.ColumnInfo

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
@ -45,12 +59,9 @@ interface PlaylistDao {
@Delete @Delete
suspend fun deletePlaylistSongs(songs: List<SongEntity>) suspend fun deletePlaylistSongs(songs: List<SongEntity>)
@Query("SELECT * FROM SongEntity WHERE playlist_creator_id= :playlistId") @Query("SELECT * FROM SongEntity WHERE playlist_creator_id= :playlistId")
fun favoritesSongsLiveData(playlistId: Long): LiveData<List<SongEntity>> fun favoritesSongsLiveData(playlistId: Long): LiveData<List<SongEntity>>
@Query("SELECT * FROM SongEntity WHERE playlist_creator_id= :playlistId") @Query("SELECT * FROM SongEntity WHERE playlist_creator_id= :playlistId")
fun favoritesSongs(playlistId: Long): List<SongEntity> fun favoritesSongs(playlistId: Long): List<SongEntity>
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import android.os.Parcelable import android.os.Parcelable

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import android.os.Parcelable import android.os.Parcelable
@ -14,4 +28,3 @@ data class PlaylistWithSongs(
) )
val songs: List<SongEntity> val songs: List<SongEntity>
) : Parcelable ) : Parcelable

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import androidx.room.Database import androidx.room.Database

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import android.os.Parcelable import android.os.Parcelable
@ -36,4 +50,3 @@ class SongEntity(
@ColumnInfo(name = "album_artist") @ColumnInfo(name = "album_artist")
val albumArtist: String? val albumArtist: String?
) : Parcelable ) : Parcelable

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.db package code.name.monkey.retromusic.db
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
@ -137,4 +151,3 @@ fun List<Song>.toSongsEntity(playlistEntity: PlaylistEntity): List<SongEntity> {
it.toSongEntity(playlistEntity.playListId) it.toSongEntity(playlistEntity.playListId)
} }
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.app.Dialog import android.app.Dialog
@ -47,7 +61,6 @@ class AddToPlaylistDialog : DialogFragment() {
return adapter return adapter
} }
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val playlistEntities = extraNotNull<List<PlaylistEntity>>(EXTRA_PLAYLISTS).value val playlistEntities = extraNotNull<List<PlaylistEntity>>(EXTRA_PLAYLISTS).value
val songs = extraNotNull<List<Song>>(EXTRA_SONG).value val songs = extraNotNull<List<Song>>(EXTRA_SONG).value

View File

@ -7,22 +7,19 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import code.name.monkey.retromusic.R;
import com.afollestad.materialdialogs.MaterialDialog; import com.afollestad.materialdialogs.MaterialDialog;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import code.name.monkey.retromusic.R; public class BlacklistFolderChooserDialog extends DialogFragment
implements MaterialDialog.ListCallback {
public class BlacklistFolderChooserDialog extends DialogFragment implements MaterialDialog.ListCallback {
String initialPath = Environment.getExternalStorageDirectory().getAbsolutePath(); String initialPath = Environment.getExternalStorageDirectory().getAbsolutePath();
private File parentFolder; private File parentFolder;
@ -88,12 +85,14 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate
parentFolder = new File(savedInstanceState.getString("current_path", File.pathSeparator)); parentFolder = new File(savedInstanceState.getString("current_path", File.pathSeparator));
checkIfCanGoUp(); checkIfCanGoUp();
parentContents = listFiles(); parentContents = listFiles();
MaterialDialog.Builder builder = new MaterialDialog.Builder(requireContext()) MaterialDialog.Builder builder =
new MaterialDialog.Builder(requireContext())
.title(parentFolder.getAbsolutePath()) .title(parentFolder.getAbsolutePath())
.items((CharSequence[]) getContentsArray()) .items((CharSequence[]) getContentsArray())
.itemsCallback(this) .itemsCallback(this)
.autoDismiss(false) .autoDismiss(false)
.onPositive((dialog, which) -> { .onPositive(
(dialog, which) -> {
callback.onFolderSelection(BlacklistFolderChooserDialog.this, parentFolder); callback.onFolderSelection(BlacklistFolderChooserDialog.this, parentFolder);
dismiss(); dismiss();
}) })

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.app.Dialog import android.app.Dialog

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.app.Dialog import android.app.Dialog
@ -65,5 +79,4 @@ class DeletePlaylistDialog : DialogFragment() {
.create() .create()
.colorButtons() .colorButtons()
} }
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.app.Dialog import android.app.Dialog

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.app.Dialog import android.app.Dialog

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.app.Dialog import android.app.Dialog

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.app.Dialog import android.app.Dialog

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.app.Dialog import android.app.Dialog
@ -19,7 +33,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
class SavePlaylistDialog : DialogFragment() { class SavePlaylistDialog : DialogFragment() {
companion object { companion object {
fun create(playlistWithSongs: PlaylistWithSongs): SavePlaylistDialog { fun create(playlistWithSongs: PlaylistWithSongs): SavePlaylistDialog {
@ -41,7 +54,6 @@ class SavePlaylistDialog : DialogFragment() {
arrayOf<String>(file.path), arrayOf<String>(file.path),
null null
) { _, _ -> ) { _, _ ->
} }
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
Toast.makeText( Toast.makeText(

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.annotation.SuppressLint import android.annotation.SuppressLint
@ -130,7 +130,6 @@ class SleepTimerDialog : DialogFragment() {
} }
.create() .create()
.colorButtons() .colorButtons()
} }
private fun updateTimeDisplayTime() { private fun updateTimeDisplayTime() {

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.annotation.SuppressLint import android.annotation.SuppressLint
@ -31,13 +31,13 @@ import code.name.monkey.retromusic.extensions.colorButtons
import code.name.monkey.retromusic.extensions.materialDialog import code.name.monkey.retromusic.extensions.materialDialog
import code.name.monkey.retromusic.model.Song import code.name.monkey.retromusic.model.Song
import code.name.monkey.retromusic.util.MusicUtil import code.name.monkey.retromusic.util.MusicUtil
import java.io.File
import java.io.IOException
import org.jaudiotagger.audio.AudioFileIO import org.jaudiotagger.audio.AudioFileIO
import org.jaudiotagger.audio.exceptions.CannotReadException import org.jaudiotagger.audio.exceptions.CannotReadException
import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException
import org.jaudiotagger.audio.exceptions.ReadOnlyFileException import org.jaudiotagger.audio.exceptions.ReadOnlyFileException
import org.jaudiotagger.tag.TagException import org.jaudiotagger.tag.TagException
import java.io.File
import java.io.IOException
class SongDetailDialog : DialogFragment() { class SongDetailDialog : DialogFragment() {

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.dialogs package code.name.monkey.retromusic.dialogs
import android.app.Dialog import android.app.Dialog

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.extensions package code.name.monkey.retromusic.extensions
import android.app.Activity import android.app.Activity

View File

@ -1,17 +1,17 @@
/* /*
* Copyright (c) 2019 Hemanth Savarala. * Copyright (c) 2020 Hemanth Savarla.
* *
* Licensed under the GNU General Public License v3 * Licensed under the GNU General Public License v3
* *
* This is free software: you can redistribute it and/or modify it under * This is free software: you can redistribute it and/or modify it
* the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by
* the Free Software Foundation either version 3 of the License, or (at your option) any later version. * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. * See the GNU General Public License for more details.
*
*/ */
package code.name.monkey.retromusic.extensions package code.name.monkey.retromusic.extensions
import android.app.Dialog import android.app.Dialog
@ -180,7 +180,6 @@ fun ProgressIndicator.applyColor(color: Int) {
} }
fun TextInputEditText.accentColor() { fun TextInputEditText.accentColor() {
} }
fun AppCompatImageView.accentColor(): Int { fun AppCompatImageView.accentColor(): Int {
@ -203,4 +202,3 @@ fun Drawable.tint(context: Context, @ColorRes color: Int): Drawable {
fun Context.getColorCompat(@ColorRes colorRes: Int): Int { fun Context.getColorCompat(@ColorRes colorRes: Int): Int {
return ContextCompat.getColor(this, colorRes) return ContextCompat.getColor(this, colorRes)
} }

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.extensions package code.name.monkey.retromusic.extensions
import android.database.Cursor import android.database.Cursor

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.extensions package code.name.monkey.retromusic.extensions
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog

View File

@ -1,3 +1,17 @@
/*
* Copyright (c) 2020 Hemanth Savarla.
*
* Licensed under the GNU General Public License v3
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
package code.name.monkey.retromusic.extensions package code.name.monkey.retromusic.extensions
import android.app.Activity import android.app.Activity

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