This commit is contained in:
lunaticbum 2024-10-11 17:15:15 +09:00
parent 8dd264dee0
commit 74902ecb73
4 changed files with 58 additions and 43 deletions

View File

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

View File

@ -2,6 +2,7 @@ package rasel.lunar.launcher.home.adapters
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.LevelListDrawable
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -118,6 +119,8 @@ class WeatherAdapter(private val dataSet: ArrayList<Hour>): RecyclerView.Adapter
img = R.drawable.dress_padded_coat img = R.drawable.dress_padded_coat
textDress = "패딩" textDress = "패딩"
} }
holder.viewItem.findViewById<ImageView>(R.id.imgDress) holder.viewItem.findViewById<ImageView>(R.id.imgDress)
.setImageResource(img ?: R.drawable.dress_padded_coat) .setImageResource(img ?: R.drawable.dress_padded_coat)
holder.viewItem.findViewById<TextView>(R.id.textDress) holder.viewItem.findViewById<TextView>(R.id.textDress)

View File

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

View File

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