From 3f2a92b880ec3bd2e3b920a6cc8b11729f7ac7d4 Mon Sep 17 00:00:00 2001 From: lunaticbum <> Date: Wed, 16 Oct 2024 15:59:59 +0900 Subject: [PATCH] .... --- app/src/main/AndroidManifest.xml | 3 + .../rasel/lunar/launcher/LauncherActivity.kt | 16 +- .../rasel/lunar/launcher/apps/AppDrawer.kt | 4 +- .../rasel/lunar/launcher/feeds/Feeds.kt | 101 ++++++++-- .../rasel/lunar/launcher/feeds/FeedsResult.kt | 3 +- .../lunar/launcher/helpers/BleHelper.java | 22 +++ .../launcher/helpers/BluetoothManager.kt | 172 ++++++++++++++++++ .../launcher/home/adapters/RssItemAdapter.kt | 6 +- .../rasel/lunar/launcher/model/LocationLog.kt | 5 + app/src/main/res/layout/feeds_result_menu.xml | 7 +- 10 files changed, 315 insertions(+), 24 deletions(-) create mode 100644 app/src/main/kotlin/rasel/lunar/launcher/helpers/BleHelper.java create mode 100644 app/src/main/kotlin/rasel/lunar/launcher/helpers/BluetoothManager.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 750a104..4d91bb3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,6 +6,7 @@ android:required="false" /> + @@ -24,6 +25,7 @@ + @@ -31,6 +33,7 @@ + diff --git a/app/src/main/kotlin/rasel/lunar/launcher/LauncherActivity.kt b/app/src/main/kotlin/rasel/lunar/launcher/LauncherActivity.kt index 36efa5b..4ef48d1 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/LauncherActivity.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/LauncherActivity.kt @@ -85,6 +85,7 @@ import rasel.lunar.launcher.databinding.LauncherActivityBinding import rasel.lunar.launcher.databinding.RecommendedHourlyDressBinding import rasel.lunar.launcher.feeds.Feeds import rasel.lunar.launcher.feeds.WidgetHost +import rasel.lunar.launcher.helpers.BluetoothManager import rasel.lunar.launcher.helpers.Constants.Companion.KEY_APPLICATION_THEME import rasel.lunar.launcher.helpers.Constants.Companion.KEY_FIRST_LAUNCH import rasel.lunar.launcher.helpers.Constants.Companion.KEY_STATUS_BAR @@ -433,9 +434,14 @@ internal class LauncherActivity : AppCompatActivity() { super.onDestroy() appWidgetHost?.stopListening() } - + var blutoothManager : BluetoothManager? = null override fun onStart() { super.onStart() + blutoothManager = BluetoothManager(this) + blutoothManager?.register() + blutoothManager?.initBluetoothAdapter() + blutoothManager?.blueToothState() + blutoothManager?.getPairedDevices() BLog.LOGE("LauncherActivity onStart()") statusBarView() setBgColor() @@ -444,12 +450,14 @@ internal class LauncherActivity : AppCompatActivity() { @RequiresApi(Build.VERSION_CODES.O_MR1) override fun onResume() { super.onResume() + blutoothManager?.getPairedDevices() BLog.LOGE("LauncherActivity onResume") } private fun welcomeDialog() { var needAsk = if ( + this.checkSelfPermission(Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.WRITE_CALENDAR) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED || @@ -460,6 +468,7 @@ internal class LauncherActivity : AppCompatActivity() { this.checkSelfPermission(Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.READ_SMS) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED || + this.checkSelfPermission(Manifest.permission.ACCESS_BACKGROUND_LOCATION) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED ) { true @@ -490,6 +499,7 @@ internal class LauncherActivity : AppCompatActivity() { /* phone permission */ if ( + this.checkSelfPermission(Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.WRITE_CALENDAR) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED || @@ -500,9 +510,12 @@ internal class LauncherActivity : AppCompatActivity() { this.checkSelfPermission(Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.READ_SMS) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED || + this.checkSelfPermission(Manifest.permission.ACCESS_BACKGROUND_LOCATION) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED + ) { this.requestPermissions(arrayOf( + Manifest.permission.BLUETOOTH_CONNECT, Manifest.permission.READ_CALENDAR, Manifest.permission.WRITE_CALENDAR, Manifest.permission.READ_CONTACTS, @@ -513,6 +526,7 @@ internal class LauncherActivity : AppCompatActivity() { Manifest.permission.RECEIVE_MMS, Manifest.permission.RECEIVE_SMS, Manifest.permission.ACCESS_COARSE_LOCATION, + Manifest.permission.ACCESS_BACKGROUND_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CALL_PHONE, Manifest.permission.READ_SMS), 1) diff --git a/app/src/main/kotlin/rasel/lunar/launcher/apps/AppDrawer.kt b/app/src/main/kotlin/rasel/lunar/launcher/apps/AppDrawer.kt index 9164dc5..16816b5 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/apps/AppDrawer.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/apps/AppDrawer.kt @@ -282,7 +282,9 @@ internal class AppDrawer : Fragment() { val chechHandler = Handler(Looper.getMainLooper()) - val cancelSearch = Runnable { lActivity?.viewPager?.currentItem = 1 } + val cancelSearch = Runnable { +// lActivity?.viewPager?.currentItem = 1 + } fun registCancelSearch() { chechHandler.removeCallbacks(cancelSearch) diff --git a/app/src/main/kotlin/rasel/lunar/launcher/feeds/Feeds.kt b/app/src/main/kotlin/rasel/lunar/launcher/feeds/Feeds.kt index 32edcbd..fe5b51b 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/feeds/Feeds.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/feeds/Feeds.kt @@ -18,17 +18,21 @@ package rasel.lunar.launcher.feeds +import android.Manifest import android.app.Activity.RESULT_CANCELED import android.app.Activity.RESULT_OK import android.appwidget.AppWidgetManager import android.content.DialogInterface import android.content.Intent import android.content.SharedPreferences +import android.content.pm.PackageManager import android.net.Uri import android.os.Bundle import android.os.Handler import android.os.Looper -import android.os.ResultReceiver +import android.speech.RecognitionListener +import android.speech.RecognizerIntent +import android.speech.SpeechRecognizer import android.text.method.ScrollingMovementMethod import android.view.ContextMenu import android.view.Gravity @@ -52,7 +56,6 @@ import io.realm.kotlin.ext.query import io.realm.kotlin.query.Sort import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.delay import kotlinx.coroutines.isActive import kotlinx.coroutines.launch @@ -65,7 +68,6 @@ import rasel.lunar.launcher.LauncherActivity.Companion.lActivity import rasel.lunar.launcher.LauncherActivity.Companion.refreshDeviceData import rasel.lunar.launcher.LauncherActivity.Companion.refreshFeeds import rasel.lunar.launcher.R -import rasel.lunar.launcher.apps.ContactMenu import rasel.lunar.launcher.databinding.FeedsBinding import rasel.lunar.launcher.feeds.rss.RssAdapter import rasel.lunar.launcher.helpers.Constants.Companion.KEY_WIDGET_HEIGHTS @@ -76,33 +78,22 @@ import rasel.lunar.launcher.helpers.Constants.Companion.requestCreateWidget import rasel.lunar.launcher.helpers.Constants.Companion.requestPickWidget import rasel.lunar.launcher.helpers.PrefHelper import rasel.lunar.launcher.home.LauncherHome.Companion.home -import rasel.lunar.launcher.home.LauncherHome.Companion.lastedFinishedPageUrl import rasel.lunar.launcher.home.LauncherHome.Companion.listTags import rasel.lunar.launcher.model.CiliMagnet -import rasel.lunar.launcher.model.MostItem import rasel.lunar.launcher.model.RssData import rasel.lunar.launcher.model.RssDataInterface import rasel.lunar.launcher.model.RssDataType import rasel.lunar.launcher.model.jGuruTag -import rasel.lunar.launcher.model.dateFormat -import rasel.lunar.launcher.model.getRssData import rasel.lunar.launcher.utils.BLog import rasel.lunar.launcher.utils.FeedParseManager -import rasel.lunar.launcher.utils.JamoUtils import rasel.lunar.launcher.utils.RssList.jGuruMain -import rasel.lunar.launcher.utils.USAGT import rasel.lunar.launcher.utils.getJ -import rasel.lunar.launcher.workers.BaseGetter import rasel.lunar.launcher.workers.RecentCallGetter import rasel.lunar.launcher.workers.RecentSmsGetter import rasel.lunar.launcher.workers.WorkersDb import java.net.URLEncoder import java.nio.charset.Charset -import java.text.SimpleDateFormat import java.util.Base64 -import java.util.Date -import java.util.concurrent.Executors -import java.util.concurrent.TimeUnit internal class Feeds : Fragment() , CommadCallabck { @@ -210,7 +201,7 @@ internal class Feeds : Fragment() , CommadCallabck { override fun collectComplete() { } - + var speechRecognizer : SpeechRecognizer? = null /* start rss service if network is active and rss url is not empty */ private fun startService() { @@ -304,6 +295,86 @@ internal class Feeds : Fragment() , CommadCallabck { binding.expandRss.isChecked = false } else { when (input.text.toString()) { + "spe"->{ + speechRecognizer?.stopListening() + speechRecognizer?.destroy() + speechRecognizer = null + } + "sps"->{ + lActivity?.let { lActivity -> + if (lActivity.checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { + lActivity.requestPermissions(arrayOf(Manifest.permission.RECORD_AUDIO), 1) + } else { + speechRecognizer = SpeechRecognizer.createSpeechRecognizer(lActivity) + val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) + intent.putExtra( + RecognizerIntent.EXTRA_LANGUAGE_MODEL, + RecognizerIntent.LANGUAGE_MODEL_FREE_FORM + ) + intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true) + + speechRecognizer?.setRecognitionListener(object : RecognitionListener { + override fun onReadyForSpeech(params: Bundle) { + consoleLog("onReadyForSpeech ") + } + + override fun onBeginningOfSpeech() { + consoleLog("onBeginningOfSpeech ") + } + + override fun onRmsChanged(rmsdB: Float) {} + + override fun onBufferReceived(buffer: ByteArray) {} + + override fun onEndOfSpeech() { + consoleLog("onEndOfSpeech ") + } + + override fun onError(error: Int) { + consoleLog("onError ${error}") + } + + override fun onResults(results: Bundle) { + val matches = + results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION) + if (matches != null) { + val recognizedText = matches[0] + consoleLog("recognizedText ${recognizedText}") + } + } + + override fun onPartialResults(partialResults: Bundle) { + consoleLog("recognizedText ${partialResults}") + } + + override fun onEvent(eventType: Int, params: Bundle) {} + }) + + speechRecognizer?.startListening(intent) + } + } + } + "citys" -> { + val baseUrl = "https://www.worldcitydb.com/" + var nations = arrayListOf() + CoroutineScope(Dispatchers.IO).launch { + "https://www.worldcitydb.com/search-by-country?lang=ko".getJ().let { doc -> + BLog.LOGE("it.title() >> ${doc.title()}") + doc.getElementsByTag("tr").forEach { table -> + table.children().forEach { + it.getElementsByTag("td").forEach { td -> + td.children().forEach { + if (it.tag().name.equals("a")) { + BLog.LOGE("TD>>A ${it}") + it.text() + } + } + } + } + } + } + } + } "loc_ck" -> { FeedsResult().show(parentFragmentManager, "") } diff --git a/app/src/main/kotlin/rasel/lunar/launcher/feeds/FeedsResult.kt b/app/src/main/kotlin/rasel/lunar/launcher/feeds/FeedsResult.kt index 04bb66e..d007c8e 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/feeds/FeedsResult.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/feeds/FeedsResult.kt @@ -14,6 +14,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.gson.Gson import io.realm.kotlin.ext.query +import io.realm.kotlin.query.Sort import rasel.lunar.launcher.BuildConfig import rasel.lunar.launcher.apps.DismissCalback import rasel.lunar.launcher.databinding.FeedsResultMenuBinding @@ -36,7 +37,7 @@ internal class FeedsResult : BottomSheetDialogFragment() { /* get package name from fragment's tag */ searchWord = tag.toString() - WorkersDb.getRealm().query().find()?.let { + WorkersDb.getRealm().query().sort("time", Sort.DESCENDING).find()?.let { if (it.size > 0) { binding.logs.text = it.map { BLog.LOGE("LocLog >> ${it.toString()}") diff --git a/app/src/main/kotlin/rasel/lunar/launcher/helpers/BleHelper.java b/app/src/main/kotlin/rasel/lunar/launcher/helpers/BleHelper.java new file mode 100644 index 0000000..7ee6af3 --- /dev/null +++ b/app/src/main/kotlin/rasel/lunar/launcher/helpers/BleHelper.java @@ -0,0 +1,22 @@ +package rasel.lunar.launcher.helpers; + +import android.annotation.SuppressLint; +import android.bluetooth.BluetoothDevice; + +import java.lang.reflect.Method; + +import rasel.lunar.launcher.utils.BLog; + +public class BleHelper { + @SuppressLint("MissingPermission") + public static boolean isConnected(BluetoothDevice device) { + try { + Method m = device.getClass().getMethod("isConnected", (Class[]) null); + boolean connected = (boolean) m.invoke(device, (Object[]) null); + BLog.INSTANCE.LOGE("D >> " + device.getName() + " || isConnected >>> " + (connected ? "TRUE" : "FALSE")); + return connected; + } catch (Exception e) { + throw new IllegalStateException(e); + } + } +} diff --git a/app/src/main/kotlin/rasel/lunar/launcher/helpers/BluetoothManager.kt b/app/src/main/kotlin/rasel/lunar/launcher/helpers/BluetoothManager.kt new file mode 100644 index 0000000..51005e4 --- /dev/null +++ b/app/src/main/kotlin/rasel/lunar/launcher/helpers/BluetoothManager.kt @@ -0,0 +1,172 @@ +package rasel.lunar.launcher.helpers + +import android.Manifest +import android.annotation.SuppressLint +import android.bluetooth.BluetoothAdapter +import android.bluetooth.BluetoothDevice +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.content.pm.PackageManager +import androidx.core.app.ActivityCompat +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import okhttp3.ConnectionPool +import okhttp3.OkHttpClient +import okhttp3.Request +import okhttp3.Response +import okhttp3.ResponseBody +import org.apache.commons.lang3.ObjectUtils.Null +import rasel.lunar.launcher.utils.BLog +import rasel.lunar.launcher.utils.BLog.LOGE +import java.util.concurrent.TimeUnit + + +class BluetoothManager { + + enum class BLUETOOTH_STATE(val statestr: String) { + ENABLED("enabledBlutooth"), + DISABLED("disableBlutooth"), + NOT_SUPPORT("notSupport") + } + + lateinit var context: Context + var blueToothAdapter:BluetoothAdapter? = null + + constructor(context: Context) { + this.context = context + } + constructor() { + + } + +// init { +// this.context = context +// } + + fun initBluetoothAdapter(){ + if ( blueToothAdapter == null ){ + val bluetoothManager = context.getSystemService(Context.BLUETOOTH_SERVICE) as android.bluetooth.BluetoothManager + blueToothAdapter = bluetoothManager.getAdapter() + } + } + + fun register(){ + if (context == null) return + context.registerReceiver(bluetoothreceiver, addFilterAction()) + } + + fun unregister(){ + if (context == null) return + context.unregisterReceiver(bluetoothreceiver) + } + + //페어링된 디바이스 정보 가져오기 + + fun getPairedDevices() { + val bluetoothManager = context.getSystemService(Context.BLUETOOTH_SERVICE) as android.bluetooth.BluetoothManager + blueToothAdapter = bluetoothManager.adapter + if (ActivityCompat.checkSelfPermission(context,Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) return + var pairedDevices = blueToothAdapter?.bondedDevices + if (pairedDevices?.size ?: 0 > 0) { + pairedDevices?.forEach { i -> + //bondState : 12 (페어링 등록된 상태) + //bondState : 10 (페어링 등록 안됨) + BLog.LOGE("getPairedDevices() / name : ${i.name}") + BLog.LOGE("getPairedDevices() / bondState : ${i.bondState}") + if(i.name.contains("SOUL") && isConnected(i)) { + sendToI() + } + } + } + } + + + fun sendToI() { + CoroutineScope(Dispatchers.IO).launch { + val url = "https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=83268260&text=돼지가쏘울레탔다요." + //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") + } + } + @SuppressLint("MissingPermission") + fun isConnected(device: BluetoothDevice): Boolean { + try { + val m = device.javaClass.getMethod("isConnected") + val connected = m.invoke(device) as Boolean + BLog.LOGE("D >> " + device.name + " || isConnected >>> " + (if (connected) "TRUE" else "FALSE")) + return connected + } catch (e: Exception) { + throw IllegalStateException(e) + } + } + + //블루투스 상태(켜짐 / 꺼짐 / 지원 불가 기기) + fun blueToothState(): String { + if (blueToothAdapter != null) { + if (blueToothAdapter!!.isEnabled) { + return BLUETOOTH_STATE.ENABLED.statestr + } else { + return BLUETOOTH_STATE.DISABLED.statestr + } + } + return BLUETOOTH_STATE.NOT_SUPPORT.statestr + } + + //add Receive action + private fun addFilterAction(): IntentFilter { + val stateFilter = IntentFilter() + stateFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED) //BluetoothAdapter.ACTION_STATE_CHANGED : 블루투스 상태변화 액션 + stateFilter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED) + stateFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED) //연결 확인 + stateFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED) //연결 끊김 확인 + /* + stateFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED) + stateFilter.addAction(BluetoothDevice.ACTION_FOUND) //기기 검색됨 + stateFilter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED) //기기 검색 시작 + stateFilter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED) //기기 검색 종료 + stateFilter.addAction(BluetoothDevice.ACTION_PAIRING_REQUEST) + */ + return stateFilter + } + + //BlueTooth Receiver + private var bluetoothreceiver = object : BroadcastReceiver(){ + override fun onReceive(context: Context?, intent: Intent?) { + var state = intent?.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR) + BLog.LOGE("onReceive() / state : ${state}") + val action = intent!!.action + BLog.LOGE("onReceive() / action : ${action}") + if (context == null) return + if (ActivityCompat.checkSelfPermission(context!!, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) return + val device: BluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE)!! + BLog.LOGE("onReceive() / device.name : ${device.name}") + BLog.LOGE("onReceive() / device.type : ${device.type}") + if(device.name.contains("SOUL") && isConnected(device)) { + sendToI() + } + } + } +} \ No newline at end of file diff --git a/app/src/main/kotlin/rasel/lunar/launcher/home/adapters/RssItemAdapter.kt b/app/src/main/kotlin/rasel/lunar/launcher/home/adapters/RssItemAdapter.kt index 8326359..1185929 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/home/adapters/RssItemAdapter.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/home/adapters/RssItemAdapter.kt @@ -36,6 +36,7 @@ import com.squareup.picasso.Picasso import rasel.lunar.launcher.LauncherActivity.Companion.lActivity import rasel.lunar.launcher.R import rasel.lunar.launcher.databinding.ListItemWithBinding +import rasel.lunar.launcher.model.RssData import rasel.lunar.launcher.model.RssDataInterface import rasel.lunar.launcher.model.RssDataType import rasel.lunar.launcher.openDotax @@ -56,8 +57,7 @@ internal class RssItemAdapter ( val emptyDate = " - " val dateViewClick = View.OnClickListener { v -> - (v?.tag as? Int)?.let { idx -> - val rss = rssDataItemLis[idx] + (v?.tag as? RssData)?.let { rss -> when(rss.category()) { RssDataType.GURU,RssDataType.Most,RssDataType.REDDIT_nsfw -> { v.findViewById(R.id.circle_preview)?.let { @@ -125,7 +125,7 @@ internal class RssItemAdapter ( holder.view.circlePreview.setImageDrawable(null) } - holder.view.root.tag = position + holder.view.root.tag = rssData holder.view.root.setOnClickListener(dateViewClick) // holder.view.root.setOnLongClickListener(mLongClickListener) } diff --git a/app/src/main/kotlin/rasel/lunar/launcher/model/LocationLog.kt b/app/src/main/kotlin/rasel/lunar/launcher/model/LocationLog.kt index 8762699..4c2bbcc 100644 --- a/app/src/main/kotlin/rasel/lunar/launcher/model/LocationLog.kt +++ b/app/src/main/kotlin/rasel/lunar/launcher/model/LocationLog.kt @@ -6,6 +6,8 @@ import io.realm.kotlin.ext.realmAnyListOf import io.realm.kotlin.ext.realmListOf import io.realm.kotlin.types.RealmList import io.realm.kotlin.types.RealmObject +import java.text.SimpleDateFormat +import java.util.Date import java.util.Locale class LocationLog : RealmObject { @@ -28,8 +30,11 @@ class LocationLog : RealmObject { var mPhone: String? = null var mUrl: String? = null var time : Long = 0L + var timeString : String? = null + fun fillData(address: Address) { time = System.currentTimeMillis() + timeString = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Date()) mFeatureName = address.featureName mAddressLines.apply { for (i in 0..address.maxAddressLineIndex) { diff --git a/app/src/main/res/layout/feeds_result_menu.xml b/app/src/main/res/layout/feeds_result_menu.xml index 1604a4d..1283955 100644 --- a/app/src/main/res/layout/feeds_result_menu.xml +++ b/app/src/main/res/layout/feeds_result_menu.xml @@ -2,7 +2,8 @@ + android:layout_height="match_parent"> + android:layout_height="match_parent"/> \ No newline at end of file