This repository has been archived by the owner on May 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into javi-1159-apptentive
- Loading branch information
Showing
75 changed files
with
1,401 additions
and
304 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
Binary file added
BIN
+300 Bytes
modules/app/src/main/res/drawable-hdpi/icon_edit_moment_bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+235 Bytes
modules/app/src/main/res/drawable-mdpi/icon_edit_moment_bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+325 Bytes
modules/app/src/main/res/drawable-xhdpi/icon_edit_moment_bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+442 Bytes
modules/app/src/main/res/drawable-xxhdpi/icon_edit_moment_bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+477 Bytes
modules/app/src/main/res/drawable-xxxhdpi/icon_edit_moment_bluetooth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
18 changes: 11 additions & 7 deletions
18
modules/app/src/main/scala/cards/nine/app/commons/ContextSupportProvider.scala
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
24 changes: 24 additions & 0 deletions
24
modules/app/src/main/scala/cards/nine/app/receivers/bluetooth/BluetoothJobs.scala
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,24 @@ | ||
package cards.nine.app.receivers.bluetooth | ||
|
||
import cards.nine.app.ui.commons.action_filters.MomentBestAvailableActionFilter | ||
import cards.nine.app.ui.commons.{BroadAction, Jobs} | ||
import cards.nine.commons.services.TaskService | ||
import cards.nine.commons.services.TaskService.TaskService | ||
import cards.nine.commons.services.TaskService._ | ||
import macroid.ContextWrapper | ||
|
||
class BluetoothJobs(implicit contextWrapper: ContextWrapper) extends Jobs { | ||
|
||
def addBluetoothDevice(device: String): TaskService[Unit] = | ||
for { | ||
_ <- TaskService.right(contextSupport.addBluetoothDevice(device)) | ||
_ <- sendBroadCastTask(BroadAction(MomentBestAvailableActionFilter.action)) | ||
} yield () | ||
|
||
def removeBluetoothDevice(device: String): TaskService[Unit] = | ||
for { | ||
_ <- TaskService.right(contextSupport.removeBluetoothDevice(device)) | ||
_ <- sendBroadCastTask(BroadAction(MomentBestAvailableActionFilter.action)) | ||
} yield () | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
modules/app/src/main/scala/cards/nine/app/receivers/bluetooth/BluetoothReceiver.scala
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,28 @@ | ||
package cards.nine.app.receivers.bluetooth | ||
|
||
import android.bluetooth.BluetoothDevice | ||
import android.content.{BroadcastReceiver, Context, Intent} | ||
import cards.nine.app.ui.commons.ops.TaskServiceOps._ | ||
import macroid.ContextWrapper | ||
|
||
class BluetoothReceiver extends BroadcastReceiver { | ||
|
||
override def onReceive(context: Context, intent: Intent): Unit = { | ||
|
||
implicit val contextWrapper = ContextWrapper(context) | ||
|
||
val jobs = new BluetoothJobs | ||
|
||
(intent.getAction, | ||
Option(intent.getParcelableExtra[BluetoothDevice](BluetoothDevice.EXTRA_DEVICE))) match { | ||
case (action, Some(device: BluetoothDevice)) | ||
if action.equals(BluetoothDevice.ACTION_ACL_CONNECTED) => | ||
jobs.addBluetoothDevice(device.getName).resolveAsync() | ||
case (action, Some(device: BluetoothDevice)) | ||
if action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) => | ||
jobs.removeBluetoothDevice(device.getName).resolveAsync() | ||
case _ => | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.