-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from haroldadmin/auto-init
feat: Switch to androidx startup instead of content provider for init
- Loading branch information
Showing
6 changed files
with
43 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 0 additions & 77 deletions
77
what-the-stack/src/main/java/com/haroldadmin/whatthestack/WhatTheStackInitProvider.kt
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
what-the-stack/src/main/java/com/haroldadmin/whatthestack/WhatTheStackInitializer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.haroldadmin.whatthestack | ||
|
||
import android.content.Context | ||
import androidx.startup.Initializer | ||
import java.lang.Class | ||
|
||
/** | ||
* WhatTheStackInitializer is an [androidx.startup.Initializer] for WhatTheStack | ||
* | ||
* This particular initializer does not need to return anything, but it is required to return | ||
* a sensible value here so we return an instance of a dummy class [WhatTheStackInitializedToken] | ||
* instead. | ||
*/ | ||
class WhatTheStackInitializer : Initializer<WhatTheStackInitializedToken> { | ||
|
||
override fun create(context: Context): WhatTheStackInitializedToken { | ||
InitializationManager.init(context) | ||
return WhatTheStackInitializedToken() | ||
} | ||
|
||
override fun dependencies(): List<Class<out Initializer<*>>> { | ||
return emptyList() | ||
} | ||
} | ||
|
||
/** | ||
* A dummy class that does nothing but represent a type that can be returned by | ||
* [WhatTheStackInitializer] | ||
*/ | ||
class WhatTheStackInitializedToken |