#953 opening app from launcher always show home page
This commit is contained in:
parent
38d6ee430a
commit
b5dbac1e2b
8 changed files with 21 additions and 44 deletions
|
@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
### Changed
|
||||
|
||||
- opening app from launcher always show home page
|
||||
- upgraded Flutter to stable v3.19.4
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -3,6 +3,7 @@ package deckers.thibault.aves
|
|||
import android.appwidget.AppWidgetManager
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import deckers.thibault.aves.model.FieldMap
|
||||
import deckers.thibault.aves.utils.FlutterUtils
|
||||
import deckers.thibault.aves.utils.FlutterUtils.enableSoftwareRendering
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
|
@ -56,7 +57,7 @@ class HomeWidgetSettingsActivity : MainActivity() {
|
|||
finish()
|
||||
}
|
||||
|
||||
override fun extractIntentData(intent: Intent?): MutableMap<String, Any?> {
|
||||
override fun extractIntentData(intent: Intent?): FieldMap {
|
||||
return hashMapOf(
|
||||
INTENT_DATA_KEY_ACTION to INTENT_ACTION_WIDGET_SETTINGS,
|
||||
INTENT_DATA_KEY_WIDGET_ID to appWidgetId,
|
||||
|
|
|
@ -175,18 +175,6 @@ open class MainActivity : FlutterFragmentActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
mediaStoreChangeStreamHandler.onAppResume()
|
||||
settingsChangeStreamHandler.onAppResume()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
mediaStoreChangeStreamHandler.onAppPause()
|
||||
settingsChangeStreamHandler.onAppPause()
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
Log.i(LOG_TAG, "onStop")
|
||||
super.onStop()
|
||||
|
@ -279,21 +267,19 @@ open class MainActivity : FlutterFragmentActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
open fun extractIntentData(intent: Intent?): MutableMap<String, Any?> {
|
||||
open fun extractIntentData(intent: Intent?): FieldMap {
|
||||
when (val action = intent?.action) {
|
||||
Intent.ACTION_MAIN -> {
|
||||
if (intent.getBooleanExtra(EXTRA_KEY_SAFE_MODE, false)) {
|
||||
return hashMapOf(
|
||||
INTENT_DATA_KEY_SAFE_MODE to true,
|
||||
)
|
||||
}
|
||||
val fields = hashMapOf<String, Any?>(
|
||||
INTENT_DATA_KEY_LAUNCHER to intent.hasCategory(Intent.CATEGORY_LAUNCHER),
|
||||
INTENT_DATA_KEY_SAFE_MODE to intent.getBooleanExtra(EXTRA_KEY_SAFE_MODE, false),
|
||||
)
|
||||
intent.getStringExtra(EXTRA_KEY_PAGE)?.let { page ->
|
||||
val filters = extractFiltersFromIntent(intent)
|
||||
return hashMapOf(
|
||||
INTENT_DATA_KEY_PAGE to page,
|
||||
INTENT_DATA_KEY_FILTERS to filters,
|
||||
)
|
||||
fields[INTENT_DATA_KEY_PAGE] = page
|
||||
fields[INTENT_DATA_KEY_FILTERS] = filters
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
Intent.ACTION_VIEW,
|
||||
|
@ -496,6 +482,7 @@ open class MainActivity : FlutterFragmentActivity() {
|
|||
const val INTENT_DATA_KEY_ACTION = "action"
|
||||
const val INTENT_DATA_KEY_ALLOW_MULTIPLE = "allowMultiple"
|
||||
const val INTENT_DATA_KEY_FILTERS = "filters"
|
||||
const val INTENT_DATA_KEY_LAUNCHER = "launcher"
|
||||
const val INTENT_DATA_KEY_MIME_TYPE = "mimeType"
|
||||
const val INTENT_DATA_KEY_PAGE = "page"
|
||||
const val INTENT_DATA_KEY_QUERY = "query"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package deckers.thibault.aves
|
||||
|
||||
import android.content.Intent
|
||||
import deckers.thibault.aves.model.FieldMap
|
||||
|
||||
class ScreenSaverSettingsActivity : MainActivity() {
|
||||
override fun extractIntentData(intent: Intent?): MutableMap<String, Any?> {
|
||||
override fun extractIntentData(intent: Intent?): FieldMap {
|
||||
return hashMapOf(
|
||||
INTENT_DATA_KEY_ACTION to INTENT_ACTION_SCREEN_SAVER_SETTINGS,
|
||||
)
|
||||
|
|
|
@ -14,6 +14,7 @@ import deckers.thibault.aves.channel.calls.window.ActivityWindowHandler
|
|||
import deckers.thibault.aves.channel.calls.window.WindowHandler
|
||||
import deckers.thibault.aves.channel.streams.ImageByteStreamHandler
|
||||
import deckers.thibault.aves.channel.streams.MediaCommandStreamHandler
|
||||
import deckers.thibault.aves.model.FieldMap
|
||||
import deckers.thibault.aves.utils.FlutterUtils
|
||||
import deckers.thibault.aves.utils.FlutterUtils.enableSoftwareRendering
|
||||
import deckers.thibault.aves.utils.LogUtils
|
||||
|
@ -25,7 +26,7 @@ import io.flutter.plugin.common.MethodCall
|
|||
import io.flutter.plugin.common.MethodChannel
|
||||
|
||||
class WallpaperActivity : FlutterFragmentActivity() {
|
||||
private lateinit var intentDataMap: MutableMap<String, Any?>
|
||||
private lateinit var intentDataMap: FieldMap
|
||||
private lateinit var mediaSessionHandler: MediaSessionHandler
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -103,7 +104,7 @@ class WallpaperActivity : FlutterFragmentActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun extractIntentData(intent: Intent?): MutableMap<String, Any?> {
|
||||
private fun extractIntentData(intent: Intent?): FieldMap {
|
||||
when (intent?.action) {
|
||||
Intent.ACTION_ATTACH_DATA, Intent.ACTION_SET_WALLPAPER -> {
|
||||
(intent.data ?: intent.getParcelableExtraCompat<Uri>(Intent.EXTRA_STREAM))?.let { uri ->
|
||||
|
|
|
@ -30,14 +30,6 @@ class MediaStoreChangeStreamHandler(private val context: Context) : EventChannel
|
|||
}
|
||||
|
||||
init {
|
||||
onAppResume()
|
||||
}
|
||||
|
||||
fun dispose() {
|
||||
onAppPause()
|
||||
}
|
||||
|
||||
fun onAppResume() {
|
||||
Log.i(LOG_TAG, "start listening to Media Store")
|
||||
context.contentResolver.apply {
|
||||
registerContentObserver(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, true, contentObserver)
|
||||
|
@ -45,7 +37,7 @@ class MediaStoreChangeStreamHandler(private val context: Context) : EventChannel
|
|||
}
|
||||
}
|
||||
|
||||
fun onAppPause() {
|
||||
fun dispose() {
|
||||
Log.i(LOG_TAG, "stop listening to Media Store")
|
||||
context.contentResolver.unregisterContentObserver(contentObserver)
|
||||
}
|
||||
|
|
|
@ -62,19 +62,11 @@ class SettingsChangeStreamHandler(private val context: Context) : EventChannel.S
|
|||
}
|
||||
|
||||
init {
|
||||
onAppResume()
|
||||
}
|
||||
|
||||
fun dispose() {
|
||||
onAppPause()
|
||||
}
|
||||
|
||||
fun onAppResume() {
|
||||
Log.i(LOG_TAG, "start listening to system settings")
|
||||
context.contentResolver.registerContentObserver(Settings.System.CONTENT_URI, true, contentObserver)
|
||||
}
|
||||
|
||||
fun onAppPause() {
|
||||
fun dispose() {
|
||||
Log.i(LOG_TAG, "stop listening to system settings")
|
||||
context.contentResolver.unregisterContentObserver(contentObserver)
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:aves/services/common/services.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
|
@ -26,6 +27,7 @@ class AvesPopScope extends StatelessWidget {
|
|||
Navigator.maybeOf(context)?.pop();
|
||||
} else {
|
||||
// exit
|
||||
reportService.log('Exit by pop');
|
||||
SystemNavigator.pop();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue