Skip to content

Commit

Permalink
1.8
Browse files Browse the repository at this point in the history
- The Date & filler date Targets are now fully handled by Smartspacer. This is required to fix an issue in Android 15 QPR1 where it is no longer possible to allow the Launcher or Lock Screen to handle the date while showing two complications below it. This also means that when the open behaviour for Expanded Smartspace is set to "always", tapping the date will now open Expanded Smartspace, where it was previously not possible. (#241)
- Fixed an issue where tapping the weather on devices using the At a Glance Complication with Pixel Weather installed would not open the weather, it now opens in Pixel Weather
- Tapping the weather when using the Google Weather Complication and will now open Pixel Weather when it is installed
- All built in Targets & Complications that can support being added more than once are now able to be. This is useful if you want to add different requirements for specific screens (eg. lock screen).
- Added an in-app option to change the app language (this is synced with the system setting on Android 13+)
- Added a link to the Crowdin page in the about card
  • Loading branch information
KieronQuinn authored Aug 27, 2024
1 parent 8f304b8 commit e819780
Show file tree
Hide file tree
Showing 86 changed files with 629 additions and 304 deletions.
18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ plugins {

apply plugin: 'com.google.android.gms.oss-licenses-plugin'

def tagName = '1.7.7'
def tagCode = 177
def tagName = '1.8'
def tagCode = 180

android {
compileSdk 34
Expand Down Expand Up @@ -72,16 +72,16 @@ android {
dependencies {
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.13.0-alpha03'
implementation 'com.google.android.material:material:1.13.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.lifecycle:lifecycle-service:2.8.3"
implementation "androidx.lifecycle:lifecycle-service:2.8.4"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "androidx.fragment:fragment-ktx:1.8.1"
implementation "androidx.activity:activity-ktx:1.9.0"
implementation "androidx.work:work-runtime-ktx:2.9.0"
implementation "androidx.fragment:fragment-ktx:1.8.2"
implementation "androidx.activity:activity-ktx:1.9.1"
implementation "androidx.work:work-runtime-ktx:2.9.1"
implementation "androidx.core:core-remoteviews:1.1.0"
implementation "androidx.security:security-crypto:1.1.0-alpha06"
implementation project(path: ':proto')
Expand Down Expand Up @@ -159,7 +159,7 @@ dependencies {
implementation 'com.google.android.gms:play-services-oss-licenses:17.1.0'

//Firebase Analytics + Crashlytics
implementation(platform("com.google.firebase:firebase-bom:33.1.1"))
implementation(platform("com.google.firebase:firebase-bom:33.2.0"))
implementation("com.google.firebase:firebase-crashlytics-ktx")
implementation("com.google.firebase:firebase-analytics-ktx")

Expand All @@ -175,7 +175,7 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
androidTestImplementation 'com.google.truth:truth:1.1.3'
androidTestImplementation 'androidx.test:runner:1.6.1'
androidTestImplementation 'androidx.test:runner:1.6.2'
androidTestUtil 'androidx.test:orchestrator:1.5.0'
androidTestCompileOnly project(path: ':systemstubs')
}
Binary file modified app/release/baselineProfiles/0/app-release.dm
Binary file not shown.
Binary file modified app/release/baselineProfiles/1/app-release.dm
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 176,
"versionName": "1.7.6",
"versionCode": 180,
"versionName": "1.8",
"outputFile": "app-release.apk"
}
],
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,15 @@
android:value="7" />
</service>

<service
android:name="androidx.appcompat.app.AppLocalesMetadataHolderService"
android:enabled="false"
android:exported="false">
<meta-data
android:name="autoStoreLocales"
android:value="true" />
</service>

<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/AppTheme.ThirdPartyLicences" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ import com.kieronquinn.app.smartspacer.ui.screens.settings.batteryoptimisation.S
import com.kieronquinn.app.smartspacer.ui.screens.settings.batteryoptimisation.SettingsBatteryOptimisationViewModelImpl
import com.kieronquinn.app.smartspacer.ui.screens.settings.dump.DumpSmartspacerViewModel
import com.kieronquinn.app.smartspacer.ui.screens.settings.dump.DumpSmartspacerViewModelImpl
import com.kieronquinn.app.smartspacer.ui.screens.settings.language.SettingsLanguageViewModel
import com.kieronquinn.app.smartspacer.ui.screens.settings.language.SettingsLanguageViewModelImpl
import com.kieronquinn.app.smartspacer.ui.screens.settings.sensitive.SettingsHideSensitiveViewModel
import com.kieronquinn.app.smartspacer.ui.screens.setup.analytics.SetupAnalyticsViewModel
import com.kieronquinn.app.smartspacer.ui.screens.setup.analytics.SetupAnalyticsViewModelImpl
Expand Down Expand Up @@ -417,7 +419,7 @@ class Smartspacer: Application(), Configuration.Provider {
viewModel<GeofenceRequirementConfigurationViewModel> { GeofenceRequirementConfigurationViewModelImpl(get(), get(), get(), get()) }
viewModel<GeofenceRequirementConfigurationNameViewModel> { GeofenceRequirementConfigurationNameViewModelImpl() }
viewModel<AppPredictionRequirementConfigurationViewModel> { AppPredictionRequirementConfigurationViewModelImpl(get(), get()) }
viewModel<SettingsViewModel> { SettingsViewModelImpl(get(), get(), get()) }
viewModel<SettingsViewModel> { SettingsViewModelImpl(get(), get(), get(), get()) }
viewModel { SettingsHideSensitiveViewModel(get()) }
viewModel<SetupLandingViewModel> { SetupLandingViewModelImpl(get()) }
viewModel<SetupAnalyticsViewModel> { SetupAnalyticsViewModelImpl(get(), get()) }
Expand Down Expand Up @@ -523,6 +525,7 @@ class Smartspacer: Application(), Configuration.Provider {
viewModel<BluetoothRequirementConfigurationViewModel> { BluetoothRequirementConfigurationViewModelImpl(get(), get(), get(), get()) }
viewModel<FlashlightTargetConfigurationViewModel> { FlashlightTargetConfigurationViewModelImpl(get(), get()) }
viewModel<WidgetConfigurationViewModel> { WidgetConfigurationViewModelImpl(get(), get(), get(), get(), get()) }
viewModel<SettingsLanguageViewModel> { SettingsLanguageViewModelImpl(get()) }
}

override fun attachBaseContext(base: Context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package com.kieronquinn.app.smartspacer.components.smartspace.compat

import android.content.ComponentName
import android.content.ContentUris
import android.content.Intent
import android.icu.text.DateFormat
import android.icu.text.DisplayContext
import android.os.Bundle
import android.provider.CalendarContract
import com.kieronquinn.app.smartspacer.BuildConfig
import com.kieronquinn.app.smartspacer.model.smartspace.Action
import com.kieronquinn.app.smartspacer.model.smartspace.ActionHolder
import com.kieronquinn.app.smartspacer.model.smartspace.Target
Expand All @@ -18,11 +24,15 @@ import com.kieronquinn.app.smartspacer.sdk.model.SmartspaceAction.Companion.KEY_
import com.kieronquinn.app.smartspacer.sdk.model.SmartspaceAction.Companion.KEY_EXTRA_SHOW_ON_LOCKSCREEN
import com.kieronquinn.app.smartspacer.sdk.model.SmartspaceTarget
import com.kieronquinn.app.smartspacer.sdk.model.uitemplatedata.BaseTemplateData
import com.kieronquinn.app.smartspacer.sdk.model.uitemplatedata.BaseTemplateData.SubItemInfo
import com.kieronquinn.app.smartspacer.sdk.model.uitemplatedata.BasicTemplateData
import com.kieronquinn.app.smartspacer.sdk.model.uitemplatedata.TapAction
import com.kieronquinn.app.smartspacer.sdk.model.uitemplatedata.Text
import com.kieronquinn.app.smartspacer.sdk.model.weather.WeatherData
import com.kieronquinn.app.smartspacer.utils.extensions.cloneWithUniqneness
import com.kieronquinn.app.smartspacer.utils.extensions.popOrNull
import com.kieronquinn.app.smartspacer.utils.extensions.reformatBullet
import java.util.Calendar
import java.util.LinkedList
import java.util.UUID

Expand Down Expand Up @@ -221,7 +231,11 @@ abstract class TargetMerger {
val action = actionQueue.popOrNull() ?: break
val secondAction = actionQueue.popOrNull()
val page = SmartspacePageHolder(
createBlankTarget(action.action, secondAction?.action),
createBlankTarget(
action.action,
secondAction?.action,
useExpandedIntent = openMode == ExpandedOpenMode.ALWAYS
),
null,
listOfNotNull(action.parent, secondAction?.parent)
)
Expand Down Expand Up @@ -264,8 +278,6 @@ abstract class TargetMerger {
return this
}

protected open val blankFeatureType = SmartspaceTarget.FEATURE_WEATHER

/**
* Creates a blank target, with one or two [SmartspaceAction]s. If [base] is not specified,
* a blank base will be used. The launcher will surround these actions with the default
Expand All @@ -274,20 +286,19 @@ abstract class TargetMerger {
protected fun createBlankTarget(
header: SmartspaceAction,
base: SmartspaceAction?,
templateData: BasicTemplateData? = null
templateData: BasicTemplateData? = null,
useExpandedIntent: Boolean = false
): SmartspaceTarget {
//Strip undocumented extras from the complication so it can't inject them into the target
base?.extras?.stripUndocumentedExtras()
return SmartspaceTarget(
smartspaceTargetId = "${BLANK_TARGET_PREFIX}_${UUID.randomUUID()}",
headerAction = header.reformatBullet(base == null),
baseAction = base ?: SmartspaceAction(
id = "",
title = ""
),
featureType = blankFeatureType,
baseAction = base ?: createBlankHeader(useExpandedIntent),
featureType = SmartspaceTarget.FEATURE_UNDEFINED,
componentName = ComponentName("package_name", "class_name"),
templateData = BasicTemplateData(
primaryItem = createBlankTitle(useExpandedIntent),
subtitleItem = header.subItemInfo ?: templateData?.subtitleItem
?: header.generateSubItemInfo().reformatBullet(base == null),
subtitleSupplementalItem = base?.subItemInfo
Expand All @@ -298,4 +309,58 @@ abstract class TargetMerger {
)
}

private fun createBlankHeader(useExpandedIntent: Boolean): SmartspaceAction {
val date = DateFormat.getInstanceForSkeleton("EEEMMMd").apply {
setContext(DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE)
}.format(Calendar.getInstance().time)
return SmartspaceAction(
id = "",
icon = null,
title = date,
intent = if(useExpandedIntent) {
getExpandedIntent()
}else{
getCalendarIntent()
}
).apply {
launchDisplayOnLockScreen = useExpandedIntent
}
}

private fun createBlankTitle(useExpandedIntent: Boolean): SubItemInfo? {
val date = DateFormat.getInstanceForSkeleton("EEEMMMd").apply {
setContext(DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE)
}.format(Calendar.getInstance().time)
val intent = if(useExpandedIntent) {
getExpandedIntent()
}else{
getCalendarIntent()
}
return SubItemInfo(
text = Text(date),
tapAction = TapAction(intent = intent, shouldShowOnLockScreen = useExpandedIntent)
)
}

private fun getCalendarIntent(): Intent {
return Intent(Intent.ACTION_VIEW).apply {
data = ContentUris.appendId(
CalendarContract.CONTENT_URI.buildUpon().appendPath("time"),
System.currentTimeMillis()
).build()
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)
}
}

private fun getExpandedIntent(): Intent {
return Intent("com.kieronquinn.app.smartspacer.SMARTSPACE").apply {
component = ComponentName(
BuildConfig.APPLICATION_ID,
"com.kieronquinn.app.smartspacer.ui.activities.ExportedExpandedActivity"
)
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.kieronquinn.app.smartspacer.components.smartspace.compat

/**
* Regular Target merger, as [TargetMerger]
*/
object TargetMergerRegular: TargetMerger()
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import java.util.LinkedList
*/
object TargetMergerSplit: TargetMerger() {

override val blankFeatureType = SmartspaceTarget.FEATURE_UNDEFINED

override fun getSplitTargets(
actions: LinkedList<SmartspaceActionHolder>
): List<SmartspacePageHolder> {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class AlarmComplication: SmartspacerComplicationProvider() {
return Config(
resources.getString(R.string.complication_alarm_label),
resources.getString(R.string.complication_alarm_description),
AndroidIcon.createWithResource(provideContext(), R.drawable.ic_alarm)
AndroidIcon.createWithResource(provideContext(), R.drawable.ic_alarm),
allowAddingMoreThanOnce = true
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class DefaultComplication: SmartspacerComplicationProvider() {
description = resources.getText(description),
icon = Icon.createWithResource(provideContext(), R.drawable.ic_target_default),
compatibilityState = getCompatibilityState(),
configActivity = TrampolineActivity.createAsiTrampolineIntent(provideContext())
configActivity = TrampolineActivity.createAsiTrampolineIntent(provideContext()),
allowAddingMoreThanOnce = true
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class DigitalWellbeingComplication: SmartspacerComplicationProvider() {
),
compatibilityState = getCompatibility(),
widgetProvider = "${BuildConfig.APPLICATION_ID}.widget.digitalwellbeing",
refreshPeriodMinutes = 1
refreshPeriodMinutes = 1,
allowAddingMoreThanOnce = true
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.kieronquinn.app.smartspacer.components.smartspace.complications

import android.content.ComponentName
import android.content.Intent
import com.kieronquinn.app.smartspacer.BuildConfig
import com.kieronquinn.app.smartspacer.R
Expand All @@ -14,6 +13,7 @@ import com.kieronquinn.app.smartspacer.sdk.model.uitemplatedata.TapAction
import com.kieronquinn.app.smartspacer.sdk.model.uitemplatedata.Text
import com.kieronquinn.app.smartspacer.sdk.provider.SmartspacerComplicationProvider
import com.kieronquinn.app.smartspacer.sdk.utils.ComplicationTemplate
import com.kieronquinn.app.smartspacer.utils.extensions.getGoogleWeatherIntent
import org.koin.android.ext.android.inject
import android.graphics.drawable.Icon as AndroidIcon

Expand All @@ -33,11 +33,7 @@ class GoogleWeatherComplication: SmartspacerComplicationProvider() {
icon = Icon(AndroidIcon.createWithBitmap(state.icon), shouldTint = false),
content = Text(state.temperature),
onClick = TapAction(
intent = Intent().apply {
component = ComponentName(
"com.google.android.googlequicksearchbox",
"com.google.android.apps.search.weather.WeatherExportedActivity"
)
intent = provideContext().getGoogleWeatherIntent().apply {
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class MissedCallsComplication: SmartspacerComplicationProvider() {
resources.getString(R.string.complication_missed_calls_label),
resources.getString(R.string.complication_missed_calls_description),
AndroidIcon.createWithResource(provideContext(), R.drawable.ic_complication_missed_calls),
setupActivity = Intent(provideContext(), CallLogPermissionActivity::class.java)
setupActivity = Intent(provideContext(), CallLogPermissionActivity::class.java),
allowAddingMoreThanOnce = true
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class SmsComplication: SmartspacerComplicationProvider() {
label = resources.getString(R.string.complication_sms_label),
description = resources.getString(R.string.complication_sms_description),
icon = AndroidIcon.createWithResource(provideContext(), R.drawable.ic_complication_sms),
setupActivity = Intent(provideContext(), SmsPermissionActivity::class.java)
setupActivity = Intent(provideContext(), SmsPermissionActivity::class.java),
allowAddingMoreThanOnce = true
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class AmmNowPlayingTarget: NowPlayingTarget() {
icon = Icon.createWithResource(provideContext(), R.drawable.ic_target_now_playing),
setupActivity = Intent(provideContext(), NotificationPermissionActivity::class.java),
compatibilityState = getCompatibilityState(),
notificationProvider = AmmNowPlayingTargetNotification.AUTHORITY
notificationProvider = AmmNowPlayingTargetNotification.AUTHORITY,
allowAddingMoreThanOnce = true
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class AsNowPlayingTarget: NowPlayingTarget() {
icon = Icon.createWithResource(provideContext(), R.drawable.ic_target_now_playing),
setupActivity = Intent(provideContext(), NotificationPermissionActivity::class.java),
compatibilityState = getCompatibilityState(),
notificationProvider = AsNowPlayingTargetNotification.AUTHORITY
notificationProvider = AsNowPlayingTargetNotification.AUTHORITY,
allowAddingMoreThanOnce = true
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class AtAGlanceTarget: SmartspacerTargetProvider() {
AndroidIcon.createWithResource(provideContext(), R.drawable.ic_target_at_a_glance),
compatibilityState = getCompatibility(),
widgetProvider = AtAGlanceWidget.AUTHORITY,
configActivity = TrampolineActivity.createGlanceTrampolineIntent(provideContext())
configActivity = TrampolineActivity.createGlanceTrampolineIntent(provideContext()),
allowAddingMoreThanOnce = true
)
}

Expand Down
Loading

0 comments on commit e819780

Please sign in to comment.