diff --git a/app/build.gradle b/app/build.gradle index e905956b2..5b9ac190c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,20 +1,3 @@ -// TODO: Remove comment marks to enable -/* -buildscript { - repositories { - google() - mavenCentral() - gradlePluginPortal() - } - - dependencies { - classpath Plugins.oneSignal - } -} - -apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin' -*/ - apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-parcelize' @@ -97,12 +80,12 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '11' } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c2132f165..a940e351f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,9 +8,11 @@ + android:exported="true" + android:label="@string/app_name"> @@ -253,13 +255,6 @@ android:value="dev.jahir.kuper.ui.activities.KuperMuzeiSettingsActivity" /> - - false - - - - @string/app_name - Cool widgets. - Your name - - - 1 - - - @mipmap/ic_launcher - - - false - - - @string/app_name Cool Kustom komponents, wallpapers and widgets. - \ No newline at end of file + diff --git a/app/src/main/res/values/supported_launchers.xml b/app/src/main/res/values/supported_launchers.xml index e5e9ee453..791038c0b 100644 --- a/app/src/main/res/values/supported_launchers.xml +++ b/app/src/main/res/values/supported_launchers.xml @@ -14,6 +14,7 @@ lawnchair lineageos lucid + moto niagara nova oneplus @@ -25,4 +26,4 @@ square tsf - \ No newline at end of file + diff --git a/buildSrc/src/main/java/Blueprint.kt b/buildSrc/src/main/java/Blueprint.kt index 9a49cf821..edd2ed798 100644 --- a/buildSrc/src/main/java/Blueprint.kt +++ b/buildSrc/src/main/java/Blueprint.kt @@ -2,6 +2,6 @@ object Blueprint { const val appId = "dev.jahir.blueprint.app" - const val version = 230 - const val versionName = "2.3.0" + const val version = 234 + const val versionName = "2.3.4" } diff --git a/buildSrc/src/main/java/Plugins.kt b/buildSrc/src/main/java/Plugins.kt index a2cad5f46..a440687fb 100644 --- a/buildSrc/src/main/java/Plugins.kt +++ b/buildSrc/src/main/java/Plugins.kt @@ -7,10 +7,6 @@ object Plugins { // Kotlin const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}" - // OneSignal - const val oneSignal = - "gradle.plugin.com.onesignal:onesignal-gradle-plugin:${Versions.oneSignalPlugin}" - // Sonatype const val sonatype = "io.github.gradle-nexus:publish-plugin:${Versions.sonatype}" diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index 2be07c172..831ac0fb7 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -2,22 +2,21 @@ object Versions { // Plugins - const val gradle = "7.2.1" - const val kotlin = "1.7.0" + const val gradle = "7.4.1" + const val kotlin = "1.8.0" const val sonatype = "1.1.0" - const val ksp = "$kotlin-1.0.6" + const val ksp = "$kotlin-1.0.9" // OneSignal - const val oneSignalPlugin = "0.14.0" - const val oneSignal = "4.8.1" + const val oneSignal = "4.8.4" // App const val minSdk = 21 - const val targetSdk = 32 - const val buildTools = "32.0.0" + const val targetSdk = 33 + const val buildTools = "33.0.2" // Kuper - const val kuper = "2.4.0" + const val kuper = "2.4.4" // Adaptive Icons const val adaptiveIcons = "1.0.0" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7c258dce9..4b61ff163 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Sun Jul 24 22:47:34 CEST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/library/build.gradle b/library/build.gradle index 8d571cad5..509eb47b2 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -4,6 +4,7 @@ apply plugin: 'kotlin-parcelize' apply plugin: 'com.google.devtools.ksp' android { + namespace 'dev.jahir.blueprint' compileSdkVersion Versions.targetSdk buildToolsVersion Versions.buildTools @@ -64,12 +65,12 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '11' } } diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml index 69183516f..003506ecc 100644 --- a/library/src/main/AndroidManifest.xml +++ b/library/src/main/AndroidManifest.xml @@ -4,8 +4,10 @@ @@ -57,6 +59,14 @@ + + + + + + + + diff --git a/library/src/main/kotlin/dev/jahir/blueprint/data/BlueprintPreferences.kt b/library/src/main/kotlin/dev/jahir/blueprint/data/BlueprintPreferences.kt index 60cb4b2bc..e8e5dfd23 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/data/BlueprintPreferences.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/data/BlueprintPreferences.kt @@ -17,9 +17,14 @@ class BlueprintPreferences(context: Context) : Preferences(context) { get() = prefs.getInt(ICON_SHAPE, 0) set(value) = prefsEditor.putInt(ICON_SHAPE, value).apply() + var iconsRequestConsentAccepted: Boolean + get() = prefs.getBoolean(ICONS_REQUEST_CONSENT_ACCEPTED, false) + set(value) = prefsEditor.putBoolean(ICONS_REQUEST_CONSENT_ACCEPTED, value).apply() + companion object { private const val KEY_SAVED_TIME_MILLIS = "saved_time_millis" private const val MAX_APPS = "apps_to_request" private const val ICON_SHAPE = "icon_shape" + private const val ICONS_REQUEST_CONSENT_ACCEPTED = "icons_request_consent_accepted" } -} \ No newline at end of file +} diff --git a/library/src/main/kotlin/dev/jahir/blueprint/data/models/Counter.kt b/library/src/main/kotlin/dev/jahir/blueprint/data/models/Counter.kt index 83f7517da..8bb964791 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/data/models/Counter.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/data/models/Counter.kt @@ -14,6 +14,3 @@ data class WallpapersCounter(override val count: Int = 0) : data class KustomCounter(override val count: Int = 0) : Counter(R.string.templates, R.drawable.ic_kustom, count) - -data class ZooperCounter(override val count: Int = 0) : - Counter(R.string.templates, R.drawable.ic_zooper, count) \ No newline at end of file diff --git a/library/src/main/kotlin/dev/jahir/blueprint/data/models/Icon.kt b/library/src/main/kotlin/dev/jahir/blueprint/data/models/Icon.kt index 322ba9729..c4f1b61b9 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/data/models/Icon.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/data/models/Icon.kt @@ -12,9 +12,9 @@ data class Icon(val name: String, @DrawableRes val resId: Int) : Parcelable, Com parcelIn.readInt() ) - override fun writeToParcel(dest: Parcel?, flags: Int) { - dest?.writeString(name) - dest?.writeInt(resId) + override fun writeToParcel(dest: Parcel, flags: Int) { + dest.writeString(name) + dest.writeInt(resId) } override fun describeContents(): Int = 0 @@ -24,4 +24,4 @@ data class Icon(val name: String, @DrawableRes val resId: Int) : Parcelable, Com @JvmField val CREATOR: Parcelable.Creator = createParcel { Icon(it) } } -} \ No newline at end of file +} diff --git a/library/src/main/kotlin/dev/jahir/blueprint/data/models/IconsCategory.kt b/library/src/main/kotlin/dev/jahir/blueprint/data/models/IconsCategory.kt index 991294d60..1d8446c29 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/data/models/IconsCategory.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/data/models/IconsCategory.kt @@ -22,9 +22,9 @@ data class IconsCategory( ArrayList().apply { parcelIn.readTypedList(this, Icon.CREATOR) } ) - override fun writeToParcel(dest: Parcel?, flags: Int) { - dest?.writeString(title) - dest?.writeTypedList(icons) + override fun writeToParcel(dest: Parcel, flags: Int) { + dest.writeString(title) + dest.writeTypedList(icons) } override fun describeContents(): Int = 0 @@ -54,4 +54,4 @@ data class IconsCategory( val subList = icons.subList(0, maxSize) return ArrayList(if (shuffle) subList.shuffled() else subList) } -} \ No newline at end of file +} diff --git a/library/src/main/kotlin/dev/jahir/blueprint/data/models/Launcher.kt b/library/src/main/kotlin/dev/jahir/blueprint/data/models/Launcher.kt index 2ffccbed4..c76dd237d 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/data/models/Launcher.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/data/models/Launcher.kt @@ -48,7 +48,8 @@ enum class Launcher( "ch.deletescape.lawnchair.plah", "ch.deletescape.lawnchair", "ch.deletescape.lawnchair.ci", - "ch.deletescape.lawnchair.dev" + "ch.deletescape.lawnchair.dev", + "app.lawnchair" ), R.drawable.ic_lawnchair ), @@ -63,11 +64,13 @@ enum class Launcher( R.drawable.ic_lineageos_theme_engine ), LUCID("lucid", "Lucid Launcher", arrayOf("com.powerpoint45.launcher"), R.drawable.ic_lucid), - MOTO("moto", "Moto Launcher", arrayOf( - "com.motorola.launcher3", - "com.motorola.personalize", - "com.motorola.moto.overlay.personalizelauncher", - ), R.drawable.ic_moto), + MOTO( + "moto", "Moto Launcher", arrayOf( + "com.motorola.launcher3", + "com.motorola.personalize", + "com.motorola.moto.overlay.personalizelauncher", + ), R.drawable.ic_moto + ), NIAGARA("niagara", "Niagara Launcher", arrayOf("bitpit.launcher"), R.drawable.ic_niagara), NOVA("nova", "Nova Launcher", arrayOf("com.teslacoilsw.launcher"), R.drawable.ic_nova), ONEPLUS("oneplus", "OnePlus Launcher", arrayOf("net.oneplus.launcher"), R.drawable.ic_oneplus), @@ -119,4 +122,4 @@ enum class Launcher( return ArrayList(pairs) } } -} \ No newline at end of file +} diff --git a/library/src/main/kotlin/dev/jahir/blueprint/data/models/RequestManagerResponse.kt b/library/src/main/kotlin/dev/jahir/blueprint/data/models/RequestManagerResponse.kt index 089957238..4774b8bbf 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/data/models/RequestManagerResponse.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/data/models/RequestManagerResponse.kt @@ -4,4 +4,5 @@ import android.os.Parcelable import kotlinx.parcelize.Parcelize @Parcelize -data class RequestManagerResponse(val status: String? = null, val message: String? = null) : Parcelable +data class RequestManagerResponse(val status: String? = null, val message: String? = null) : + Parcelable diff --git a/library/src/main/kotlin/dev/jahir/blueprint/data/requests/RequestCallback.kt b/library/src/main/kotlin/dev/jahir/blueprint/data/requests/RequestCallback.kt index 2d0d41502..1704ca885 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/data/requests/RequestCallback.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/data/requests/RequestCallback.kt @@ -4,24 +4,14 @@ import android.content.Intent import android.util.Log interface RequestCallback { - fun onRequestRunning() { - Log.d("Blueprint", "Request in progress!") - } - - fun onRequestStarted() { - Log.d("Blueprint", "Request started!") - } - - fun onRequestUploadFinished(success: Boolean) { - Log.d("Blueprint", "Request finished! - Success? $success") - } - - fun onRequestEmpty() { - Log.w("Blueprint", "Nothing to request") - } + fun onRequestRunning() {} + fun onRequestStarted() {} + fun onRequestUploadFinished(success: Boolean) {} + fun onRequestEmpty() {} + fun onRequestEmailIntent(intent: Intent?) {} fun onRequestError(reason: String? = null, e: Throwable? = null) { - Log.e("Blueprint", "Request ERROR") + e?.printStackTrace() } fun onRequestLimited(state: RequestState, building: Boolean = false) { @@ -30,8 +20,4 @@ interface RequestCallback { "Request limited (${state.state.name})! Apps left: ${state.requestsLeft} - Time left: ${state.timeLeft}" ) } - - fun onRequestEmailIntent(intent: Intent?) { - Log.d("Blueprint", "Should send request via email!") - } -} \ No newline at end of file +} diff --git a/library/src/main/kotlin/dev/jahir/blueprint/data/requests/SendIconRequest.kt b/library/src/main/kotlin/dev/jahir/blueprint/data/requests/SendIconRequest.kt index d49d7db4f..246cfbae5 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/data/requests/SendIconRequest.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/data/requests/SendIconRequest.kt @@ -28,9 +28,10 @@ import dev.jahir.frames.extensions.resources.hasContent import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import okhttp3.MediaType +import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.MultipartBody import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.asRequestBody import retrofit2.HttpException import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory @@ -102,7 +103,7 @@ object SendIconRequest { it.delete() } } - } catch (e: Exception) { + } catch (_: Exception) { } } @@ -265,7 +266,8 @@ object SendIconRequest { val date = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date()).clean() - val (textFiles, jsonContent) = buildTextFiles(context, correctList, date, uploadToRequestManager) + val (textFiles, jsonContent) = + buildTextFiles(context, correctList, date, uploadToRequestManager) emailZipFiles.addAll(textFiles) val zipFile = buildZipFile(date, requestLocation, emailZipFiles) @@ -282,8 +284,9 @@ object SendIconRequest { return withContext(IO) { var fileType = URLConnection.guessContentTypeFromName(zipFile.name) if (fileType == null || !fileType.hasContent()) fileType = "application/zip" - val requestBody: RequestBody = RequestBody.create(MediaType.parse(fileType), zipFile) - val fileToUpload = MultipartBody.Part.createFormData("archive", zipFile.name, requestBody) + val requestBody: RequestBody = zipFile.asRequestBody(fileType.toMediaTypeOrNull()) + val fileToUpload = + MultipartBody.Part.createFormData("archive", zipFile.name, requestBody) var succeeded = false val message = try { getService(baseUrl).uploadRequest(apiKey, jsonContent, fileToUpload).let { @@ -372,12 +375,14 @@ object SendIconRequest { val apiKey = activity.string(R.string.request_manager_backend_api_key) val uploadToRequestManager = apiKey.hasContent() - val (zipFile, jsonContent) = zipFiles(activity, selectedApps, uploadToRequestManager) + val (zipFile, jsonContent) = + zipFiles(activity, selectedApps, uploadToRequestManager) cleanFiles(activity) if (uploadToRequestManager) { val baseUrl = activity.string(R.string.request_manager_base_url) - val (succeeded, message) = uploadToRequestManager(zipFile, jsonContent, apiKey, baseUrl) + val (succeeded, message) = + uploadToRequestManager(zipFile, jsonContent, apiKey, baseUrl) if (succeeded) theCallback.onRequestUploadFinished(true) else theCallback.onRequestError(message) @@ -389,9 +394,9 @@ object SendIconRequest { theCallback.onRequestLimited(state, true) requestInProgress = false } - } ?: { + } ?: run { theCallback.onRequestError() requestInProgress = false - }() + } } } diff --git a/library/src/main/kotlin/dev/jahir/blueprint/data/viewmodels/HomeViewModel.kt b/library/src/main/kotlin/dev/jahir/blueprint/data/viewmodels/HomeViewModel.kt index 13f0910ec..b5c076cb4 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/data/viewmodels/HomeViewModel.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/data/viewmodels/HomeViewModel.kt @@ -29,17 +29,14 @@ import kotlinx.coroutines.withContext class HomeViewModel(application: Application) : AndroidViewModel(application) { private val iconsPreviewData: MutableLiveData> by lazyMutableLiveData() - val iconsPreviewList: List + private val iconsPreviewList: List get() = iconsPreviewData.value.orEmpty() private val homeItemsData: MutableLiveData> by lazyMutableLiveData() - val homeItems: List - get() = homeItemsData.value.orEmpty() private val iconsCountData: MutableLiveData by lazyMutableLiveData() private val wallpapersCountData: MutableLiveData by lazyMutableLiveData() private val kustomCountData: MutableLiveData by lazyMutableLiveData() - private val zooperCountData: MutableLiveData by lazyMutableLiveData() fun loadPreviewIcons(force: Boolean = false) { if (iconsPreviewList.isEmpty() || force) { @@ -65,7 +62,8 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) { .distinctBy { it.url } .map { val isMarketUrl = it.url.lower().startsWith("market://details?id=") - val isAnApp = isMarketUrl || it.url.lower().startsWith(PLAY_STORE_LINK_PREFIX) + val isAnApp = + isMarketUrl || it.url.lower().startsWith(PLAY_STORE_LINK_PREFIX) var isInstalled = false var intent: Intent? = null if (isAnApp) { @@ -74,10 +72,14 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) { isInstalled = context.isAppInstalled(packageName) intent = context.packageManager.getLaunchIntentForPackage(packageName) - } catch (e: Exception) { + } catch (_: Exception) { } if (intent == null && isMarketUrl) { - intent = Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$packageName")) + intent = + Intent( + Intent.ACTION_VIEW, + Uri.parse("market://details?id=$packageName") + ) } } val openIcon = if (isAnApp) @@ -128,10 +130,6 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) { kustomCountData.postValue(count) } - fun postZooperCount(count: Int? = 0) { - zooperCountData.postValue(count) - } - private fun observeIconsCount(owner: LifecycleOwner, onUpdated: (Int) -> Unit) { onUpdated(iconsCountData.value ?: 0) iconsCountData.tryToObserve(owner, onUpdated) @@ -147,23 +145,16 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) { kustomCountData.tryToObserve(owner, onUpdated) } - private fun observeZooperCount(owner: LifecycleOwner, onUpdated: (Int) -> Unit) { - onUpdated(zooperCountData.value ?: 0) - zooperCountData.tryToObserve(owner, onUpdated) - } - fun observeCounters(owner: LifecycleOwner, fragment: HomeFragment? = null) { observeIconsCount(owner) { fragment?.updateIconsCount(it) } observeWallpapersCount(owner) { fragment?.updateWallpapersCount(it) } observeKustomCount(owner) { fragment?.updateKustomCount(it) } - observeZooperCount(owner) { fragment?.updateZooperCount(it) } } fun repostCounters() { iconsCountData.postValue(iconsCountData.value ?: 0) wallpapersCountData.postValue(wallpapersCountData.value ?: 0) kustomCountData.postValue(kustomCountData.value ?: 0) - zooperCountData.postValue(zooperCountData.value ?: 0) } fun destroy(owner: LifecycleOwner) { @@ -172,6 +163,5 @@ class HomeViewModel(application: Application) : AndroidViewModel(application) { iconsCountData.removeObservers(owner) wallpapersCountData.removeObservers(owner) kustomCountData.removeObservers(owner) - zooperCountData.removeObservers(owner) } -} \ No newline at end of file +} diff --git a/library/src/main/kotlin/dev/jahir/blueprint/data/viewmodels/RequestsViewModel.kt b/library/src/main/kotlin/dev/jahir/blueprint/data/viewmodels/RequestsViewModel.kt index 08ee107c6..50f7c7742 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/data/viewmodels/RequestsViewModel.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/data/viewmodels/RequestsViewModel.kt @@ -62,7 +62,8 @@ class RequestsViewModel(application: Application) : AndroidViewModel(application val drawable = parser.getAttributeValue(null, "drawable").orEmpty() if (component.hasContent() && !component.startsWith(":")) { - val actualComponent = component.substring(componentInfoPrefixLength, component.length - 1) + val actualComponent = + component.substring(componentInfoPrefixLength, component.length - 1) if (actualComponent.hasContent() && !actualComponent.startsWith("/") && !actualComponent.endsWith("/")) { if (debug) { diff --git a/library/src/main/kotlin/dev/jahir/blueprint/extensions/Email.kt b/library/src/main/kotlin/dev/jahir/blueprint/extensions/Email.kt index 5dff053a2..8aa263ba1 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/extensions/Email.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/extensions/Email.kt @@ -54,11 +54,7 @@ internal class EmailBuilder( context.packageManager.getInstallerPackageName(context.packageName) ?: "None" val deviceItems = mutableMapOf( - "OS Version" to "${ - System.getProperty( - "os.version" - ) - } (${Build.VERSION.INCREMENTAL})", + "OS Version" to "${System.getProperty("os.version")} (${Build.VERSION.INCREMENTAL})", "OS API Level" to Build.VERSION.SDK_INT, "Device (Manufacturer)" to "${Build.DEVICE} (${Build.MANUFACTURER})", "Model (Product)" to "${Build.MODEL} (${Build.PRODUCT})", @@ -98,7 +94,9 @@ internal class EmailBuilder( intent.putExtra(Intent.EXTRA_STREAM, attachment) } resultIntent = Intent.createChooser(intent, context.string(R.string.send_using)) - } ?: { context.toast(R.string.error) }() + } ?: run { + context.toast(R.string.error) + } return resultIntent } diff --git a/library/src/main/kotlin/dev/jahir/blueprint/extensions/Launchers.kt b/library/src/main/kotlin/dev/jahir/blueprint/extensions/Launchers.kt index ed7b73eda..699dcda8a 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/extensions/Launchers.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/extensions/Launchers.kt @@ -8,6 +8,7 @@ import dev.jahir.blueprint.R import dev.jahir.blueprint.data.models.Launcher import dev.jahir.frames.extensions.context.getAppName import dev.jahir.frames.extensions.context.openLink +import dev.jahir.frames.extensions.context.string import dev.jahir.frames.extensions.fragments.mdDialog import dev.jahir.frames.extensions.fragments.message import dev.jahir.frames.extensions.fragments.negativeButton @@ -59,7 +60,7 @@ private fun Context.executeIconPacksNotSupportedIntent() { } negativeButton(android.R.string.cancel) }.show() - } catch (e: Exception) { + } catch (_: Exception) { } } @@ -73,31 +74,42 @@ internal fun Context.showLauncherNotInstalledDialog(launcher: Launcher) { } negativeButton(android.R.string.cancel) }.show() - } catch (e: Exception) { + } catch (_: Exception) { } } -private fun Context.showLauncherApplyError(customContent: String? = null) { +private fun Context.showLauncherApplyError( + launcher: Launcher? = null, + customContent: String? = null +) { try { mdDialog { title(R.string.error) - message(customContent ?: getString(R.string.coming_soon)) + message( + customContent ?: launcher?.cleanAppName?.let { + string(R.string.direct_apply_not_supported, it, getAppName()) + } ?: getString(R.string.coming_soon)) positiveButton(android.R.string.ok) }.show() - } catch (e: Exception) { + } catch (_: Exception) { } } -private fun Context.attemptApply(customContent: String? = null, intent: (() -> Intent?)? = null) { +private fun Context.attemptApply( + launcher: Launcher?, + customContent: String? = null, + intent: (() -> Intent?)? = null +) { try { - intent?.invoke()?.let { startActivity(it) } ?: showLauncherApplyError(customContent) + intent?.invoke()?.let { startActivity(it) } + ?: showLauncherApplyError(launcher, customContent) } catch (e: Exception) { - showLauncherApplyError(customContent) + showLauncherApplyError(launcher, customContent) } } private fun Context.executeActionLauncherIntent() { - attemptApply { + attemptApply(Launcher.ACTION) { packageManager .getLaunchIntentForPackage("com.actionlauncher.playstore")?.apply { putExtra("apply_icon_pack", packageName) @@ -106,7 +118,7 @@ private fun Context.executeActionLauncherIntent() { } private fun Context.executeAdwLauncherIntent() { - attemptApply { + attemptApply(Launcher.ADW) { Intent("org.adw.launcher.SET_THEME").apply { putExtra("org.adw.launcher.theme.NAME", packageName) addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) @@ -115,7 +127,7 @@ private fun Context.executeAdwLauncherIntent() { } private fun Context.executeAdwEXLauncherIntent() { - attemptApply { + attemptApply(Launcher.ADW_EX) { Intent("org.adwfreak.launcher.SET_THEME").apply { putExtra("org.adwfreak.launcher.theme.NAME", packageName) addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) @@ -124,7 +136,7 @@ private fun Context.executeAdwEXLauncherIntent() { } private fun Context.executeApexLauncherIntent() { - attemptApply { + attemptApply(Launcher.APEX) { Intent("com.anddoes.launcher.SET_THEME").apply { putExtra("com.anddoes.launcher.THEME_PACKAGE_NAME", packageName) addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) @@ -133,7 +145,7 @@ private fun Context.executeApexLauncherIntent() { } private fun Context.executeGoLauncherIntent() { - attemptApply { + attemptApply(Launcher.GO) { packageManager.getLaunchIntentForPackage("com.gau.go.launcherex").also { val go = Intent("com.gau.go.launcherex.MyThemes.mythemeaction") go.putExtra("type", 1) @@ -144,7 +156,7 @@ private fun Context.executeGoLauncherIntent() { } private fun Context.executeHoloLauncherIntent() { - attemptApply { + attemptApply(Launcher.HOLO) { Intent(Intent.ACTION_MAIN).apply { component = ComponentName("com.mobint.hololauncher", "com.mobint.hololauncher.Settings") } @@ -152,7 +164,7 @@ private fun Context.executeHoloLauncherIntent() { } private fun Context.executeHoloLauncherICSIntent() { - attemptApply { + attemptApply(Launcher.HOLO_ICS) { Intent(Intent.ACTION_MAIN).apply { component = ComponentName( "com.mobint.hololauncher.hd", "com.mobint.hololauncher.SettingsActivity" @@ -162,7 +174,7 @@ private fun Context.executeHoloLauncherICSIntent() { } private fun Context.executeLgHomeLauncherIntent() { - attemptApply { + attemptApply(Launcher.LG_HOME) { Intent(Intent.ACTION_MAIN).apply { component = ComponentName( "com.lge.launcher2", @@ -173,7 +185,7 @@ private fun Context.executeLgHomeLauncherIntent() { } private fun Context.executeLawnchairIntent() { - attemptApply { + attemptApply(Launcher.LAWNCHAIR) { Intent("ch.deletescape.lawnchair.APPLY_ICONS", null).apply { putExtra("packageName", packageName) } @@ -186,6 +198,7 @@ private fun Context.executeLineageOSThemeEngineIntent() { isAppInstalled("com.cyngn.theme.chooser") attemptApply( + Launcher.LINEAGE_OS, if (themesAppInstalled) getString(R.string.impossible_open_themes) else getString(R.string.themes_app_not_installed) ) { @@ -217,7 +230,7 @@ private fun Context.executeLineageOSThemeEngineIntent() { } private fun Context.executeLucidLauncherIntent() { - attemptApply { + attemptApply(Launcher.LUCID) { Intent("com.powerpoint45.action.APPLY_THEME", null).apply { putExtra("icontheme", packageName) } @@ -225,7 +238,7 @@ private fun Context.executeLucidLauncherIntent() { } private fun Context.executeNiagaraLauncherIntent() { - attemptApply { + attemptApply(Launcher.NIAGARA) { Intent("bitpit.launcher.APPLY_ICONS").apply { `package` = "bitpit.launcher" putExtra("packageName", packageName) @@ -234,7 +247,7 @@ private fun Context.executeNiagaraLauncherIntent() { } private fun Context.executeNovaLauncherIntent() { - attemptApply { + attemptApply(Launcher.NOVA) { Intent("com.teslacoilsw.launcher.APPLY_ICON_THEME").apply { `package` = "com.teslacoilsw.launcher" putExtra("com.teslacoilsw.launcher.extra.ICON_THEME_TYPE", "GO") @@ -245,7 +258,7 @@ private fun Context.executeNovaLauncherIntent() { } private fun Context.executeOnePlusLauncherIntent() { - attemptApply { + attemptApply(Launcher.ONEPLUS) { Intent().apply { component = ComponentName( "net.oneplus.launcher", @@ -256,7 +269,7 @@ private fun Context.executeOnePlusLauncherIntent() { } private fun Context.executePosidonLauncherIntent() { - attemptApply { + attemptApply(Launcher.POSIDON) { Intent(Intent.ACTION_MAIN).apply { component = ComponentName("posidon.launcher", "posidon.launcher.external.ApplyIcons") putExtra("iconpack", packageName) @@ -265,7 +278,7 @@ private fun Context.executePosidonLauncherIntent() { } private fun Context.executeSmartLauncherIntent() { - attemptApply { + attemptApply(Launcher.SMART) { Intent("ginlemon.smartlauncher.setGSLTHEME").apply { putExtra("package", packageName) } @@ -273,7 +286,7 @@ private fun Context.executeSmartLauncherIntent() { } private fun Context.executeSmartLauncherProIntent() { - attemptApply { + attemptApply(Launcher.SMART_PRO) { Intent("ginlemon.smartlauncher.setGSLTHEME").apply { putExtra("package", packageName) } @@ -281,7 +294,7 @@ private fun Context.executeSmartLauncherProIntent() { } private fun Context.executeSoloLauncherIntent() { - attemptApply { + attemptApply(Launcher.SOLO) { packageManager.getLaunchIntentForPackage("home.solo.launcher.free").also { val solo = Intent("home.solo.launcher.free.APPLY_THEME") solo.putExtra("EXTRA_PACKAGENAME", packageName) @@ -292,7 +305,7 @@ private fun Context.executeSoloLauncherIntent() { } private fun Context.executeSquareHomeIntent() { - attemptApply { + attemptApply(Launcher.SQUARE) { Intent("com.ss.squarehome2.ACTION_APPLY_ICONPACK").apply { component = ComponentName.unflattenFromString("com.ss.squarehome2/.ApplyThemeActivity") @@ -302,7 +315,7 @@ private fun Context.executeSquareHomeIntent() { } private fun Context.executeTsfLauncherIntent() { - attemptApply { + attemptApply(Launcher.TSF) { packageManager.getLaunchIntentForPackage("com.tsf.shell").also { val tsf = Intent("android.action.MAIN") tsf.component = ComponentName("com.tsf.shell", "com.tsf.shelShellActivity") @@ -312,9 +325,12 @@ private fun Context.executeTsfLauncherIntent() { } private fun Context.executeMotoLauncherIntent() { - attemptApply { + attemptApply(Launcher.MOTO) { Intent().apply { - component = ComponentName("com.motorola.personalize", "com.motorola.personalize.app.IconPacksActivity") + component = ComponentName( + "com.motorola.personalize", + "com.motorola.personalize.app.IconPacksActivity" + ) putExtra("package", packageName) } } @@ -323,12 +339,11 @@ private fun Context.executeMotoLauncherIntent() { internal val Context.defaultLauncher: Launcher? get() = try { val intent = Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME) - val resolveInfo = - packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) + val resolveInfo = packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) val launcherPackage = resolveInfo?.activityInfo?.packageName Launcher.getSupportedLaunchers(this) .filter { it.first.isActuallySupported } .firstOrNull { it.first.hasPackage(launcherPackage.orEmpty()) }?.first } catch (e: Exception) { null - } \ No newline at end of file + } diff --git a/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/BlueprintAboutActivity.kt b/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/BlueprintAboutActivity.kt index a4e31c6cf..fa0e65d45 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/BlueprintAboutActivity.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/BlueprintAboutActivity.kt @@ -1,7 +1,7 @@ package dev.jahir.blueprint.ui.activities -import dev.jahir.frames.ui.activities.AboutActivity import dev.jahir.blueprint.BuildConfig +import dev.jahir.frames.ui.activities.AboutActivity class BlueprintAboutActivity : AboutActivity() { override val dashboardName = BuildConfig.DASHBOARD_NAME diff --git a/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/BlueprintActivity.kt b/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/BlueprintActivity.kt index 2be57a932..2712288e1 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/BlueprintActivity.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/BlueprintActivity.kt @@ -1,5 +1,6 @@ package dev.jahir.blueprint.ui.activities +import android.Manifest import android.content.Intent import android.os.Build import android.os.Bundle @@ -7,7 +8,6 @@ import android.view.Menu import android.view.MenuItem import androidx.appcompat.app.AlertDialog import androidx.fragment.app.Fragment -import com.fondesa.kpermissions.PermissionStatus import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton import dev.jahir.blueprint.BuildConfig @@ -47,6 +47,7 @@ import dev.jahir.frames.extensions.context.string import dev.jahir.frames.extensions.fragments.cancelable import dev.jahir.frames.extensions.fragments.mdDialog import dev.jahir.frames.extensions.fragments.message +import dev.jahir.frames.extensions.fragments.neutralButton import dev.jahir.frames.extensions.fragments.positiveButton import dev.jahir.frames.extensions.fragments.singleChoiceItems import dev.jahir.frames.extensions.fragments.title @@ -112,7 +113,7 @@ abstract class BlueprintActivity : FramesActivity(), RequestCallback { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - bottomNavigation?.setOnNavigationItemSelectedListener { + bottomNavigation?.setOnItemSelectedListener { if (isIconsPicker && it.itemId != R.id.icons) false else { updateFab(it.itemId, true) { changeFragment(it.itemId) } @@ -128,13 +129,9 @@ abstract class BlueprintActivity : FramesActivity(), RequestCallback { } templatesViewModel.observe(this) { components -> onTemplatesLoaded(components) - val kustomCount = - components.filter { it.type != Component.Type.ZOOPER && it.type != Component.Type.UNKNOWN }.size - val zooperCount = components.filter { it.type == Component.Type.ZOOPER }.size + val kustomCount = components.filter { it.type != Component.Type.UNKNOWN }.size homeFragment?.updateKustomCount(kustomCount) homeViewModel?.postKustomCount(kustomCount) - homeFragment?.updateZooperCount(zooperCount) - homeViewModel?.postZooperCount(zooperCount) } iconsViewModel.observe(this) { iconsCategoriesFragment.updateItems(it) @@ -169,9 +166,9 @@ abstract class BlueprintActivity : FramesActivity(), RequestCallback { bottomNavigation?.setSelectedItemId(itemId, true) } - override fun onBackPressed() { + override fun onSafeBackPressed() { if (currentItemId != initialItemId) selectNavigationItem(initialItemId) - else super.onBackPressed() + else super.onSafeBackPressed() } override fun onCreateOptionsMenu(menu: Menu): Boolean { @@ -224,7 +221,7 @@ abstract class BlueprintActivity : FramesActivity(), RequestCallback { try { iconDialog?.dismiss() iconDialog = null - } catch (e: Exception) { + } catch (_: Exception) { } } @@ -232,7 +229,7 @@ abstract class BlueprintActivity : FramesActivity(), RequestCallback { try { requestDialog?.dismiss() requestDialog = null - } catch (e: Exception) { + } catch (_: Exception) { } } @@ -240,7 +237,7 @@ abstract class BlueprintActivity : FramesActivity(), RequestCallback { try { iconsShapePickerDialog?.dismiss() iconsShapePickerDialog = null - } catch (e: Exception) { + } catch (_: Exception) { } } @@ -263,10 +260,12 @@ abstract class BlueprintActivity : FramesActivity(), RequestCallback { else -> super.getNextFragment(itemId) } - override fun internalOnPermissionsGranted(result: List) { - super.internalOnPermissionsGranted(result) - homeFragment?.updateWallpaper() - if (shouldBuildRequest) buildRequest() + override fun internalOnPermissionsGranted(permission: String) { + super.internalOnPermissionsGranted(permission) + if (permission == Manifest.permission.WRITE_EXTERNAL_STORAGE) { + homeFragment?.updateWallpaper() + if (shouldBuildRequest) buildRequest() + } } override fun canShowSearch(itemId: Int): Boolean = @@ -427,7 +426,9 @@ abstract class BlueprintActivity : FramesActivity(), RequestCallback { private fun buildRequest() { shouldBuildRequest = false - SendIconRequest.sendIconRequest(this, requestsViewModel?.selectedApps, this) + showConsentDisclaimer { + SendIconRequest.sendIconRequest(this, requestsViewModel?.selectedApps, this) + } } override fun onBillingClientReady() { @@ -538,6 +539,21 @@ abstract class BlueprintActivity : FramesActivity(), RequestCallback { invalidateOptionsMenu() } + internal fun showConsentDisclaimer(onConsentAccepted: () -> Unit = { }) { + if (blueprintPrefs.iconsRequestConsentAccepted) onConsentAccepted() + else { + mdDialog { + title(R.string.icon_request_consent_title) + message(string(R.string.icon_request_consent, context.getAppName())) + positiveButton(R.string.icon_request_consent_accept) { + blueprintPrefs.iconsRequestConsentAccepted = true + onConsentAccepted() + } + neutralButton(R.string.icon_request_consent_deny) + }.show() + } + } + override fun onSaveInstanceState(outState: Bundle) { outState.putInt("pickerKey", pickerKey) super.onSaveInstanceState(outState) diff --git a/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/DrawerBlueprintActivity.kt b/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/DrawerBlueprintActivity.kt index 7e2fe0e4b..71ab5e9da 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/DrawerBlueprintActivity.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/ui/activities/DrawerBlueprintActivity.kt @@ -131,15 +131,15 @@ abstract class DrawerBlueprintActivity : BlueprintActivity(), return checked } - override fun onBackPressed() { + override fun onSafeBackPressed() { val isDrawerOpen = drawerLayout?.isDrawerOpen(GravityCompat.START) ?: false if (!isIconsPicker) { when { isDrawerOpen -> drawerLayout?.closeDrawer(GravityCompat.START, true) - else -> super.onBackPressed() + else -> super.onSafeBackPressed() } } else { - super.onBackPressed() + super.onSafeBackPressed() } } @@ -155,4 +155,4 @@ abstract class DrawerBlueprintActivity : BlueprintActivity(), override fun getLayoutRes(): Int = R.layout.activity_drawer override val snackbarAnchorId: Int get() = R.id.fab_btn -} \ No newline at end of file +} diff --git a/library/src/main/kotlin/dev/jahir/blueprint/ui/adapters/HomeAdapter.kt b/library/src/main/kotlin/dev/jahir/blueprint/ui/adapters/HomeAdapter.kt index b3731584e..295fcb71c 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/ui/adapters/HomeAdapter.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/ui/adapters/HomeAdapter.kt @@ -1,5 +1,6 @@ package dev.jahir.blueprint.ui.adapters +import android.annotation.SuppressLint import android.graphics.drawable.Drawable import android.view.ViewGroup import androidx.core.view.children @@ -13,7 +14,6 @@ import dev.jahir.blueprint.data.models.Icon import dev.jahir.blueprint.data.models.IconsCounter import dev.jahir.blueprint.data.models.KustomCounter import dev.jahir.blueprint.data.models.WallpapersCounter -import dev.jahir.blueprint.data.models.ZooperCounter import dev.jahir.blueprint.ui.viewholders.AppLinkViewHolder import dev.jahir.blueprint.ui.viewholders.CounterViewHolder import dev.jahir.blueprint.ui.viewholders.HomeActionsViewHolder @@ -30,6 +30,7 @@ class HomeAdapter( ) : SectionedRecyclerViewAdapter() { var actionsStyle: Int = actionsStyle + @SuppressLint("NotifyDataSetChanged") set(value) { if (value == field) return field = value @@ -40,6 +41,7 @@ class HomeAdapter( get() = actionsStyle > 0 var showDonateButton: Boolean = showOverview + @SuppressLint("NotifyDataSetChanged") set(value) { if (value == field) return field = value @@ -47,6 +49,7 @@ class HomeAdapter( } var showOverview: Boolean = showOverview + @SuppressLint("NotifyDataSetChanged") set(value) { if (value == field) return field = value @@ -54,6 +57,7 @@ class HomeAdapter( } var wallpaper: Drawable? = null + @SuppressLint("NotifyDataSetChanged") set(value) { if (field != null) return field = value @@ -61,6 +65,7 @@ class HomeAdapter( } var iconsPreviewList: ArrayList = ArrayList() + @SuppressLint("NotifyDataSetChanged") set(value) { field.clear() field.addAll(value) @@ -68,6 +73,7 @@ class HomeAdapter( } var homeItems: ArrayList = ArrayList() + @SuppressLint("NotifyDataSetChanged") set(value) { field.clear() field.addAll(value) @@ -81,6 +87,7 @@ class HomeAdapter( get() = ArrayList(homeItems.filter { !it.isAnApp }) var iconsCount: Int = 0 + @SuppressLint("NotifyDataSetChanged") set(value) { if (value == field) return field = value @@ -88,6 +95,7 @@ class HomeAdapter( } var wallpapersCount: Int = 0 + @SuppressLint("NotifyDataSetChanged") set(value) { if (value == field) return field = value @@ -95,13 +103,7 @@ class HomeAdapter( } var kustomCount: Int = 0 - set(value) { - if (value == field) return - field = value - notifyDataSetChanged() - } - - var zooperCount: Int = 0 + @SuppressLint("NotifyDataSetChanged") set(value) { if (value == field) return field = value @@ -114,7 +116,6 @@ class HomeAdapter( IconsCounter(iconsCount), WallpapersCounter(wallpapersCount), KustomCounter(kustomCount), - ZooperCounter(zooperCount) ).filter { it.count > 0 } } else listOf() @@ -204,4 +205,4 @@ class HomeAdapter( private const val MORE_APPS_SECTION = 3 private const val USEFUL_LINKS_SECTION = 4 } -} \ No newline at end of file +} diff --git a/library/src/main/kotlin/dev/jahir/blueprint/ui/fragments/HomeFragment.kt b/library/src/main/kotlin/dev/jahir/blueprint/ui/fragments/HomeFragment.kt index fa9d67c9c..a8dddb336 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/ui/fragments/HomeFragment.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/ui/fragments/HomeFragment.kt @@ -20,7 +20,6 @@ import dev.jahir.blueprint.data.models.Icon import dev.jahir.blueprint.data.models.IconsCounter import dev.jahir.blueprint.data.models.KustomCounter import dev.jahir.blueprint.data.models.WallpapersCounter -import dev.jahir.blueprint.data.models.ZooperCounter import dev.jahir.blueprint.extensions.defaultLauncher import dev.jahir.blueprint.ui.activities.BlueprintActivity import dev.jahir.blueprint.ui.activities.BlueprintKuperActivity @@ -40,12 +39,11 @@ import dev.jahir.frames.extensions.views.setPaddingBottom import dev.jahir.frames.extensions.views.snackbar import dev.jahir.frames.ui.activities.base.BaseBillingActivity import dev.jahir.frames.ui.activities.base.BaseLicenseCheckerActivity.Companion.PLAY_STORE_LINK_PREFIX -import dev.jahir.frames.ui.activities.base.BaseStoragePermissionRequestActivity +import dev.jahir.frames.ui.activities.base.BasePermissionsRequestActivity import dev.jahir.frames.ui.activities.base.BaseSystemUIVisibilityActivity import dev.jahir.frames.ui.widgets.StatefulRecyclerView import dev.jahir.kuper.extensions.userWallpaper - @SuppressLint("MissingPermission") class HomeFragment : Fragment(R.layout.fragment_home), HomeItemsListener { @@ -112,7 +110,7 @@ class HomeFragment : Fragment(R.layout.fragment_home), HomeItemsListener { snackbar( string(R.string.permission_request, context?.getAppName()), Snackbar.LENGTH_INDEFINITE, - (activity as? BaseStoragePermissionRequestActivity<*>)?.snackbarAnchorId ?: 0 + (activity as? BasePermissionsRequestActivity<*>)?.snackbarAnchorId ?: 0 ) { setAction(android.R.string.ok) { requestStoragePermission() @@ -158,6 +156,7 @@ class HomeFragment : Fragment(R.layout.fragment_home), HomeItemsListener { } } + @SuppressLint("NotifyDataSetChanged") internal fun notifyShapeChange() { adapter.notifyDataSetChanged() setupContentBottomOffset() @@ -193,11 +192,6 @@ class HomeFragment : Fragment(R.layout.fragment_home), HomeItemsListener { setupContentBottomOffset() } - internal fun updateZooperCount(count: Int) { - adapter.zooperCount = count - setupContentBottomOffset() - } - override fun onIconsPreviewClicked() { super.onIconsPreviewClicked() (activity as? BlueprintActivity)?.loadPreviewIcons(true) @@ -212,7 +206,7 @@ class HomeFragment : Fragment(R.layout.fragment_home), HomeItemsListener { is WallpapersCounter -> { (activity as? BlueprintActivity)?.selectNavigationItem(R.id.wallpapers) } - is KustomCounter, is ZooperCounter -> { + is KustomCounter -> { (activity as? BlueprintActivity)?.let { it.startActivity(Intent(it, BlueprintKuperActivity::class.java)) } @@ -222,7 +216,7 @@ class HomeFragment : Fragment(R.layout.fragment_home), HomeItemsListener { override fun onAppLinkClicked(url: String, intent: Intent?) { super.onAppLinkClicked(url, intent) - intent?.let { activity?.startActivity(it) } ?: { context?.openLink(url) }() + intent?.let { activity?.startActivity(it) } ?: context?.openLink(url) } internal fun showDonation(show: Boolean) { diff --git a/library/src/main/kotlin/dev/jahir/blueprint/ui/fragments/RequestFragment.kt b/library/src/main/kotlin/dev/jahir/blueprint/ui/fragments/RequestFragment.kt index c6c77e2d5..ddeb9c739 100644 --- a/library/src/main/kotlin/dev/jahir/blueprint/ui/fragments/RequestFragment.kt +++ b/library/src/main/kotlin/dev/jahir/blueprint/ui/fragments/RequestFragment.kt @@ -31,6 +31,11 @@ class RequestFragment : BaseFramesFragment() { loadData() } + override fun onResume() { + super.onResume() + if (isVisible) (activity as? BlueprintActivity)?.showConsentDisclaimer() + } + override fun setupContentBottomOffset(view: View?) { (view ?: getView())?.let { v -> v.post { diff --git a/library/src/main/res/color/checkbox_check_tint.xml b/library/src/main/res/color/checkbox_check_tint.xml new file mode 100644 index 000000000..1f7be80c5 --- /dev/null +++ b/library/src/main/res/color/checkbox_check_tint.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/library/src/main/res/layout/item_counter.xml b/library/src/main/res/layout/item_counter.xml index 94290d3d8..9664919d2 100644 --- a/library/src/main/res/layout/item_counter.xml +++ b/library/src/main/res/layout/item_counter.xml @@ -19,7 +19,7 @@ android:layout_height="24dp" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" - app:srcCompat="@drawable/ic_zooper" + app:srcCompat="@drawable/ic_kustom" app:tint="?colorOnSurface" /> - \ No newline at end of file + diff --git a/library/src/main/res/layout/item_request.xml b/library/src/main/res/layout/item_request.xml index 981367f0f..e60cf7fb2 100644 --- a/library/src/main/res/layout/item_request.xml +++ b/library/src/main/res/layout/item_request.xml @@ -52,6 +52,7 @@ android:clickable="false" android:focusable="false" android:padding="8dp" + app:buttonIconTint="@color/checkbox_check_tint" app:buttonTint="@color/checkbox_button_tint" app:useMaterialThemeColors="true" /> diff --git a/library/src/main/res/menu/kuper_navigation_menu.xml b/library/src/main/res/menu/kuper_navigation_menu.xml index ee76f22e5..336b3d033 100644 --- a/library/src/main/res/menu/kuper_navigation_menu.xml +++ b/library/src/main/res/menu/kuper_navigation_menu.xml @@ -5,7 +5,7 @@ android:id="@+id/setup" android:icon="@drawable/ic_setup" android:orderInCategory="100" - android:title="@string/setup" + android:title="@string/required_apps" app:showAsAction="ifRoom" /> - \ No newline at end of file + diff --git a/library/src/main/res/values-es-rES/translatable_strings.xml b/library/src/main/res/values-es-rES/translatable_strings.xml index 313324e0b..9e9184d2b 100644 --- a/library/src/main/res/values-es-rES/translatable_strings.xml +++ b/library/src/main/res/values-es-rES/translatable_strings.xml @@ -18,6 +18,7 @@ No se puede abrir la aplicación “Temas” no está instalado. Proximamente. + %1$s no soporta aplicar íconos directamente. Por favor intenta aplicar %2$s manualmente desde la configuración del launcher. Aplicar al inicio Solicitar %1$s iconos Solicitar icono @@ -54,6 +55,10 @@ Cuadrado Gota Algo salió mal. Nombre del error: “%1$s”. + Requisito de consentimiento + Aceptar + Denegar + %1$s recopila información de las aplicaciones instaladas y detalles de tu dispositivo, tales como dimensiones de pantalla y versión de Android. Estos datos serán usados para diseñar nuevos íconos y proveer la mejor experiencia posible. Para información adicional, por favor revisa la Política de Privacidad en la configuración de la aplicación. ¿Cómo utilizar el paquete de iconos? diff --git a/library/src/main/res/values/translatable_strings.xml b/library/src/main/res/values/translatable_strings.xml index 201829c18..11fc036ed 100644 --- a/library/src/main/res/values/translatable_strings.xml +++ b/library/src/main/res/values/translatable_strings.xml @@ -18,6 +18,7 @@ Can’t Open App “Themes” isn’t installed. Coming soon. + %1$s does not support applying icons directly. Please try to apply %2$s manually from the launcher settings. Apply to Home Request %1$s Icons Request Icon @@ -55,6 +56,10 @@ Teardrop Something went wrong. Error name: “%1$s”. Something went wrong. + Consent requirement + Accept + Deny + %1$s collects information about the installed apps and your device details, such as screen dimensions and Android version. This data will be used to design new icons and provide the best possible experience. For additional information, please check the Privacy Policy in the app\'s settings.