fixes and bump version

This commit is contained in:
Bnyro 2022-08-04 09:32:02 +02:00
parent b03dd7933c
commit 9c86af9b7e
3 changed files with 15 additions and 8 deletions

View File

@ -13,8 +13,8 @@ android {
applicationId 'com.github.libretube' applicationId 'com.github.libretube'
minSdk 21 minSdk 21
targetSdk 31 targetSdk 31
versionCode 15 versionCode 16
versionName '0.4.1' versionName '0.4.2'
multiDexEnabled true multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
resValue "string", "app_name", "LibreTube" resValue "string", "app_name", "LibreTube"
@ -103,9 +103,9 @@ dependencies {
implementation libs.cronet.okhttp implementation libs.cronet.okhttp
implementation libs.coil implementation libs.coil
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1" implementation libs.lifecycle.viewmodel
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1" implementation libs.lifecycle.runtime
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1" implementation libs.lifecycle.livedata
} }
static def getUnixTime() { static def getUnixTime() {

View File

@ -50,6 +50,7 @@ class MainActivity : AppCompatActivity() {
lateinit var navController: NavController lateinit var navController: NavController
private var startFragmentId = R.id.homeFragment private var startFragmentId = R.id.homeFragment
var autoRotationEnabled = false var autoRotationEnabled = false
lateinit var searchView: SearchView lateinit var searchView: SearchView
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -176,12 +177,13 @@ class MainActivity : AppCompatActivity() {
// stuff for the search in the topBar // stuff for the search in the topBar
val searchItem = menu.findItem(R.id.action_search) val searchItem = menu.findItem(R.id.action_search)
searchView = searchItem.actionView as SearchView searchView = searchItem.actionView as SearchView
searchView.setMaxWidth(Integer.MAX_VALUE) searchView.maxWidth = Integer.MAX_VALUE
val searchViewModel = ViewModelProvider(this).get(SearchViewModel::class.java) val searchViewModel = ViewModelProvider(this)[SearchViewModel::class.java]
searchView.setOnSearchClickListener { searchView.setOnSearchClickListener {
if (navController.currentDestination?.id != R.id.searchResultFragment) { if (navController.currentDestination?.id != R.id.searchResultFragment) {
searchViewModel.setQuery(null)
navController.navigate(R.id.searchFragment) navController.navigate(R.id.searchFragment)
} }
} }
@ -208,6 +210,7 @@ class MainActivity : AppCompatActivity() {
searchView.setOnCloseListener { searchView.setOnCloseListener {
if (navController.currentDestination?.id == R.id.searchFragment) { if (navController.currentDestination?.id == R.id.searchFragment) {
searchViewModel.setQuery(null)
onBackPressed() onBackPressed()
} }
false false

View File

@ -1,5 +1,6 @@
[versions] [versions]
appcompat = "1.4.1" appcompat = "1.4.1"
lifecycle = "2.5.1"
constraintlayout = "2.1.3" constraintlayout = "2.1.3"
material = "1.6.0" material = "1.6.0"
navigation = "2.4.2" navigation = "2.4.2"
@ -45,3 +46,6 @@ cronet-embedded = { group = "org.chromium.net", name = "cronet-embedded", versio
cronet-okhttp = { group = "com.google.net.cronet", name = "cronet-okhttp", version.ref = "cronetOkHttp" } cronet-okhttp = { group = "com.google.net.cronet", name = "cronet-okhttp", version.ref = "cronetOkHttp" }
coil = { group = "io.coil-kt", name = "coil", version.ref="coil" } coil = { group = "io.coil-kt", name = "coil", version.ref="coil" }
square-leakcanary = { group = "com.squareup.leakcanary", name = "leakcanary-android", version.ref = "leakcanary" } square-leakcanary = { group = "com.squareup.leakcanary", name = "leakcanary-android", version.ref = "leakcanary" }
lifecycle-viewmodel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle" }
lifecycle-runtime = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" }
lifecycle-livedata = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycle" }