better update objectives gui
This commit is contained in:
parent
830f59b2fa
commit
a18f5523b9
1 changed files with 6 additions and 6 deletions
|
@ -210,9 +210,9 @@ class ObjectivesFragment : Fragment() {
|
||||||
NetworkChangeReceiver.fetch()
|
NetworkChangeReceiver.fetch()
|
||||||
if (objectives_fake.isChecked) {
|
if (objectives_fake.isChecked) {
|
||||||
objective.accomplishedOn = DateUtil.now()
|
objective.accomplishedOn = DateUtil.now()
|
||||||
notifyDataSetChanged()
|
|
||||||
scrollToCurrentObjective()
|
scrollToCurrentObjective()
|
||||||
startUpdateTimer()
|
startUpdateTimer()
|
||||||
|
RxBus.send(EventObjectivesUpdateGui())
|
||||||
} else
|
} else
|
||||||
SntpClient.ntpTime(object : SntpClient.Callback() {
|
SntpClient.ntpTime(object : SntpClient.Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
@ -224,9 +224,9 @@ class ObjectivesFragment : Fragment() {
|
||||||
} else if (success) {
|
} else if (success) {
|
||||||
if (objective.isCompleted(time)) {
|
if (objective.isCompleted(time)) {
|
||||||
objective.accomplishedOn = time
|
objective.accomplishedOn = time
|
||||||
notifyDataSetChanged()
|
|
||||||
scrollToCurrentObjective()
|
scrollToCurrentObjective()
|
||||||
startUpdateTimer()
|
startUpdateTimer()
|
||||||
|
RxBus.send(EventObjectivesUpdateGui())
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.showToastInUiThread(context, R.string.requirementnotmet)
|
ToastUtils.showToastInUiThread(context, R.string.requirementnotmet)
|
||||||
}
|
}
|
||||||
|
@ -244,9 +244,9 @@ class ObjectivesFragment : Fragment() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
if (objectives_fake.isChecked) {
|
if (objectives_fake.isChecked) {
|
||||||
objective.startedOn = time
|
objective.startedOn = time
|
||||||
notifyDataSetChanged()
|
|
||||||
scrollToCurrentObjective()
|
scrollToCurrentObjective()
|
||||||
startUpdateTimer()
|
startUpdateTimer()
|
||||||
|
RxBus.send(EventObjectivesUpdateGui())
|
||||||
} else
|
} else
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
holder.start.visibility = View.VISIBLE
|
holder.start.visibility = View.VISIBLE
|
||||||
|
@ -255,9 +255,9 @@ class ObjectivesFragment : Fragment() {
|
||||||
ToastUtils.showToastInUiThread(context, R.string.notconnected)
|
ToastUtils.showToastInUiThread(context, R.string.notconnected)
|
||||||
} else if (success) {
|
} else if (success) {
|
||||||
objective.startedOn = time
|
objective.startedOn = time
|
||||||
notifyDataSetChanged()
|
|
||||||
scrollToCurrentObjective()
|
scrollToCurrentObjective()
|
||||||
startUpdateTimer()
|
startUpdateTimer()
|
||||||
|
RxBus.send(EventObjectivesUpdateGui())
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.showToastInUiThread(context, R.string.failedretrievetime)
|
ToastUtils.showToastInUiThread(context, R.string.failedretrievetime)
|
||||||
}
|
}
|
||||||
|
@ -272,8 +272,8 @@ class ObjectivesFragment : Fragment() {
|
||||||
val prevObj = ObjectivesPlugin.objectives[position - 1]
|
val prevObj = ObjectivesPlugin.objectives[position - 1]
|
||||||
prevObj.accomplishedOn = 0
|
prevObj.accomplishedOn = 0
|
||||||
}
|
}
|
||||||
notifyDataSetChanged()
|
|
||||||
scrollToCurrentObjective()
|
scrollToCurrentObjective()
|
||||||
|
RxBus.send(EventObjectivesUpdateGui())
|
||||||
}
|
}
|
||||||
if (objective.hasSpecialInput && !objective.isAccomplished && objective.isStarted) {
|
if (objective.hasSpecialInput && !objective.isAccomplished && objective.isStarted) {
|
||||||
// generate random request code if none exists
|
// generate random request code if none exists
|
||||||
|
@ -287,7 +287,7 @@ class ObjectivesFragment : Fragment() {
|
||||||
holder.enterButton.setOnClickListener {
|
holder.enterButton.setOnClickListener {
|
||||||
val input = holder.input.text.toString()
|
val input = holder.input.text.toString()
|
||||||
objective.specialAction(activity, input)
|
objective.specialAction(activity, input)
|
||||||
notifyDataSetChanged()
|
RxBus.send(EventObjectivesUpdateGui())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
holder.enterButton.visibility = View.GONE
|
holder.enterButton.visibility = View.GONE
|
||||||
|
|
Loading…
Reference in a new issue