mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Clean up unused ContextExtensions
This commit is contained in:
parent
cb5697e230
commit
8714abe568
1 changed files with 0 additions and 59 deletions
|
@ -1,13 +1,10 @@
|
||||||
package eu.kanade.tachiyomi.util.system
|
package eu.kanade.tachiyomi.util.system
|
||||||
|
|
||||||
import android.app.ActivityManager
|
|
||||||
import android.app.LocaleManager
|
import android.app.LocaleManager
|
||||||
import android.app.Notification
|
import android.app.Notification
|
||||||
import android.app.NotificationManager
|
import android.app.NotificationManager
|
||||||
import android.content.BroadcastReceiver
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.content.pm.ResolveInfo
|
import android.content.pm.ResolveInfo
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
|
@ -305,51 +302,6 @@ val Context.wifiManager: WifiManager
|
||||||
val Context.powerManager: PowerManager
|
val Context.powerManager: PowerManager
|
||||||
get() = getSystemService()!!
|
get() = getSystemService()!!
|
||||||
|
|
||||||
/**
|
|
||||||
* Function used to send a local broadcast asynchronous
|
|
||||||
*
|
|
||||||
* @param intent intent that contains broadcast information
|
|
||||||
*/
|
|
||||||
fun Context.sendLocalBroadcast(intent: Intent) {
|
|
||||||
androidx.localbroadcastmanager.content.LocalBroadcastManager.getInstance(this).sendBroadcast(
|
|
||||||
intent,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function used to send a local broadcast synchronous
|
|
||||||
*
|
|
||||||
* @param intent intent that contains broadcast information
|
|
||||||
*/
|
|
||||||
fun Context.sendLocalBroadcastSync(intent: Intent) {
|
|
||||||
androidx.localbroadcastmanager.content.LocalBroadcastManager.getInstance(this).sendBroadcastSync(
|
|
||||||
intent,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function used to register local broadcast
|
|
||||||
*
|
|
||||||
* @param receiver receiver that gets registered.
|
|
||||||
*/
|
|
||||||
fun Context.registerLocalReceiver(receiver: BroadcastReceiver, filter: IntentFilter) {
|
|
||||||
androidx.localbroadcastmanager.content.LocalBroadcastManager.getInstance(this).registerReceiver(
|
|
||||||
receiver,
|
|
||||||
filter,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function used to unregister local broadcast
|
|
||||||
*
|
|
||||||
* @param receiver receiver that gets unregistered.
|
|
||||||
*/
|
|
||||||
fun Context.unregisterLocalReceiver(receiver: BroadcastReceiver) {
|
|
||||||
androidx.localbroadcastmanager.content.LocalBroadcastManager.getInstance(this).unregisterReceiver(
|
|
||||||
receiver,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if device is connected to Wifi.
|
* Returns true if device is connected to Wifi.
|
||||||
*/
|
*/
|
||||||
|
@ -368,17 +320,6 @@ fun Context.isConnectedToWifi(): Boolean {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the given service class is running.
|
|
||||||
*/
|
|
||||||
fun Context.isServiceRunning(serviceClass: Class<*>): Boolean {
|
|
||||||
val className = serviceClass.name
|
|
||||||
val manager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
return manager.getRunningServices(Integer.MAX_VALUE)
|
|
||||||
.any { className == it.service.className }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Context.openInBrowser(url: String, @ColorInt toolbarColor: Int? = null, forceBrowser: Boolean = false) {
|
fun Context.openInBrowser(url: String, @ColorInt toolbarColor: Int? = null, forceBrowser: Boolean = false) {
|
||||||
this.openInBrowser(url.toUri(), toolbarColor, forceBrowser)
|
this.openInBrowser(url.toUri(), toolbarColor, forceBrowser)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue