Skip to content

Commit

Permalink
Bug fixes: Add additinal logging for Start/Stop
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrivoruchko committed Aug 19, 2017
1 parent faecb3a commit c2c9352
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package info.dvkr.screenstream.presenter


import com.crashlytics.android.Crashlytics
import info.dvkr.screenstream.BuildConfig
import info.dvkr.screenstream.dagger.PersistentScope
import info.dvkr.screenstream.model.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class ForegroundService : Service(), ForegroundServiceView {
projectionCallback = object : MediaProjection.Callback() {
override fun onStop() {
if (BuildConfig.DEBUG_MODE) Log.w(TAG, "Thread [${Thread.currentThread().name}] ProjectionCallback")
Crashlytics.log(1, "EventBus.GlobalEvent.StopStream", "ProjectionCallback")
eventBus.sendEvent(EventBus.GlobalEvent.StopStream())
}
}
Expand Down
11 changes: 10 additions & 1 deletion app/src/main/java/info/dvkr/screenstream/ui/StartActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,18 @@ class StartActivity : BaseActivity(), StartActivityView {

is StartActivityView.ToEvent.OnStreamStartStop -> {
setStreamRunning(event.running)
Crashlytics.log(1, "StartActivityView.ToEvent.OnStreamStartStop", "isRunning=$isRunning")
if (event.running && settings.minimizeOnStream)
startActivity(Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
}

is StartActivityView.ToEvent.ResizeFactor -> showResizeFactor(event.value)
is StartActivityView.ToEvent.EnablePin -> showEnablePin(event.value)
is StartActivityView.ToEvent.SetPin -> textViewPinValue.text = event.value
is StartActivityView.ToEvent.StreamRunning -> setStreamRunning(event.running)
is StartActivityView.ToEvent.StreamRunning -> {
setStreamRunning(event.running)
Crashlytics.log(1, "StartActivityView.ToEvent.StreamRunning", "isRunning=$isRunning")
}

is StartActivityView.ToEvent.Error -> {
canStart = true
Expand Down Expand Up @@ -160,10 +164,12 @@ class StartActivity : BaseActivity(), StartActivityView {
toggleButtonStartStop.isChecked = isRunning
if (!canStart) return@setOnClickListener
toggleButtonStartStop.isEnabled = false
Crashlytics.log(1, "StartActivityView.FromEvent.TryStartStreamm", "setOnClickListener;isRunning=$isRunning")
fromEvents.onNext(StartActivityView.FromEvent.TryStartStream())
} else {
toggleButtonStartStop.isChecked = isRunning
toggleButtonStartStop.isEnabled = false
Crashlytics.log(1, "StartActivityView.FromEvent.StopStream", "setOnClickListener;isRunning=$isRunning")
fromEvents.onNext(StartActivityView.FromEvent.StopStream())
}
}
Expand Down Expand Up @@ -238,14 +244,17 @@ class StartActivity : BaseActivity(), StartActivityView {

when (action) {
ACTION_START_STREAM -> {
if (!canStart) return
toggleButtonStartStop.isChecked = isRunning
toggleButtonStartStop.isEnabled = false
Crashlytics.log(1, "StartActivityView.FromEvent.TryStartStreamm", "ACTION_START_STREAM;isRunning=$isRunning")
fromEvents.onNext(StartActivityView.FromEvent.TryStartStream())
}

ACTION_STOP_STREAM -> {
toggleButtonStartStop.isChecked = isRunning
toggleButtonStartStop.isEnabled = false
Crashlytics.log(1, "StartActivityView.FromEvent.StopStream", "ACTION_STOP_STREAM;isRunning=$isRunning")
fromEvents.onNext(StartActivityView.FromEvent.StopStream())
}

Expand Down

0 comments on commit c2c9352

Please sign in to comment.