From f2fc28c1ee35a970800f7a15b9df38860eacc606 Mon Sep 17 00:00:00 2001 From: Aastha Jain Date: Thu, 11 Apr 2024 18:29:50 +0530 Subject: [PATCH] feature(logger): added type & duration filters for logs (#312) Co-authored-by: Aastha --- .../pluto/plugins/logger/FilterViewModel.kt | 119 +++++++++++ .../pluto/plugins/logger/PlutoLoggerPlugin.kt | 3 + .../com/pluto/plugins/logger/Preferences.kt | 45 +++++ .../plugins/logger/internal/DataModel.kt | 34 +++- .../plugins/logger/internal/LogsViewModel.kt | 44 ++++- .../logger/internal/ui/ListFragment.kt | 89 ++++++++- .../res/drawable/pluto_logger___ic_circle.xml | 12 ++ .../pluto_logger___ic_filter_dark.xml | 9 + .../layout/pluto_logger___fragment_list.xml | 185 ++++++++++++++---- .../logger/lib/src/main/res/values/colors.xml | 39 +--- .../lib/src/main/res/values/strings.xml | 6 +- .../pluto_rooms___fragment_column_details.xml | 6 +- .../lib/src/main/res/values/styles.xml | 6 +- .../functions/logger/DemoLoggerFragment.kt | 13 +- sample/src/main/res/layout/activity_main.xml | 2 +- sample/src/main/res/values/styles.xml | 7 +- 16 files changed, 511 insertions(+), 108 deletions(-) create mode 100644 pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/FilterViewModel.kt create mode 100644 pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/Preferences.kt create mode 100644 pluto-plugins/plugins/logger/lib/src/main/res/drawable/pluto_logger___ic_circle.xml create mode 100644 pluto-plugins/plugins/logger/lib/src/main/res/drawable/pluto_logger___ic_filter_dark.xml diff --git a/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/FilterViewModel.kt b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/FilterViewModel.kt new file mode 100644 index 000000000..b503db8f9 --- /dev/null +++ b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/FilterViewModel.kt @@ -0,0 +1,119 @@ +package com.pluto.plugins.logger + +import android.app.Application +import androidx.lifecycle.AndroidViewModel +import androidx.lifecycle.LiveData +import androidx.lifecycle.MediatorLiveData +import androidx.lifecycle.MutableLiveData +import com.pluto.plugins.logger.internal.LogTimeStamp +import com.pluto.plugins.logger.internal.LogType +import com.pluto.plugins.logger.internal.Session +import com.pluto.utilities.selector.SelectorOption + +internal class FilterViewModel(application: Application) : AndroidViewModel(application) { + val selectedFiltersList: LiveData> + get() = _selectedFiltersList + private val _selectedFiltersList = MutableLiveData>() + + val selectedTimeStamp: LiveData + get() = _selectedTimeStamp + private val _selectedTimeStamp = MutableLiveData() + + val searchTextLogger: LiveData + get() = _searchTextLogger + private val _searchTextLogger = MutableLiveData() + + private val preferences = Preferences(application) + private val logTypes = listOf( + LogType("debug"), + LogType("verbose"), + LogType("error"), + LogType("info"), + LogType("event") + ) + + private val timeStamps = listOf( + LogTimeStamp(1), + LogTimeStamp(5), + LogTimeStamp(10), + LogTimeStamp(Integer.MIN_VALUE, true) + ) + + val isTriggerSearch: LiveData + get() = _isTriggerSearch + private val _isTriggerSearch = MediatorLiveData() + val isFilterApplied: LiveData + get() = _isFilterApplied + private val _isFilterApplied = MediatorLiveData() + + val isFilterVisible: LiveData + get() = _isFilterVisible + private val _isFilterVisible = MediatorLiveData() + + init { + + _isTriggerSearch.addSource(_selectedFiltersList) { _isTriggerSearch.postValue(true) } + _isTriggerSearch.addSource(_searchTextLogger) { _isTriggerSearch.postValue(true) } + _isTriggerSearch.addSource(_selectedTimeStamp) { _isTriggerSearch.postValue(true) } + _searchTextLogger.postValue(Session.loggerSearchText) + _selectedFiltersList.postValue(preferences.selectedFilterLogType) + _selectedTimeStamp.postValue(preferences.selectedFilterTime) + _isFilterApplied.addSource(_selectedFiltersList) { + if (it.isNotEmpty() || getSelectedTimeStamp().timeStamp != 0) { + _isFilterApplied.postValue(true) + } else { + _isFilterApplied.postValue(false) + } + } + _isFilterApplied.addSource(_selectedTimeStamp) { + if (it.timeStamp != 0 || getSelectedFilters().isNotEmpty()) { + _isFilterApplied.postValue(true) + } else { + _isFilterApplied.postValue(false) + } + } + _isFilterVisible.postValue(false) + } + + fun getLogTypes(): List { + return logTypes + } + + fun getTimeStamps(): List { + return timeStamps + } + + fun getSelectedFilters(): List { + return selectedFiltersList.value ?: emptyList() + } + + fun getSelectedTimeStamp(): LogTimeStamp { + return selectedTimeStamp.value ?: LogTimeStamp(0, false) + } + + fun updateSearchText(searchText: String) { + _searchTextLogger.postValue(searchText) + Session.loggerSearchText = searchText + } + + fun setSelectedFiltersLogType(logTypeList: ArrayList) { + _selectedFiltersList.postValue(logTypeList) + preferences.selectedFilterLogType = logTypeList + } + fun setSelectedFilterTimeStamp(logTimeStamp: LogTimeStamp) { + _selectedTimeStamp.postValue(logTimeStamp) + preferences.selectedFilterTime = logTimeStamp + } + fun getSearchText(): String { + return searchTextLogger.value ?: "" + } + + fun toggleFilterViewVisibility() { + _isFilterVisible.postValue(_isFilterVisible.value?.not()) + } + fun clearFilters() { + preferences.clearFilters() + _selectedFiltersList.postValue(emptyList()) + _selectedTimeStamp.postValue(LogTimeStamp(0, false)) + } +} diff --git a/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/PlutoLoggerPlugin.kt b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/PlutoLoggerPlugin.kt index aa2388984..69f8f257d 100644 --- a/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/PlutoLoggerPlugin.kt +++ b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/PlutoLoggerPlugin.kt @@ -13,6 +13,8 @@ class PlutoLoggerPlugin() : Plugin(ID) { @Deprecated("Use the default constructor PlutoLoggerPlugin() instead.") constructor(identifier: String) : this() + private val settingsPreferences by lazy { Preferences(application) } + override fun getConfig(): PluginConfiguration = PluginConfiguration( name = context.getString(R.string.pluto_logger___plugin_name), icon = R.drawable.pluto_logger___ic_logger_icon, @@ -35,6 +37,7 @@ class PlutoLoggerPlugin() : Plugin(ID) { override fun onPluginDataCleared() { LogDBHandler.flush() + settingsPreferences.clearFilters() } companion object { diff --git a/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/Preferences.kt b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/Preferences.kt new file mode 100644 index 000000000..730c87860 --- /dev/null +++ b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/Preferences.kt @@ -0,0 +1,45 @@ +package com.pluto.plugins.logger + +import android.content.Context +import com.pluto.plugins.logger.internal.LogTimeStamp +import com.pluto.plugins.logger.internal.LogType +import com.squareup.moshi.JsonAdapter +import com.squareup.moshi.Moshi +import com.squareup.moshi.Types + +internal class Preferences(context: Context) { + + private val settingsPrefs by lazy { context.preferences("_pluto_log_filter_settings") } + private val moshi: Moshi = Moshi.Builder().build() + private val moshiAdapter: JsonAdapter> = + moshi.adapter(Types.newParameterizedType(List::class.java, String::class.java)) + + private var timeStampAdapter: JsonAdapter = + moshi.adapter(LogTimeStamp::class.java) + + internal var selectedFilterLogType: List + get() = settingsPrefs.getString(SELECTED_FILTER_LOG_TYPE, null)?.let { + moshiAdapter.fromJson(it)?.map { type -> LogType(type) } + } ?: run { emptyList() } + set(value) = settingsPrefs.edit() + .putString(SELECTED_FILTER_LOG_TYPE, moshiAdapter.toJson(value.map { it.type })).apply() + + internal var selectedFilterTime: LogTimeStamp + get() = settingsPrefs.getString(SELECTED_FILTER_TIMESTAMP, null)?.let { + timeStampAdapter.fromJson(it) + } ?: run { LogTimeStamp(0, false) } + set(value) = settingsPrefs.edit() + .putString(SELECTED_FILTER_TIMESTAMP, timeStampAdapter.toJson(value)).apply() + + companion object { + private const val SELECTED_FILTER_LOG_TYPE = "selected_filter_logtype" + private const val SELECTED_FILTER_TIMESTAMP = "selected_filter_timestamp" + } + + fun clearFilters() { + settingsPrefs.edit().clear().apply() + } +} + +private fun Context.preferences(name: String, mode: Int = Context.MODE_PRIVATE) = + getSharedPreferences(name, mode) diff --git a/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/DataModel.kt b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/DataModel.kt index c7b8c069f..0212b8a39 100644 --- a/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/DataModel.kt +++ b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/DataModel.kt @@ -4,6 +4,7 @@ import androidx.annotation.DrawableRes import androidx.annotation.Keep import com.pluto.plugins.logger.R import com.pluto.utilities.list.ListItem +import com.pluto.utilities.selector.SelectorOption import com.squareup.moshi.JsonClass @Keep @@ -20,7 +21,11 @@ internal open class Level( object Warning : Level("warning") object WTF : Level("wtf") object Error : Level("error", R.color.pluto___red_05, R.color.pluto___red_80) - object Event : Level(label = "event", iconRes = R.drawable.pluto_logger___ic_analytics, textColor = R.color.pluto___blue) + object Event : Level( + label = "event", + iconRes = R.drawable.pluto_logger___ic_analytics, + textColor = R.color.pluto___blue + ) } @Keep @@ -47,3 +52,30 @@ internal data class StackTrace( val fileName: String, val lineNumber: Int, ) + +@Keep +@JsonClass(generateAdapter = true) +internal data class LogType( + val type: String +) : SelectorOption() { + override fun displayText(): CharSequence { + return type + } +} + +@Keep +@JsonClass(generateAdapter = true) +internal data class LogTimeStamp( + val timeStamp: Int = 0, + val isSessionFilter: Boolean = false +) : SelectorOption() { + override fun displayText(): CharSequence { + if (isSessionFilter) { + return "Current session only" + } + if (timeStamp == 1) { + return "< $timeStamp minute" + } + return "< $timeStamp minutes" + } +} diff --git a/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/LogsViewModel.kt b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/LogsViewModel.kt index 33fff7c2d..75d3c9553 100644 --- a/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/LogsViewModel.kt +++ b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/LogsViewModel.kt @@ -9,6 +9,7 @@ import com.pluto.plugins.logger.internal.persistence.LogDBHandler import com.pluto.plugins.logger.internal.persistence.LogEntity import com.pluto.utilities.extensions.asFormattedDate import com.pluto.utilities.list.ListItem +import java.util.concurrent.TimeUnit import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -27,13 +28,36 @@ internal class LogsViewModel(application: Application) : AndroidViewModel(applic get() = _serializedLogs private val _serializedLogs = MutableLiveData() - fun fetch(search: String = "") { + fun searchAndFilter( + search: String = "", + logType: List = emptyList(), + logTimeStamp: LogTimeStamp = LogTimeStamp(0, false) + ) { viewModelScope.launch(Dispatchers.IO) { if (rawLogs == null) { rawLogs = LogDBHandler.fetchAll() } - val currentSessionLogs = (rawLogs ?: arrayListOf()).filter { it.sessionId == Session.id && it.data.isValidSearch(search) }.map { it.data } - val previousSessionLogs = (rawLogs ?: arrayListOf()).filter { it.sessionId != Session.id && it.data.isValidSearch(search) }.map { it.data } + val currentSessionLogs = + (rawLogs ?: arrayListOf()) + .asSequence() + .filter { it.sessionId == Session.id } + .filter { pastTimeFilter(it.timestamp, logTimeStamp) } + .filter { logType.map { type -> type.type }.contains(it.data.tag) } + .filter { it.data.isValidSearch(search) } + .map { it.data } + .toList() + + val previousSessionLogs = if (!logTimeStamp.isSessionFilter) { + (rawLogs ?: arrayListOf()) + .asSequence() + .filter { it.sessionId != Session.id } + .filter { it.data.isValidSearch(search) } + .filter { pastTimeFilter(it.timestamp, logTimeStamp) } + .map { it.data } + .toList() + } else { + emptyList() + } val list = arrayListOf() list.addAll(currentSessionLogs) @@ -45,6 +69,13 @@ internal class LogsViewModel(application: Application) : AndroidViewModel(applic } } + private fun pastTimeFilter(logTime: Long, log: LogTimeStamp): Boolean { + if (log.timeStamp == 0 || log.isSessionFilter) { + return true + } + return logTime >= System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(log.timeStamp.toLong()) + } + fun deleteAll() { viewModelScope.launch(Dispatchers.IO) { LogDBHandler.flush() @@ -93,5 +124,8 @@ internal class LogsViewModel(application: Application) : AndroidViewModel(applic } } -private fun LogData.isValidSearch(search: String): Boolean = - search.isEmpty() || tag.contains(search, true) || message.contains(search, true) || stackTrace.fileName.contains(search, true) +private fun LogData.isValidSearch(search: String): Boolean { + return search.isEmpty() || + message.contains(search, true) || + stackTrace.fileName.contains(search, true) +} diff --git a/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/ui/ListFragment.kt b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/ui/ListFragment.kt index 338520a34..364c50470 100644 --- a/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/ui/ListFragment.kt +++ b/pluto-plugins/plugins/logger/lib/src/main/java/com/pluto/plugins/logger/internal/ui/ListFragment.kt @@ -10,11 +10,13 @@ import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.findNavController import com.pluto.plugin.share.Shareable import com.pluto.plugin.share.lazyContentSharer +import com.pluto.plugins.logger.FilterViewModel import com.pluto.plugins.logger.R import com.pluto.plugins.logger.databinding.PlutoLoggerFragmentListBinding import com.pluto.plugins.logger.internal.LogData +import com.pluto.plugins.logger.internal.LogTimeStamp +import com.pluto.plugins.logger.internal.LogType import com.pluto.plugins.logger.internal.LogsViewModel -import com.pluto.plugins.logger.internal.Session import com.pluto.plugins.logger.internal.ui.list.LogsAdapter import com.pluto.utilities.autoClearInitializer import com.pluto.utilities.extensions.hideKeyboard @@ -26,6 +28,7 @@ import com.pluto.utilities.list.CustomItemDecorator import com.pluto.utilities.list.DiffAwareAdapter import com.pluto.utilities.list.DiffAwareHolder import com.pluto.utilities.list.ListItem +import com.pluto.utilities.selector.lazyDataSelector import com.pluto.utilities.setOnDebounceClickListener import com.pluto.utilities.viewBinding @@ -33,8 +36,10 @@ internal class ListFragment : Fragment(R.layout.pluto_logger___fragment_list) { private val binding by viewBinding(PlutoLoggerFragmentListBinding::bind) private val viewModel: LogsViewModel by activityViewModels() + private val filterViewModel: FilterViewModel by activityViewModels() private val logsAdapter: BaseAdapter by autoClearInitializer { LogsAdapter(onActionListener) } private val contentSharer by lazyContentSharer() + private val dataSelector by lazyDataSelector() override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -45,26 +50,47 @@ internal class ListFragment : Fragment(R.layout.pluto_logger___fragment_list) { binding.search.doOnTextChanged { text, _, _, _ -> viewLifecycleOwner.lifecycleScope.launchWhenResumed { text?.toString()?.let { - Session.loggerSearchText = it - viewModel.fetch(it) + filterViewModel.updateSearchText(it) + // viewModel.searchAndFilter(it, filterViewModel.getSelectedFilters()) if (it.isEmpty()) { binding.logList.linearLayoutManager()?.scrollToPositionWithOffset(0, 0) } } } } - binding.search.setText(Session.loggerSearchText) + binding.search.setText(filterViewModel.getSearchText()) viewModel.logs.removeObserver(logsObserver) viewModel.logs.observe(viewLifecycleOwner, logsObserver) - viewModel.fetch() + filterViewModel.isTriggerSearch.observe(viewLifecycleOwner) { + viewModel.searchAndFilter( + filterViewModel.getSearchText(), + filterViewModel.getSelectedFilters(), + filterViewModel.getSelectedTimeStamp() + ) + } viewModel.serializedLogs.removeObserver(serializedLogsObserver) viewModel.serializedLogs.observe(viewLifecycleOwner, serializedLogsObserver) + binding.filter.setOnClickListener { + filterViewModel.toggleFilterViewVisibility() + } binding.close.setOnDebounceClickListener { activity?.finish() } + + binding.logType.setOnDebounceClickListener { + openLogTypeFilterView() + } + + binding.logTimeStamp.setOnDebounceClickListener { + openTimeStampFilterView() + } + binding.tvClearFilter.setOnDebounceClickListener { + filterViewModel.clearFilters() + } + binding.options.setOnDebounceClickListener { context?.showMoreOptions(it, R.menu.pluto_logger___menu_more_options) { item -> when (item.itemId) { @@ -78,6 +104,25 @@ internal class ListFragment : Fragment(R.layout.pluto_logger___fragment_list) { } } } + handleFilterStates() + } + + private fun handleFilterStates() { + filterViewModel.selectedFiltersList.observe(this) { + binding.ivLogTypeSelected.visibility = if (it.isNotEmpty()) View.VISIBLE else View.GONE + } + + filterViewModel.isFilterApplied.observe(this) { + binding.ivFilterApplied.visibility = if (it) View.VISIBLE else View.GONE + } + + filterViewModel.selectedTimeStamp.observe(this) { + binding.ivLogTimeStamp.visibility = if (it.timeStamp != 0) View.VISIBLE else View.GONE + } + + filterViewModel.isFilterVisible.observe(this) { + binding.filterView.visibility = if (it) View.VISIBLE else View.GONE + } } private val logsObserver = Observer> { @@ -93,7 +138,13 @@ internal class ListFragment : Fragment(R.layout.pluto_logger___fragment_list) { } private val serializedLogsObserver = Observer { - contentSharer.share(Shareable(title = "Share all logs", content = it, fileName = "Log Trace from Pluto")) + contentSharer.share( + Shareable( + title = "Share all logs", + content = it, + fileName = "Log Trace from Pluto" + ) + ) } private val onActionListener = object : DiffAwareAdapter.OnActionListener { @@ -108,4 +159,30 @@ internal class ListFragment : Fragment(R.layout.pluto_logger___fragment_list) { } } } + + private fun openLogTypeFilterView() { + dataSelector.selectMultiple( + title = getString(R.string.pluto_logger___select_log_type), + list = filterViewModel.getLogTypes(), + preSelected = filterViewModel.getSelectedFilters() + ).observe(viewLifecycleOwner) { selectorOptions -> + val logTypeList = arrayListOf() + selectorOptions.forEach { option -> + if (option is LogType) { + logTypeList.add(option) + } + } + filterViewModel.setSelectedFiltersLogType(logTypeList) + } + } + + private fun openTimeStampFilterView() { + dataSelector.selectSingle( + title = getString(R.string.pluto_logger___select_log_Time), + list = filterViewModel.getTimeStamps(), + preSelected = filterViewModel.getSelectedTimeStamp() + ).observe(viewLifecycleOwner) { selectorOptions -> + filterViewModel.setSelectedFilterTimeStamp(selectorOptions as LogTimeStamp) + } + } } diff --git a/pluto-plugins/plugins/logger/lib/src/main/res/drawable/pluto_logger___ic_circle.xml b/pluto-plugins/plugins/logger/lib/src/main/res/drawable/pluto_logger___ic_circle.xml new file mode 100644 index 000000000..4b0df3738 --- /dev/null +++ b/pluto-plugins/plugins/logger/lib/src/main/res/drawable/pluto_logger___ic_circle.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/pluto-plugins/plugins/logger/lib/src/main/res/drawable/pluto_logger___ic_filter_dark.xml b/pluto-plugins/plugins/logger/lib/src/main/res/drawable/pluto_logger___ic_filter_dark.xml new file mode 100644 index 000000000..325a8949f --- /dev/null +++ b/pluto-plugins/plugins/logger/lib/src/main/res/drawable/pluto_logger___ic_filter_dark.xml @@ -0,0 +1,9 @@ + + + diff --git a/pluto-plugins/plugins/logger/lib/src/main/res/layout/pluto_logger___fragment_list.xml b/pluto-plugins/plugins/logger/lib/src/main/res/layout/pluto_logger___fragment_list.xml index 7476f1b01..73bae8674 100644 --- a/pluto-plugins/plugins/logger/lib/src/main/res/layout/pluto_logger___fragment_list.xml +++ b/pluto-plugins/plugins/logger/lib/src/main/res/layout/pluto_logger___fragment_list.xml @@ -35,9 +35,9 @@ android:fontFamily="@font/muli_semibold" android:gravity="center_vertical" android:maxLines="1" - android:text="@string/pluto_logger___plugin_name" android:paddingVertical="@dimen/pluto___margin_medium" android:singleLine="true" + android:text="@string/pluto_logger___plugin_name" android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" android:textColor="@color/pluto___white" android:textSize="@dimen/pluto___text_medium" @@ -88,53 +88,156 @@ app:layout_constraintBottom_toTopOf="@+id/bottom" app:layout_constraintTop_toTopOf="parent" /> - - - + + - - - + + + + + + + + + + + + + + + + - - - + android:text="@string/pluto_logger___duration" + android:textAlignment="center" + android:textAllCaps="false" + android:textAppearance="@style/PlutoChipTextStyle" + android:textColor="@color/pluto___text_dark_80" + android:textSize="@dimen/pluto___text_xmedium" + app:layout_constraintStart_toEndOf="@id/logType" + app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + - + - + - - \ No newline at end of file + diff --git a/pluto-plugins/plugins/logger/lib/src/main/res/values/colors.xml b/pluto-plugins/plugins/logger/lib/src/main/res/values/colors.xml index afaf07e02..0559471c3 100644 --- a/pluto-plugins/plugins/logger/lib/src/main/res/values/colors.xml +++ b/pluto-plugins/plugins/logger/lib/src/main/res/values/colors.xml @@ -1,41 +1,4 @@ - #f8f8f8 - #ffffff - #11141c - #0D11141c - #3311141c - #6611141c - #9911141c - #cc11141c - - #231f40 - #66231f40 - #99231f40 - #cc231f40 - @color/pluto___dark - #0Dffffff - #33ffffff - #66ffffff - #99ffffff - #ccffffff - #e50914 - #ff5733 - #0Dff5733 - #99ff5733 - #ccff5733 - #ff9100 - #0Dff9100 - #009463 - #20c997 - #00000000 - #eeecec - #73a964 - #1873a964 - #0D73a964 - - #f5f5f5 - #366BD1 - #cc366BD1 - #66366BD1 + #0511141c diff --git a/pluto-plugins/plugins/logger/lib/src/main/res/values/strings.xml b/pluto-plugins/plugins/logger/lib/src/main/res/values/strings.xml index aa2f0b821..b70af0702 100644 --- a/pluto-plugins/plugins/logger/lib/src/main/res/values/strings.xml +++ b/pluto-plugins/plugins/logger/lib/src/main/res/values/strings.xml @@ -15,4 +15,8 @@ Close Logger Share all logs Logs from previous sessions - \ No newline at end of file + Select log type + Select log timeframe + Clear + Duration + diff --git a/pluto-plugins/plugins/rooms-database/lib/src/main/res/layout/pluto_rooms___fragment_column_details.xml b/pluto-plugins/plugins/rooms-database/lib/src/main/res/layout/pluto_rooms___fragment_column_details.xml index 6d4c213d1..f77682cf8 100644 --- a/pluto-plugins/plugins/rooms-database/lib/src/main/res/layout/pluto_rooms___fragment_column_details.xml +++ b/pluto-plugins/plugins/rooms-database/lib/src/main/res/layout/pluto_rooms___fragment_column_details.xml @@ -127,14 +127,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/pluto_rooms___sort_asc" - android:textAppearance="@style/PlutoRoomsDBChipTextStyle" /> + android:textAppearance="@style/PlutoChipTextStyle" /> + android:textAppearance="@style/PlutoChipTextStyle" /> @@ -157,4 +157,4 @@ - \ No newline at end of file + diff --git a/pluto-plugins/plugins/rooms-database/lib/src/main/res/values/styles.xml b/pluto-plugins/plugins/rooms-database/lib/src/main/res/values/styles.xml index 4644722ee..0898c7669 100644 --- a/pluto-plugins/plugins/rooms-database/lib/src/main/res/values/styles.xml +++ b/pluto-plugins/plugins/rooms-database/lib/src/main/res/values/styles.xml @@ -16,8 +16,4 @@ @style/PlutoBottomSheetDialogTheme - - \ No newline at end of file + diff --git a/sample/src/main/java/com/sampleapp/functions/logger/DemoLoggerFragment.kt b/sample/src/main/java/com/sampleapp/functions/logger/DemoLoggerFragment.kt index 37d385bb6..3e5481101 100644 --- a/sample/src/main/java/com/sampleapp/functions/logger/DemoLoggerFragment.kt +++ b/sample/src/main/java/com/sampleapp/functions/logger/DemoLoggerFragment.kt @@ -27,25 +27,26 @@ class DemoLoggerFragment : Fragment(R.layout.fragment_demo_logger) { _binding = null } + @SuppressWarnings("StringLiteralDuplication") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) /** * Pluto Logs demo */ - binding.logDebug.setOnClickListener { PlutoLog.d("demo", "debug cta clicked") } - binding.logError.setOnClickListener { PlutoLog.e("demo", "error cta clicked", NullPointerException("demo")) } - binding.logVerbose.setOnClickListener { PlutoLog.v("demo", "verbose cta clicked", NullPointerException("demo")) } - binding.logInfo.setOnClickListener { PlutoLog.i("demo", "info cta clicked") } + binding.logDebug.setOnClickListener { PlutoLog.d("debug", "debug cta clicked") } + binding.logError.setOnClickListener { PlutoLog.e("error", "error cta clicked", NullPointerException("demo")) } + binding.logVerbose.setOnClickListener { PlutoLog.v("verbose", "verbose cta clicked", NullPointerException("demo")) } + binding.logInfo.setOnClickListener { PlutoLog.i("info", "info cta clicked") } binding.logEvent.setOnClickListener { PlutoLog.event( - "demo", "event cta clicked", + "event", "event cta clicked", hashMapOf( "attr_name" to "demo attr", "timestamp" to System.currentTimeMillis() ) ) - PlutoLog.event("demo", "event cta clicked without attrs") + PlutoLog.event("event", "event cta clicked without attrs") } /** diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index f2a632e64..e6f68b1cd 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -250,4 +250,4 @@ - \ No newline at end of file + diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml index 21eb50ec7..f4c2bd6a6 100644 --- a/sample/src/main/res/values/styles.xml +++ b/sample/src/main/res/values/styles.xml @@ -59,4 +59,9 @@ @null true - \ No newline at end of file + + +