Fix LogcatActivity after review

This commit is contained in:
Nazar-Kutz 2020-10-05 21:43:08 +03:00
parent 925c708b67
commit 22ff4f581b
6 changed files with 17 additions and 16 deletions

View file

@ -20,7 +20,7 @@
android:screenOrientation="unspecified" android:screenOrientation="unspecified"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name="net.osmand.TrackerLogcatActivity" /> <activity android:name=".ui.TrackerLogcatActivity" />
<activity <activity
android:name=".ui.MainActivity" android:name=".ui.MainActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"

View file

@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:minHeight="@dimen/list_header_with_descr_height" android:minHeight="@dimen/list_description_height"
android:paddingLeft="@dimen/content_padding_standard" android:paddingLeft="@dimen/content_padding_standard"
android:paddingRight="@dimen/content_padding_standard" android:paddingRight="@dimen/content_padding_standard"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"

View file

@ -27,7 +27,8 @@
<dimen name="dialog_welcome_title_top_margin">89dp</dimen> <dimen name="dialog_welcome_title_top_margin">89dp</dimen>
<dimen name="list_header_height">48dp</dimen> <dimen name="list_header_height">48dp</dimen>
<dimen name="list_header_with_descr_height">44dp</dimen> <dimen name="list_description_height">44dp</dimen>
<dimen name="list_header_with_descr_height">42dp</dimen>
<dimen name="list_item_height">56dp</dimen> <dimen name="list_item_height">56dp</dimen>
<dimen name="list_item_height_min">48dp</dimen> <dimen name="list_item_height_min">48dp</dimen>

View file

@ -9,7 +9,7 @@ import android.net.NetworkInfo
import android.os.Build import android.os.Build
import android.os.Handler import android.os.Handler
import net.osmand.PlatformUtil import net.osmand.PlatformUtil
import net.osmand.TrackerLogcatActivity import net.osmand.telegram.ui.TrackerLogcatActivity
import net.osmand.telegram.helpers.* import net.osmand.telegram.helpers.*
import net.osmand.telegram.helpers.OsmandAidlHelper.OsmandHelperListener import net.osmand.telegram.helpers.OsmandAidlHelper.OsmandHelperListener
import net.osmand.telegram.helpers.OsmandAidlHelper.UpdatesListener import net.osmand.telegram.helpers.OsmandAidlHelper.UpdatesListener

View file

@ -14,7 +14,6 @@ import android.widget.*
import androidx.appcompat.widget.ListPopupWindow import androidx.appcompat.widget.ListPopupWindow
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import net.osmand.TrackerLogcatActivity
import net.osmand.telegram.R import net.osmand.telegram.R
import net.osmand.telegram.TelegramSettings import net.osmand.telegram.TelegramSettings
import net.osmand.telegram.TelegramSettings.ListPreference import net.osmand.telegram.TelegramSettings.ListPreference

View file

@ -1,4 +1,4 @@
package net.osmand package net.osmand.telegram.ui
import android.os.AsyncTask import android.os.AsyncTask
import android.os.Bundle import android.os.Bundle
@ -9,33 +9,26 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import net.osmand.PlatformUtil
import net.osmand.telegram.R import net.osmand.telegram.R
import net.osmand.telegram.TelegramApplication import net.osmand.telegram.TelegramApplication
import java.io.* import java.io.*
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import java.util.* import java.util.*
private const val LOGCAT_PATH = "logcat.log"
private const val MAX_BUFFER_LOG = 10000
private const val SHARE_ID = 0
private const val LEVEL_ID = 1
private val log = PlatformUtil.getLog(TrackerLogcatActivity::class.java)
class TrackerLogcatActivity : AppCompatActivity() { class TrackerLogcatActivity : AppCompatActivity() {
private var logcatAsyncTask: LogcatAsyncTask? = null private var logcatAsyncTask: LogcatAsyncTask? = null
private val logs: MutableList<String> = ArrayList() private val logs: MutableList<String> = ArrayList()
private var adapter: LogcatAdapter? = null private var adapter: LogcatAdapter? = null
private val LEVELS = arrayOf("D", "I", "W", "E") private val LEVELS = arrayOf("D", "I", "W", "E")
private var filterLevel = 1 private var filterLevel = 1
private var recyclerView: RecyclerView? = null private lateinit var recyclerView: RecyclerView
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
val app: TelegramApplication = getApplication() as TelegramApplication val app: TelegramApplication = getApplication() as TelegramApplication
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_tracker_logcat) setContentView(R.layout.activity_tracker_logcat)
log.debug("text to test")
val toolbar = findViewById<Toolbar>(R.id.toolbar).apply { val toolbar = findViewById<Toolbar>(R.id.toolbar).apply {
navigationIcon = app.uiUtils.getThemedIcon(R.drawable.ic_arrow_back) navigationIcon = app.uiUtils.getThemedIcon(R.drawable.ic_arrow_back)
setNavigationOnClickListener { onBackPressed() } setNavigationOnClickListener { onBackPressed() }
@ -44,7 +37,7 @@ class TrackerLogcatActivity : AppCompatActivity() {
setupIntermediateProgressBar() setupIntermediateProgressBar()
adapter = LogcatAdapter() adapter = LogcatAdapter()
recyclerView = findViewById<View>(R.id.recycler_view) as RecyclerView? recyclerView = findViewById<View>(R.id.recycler_view) as RecyclerView
recyclerView!!.layoutManager = LinearLayoutManager(this) recyclerView!!.layoutManager = LinearLayoutManager(this)
recyclerView!!.adapter = adapter recyclerView!!.adapter = adapter
} }
@ -267,4 +260,12 @@ class TrackerLogcatActivity : AppCompatActivity() {
this.filterLevel = filterLevel this.filterLevel = filterLevel
} }
} }
companion object {
private const val LOGCAT_PATH = "logcat.log"
private const val MAX_BUFFER_LOG = 10000
private const val SHARE_ID = 0
private const val LEVEL_ID = 1
private val log = PlatformUtil.getLog(TrackerLogcatActivity::class.java)
}
} }