Misc refinements

This commit is contained in:
Mygod
2018-04-21 21:52:03 -07:00
parent 56bea8f28f
commit 2e7b30df1a
3 changed files with 6 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ import android.support.v7.widget.Toolbar
import android.view.* import android.view.*
import android.widget.EditText import android.widget.EditText
import android.widget.Toast import android.widget.Toast
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.databinding.FragmentRepeaterBinding import be.mygod.vpnhotspot.databinding.FragmentRepeaterBinding
import be.mygod.vpnhotspot.databinding.ListitemClientBinding import be.mygod.vpnhotspot.databinding.ListitemClientBinding
import be.mygod.vpnhotspot.net.IpNeighbour import be.mygod.vpnhotspot.net.IpNeighbour
@@ -172,6 +173,8 @@ class RepeaterFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClickL
binding.swipeRefresher.setColorSchemeResources(R.color.colorAccent) binding.swipeRefresher.setColorSchemeResources(R.color.colorAccent)
binding.swipeRefresher.setOnRefreshListener { binding.swipeRefresher.setOnRefreshListener {
IpNeighbourMonitor.instance?.flush() IpNeighbourMonitor.instance?.flush()
val binder = binder
if (binder?.active == false) binder.requestGroupUpdate()
adapter.recreate() adapter.recreate()
} }
binding.toolbar.inflateMenu(R.menu.repeater) binding.toolbar.inflateMenu(R.menu.repeater)
@@ -248,7 +251,7 @@ class RepeaterFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClickL
dialog = WifiP2pDialog(context, DialogInterface.OnClickListener { _, which -> dialog = WifiP2pDialog(context, DialogInterface.OnClickListener { _, which ->
when (which) { when (which) {
DialogInterface.BUTTON_POSITIVE -> when (conf.update(dialog!!.config!!)) { DialogInterface.BUTTON_POSITIVE -> when (conf.update(dialog!!.config!!)) {
true -> binder.requestGroupUpdate() true -> app.handler.postDelayed(binder::requestGroupUpdate, 1000)
false -> Toast.makeText(context, R.string.noisy_su_failure, Toast.LENGTH_SHORT).show() false -> Toast.makeText(context, R.string.noisy_su_failure, Toast.LENGTH_SHORT).show()
null -> Toast.makeText(context, R.string.root_unavailable, Toast.LENGTH_SHORT).show() null -> Toast.makeText(context, R.string.root_unavailable, Toast.LENGTH_SHORT).show()
} }

View File

@@ -97,7 +97,7 @@ class RepeaterService : Service(), WifiP2pManager.ChannelListener, VpnMonitor.Ca
var group: WifiP2pGroup? = null var group: WifiP2pGroup? = null
private set(value) { private set(value) {
field = value field = value
binder.data?.onGroupChanged(group) binder.data?.onGroupChanged(value)
} }
private val binder = RepeaterBinder() private val binder = RepeaterBinder()
private var receiverRegistered = false private var receiverRegistered = false

View File

@@ -44,7 +44,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/wifi_item_edit_content" style="@style/wifi_item_edit_content"
android:hint="@string/wifi_ssid_hint" android:hint="@string/wifi_ssid_hint"
android:inputType="textNoSuggestions" android:inputType="textMultiLine|textNoSuggestions"
android:maxLength="32" /> android:maxLength="32" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>