mirror of
https://github.com/jrpie/Launcher.git
synced 2025-06-08 10:20:15 +02:00
Compare commits
No commits in common. "5f847a8d401d36f36318909fc4a83f2858849611" and "91c9952f7cd54c7db781e20d41e84d44512dd565" have entirely different histories.
5f847a8d40
...
91c9952f7c
7 changed files with 21 additions and 34 deletions
|
@ -120,6 +120,8 @@ class Application : android.app.Application() {
|
||||||
appWidgetHost = AppWidgetHost(this.applicationContext, APP_WIDGET_HOST_ID)
|
appWidgetHost = AppWidgetHost(this.applicationContext, APP_WIDGET_HOST_ID)
|
||||||
appWidgetManager = AppWidgetManager.getInstance(this.applicationContext)
|
appWidgetManager = AppWidgetManager.getInstance(this.applicationContext)
|
||||||
|
|
||||||
|
appWidgetHost.startListening()
|
||||||
|
|
||||||
|
|
||||||
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
LauncherPreferences.init(preferences, this.resources)
|
LauncherPreferences.init(preferences, this.resources)
|
||||||
|
@ -176,4 +178,10 @@ class Application : android.app.Application() {
|
||||||
apps.postValue(getApps(packageManager, applicationContext))
|
apps.postValue(getApps(packageManager, applicationContext))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onTerminate() {
|
||||||
|
appWidgetHost.stopListening()
|
||||||
|
super.onTerminate()
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,15 @@ class HomeActivity : UIObject, Activity() {
|
||||||
LauncherPreferences.getSharedPreferences()
|
LauncherPreferences.getSharedPreferences()
|
||||||
.registerOnSharedPreferenceChangeListener(sharedPreferencesListener)
|
.registerOnSharedPreferenceChangeListener(sharedPreferencesListener)
|
||||||
|
|
||||||
|
(application as Application).appWidgetHost.startListening()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
override fun onStop() {
|
||||||
|
(application as Application).appWidgetHost.stopListening()
|
||||||
|
super.onStop()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||||
|
@ -103,6 +112,7 @@ class HomeActivity : UIObject, Activity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun updateSettingsFallbackButtonVisibility() {
|
private fun updateSettingsFallbackButtonVisibility() {
|
||||||
// If µLauncher settings can not be reached from any action bound to an enabled gesture,
|
// If µLauncher settings can not be reached from any action bound to an enabled gesture,
|
||||||
// show the fallback button.
|
// show the fallback button.
|
||||||
|
@ -121,11 +131,6 @@ class HomeActivity : UIObject, Activity() {
|
||||||
return modifyTheme(super.getTheme())
|
return modifyTheme(super.getTheme())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
(application as Application).appWidgetHost.stopListening()
|
|
||||||
super.onPause()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
|
@ -156,9 +161,6 @@ class HomeActivity : UIObject, Activity() {
|
||||||
binding.homeWidgetContainer.updateWidgets(this@HomeActivity,
|
binding.homeWidgetContainer.updateWidgets(this@HomeActivity,
|
||||||
LauncherPreferences.widgets().widgets()
|
LauncherPreferences.widgets().widgets()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
(application as Application).appWidgetHost.startListening()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.app.Activity
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
import de.jrpie.android.launcher.Application
|
|
||||||
import de.jrpie.android.launcher.R
|
import de.jrpie.android.launcher.R
|
||||||
import de.jrpie.android.launcher.databinding.ActivityWidgetPanelBinding
|
import de.jrpie.android.launcher.databinding.ActivityWidgetPanelBinding
|
||||||
import de.jrpie.android.launcher.preferences.LauncherPreferences
|
import de.jrpie.android.launcher.preferences.LauncherPreferences
|
||||||
|
@ -58,17 +57,6 @@ class WidgetPanelActivity : Activity(), UIObject {
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super<Activity>.onStart()
|
super<Activity>.onStart()
|
||||||
super<UIObject>.onStart()
|
super<UIObject>.onStart()
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
(application as Application).appWidgetHost.stopListening()
|
|
||||||
super.onPause()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
(application as Application).appWidgetHost.startListening()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isHomeScreen(): Boolean {
|
override fun isHomeScreen(): Boolean {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import android.widget.EditText
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import de.jrpie.android.launcher.Application
|
|
||||||
import de.jrpie.android.launcher.R
|
import de.jrpie.android.launcher.R
|
||||||
import de.jrpie.android.launcher.databinding.ActivityManageWidgetPanelsBinding
|
import de.jrpie.android.launcher.databinding.ActivityManageWidgetPanelsBinding
|
||||||
import de.jrpie.android.launcher.preferences.LauncherPreferences
|
import de.jrpie.android.launcher.preferences.LauncherPreferences
|
||||||
|
|
|
@ -92,19 +92,13 @@ class ManageWidgetsActivity : UIObject, Activity() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
(application as Application).appWidgetHost.stopListening()
|
|
||||||
super.onPause()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
(application as Application).appWidgetHost.startListening()
|
|
||||||
|
|
||||||
binding.manageWidgetsContainer.updateWidgets(
|
binding.manageWidgetsContainer.updateWidgets(
|
||||||
this,
|
this,
|
||||||
LauncherPreferences.widgets().widgets()
|
LauncherPreferences.widgets().widgets()
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||||
|
|
|
@ -113,7 +113,7 @@ class WidgetManagerView(widgetPanelId: Int, context: Context, attrs: AttributeSe
|
||||||
height
|
height
|
||||||
)
|
)
|
||||||
selectedWidgetOverlayView = view
|
selectedWidgetOverlayView = view
|
||||||
selectedWidgetView = widgetViewById[view.widgetId]
|
selectedWidgetView = widgetViewById[view.widgetId] ?: return true
|
||||||
startWidgetPosition = position
|
startWidgetPosition = position
|
||||||
|
|
||||||
val positionInView = start.minus(Point(position.left, position.top))
|
val positionInView = start.minus(Point(position.left, position.top))
|
||||||
|
|
|
@ -41,7 +41,7 @@ class AppWidget(
|
||||||
id,
|
id,
|
||||||
position,
|
position,
|
||||||
panelId,
|
panelId,
|
||||||
panelId != WidgetPanel.HOME.id,
|
false,
|
||||||
widgetProviderInfo.provider.packageName,
|
widgetProviderInfo.provider.packageName,
|
||||||
widgetProviderInfo.provider.className,
|
widgetProviderInfo.provider.className,
|
||||||
widgetProviderInfo.profile.hashCode()
|
widgetProviderInfo.profile.hashCode()
|
||||||
|
@ -78,10 +78,6 @@ class AppWidget(
|
||||||
|
|
||||||
override fun createView(activity: Activity): AppWidgetHostView? {
|
override fun createView(activity: Activity): AppWidgetHostView? {
|
||||||
val providerInfo = activity.getAppWidgetManager().getAppWidgetInfo(id) ?: return null
|
val providerInfo = activity.getAppWidgetManager().getAppWidgetInfo(id) ?: return null
|
||||||
/* TODO: if providerInfo is null, the corresponding app was probably uninstalled.
|
|
||||||
There does not seem to be a way to recover the widget when the app is installed again,
|
|
||||||
hence it should be deleted. */
|
|
||||||
|
|
||||||
val view = activity.getAppWidgetHost()
|
val view = activity.getAppWidgetHost()
|
||||||
.createView(activity, this.id, providerInfo)
|
.createView(activity, this.id, providerInfo)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue