....
This commit is contained in:
parent
b1fdea3317
commit
ff14d6d3a5
@ -36,6 +36,7 @@ import androidx.fragment.app.FragmentManager
|
|||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.work.OneTimeWorkRequest
|
import androidx.work.OneTimeWorkRequest
|
||||||
import androidx.work.OneTimeWorkRequestBuilder
|
import androidx.work.OneTimeWorkRequestBuilder
|
||||||
|
import androidx.work.PeriodicWorkRequestBuilder
|
||||||
import androidx.work.WorkInfo
|
import androidx.work.WorkInfo
|
||||||
import androidx.work.WorkManager
|
import androidx.work.WorkManager
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
@ -62,6 +63,7 @@ import rasel.lunar.launcher.utils.MissedCallGetter
|
|||||||
import rasel.lunar.launcher.utils.SimpleFingerGestures
|
import rasel.lunar.launcher.utils.SimpleFingerGestures
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
|
||||||
internal class LauncherHome : Fragment() {
|
internal class LauncherHome : Fragment() {
|
||||||
@ -82,7 +84,23 @@ internal class LauncherHome : Fragment() {
|
|||||||
binding.favAppsGroup.visibility = View.GONE
|
binding.favAppsGroup.visibility = View.GONE
|
||||||
|
|
||||||
mWorkManager = WorkManager.getInstance(lActivity!!.application);
|
mWorkManager = WorkManager.getInstance(lActivity!!.application);
|
||||||
mWorkManager?.enqueue(OneTimeWorkRequestBuilder<MissedCallGetter>().addTag("MissedCallGetter").build())
|
mWorkManager?.enqueue(PeriodicWorkRequestBuilder<MissedCallGetter>(30, TimeUnit.MINUTES).addTag("MissedCallGetter").build())
|
||||||
|
mSavedWorkInfo = mWorkManager?.getWorkInfosByTagLiveData("MissedCallGetter");
|
||||||
|
getOutputWorkInfo().observeForever {
|
||||||
|
it.last()?.outputData?.keyValueMap?.forEach { t, u ->
|
||||||
|
try {
|
||||||
|
if (u is String) {
|
||||||
|
Gson().fromJson(u,MissedCall::class.java)?.let {
|
||||||
|
callList.add(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e : Exception) {
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
showTodoList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BLog.LOGE("onCreateView()")
|
BLog.LOGE("onCreateView()")
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
@ -135,22 +153,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
|
|
||||||
/* show weather */
|
/* show weather */
|
||||||
WeatherExecutor(settingsPrefs).generateWeatherString(binding.weather)
|
WeatherExecutor(settingsPrefs).generateWeatherString(binding.weather)
|
||||||
mSavedWorkInfo = mWorkManager?.getWorkInfosByTagLiveData("MissedCallGetter");
|
|
||||||
getOutputWorkInfo().observeForever {
|
|
||||||
it.last()?.outputData?.keyValueMap?.forEach { t, u ->
|
|
||||||
try {
|
|
||||||
if (u is String) {
|
|
||||||
Gson().fromJson(u,MissedCall::class.java)?.let {
|
|
||||||
callList.add(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e : Exception) {
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
showTodoList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user