Skip to content

Instantly share code, notes, and snippets.

<VirtualHost *:80>
ServerName kyouko.net
Redirect / https://kyouko.net
...
</VirtualHost>
android {
...
sourceSets {
main {
jni.srcDirs = []
}
}
}
JNIEXPORT jobject JNICALL Java_com_example_yourapp_CvUtil_processMat(
JNIEnv * env, jclass cls, jlong mat_addr, jfloat threshold) {
// Find the Java class of ArrayList
jclass arrayListClass = (*env).FindClass(“java/util/ArrayList”);
// Create an instance by finding the method ID of the constructor
jobject arrayList = (*env).NewObject(arrayListClass, (*env).GetMethodID(arrayListClass, “<init>”, “()V”));
// Find the class of float
jclass floatClass = env->FindClass(“F”);
// Let’s assume a float array contains 10 elements
jsize size = 10;
// Create arrays
// Find the class of Float
jclass FloatClass = env->FindClass(“java/lang/Float”);
// And the method ID of constructor of the Float class
jmethodID FloatInit = env->GetMethodID(FloatClass, “<init>”, “(F)V”);
for (int i = 0; i < 10; i += 1) {
jsize index = i;
// Create instances of Float
jobject value1 = env->NewObject(FloatClass, FloatInit, xxx);
jobject value2 = env->NewObject(FloatClass, FloatInit, xxx);
// Put the Float values into float arrays
task ndkBuild(type: Exec, description: ‘Compile JNI source via NDK’) {
println(‘executing ndkBuild’)
  def ndkDir = project.android.ndkDirectory
  commandLine “$ndkDir/ndk-build”,
  ‘NDK_PROJECT_PATH=build/intermediates/ndk’,
  ‘APP_BUILD_SCRIPT=src/main/jni/Android.mk’,
  ‘NDK_APPLICATION_MK=src/main/jni/Application.mk’,
  ‘V=1’
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
<View
android:id="@+id/touch_outside"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:soundEffectsEnabled="false"/>
private View wrapInBottomSheet(int layoutResId, View view, ViewGroup.LayoutParams params) {
...
if (shouldWindowCloseOnTouchOutside()) {
coordinator.findViewById(R.id.touch_outside).setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View view) {
if (isShowing()) {
cancel();
}
View touchOutsideView = getDialog().getWindow().getDecorView().findViewById(android.support.design.R.id.touch_outside);
touchOutsideView.setOnClickListener(null);