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
<VirtualHost *:80> | |
ServerName kyouko.net | |
Redirect / https://kyouko.net | |
... | |
</VirtualHost> |
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
android { | |
... | |
sourceSets { | |
main { | |
jni.srcDirs = [] | |
} | |
} | |
} |
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
JNIEXPORT jobject JNICALL Java_com_example_yourapp_CvUtil_processMat( | |
JNIEnv * env, jclass cls, jlong mat_addr, jfloat threshold) { |
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
// 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 |
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
// 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 |
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
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’ | |
} |
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
tasks.withType(JavaCompile) { | |
compileTask -> compileTask.dependsOn ndkBuild | |
} |
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
<View | |
android:id="@+id/touch_outside" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:soundEffectsEnabled="false"/> |
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 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(); | |
} |
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
View touchOutsideView = getDialog().getWindow().getDecorView().findViewById(android.support.design.R.id.touch_outside); | |
touchOutsideView.setOnClickListener(null); |