-
Notifications
You must be signed in to change notification settings - Fork 3
update both target and compile skd to api 35 #ANDROID-15972 #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,16 @@ import android.view.ViewGroup | |
| import android.widget.CompoundButton | ||
| import android.widget.TextView | ||
| import android.widget.Toast | ||
| import androidx.activity.SystemBarStyle | ||
| import androidx.activity.enableEdgeToEdge | ||
| import androidx.annotation.AttrRes | ||
| import androidx.annotation.ColorInt | ||
| import androidx.appcompat.app.AppCompatActivity | ||
| import androidx.appcompat.widget.SearchView | ||
| import androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener | ||
| import androidx.core.view.WindowInsetsCompat | ||
| import androidx.core.view.isVisible | ||
| import androidx.core.view.updatePadding | ||
| import androidx.lifecycle.Observer | ||
| import androidx.lifecycle.ViewModelProvider | ||
| import androidx.recyclerview.widget.DefaultItemAnimator | ||
|
|
@@ -56,6 +62,10 @@ class AppLoggerActivity : AppCompatActivity() { | |
| private var shareAllLogsCallback: TaskCallback<Uri>? = null | ||
|
|
||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| enableEdgeToEdge( | ||
| statusBarStyle = SystemBarStyle.dark(android.graphics.Color.TRANSPARENT), | ||
| navigationBarStyle = SystemBarStyle.dark(android.graphics.Color.TRANSPARENT), | ||
| ) | ||
| super.onCreate(savedInstanceState) | ||
|
|
||
| setContentView(R.layout.activity_app_logger) | ||
|
|
@@ -69,13 +79,16 @@ class AppLoggerActivity : AppCompatActivity() { | |
| initToolbar() | ||
| initLogsList() | ||
| initFiltersView() | ||
| setOnBackPressed() | ||
| setWindowsInsets() | ||
|
|
||
| viewModel.getFilteredLogs().observe(this@AppLoggerActivity, Observer { | ||
| adapter.onDataModified(it) | ||
| if (automaticScrollEnabled) { | ||
| recyclerView.post { scrollToBottom() } | ||
| } | ||
| }) | ||
|
|
||
| } | ||
|
|
||
| override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||
|
|
@@ -129,14 +142,18 @@ class AppLoggerActivity : AppCompatActivity() { | |
| else -> super.onOptionsItemSelected(item) | ||
| } | ||
|
|
||
| override fun onBackPressed() { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method is deprecated. I've replaced it by the new way of going back |
||
| searchView?.let { | ||
| if (!it.isIconified) { | ||
| it.isIconified = true | ||
| return | ||
| private fun setOnBackPressed() { | ||
| onBackPressedDispatcher.addCallback(this, object : androidx.activity.OnBackPressedCallback(true) { | ||
| override fun handleOnBackPressed() { | ||
| searchView?.let { | ||
| if (!it.isIconified) { | ||
| it.isIconified = true | ||
| return | ||
| } | ||
| } | ||
| finish() | ||
| } | ||
| } | ||
| super.onBackPressed() | ||
| }) | ||
| } | ||
|
|
||
| override fun onDestroy() { | ||
|
|
@@ -275,7 +292,7 @@ class AppLoggerActivity : AppCompatActivity() { | |
| } | ||
|
|
||
| private fun toggleCategoryFilter() { | ||
| if (filtersView.visibility == View.VISIBLE) { | ||
| if (filtersView.isVisible) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a warning |
||
| filtersView.visibility = View.GONE | ||
| } else { | ||
| filtersView.visibility = View.VISIBLE | ||
|
|
@@ -325,8 +342,25 @@ class AppLoggerActivity : AppCompatActivity() { | |
| }, null) | ||
| startActivity(shareIntent) | ||
| } | ||
|
|
||
| private fun setWindowsInsets() { | ||
| setOnApplyWindowInsetsListener(recyclerView) { v, windowInsets -> | ||
| val bars = windowInsets.getInsets( | ||
| WindowInsetsCompat.Type.systemBars() | ||
| or WindowInsetsCompat.Type.displayCutout() | ||
| ) | ||
| v.updatePadding( | ||
| top = v.paddingTop, | ||
| left = bars.left, | ||
| right = bars.right, | ||
| bottom = bars.bottom, | ||
| ) | ||
| WindowInsetsCompat.CONSUMED | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
| private const val EXTRA_CATEGORIES_NAMES = "extra_categories_names" | ||
|
|
||
| @JvmOverloads | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ import android.os.Handler | |
| import android.os.Looper | ||
| import androidx.lifecycle.LiveData | ||
| import androidx.lifecycle.MediatorLiveData | ||
| import androidx.lifecycle.Transformations | ||
| import androidx.lifecycle.map | ||
|
|
||
| internal class FilterableLiveData<T>( | ||
| source: LiveData<T>, | ||
|
|
@@ -62,5 +62,4 @@ internal fun <T> LiveData<T>.throttle(duration: Long = 1000L): LiveData<T> = Med | |
| } | ||
| } | ||
|
|
||
| internal fun <From, To> LiveData<From>.map(mapFunc: (From) -> To): LiveData<To> = | ||
| Transformations.map(this, mapFunc) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer used in new versions |
||
| internal fun <From, To> LiveData<From>.map(mapFunc: (From) -> To): LiveData<To> = map(mapFunc) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required for enableEdgeToEdge method