Show warning if startAlternative fails
This commit is contained in:
@@ -10,6 +10,7 @@ import androidx.databinding.BaseObservable
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import be.mygod.vpnhotspot.App.Companion.app
|
import be.mygod.vpnhotspot.App.Companion.app
|
||||||
import be.mygod.vpnhotspot.databinding.ListitemManageBinding
|
import be.mygod.vpnhotspot.databinding.ListitemManageBinding
|
||||||
|
import be.mygod.vpnhotspot.widget.SmartSnackbar
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
object ManageBar : Manager() {
|
object ManageBar : Manager() {
|
||||||
@@ -47,15 +48,17 @@ object ManageBar : Manager() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startAlternative(context: Context, e: Exception) {
|
private fun startAlternative(context: Context, e: RuntimeException) {
|
||||||
try {
|
try {
|
||||||
context.startActivity(Intent()
|
context.startActivity(Intent()
|
||||||
.setClassName("com.android.settings", "com.android.settings.TetherSettings"))
|
.setClassName("com.android.settings", "com.android.settings.TetherSettings"))
|
||||||
Timber.w(e)
|
Timber.w(e)
|
||||||
} catch (e: ActivityNotFoundException) {
|
} catch (e: ActivityNotFoundException) {
|
||||||
Timber.w(e)
|
Timber.w(e)
|
||||||
|
SmartSnackbar.make(e.localizedMessage).show()
|
||||||
} catch (e: SecurityException) {
|
} catch (e: SecurityException) {
|
||||||
Timber.w(e)
|
Timber.w(e)
|
||||||
|
SmartSnackbar.make(e.localizedMessage).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user