-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Initializer interface - Detector Interface
- Loading branch information
1 parent
1f9c720
commit 09526fc
Showing
10 changed files
with
83 additions
and
15 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
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/prolificinteractive/sample/noop/NoOpInitializer.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,10 @@ | ||
package com.prolificinteractive.sample.noop | ||
|
||
import android.content.Context | ||
import com.prolificinteractive.birdo.Initializer | ||
|
||
class NoOpInitializer : Initializer { | ||
override fun start(context: Context) { | ||
// No Op. | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/prolificinteractive/sample/noop/NoOpShakerDetector.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,25 @@ | ||
package com.prolificinteractive.sample.noop | ||
|
||
import android.content.Context | ||
import com.prolificinteractive.birdo.Initializer | ||
import com.prolificinteractive.birdo.ShakerDetector | ||
|
||
/** | ||
* One of the detector for starting Birdo. | ||
* | ||
* It will listen to shakes from the user and start Birdo upon shake. This listener needs to be | ||
* initialized in the application class of your app. | ||
*/ | ||
class NoOpShakerDetector( | ||
context: Context, | ||
initializer: Initializer | ||
) : ShakerDetector(context, initializer) { | ||
|
||
/** | ||
* Start the detector. | ||
* | ||
*/ | ||
override fun detect() { | ||
// No Op | ||
} | ||
} |
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
6 changes: 6 additions & 0 deletions
6
birdo/src/main/java/com/prolificinteractive/birdo/Detector.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,6 @@ | ||
package com.prolificinteractive.birdo | ||
|
||
/** | ||
* Abstract class for detector, implement this when creating your own. | ||
*/ | ||
abstract class Detector(val initializer: Initializer) |
13 changes: 13 additions & 0 deletions
13
birdo/src/main/java/com/prolificinteractive/birdo/Initializer.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,13 @@ | ||
package com.prolificinteractive.birdo | ||
|
||
import android.content.Context | ||
|
||
/** | ||
* Interface for initializer providing start method, implement this when creating your own. | ||
*/ | ||
interface Initializer { | ||
/** | ||
* Start method for your debug view. | ||
*/ | ||
fun start(context: Context) | ||
} |
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