Merge branch 'master' into q-beta
This commit is contained in:
@@ -98,6 +98,8 @@ Search the [issue tracker](https://github.com/Mygod/VPNHotspot/issues) for more.
|
||||
|
||||
### [What changes exactly can this app do to my system? (and how to revert them)](https://github.com/Mygod/VPNHotspot/issues/8#issuecomment-448529512)
|
||||
|
||||
### [Unable to find "Tethering hardware acceleration" in Developer options?](https://github.com/Mygod/VPNHotspot/issues/41#issuecomment-425732001)
|
||||
|
||||
### [No root?](https://github.com/Mygod/VPNHotspot/issues/62)
|
||||
|
||||
### Failed to create group due to internal error/repeater shuts down after a while?
|
||||
|
||||
@@ -15,7 +15,7 @@ buildscript {
|
||||
classpath "com.android.tools.build:gradle:3.4.0-rc02"
|
||||
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.0'
|
||||
classpath 'io.fabric.tools:gradle:1.28.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ def aux = [
|
||||
'com.google.firebase:firebase-core:16.0.8',
|
||||
]
|
||||
def lifecycleVersion = '2.0.0'
|
||||
def roomVersion = '2.1.0-alpha05'
|
||||
def roomVersion = '2.1.0-alpha06'
|
||||
dependencies {
|
||||
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycleVersion"
|
||||
kapt "androidx.room:room-compiler:$roomVersion"
|
||||
@@ -81,10 +81,10 @@ dependencies {
|
||||
implementation "androidx.room:room-ktx:$roomVersion"
|
||||
implementation 'com.android.billingclient:billing:1.2.2'
|
||||
implementation 'com.github.luongvo:BadgeView:1.1.5'
|
||||
implementation 'com.github.topjohnwu.libsu:core:2.3.1'
|
||||
implementation 'com.github.topjohnwu.libsu:core:2.3.3'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||
implementation 'com.linkedin.dexmaker:dexmaker:2.21.0'
|
||||
implementation 'com.linkedin.dexmaker:dexmaker:2.25.0'
|
||||
implementation 'com.takisoft.preferencex:preferencex-simplemenu:1.0.0'
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
android:name=".manage.LocalOnlyHotspotTileService"
|
||||
android:directBootAware="true"
|
||||
android:enabled="@bool/api_ge_26"
|
||||
android:icon="@drawable/ic_device_wifi_tethering"
|
||||
android:icon="@drawable/ic_action_perm_scan_wifi"
|
||||
android:label="@string/tethering_temp_hotspot"
|
||||
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
|
||||
<intent-filter>
|
||||
|
||||
@@ -67,11 +67,10 @@ class ClientsFragment : Fragment(), MainScope by MainScope.Supervisor() {
|
||||
override fun onClick(dialog: DialogInterface?, which: Int) {
|
||||
when (which) {
|
||||
DialogInterface.BUTTON_POSITIVE -> {
|
||||
val newNickname = this.dialog!!.findViewById<EditText>(android.R.id.edit).text
|
||||
MacLookup.abort(arg.mac)
|
||||
GlobalScope.launch(Dispatchers.Unconfined) {
|
||||
AppDatabase.instance.clientRecordDao.upsert(arg.mac) {
|
||||
nickname = this@NicknameDialogFragment.dialog!!.findViewById<EditText>(android.R.id.edit).text
|
||||
}
|
||||
AppDatabase.instance.clientRecordDao.upsert(arg.mac) { nickname = newNickname }
|
||||
}
|
||||
}
|
||||
DialogInterface.BUTTON_NEUTRAL -> MacLookup.perform(arg.mac, true)
|
||||
|
||||
@@ -79,10 +79,7 @@ class LocalOnlyHotspotManager(private val parent: TetheringFragment) : Manager()
|
||||
private inner class Data : be.mygod.vpnhotspot.manage.Data() {
|
||||
private val lookup: Map<String, NetworkInterface> get() = parent.ifaceLookup
|
||||
|
||||
override val icon: Int get() {
|
||||
val iface = binder?.iface
|
||||
return (if (iface.isNullOrBlank()) TetherType.WIFI else TetherType.ofInterface(iface)).icon
|
||||
}
|
||||
override val icon get() = R.drawable.ic_action_perm_scan_wifi
|
||||
override val title: CharSequence get() {
|
||||
val configuration = binder?.configuration ?: return parent.getString(R.string.tethering_temp_hotspot)
|
||||
return SpannableStringBuilder("${configuration.SSID} - ").apply {
|
||||
|
||||
@@ -15,7 +15,7 @@ import be.mygod.vpnhotspot.util.stopAndUnbind
|
||||
|
||||
@RequiresApi(26)
|
||||
class LocalOnlyHotspotTileService : KillableTileService() {
|
||||
private val tile by lazy { Icon.createWithResource(application, R.drawable.ic_device_wifi_tethering) }
|
||||
private val tile by lazy { Icon.createWithResource(application, R.drawable.ic_action_perm_scan_wifi) }
|
||||
|
||||
private var binder: LocalOnlyHotspotService.Binder? = null
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import be.mygod.vpnhotspot.net.TetheringManager.localOnlyTetheredIfaces
|
||||
import be.mygod.vpnhotspot.net.TetheringManager.tetheredIfaces
|
||||
import be.mygod.vpnhotspot.util.ServiceForegroundConnector
|
||||
import be.mygod.vpnhotspot.util.broadcastReceiver
|
||||
import be.mygod.vpnhotspot.util.isNotGone
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import timber.log.Timber
|
||||
import java.net.NetworkInterface
|
||||
@@ -102,18 +103,11 @@ class TetheringFragment : Fragment(), ServiceConnection, MenuItem.OnMenuItemClic
|
||||
}
|
||||
|
||||
private fun updateMonitorList(canMonitor: List<String> = emptyList()) {
|
||||
val toolbar = requireActivity().toolbar
|
||||
val menu = toolbar.menu
|
||||
if (canMonitor.isEmpty()) menu.removeItem(R.id.monitor) else {
|
||||
var item = menu.findItem(R.id.monitor)
|
||||
if (item == null) {
|
||||
toolbar.inflateMenu(R.menu.toolbar_monitor)
|
||||
item = menu.findItem(R.id.monitor)!!
|
||||
}
|
||||
item.subMenu.apply {
|
||||
clear()
|
||||
canMonitor.sorted().forEach { add(it).setOnMenuItemClickListener(this@TetheringFragment) }
|
||||
}
|
||||
val item = requireActivity().toolbar.menu.findItem(R.id.monitor) ?: return // assuming no longer foreground
|
||||
item.isNotGone = canMonitor.isNotEmpty()
|
||||
item.subMenu.apply {
|
||||
clear()
|
||||
canMonitor.sorted().forEach { add(it).setOnMenuItemClickListener(this@TetheringFragment) }
|
||||
}
|
||||
}
|
||||
override fun onMenuItemClick(item: MenuItem?): Boolean {
|
||||
@@ -130,9 +124,15 @@ class TetheringFragment : Fragment(), ServiceConnection, MenuItem.OnMenuItemClic
|
||||
binding.interfaces.adapter = adapter
|
||||
adapter.update(emptyList(), emptyList(), emptyList())
|
||||
ServiceForegroundConnector(this, this, TetheringService::class)
|
||||
requireActivity().toolbar.inflateMenu(R.menu.toolbar_tethering)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
requireActivity().toolbar.menu.clear()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (Build.VERSION.SDK_INT >= 27) ManageBar.Data.notifyChange()
|
||||
@@ -177,9 +177,4 @@ class TetheringFragment : Fragment(), ServiceConnection, MenuItem.OnMenuItemClic
|
||||
binder = null
|
||||
requireContext().unregisterReceiver(receiver)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
updateMonitorList()
|
||||
super.onDestroy()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.os.Build
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.annotation.DrawableRes
|
||||
@@ -94,6 +95,13 @@ fun Context.stopAndUnbind(connection: ServiceConnection) {
|
||||
unbindService(connection)
|
||||
}
|
||||
|
||||
var MenuItem.isNotGone: Boolean
|
||||
get() = isVisible || isEnabled
|
||||
set(value) {
|
||||
isVisible = value
|
||||
isEnabled = value
|
||||
}
|
||||
|
||||
fun <K, V> MutableMap<K, V>.computeIfAbsentCompat(key: K, value: () -> V) = if (Build.VERSION.SDK_INT >= 24)
|
||||
computeIfAbsent(key) { value() } else this[key] ?: value().also { put(key, it) }
|
||||
fun <K, V> MutableMap<K, V>.putIfAbsentCompat(key: K, value: V) = if (Build.VERSION.SDK_INT >= 24)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,3C6.95,3 3.15,4.85 0,7.23L12,22 24,7.25C20.85,4.87 17.05,3 12,3zM13,16h-2v-6h2v6zM11,8L11,6h2v2h-2z"/>
|
||||
</vector>
|
||||
@@ -4,6 +4,8 @@
|
||||
<item android:id="@+id/monitor"
|
||||
android:icon="@drawable/ic_image_remove_red_eye"
|
||||
android:title="@string/tethering_monitor"
|
||||
android:enabled="false"
|
||||
android:visible="false"
|
||||
app:showAsAction="always">
|
||||
<menu/>
|
||||
</item>
|
||||
Reference in New Issue
Block a user