Update beta dependencies because it is called beta branch

This commit is contained in:
Mygod
2019-05-10 13:44:43 +08:00
parent 267e5b0e9c
commit 34d232afd6
5 changed files with 23 additions and 24 deletions

View File

@@ -12,7 +12,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.android.tools.build:gradle:3.5.0-beta01'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.28.1'

View File

@@ -67,16 +67,17 @@ def aux = [
'com.crashlytics.sdk.android:crashlytics:2.10.0',
'com.google.firebase:firebase-core:16.0.9',
]
def lifecycleVersion = '2.0.0'
def lifecycleVersion = '2.1.0-beta01'
def roomVersion = '2.1.0-beta01'
dependencies {
kapt "androidx.room:room-compiler:$roomVersion"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.core:core-ktx:1.1.0-beta01'
implementation 'androidx.emoji:emoji:1.0.0'
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
implementation 'androidx.preference:preference:1.1.0-alpha05'
implementation "androidx.room:room-ktx:$roomVersion"
@@ -93,10 +94,9 @@ dependencies {
freedomImplementation dep
googleImplementation dep
}
testImplementation "androidx.arch.core:core-testing:$lifecycleVersion"
testImplementation 'junit:junit:4.12'
androidTestImplementation "androidx.room:room-testing:$roomVersion"
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.0'
androidTestImplementation 'androidx.test:runner:1.2.0-beta01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-beta01'
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.1-beta01'
}

View File

@@ -7,9 +7,9 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.lifecycle.get
import androidx.lifecycle.observe
import be.mygod.vpnhotspot.client.ClientViewModel
import be.mygod.vpnhotspot.client.ClientsFragment
import be.mygod.vpnhotspot.databinding.ActivityMainBinding
@@ -30,13 +30,13 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
if (savedInstanceState == null) displayFragment(TetheringFragment())
val model = ViewModelProviders.of(this).get<ClientViewModel>()
if (RepeaterService.supported) ServiceForegroundConnector(this, model, RepeaterService::class)
model.clients.observe(this, Observer {
model.clients.observe(this) {
if (it.isNotEmpty()) binding.navigation.showBadge(R.id.navigation_clients).apply {
backgroundColor = ContextCompat.getColor(this@MainActivity, R.color.colorSecondary)
badgeTextColor = ContextCompat.getColor(this@MainActivity, R.color.primary_text_default_material_light)
number = it.size
} else binding.navigation.removeBadge(R.id.navigation_clients)
})
}
SmartSnackbar.Register(lifecycle, binding.fragmentHolder)
WifiDoubleLock.ActivityListener(this)
}

View File

@@ -3,7 +3,7 @@ package be.mygod.vpnhotspot.client
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.style.StrikethroughSpan
import androidx.lifecycle.Transformations
import androidx.lifecycle.map
import androidx.recyclerview.widget.DiffUtil
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R
@@ -37,24 +37,22 @@ open class Client(val mac: Long, val iface: String) {
val blocked get() = record.value?.blocked == true
open val icon get() = TetherType.ofInterface(iface).icon
val title = Transformations.map(record) { record ->
val title = record.map { record ->
/**
* we hijack the get title process to check if we need to perform MacLookup,
* as record might not be initialized in other more appropriate places
*/
SpannableStringBuilder(if (record?.nickname.isNullOrEmpty()) {
if (record?.macLookupPending != false) MacLookup.perform(mac)
SpannableStringBuilder(if (record.nickname.isEmpty()) {
if (record.macLookupPending) MacLookup.perform(mac)
macIface
} else emojize(record?.nickname)).apply {
if (record?.blocked == true) {
setSpan(StrikethroughSpan(), 0, length, Spanned.SPAN_INCLUSIVE_INCLUSIVE)
} else emojize(record.nickname)).apply {
if (record.blocked) setSpan(StrikethroughSpan(), 0, length, Spanned.SPAN_INCLUSIVE_INCLUSIVE)
}
}
}
val titleSelectable = Transformations.map(record) { it?.nickname.isNullOrEmpty() }
val description = Transformations.map(record) { record ->
val titleSelectable = record.map { it.nickname.isEmpty() }
val description = record.map { record ->
SpannableStringBuilder().apply {
if (!record?.nickname.isNullOrEmpty()) appendln(macIface)
if (!record.nickname.isEmpty()) appendln(macIface)
ip.entries.forEach { (ip, state) ->
append(makeIpSpan(ip))
appendln(app.getText(when (state) {

View File

@@ -17,9 +17,9 @@ import androidx.appcompat.widget.PopupMenu
import androidx.databinding.BaseObservable
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.lifecycle.get
import androidx.lifecycle.observe
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.ListAdapter
@@ -219,8 +219,9 @@ class ClientsFragment : Fragment() {
binding.swipeRefresher.setOnRefreshListener {
IpNeighbourMonitor.instance?.flush()
}
ViewModelProviders.of(requireActivity()).get<ClientViewModel>().clients.observe(this,
Observer { adapter.submitList(it.toMutableList()) })
ViewModelProviders.of(requireActivity()).get<ClientViewModel>().clients.observe(this) {
adapter.submitList(it.toMutableList())
}
return binding.root
}