fixed code warnings
This commit is contained in:
parent
3c68393e04
commit
a484cb0967
|
@ -105,12 +105,9 @@ abstract class BasePreferenceFragment : PreferenceFragmentCompat(), IBaseFragmen
|
|||
|
||||
val existingValue = preference.value // TODO
|
||||
if (existingValue != null) {
|
||||
if (existingValue.isEmpty()) {
|
||||
// Select "Silent"
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, null as Uri)
|
||||
} else {
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(existingValue))
|
||||
}
|
||||
// Empty value means "Silent"
|
||||
val uri = existingValue.takeIf(String::isNotEmpty)?.let(Uri::parse)
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, uri)
|
||||
} else {
|
||||
// No ringtone has been selected, set to the default
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Settings.System.DEFAULT_NOTIFICATION_URI)
|
||||
|
|
|
@ -63,9 +63,13 @@ class CacheProvider : ContentProvider() {
|
|||
|
||||
fun getMetadata(uri: Uri): CacheMetadata? {
|
||||
val bytes = fileCache.getExtra(getCacheKey(uri)) ?: return null
|
||||
return ByteArrayInputStream(bytes).use {
|
||||
val mapper = LoganSquareMapperFinder.mapperFor(CacheMetadata::class.java)
|
||||
return mapper.parse(it)
|
||||
return try {
|
||||
ByteArrayInputStream(bytes).use {
|
||||
val mapper = LoganSquareMapperFinder.mapperFor(CacheMetadata::class.java)
|
||||
return@use mapper.parse(it)
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,7 @@ import edu.tsinghua.hotmobi.HotMobiLogger
|
|||
import edu.tsinghua.hotmobi.UploadLogsService
|
||||
import edu.tsinghua.hotmobi.model.NetworkEvent
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.twidere.TwidereConstants
|
||||
import org.mariotaku.twidere.TwidereConstants.SHARED_PREFERENCES_NAME
|
||||
import org.mariotaku.twidere.app.TwidereApplication
|
||||
import org.mariotaku.twidere.constant.usageStatisticsKey
|
||||
import org.mariotaku.twidere.util.DebugLog
|
||||
import org.mariotaku.twidere.util.Utils
|
||||
|
@ -41,11 +39,7 @@ class ConnectivityStateReceiver : BroadcastReceiver() {
|
|||
override fun onReceive(context: Context, intent: Intent) {
|
||||
DebugLog.d(RECEIVER_LOGTAG, String.format("Received Broadcast %s", intent), null)
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION != intent.action) return
|
||||
val application = TwidereApplication.getInstance(context)
|
||||
// application.reloadConnectivitySettings();
|
||||
|
||||
val prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME,
|
||||
Context.MODE_PRIVATE)
|
||||
val prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)
|
||||
if (prefs[usageStatisticsKey]) {
|
||||
// BEGIN HotMobi
|
||||
val event = NetworkEvent.create(context)
|
||||
|
@ -70,6 +64,6 @@ class ConnectivityStateReceiver : BroadcastReceiver() {
|
|||
|
||||
companion object {
|
||||
|
||||
private val RECEIVER_LOGTAG = TwidereConstants.LOGTAG + "build/intermediates/exploded-aar/com.lnikkila/extendedtouchview/0.1.0/res" + "Connectivity"
|
||||
private const val RECEIVER_LOGTAG = "TwidereConnectivity"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue