Update beta dependencies because it is called beta branch
This commit is contained in:
@@ -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'
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user