Reduce log levels

This commit is contained in:
Mygod
2018-12-30 16:55:06 +08:00
parent ce0e98c3dc
commit d26c4587f2
3 changed files with 12 additions and 7 deletions

View File

@@ -9,6 +9,7 @@ import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.browser.customtabs.CustomTabsIntent import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.os.bundleOf
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
@@ -24,7 +25,6 @@ import be.mygod.vpnhotspot.widget.SmartSnackbar
import com.google.android.material.bottomnavigation.BottomNavigationMenuView import com.google.android.material.bottomnavigation.BottomNavigationMenuView
import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.bottomnavigation.BottomNavigationView
import q.rorbin.badgeview.QBadgeView import q.rorbin.badgeview.QBadgeView
import timber.log.Timber
class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemSelectedListener { class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemSelectedListener {
private lateinit var binding: ActivityMainBinding private lateinit var binding: ActivityMainBinding
@@ -38,10 +38,10 @@ class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemS
fun launchUrl(url: Uri) = if (packageManager.hasSystemFeature("android.hardware.faketouch")) try { fun launchUrl(url: Uri) = if (packageManager.hasSystemFeature("android.hardware.faketouch")) try {
customTabsIntent.launchUrl(this, url) customTabsIntent.launchUrl(this, url)
} catch (e: ActivityNotFoundException) { } catch (e: ActivityNotFoundException) {
Timber.w(e) DebugHelper.logEvent("launch_url", bundleOf(Pair("message", e.message)))
SmartSnackbar.make(url.toString()).show() SmartSnackbar.make(url.toString()).show()
} catch (e: SecurityException) { } catch (e: SecurityException) {
Timber.w(e) DebugHelper.logEvent("launch_url", bundleOf(Pair("message", e.message)))
SmartSnackbar.make(url.toString()).show() SmartSnackbar.make(url.toString()).show()
} else SmartSnackbar.make(url.toString()).show() } else SmartSnackbar.make(url.toString()).show()

View File

@@ -18,14 +18,16 @@ import android.text.style.TypefaceSpan
import android.view.View import android.view.View
import android.widget.Toast import android.widget.Toast
import androidx.core.content.getSystemService import androidx.core.content.getSystemService
import androidx.core.os.bundleOf
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import be.mygod.vpnhotspot.DebugHelper
import be.mygod.vpnhotspot.LocalOnlyHotspotService import be.mygod.vpnhotspot.LocalOnlyHotspotService
import be.mygod.vpnhotspot.R import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.databinding.ListitemInterfaceBinding import be.mygod.vpnhotspot.databinding.ListitemInterfaceBinding
import be.mygod.vpnhotspot.net.TetherType import be.mygod.vpnhotspot.net.TetherType
import be.mygod.vpnhotspot.util.ServiceForegroundConnector import be.mygod.vpnhotspot.util.ServiceForegroundConnector
import be.mygod.vpnhotspot.util.formatAddresses import be.mygod.vpnhotspot.util.formatAddresses
import timber.log.Timber import be.mygod.vpnhotspot.widget.SmartSnackbar
import java.net.NetworkInterface import java.net.NetworkInterface
@TargetApi(26) @TargetApi(26)
@@ -57,11 +59,12 @@ class LocalOnlyHotspotManager(private val parent: TetheringFragment) : Manager()
Settings.Secure.getInt(context.contentResolver, Settings.Secure.LOCATION_MODE, Settings.Secure.getInt(context.contentResolver, Settings.Secure.LOCATION_MODE,
Settings.Secure.LOCATION_MODE_OFF) == Settings.Secure.LOCATION_MODE_OFF Settings.Secure.LOCATION_MODE_OFF) == Settings.Secure.LOCATION_MODE_OFF
} else context.getSystemService<LocationManager>()?.isLocationEnabled != true) { } else context.getSystemService<LocationManager>()?.isLocationEnabled != true) {
Toast.makeText(context, R.string.tethering_temp_hotspot_location, Toast.LENGTH_LONG).show()
try { try {
context.startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)) context.startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))
Toast.makeText(context, R.string.tethering_temp_hotspot_location, Toast.LENGTH_LONG).show()
} catch (e: ActivityNotFoundException) { } catch (e: ActivityNotFoundException) {
Timber.w(e) DebugHelper.logEvent("location_settings", bundleOf(Pair("message", e.message)))
SmartSnackbar.make(R.string.tethering_temp_hotspot_location).show()
} }
return return
} }

View File

@@ -8,12 +8,14 @@ import android.view.View
import android.widget.Toast import android.widget.Toast
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.core.os.bundleOf
import androidx.core.view.updatePaddingRelative import androidx.core.view.updatePaddingRelative
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent import androidx.lifecycle.OnLifecycleEvent
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.DebugHelper
import be.mygod.vpnhotspot.MainActivity import be.mygod.vpnhotspot.MainActivity
import be.mygod.vpnhotspot.R import be.mygod.vpnhotspot.R
import be.mygod.vpnhotspot.databinding.ListitemInterfaceBinding import be.mygod.vpnhotspot.databinding.ListitemInterfaceBinding
@@ -49,7 +51,7 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
"package:${mainActivity.packageName}".toUri())) "package:${mainActivity.packageName}".toUri()))
return return
} catch (e: ActivityNotFoundException) { } catch (e: ActivityNotFoundException) {
Timber.w(e) DebugHelper.logEvent("manage_write_settings", bundleOf(Pair("message", e.message)))
} }
val started = manager.isStarted val started = manager.isStarted
try { try {