This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Bitmap; | |
import android.os.Handler; | |
import android.os.Looper; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
public class ImageProcessor { | |
private final ExecutorService executor = Executors.newSingleThreadExecutor(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XXXXXXX: data at index: 197 is:0.0 | |
2022-08-10 11:32:22.552 9472-11151/com.horussight.app D/OCVTOOLS: XXXXXXXXXXXXX: data at index: 198 is:0.0 | |
2022-08-10 11:32:22.553 9472-11151/com.horussight.app D/OCVTOOLS: XXXXXXXXXXXXX: data at index: 199 is:0.0 | |
2022-08-10 11:32:22.553 9472-11151/com.horussight.app D/OCVTOOLS: XXXXXXXXXXXXX: data at index: 200 is:0.0 | |
2022-08-10 11:32:22.553 9472-11151/com.horussight.app D/OCVTOOLS: XXXXXXXXXXXXX: data at index: 201 is:0.0 | |
2022-08-10 11:32:22.553 9472-11151/com.horussight.app D/OCVTOOLS: XXXXXXXXXXXXX: data at index: 202 is:0.0 | |
2022-08-10 11:32:22.553 9472-11151/com.horussight.app D/OCVTOOLS: XXXXXXXXXXXXX: data at index: 203 is:0.0 | |
2022-08-10 11:32:22.553 9472-11151/com.horussight.app D/OCVTOOLS: XXXXXXXXXXXXX: data at index: 204 is:0.0 | |
2022-08-10 11:32:22.553 9472-11151/com.horussight.app D/OCVTOOLS: XXXXXXXXXXXXX: data at index: 205 is:0.0 | |
2022-08-10 11:32:22.554 9472-11151/com.horussight.app D/OCVTOOLS: XXXXXXXXXXXXX: data at index: 206 is:0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected fun changeResolution( | |
api: UsbServiceApi, | |
resolution: CameraResolution = CameraResolution.SD, | |
afterUpdate: (() -> Unit)? = null | |
) { | |
lifecycle.coroutineScope.launch(UsbScheduler.dispatcher) { | |
if (!api.connectedDevice().isPresent) { | |
Timber.tag(TAG) | |
.e("Change resolution is called without the video device height=${resolution.height} width=${resolution.width}") | |
return@launch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun Activity.autoGrantRequestedPermissionsToSelf(componentName: ComponentName) { | |
val permissions: List<String> = retrievePermissions(this) | |
val mDevicePolicyManager = this.getSystemService(AppCompatActivity.DEVICE_POLICY_SERVICE) as DevicePolicyManager | |
if (mDevicePolicyManager.isAdminActive(componentName)) { | |
Log.d("PERMISSION", "Device Admin enabled") | |
} else { | |
Log.d("PERMISSION", "Device Admin Disabled") | |
} | |
for (permission in permissions) { | |
val result = mDevicePolicyManager.getPermissionGrantState(componentName, packageName, permission) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//JSON is way of communication between client and server | |
//custom type | |
type Task={ | |
id: number; | |
title: string; | |
detail: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//declaration of array | |
var arr: number[]; | |
//initilization of array | |
arr = [1, 2, 3, 4, 5, 5, 6, 7, 8] | |
//for loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Application; | |
import android.content.Context; | |
import android.location.Criteria; | |
import android.location.Location; | |
import android.location.LocationListener; | |
import android.location.LocationManager; | |
import android.os.Bundle; | |
import android.os.Looper; | |
import rx.Observable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.text.TextUtils; | |
import io.realm.Case; | |
import io.realm.Realm; | |
import io.realm.RealmObject; | |
import io.realm.RealmResults; | |
public class RealmFullTextSearch { | |
public static <T extends RealmObject> RealmResults<T> search(Realm realm, Class<T> modelClass, String query, String fieldName, boolean partialSearch){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Drawables { | |
@NonNull | |
public static Drawable getSelectableDrawableFor(int color) { | |
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { | |
StateListDrawable stateListDrawable = new StateListDrawable(); | |
stateListDrawable.addState( | |
new int[]{android.R.attr.state_pressed}, | |
new ColorDrawable(lightenOrDarken(color, 0.20D)) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
NewerOlder