Skip to content

Commit

Permalink
added isDebug() in ContextHelper.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
am3n committed Jul 4, 2020
1 parent 93a6b83 commit 613c264
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions needtool/src/main/java/ir/am3n/needtool/ContextHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import android.app.ActivityManager
import android.app.NotificationManager
import android.content.Context
import android.content.Intent
import android.content.pm.ApplicationInfo
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.content.res.Configuration
import android.graphics.Point
import android.location.LocationManager
Expand All @@ -26,7 +26,6 @@ import kotlin.math.pow
import kotlin.math.sqrt



fun Context.sendLocalBroadcast(intent: Intent) {
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
}
Expand Down Expand Up @@ -186,6 +185,14 @@ fun Context.device(): HashMap<String, String> {
}


fun Context.isDebug(): Boolean {
try {
return 0 != (applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE)
} catch (t: Throwable) {}
return false
}


fun Context.isDarkMode(): Boolean {
return resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES
}
Expand Down

0 comments on commit 613c264

Please sign in to comment.