SmartSnackbars

This commit is contained in:
Mygod
2018-08-08 16:03:30 +08:00
parent 7ad1a51832
commit 15d838893c
13 changed files with 105 additions and 47 deletions

View File

@@ -4,6 +4,7 @@ import android.util.Log
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.util.thread
import be.mygod.vpnhotspot.widget.SmartSnackbar
import com.crashlytics.android.Crashlytics
import java.io.IOException
import java.io.InterruptedIOException
@@ -67,7 +68,7 @@ abstract class IpMonitor : Runnable {
if (err.isNotBlank()) {
Crashlytics.log(Log.ERROR, javaClass.simpleName, err)
Crashlytics.logException(FlushFailure())
app.toast(R.string.noisy_su_failure)
SmartSnackbar.make(R.string.noisy_su_failure).show()
}
}
process.inputStream.bufferedReader().useLines(this::processLines)

View File

@@ -12,9 +12,9 @@ import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.MainActivity
import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.manage.TetheringFragment
import be.mygod.vpnhotspot.widget.SmartSnackbar
import com.google.android.material.textfield.TextInputLayout
import java.nio.charset.Charset
@@ -90,8 +90,8 @@ class WifiP2pDialogFragment : DialogFragment(), TextWatcher, DialogInterface.OnC
app.handler.postDelayed((targetFragment as TetheringFragment).adapter.repeaterManager
.binder!!::requestGroupUpdate, 1000)
}
false -> (activity as MainActivity).snackbar().setText(R.string.noisy_su_failure).show()
null -> (activity as MainActivity).snackbar().setText(R.string.root_unavailable).show()
false -> SmartSnackbar.make(R.string.noisy_su_failure).show()
null -> SmartSnackbar.make(R.string.root_unavailable).show()
}
DialogInterface.BUTTON_NEUTRAL ->
(targetFragment as TetheringFragment).adapter.repeaterManager.binder!!.resetCredentials()