fix objectives fragment
This commit is contained in:
parent
2a7a004afd
commit
e84e59b4ca
1 changed files with 43 additions and 31 deletions
|
@ -208,15 +208,21 @@ class ObjectivesFragment : Fragment() {
|
||||||
holder.verify.setOnClickListener {
|
holder.verify.setOnClickListener {
|
||||||
holder.verify.visibility = View.INVISIBLE
|
holder.verify.visibility = View.INVISIBLE
|
||||||
NetworkChangeReceiver.fetch()
|
NetworkChangeReceiver.fetch()
|
||||||
|
if (objectives_fake.isChecked) {
|
||||||
|
objective.accomplishedOn = DateUtil.now()
|
||||||
|
notifyDataSetChanged()
|
||||||
|
scrollToCurrentObjective()
|
||||||
|
startUpdateTimer()
|
||||||
|
} else
|
||||||
SntpClient.ntpTime(object : SntpClient.Callback() {
|
SntpClient.ntpTime(object : SntpClient.Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
holder.verify.visibility = View.VISIBLE
|
holder.verify.visibility = View.VISIBLE
|
||||||
log.debug("NTP time: $time System time: ${DateUtil.now()}")
|
log.debug("NTP time: $time System time: ${DateUtil.now()}")
|
||||||
if (!networkConnected && !objectives_fake.isChecked) {
|
if (!networkConnected) {
|
||||||
ToastUtils.showToastInUiThread(context, R.string.notconnected)
|
ToastUtils.showToastInUiThread(context, R.string.notconnected)
|
||||||
} else if (success) {
|
} else if (success) {
|
||||||
if (objective.isCompleted(time) || objectives_fake.isChecked) {
|
if (objective.isCompleted(time)) {
|
||||||
objective.accomplishedOn = time
|
objective.accomplishedOn = time
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
scrollToCurrentObjective()
|
scrollToCurrentObjective()
|
||||||
|
@ -236,10 +242,16 @@ class ObjectivesFragment : Fragment() {
|
||||||
NetworkChangeReceiver.fetch()
|
NetworkChangeReceiver.fetch()
|
||||||
SntpClient.ntpTime(object : SntpClient.Callback() {
|
SntpClient.ntpTime(object : SntpClient.Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
|
if (objectives_fake.isChecked) {
|
||||||
|
objective.startedOn = time
|
||||||
|
notifyDataSetChanged()
|
||||||
|
scrollToCurrentObjective()
|
||||||
|
startUpdateTimer()
|
||||||
|
} else
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
holder.start.visibility = View.VISIBLE
|
holder.start.visibility = View.VISIBLE
|
||||||
log.debug("NTP time: $time System time: ${DateUtil.now()}")
|
log.debug("NTP time: $time System time: ${DateUtil.now()}")
|
||||||
if (!networkConnected && !objectives_fake.isChecked) {
|
if (!networkConnected) {
|
||||||
ToastUtils.showToastInUiThread(context, R.string.notconnected)
|
ToastUtils.showToastInUiThread(context, R.string.notconnected)
|
||||||
} else if (success) {
|
} else if (success) {
|
||||||
objective.startedOn = time
|
objective.startedOn = time
|
||||||
|
|
Loading…
Reference in a new issue